Commit Graph

21179 Commits

Author SHA1 Message Date
riastradh 9750c027c7 lib/libm/arch/m68060/makeas.sh: Create public weak aliases.
Use _foo for internal names, and weak alias foo when it's public like
sin/cos/tan.
2024-05-07 22:29:53 +00:00
riastradh 2e8caa3647 lib/libm/m68060/makeas.sh: Use `set -eu' to detect script mistakes.
No functional change intended.
2024-05-07 22:19:42 +00:00
riastradh b1bc5af1e1 lib/libm/m68060/makeas.sh: Pass arguments to dummy more idiomatically.
No functional change intended.
2024-05-07 22:18:19 +00:00
riastradh 150c79c867 lib/libm/m68060/makeas.sh: Use local for shell functions.
No functional change intended.
2024-05-07 22:17:24 +00:00
riastradh a45e4331c1 lib/libm/arch/m68060/makeas.sh: Indent sh blocks.
No functional change intended.
2024-05-07 22:17:08 +00:00
riastradh 5bc608efaf lib/libm/arch/m68060: regen 2024-05-07 21:18:47 +00:00
riastradh bd91cc76f2 lib/libm/arch/m68060/makeas.sh: Strip the $ when emitting RCS id. 2024-05-07 21:14:12 +00:00
riastradh 8383bd5dda libm/arch/m68060/Makefile: bsd.sys.mk -> bsd.host.mk
Somewhat belatedly, after bsd.sys.mk was forbidden to use directly
from Makefiles back in 2014.
2024-05-07 21:11:24 +00:00
riastradh 7065ff01cd libm/arch/m68060/makeas.sh: Tag output with makeas.sh RCS id.
No functional change intended to the output -- only changes are to
comments.
2024-05-07 21:05:47 +00:00
riastradh cd9dfcd0c5 libm: Memorialize expected symbols on various architectures.
This will reduce the risk of accidentally adding or deleting the
wrong symbols while fixing the aliases.

(This is all the architectures I have a build tree for handy; can add
other architectures like m68k later.)
2024-05-07 20:58:33 +00:00
riastradh 13d778abc5 libm/arch/vax: Expose atan2l.
PR port-vax/57881: vax libm is missing various symbols
2024-05-07 15:49:33 +00:00
riastradh 4336c6aedd libm/arch/vax: Use STRONG_ALIAS, not ALTENTRY.
STRONG_ALIAS copies the symbol size and type, so it avoids warnings
like this:

/home/riastradh/netbsd/10/obj.vax/tooldir/bin/../lib/gcc/vax--netbsdelf/10.5.0/../../../../vax--netbsdelf/bin/ld: warning: type and size of dynamic symbol `ldexpl' are not defined
2024-05-07 15:15:31 +00:00
riastradh 2a580023ad libm/arch/vax: Use END to delimit symbol definitions.
This way we get sizes and, likely, slightly better debug info about
PCs inside these symbols.
2024-05-07 15:15:09 +00:00
skrll 8c835d3895 Trailing whitespace 2024-05-06 15:59:53 +00:00
riastradh 18bbefc87a libm: Expose sincosl on vax.
PR 57881
2024-05-06 15:52:52 +00:00
riastradh bfbeee7805 libm: Expose sinl, cosl, tanl on vax.
While here, make sin, cos, and tan be weak aliases for internal
symbols _sin, _cos, and _tan; likewise sinf, cosf, tanf.

PR 57881
2024-05-06 15:33:04 +00:00
skrll ababa08f7d arm longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Move the botched sp and lr tests earlier.

PR lib/57946
2024-05-06 06:57:32 +00:00
riastradh 3822903a53 libm: long double is just double on hppa, so don't use s_rintl.c.
PR misc/58054
2024-05-05 22:52:19 +00:00
riastradh 47b5b183dd libm: If long double is double, nexttowardl is nextafter.
long double nexttowardl(long double, long double);
double nextafter(double, double);
2024-05-05 22:10:06 +00:00
riastradh 17f9eb725b libm: No s_rintl.c on mips32.
This is only for machines where long double is not double.

Not 100% sure this is the right criterion, but there's a good chance
it is.
2024-05-05 14:53:22 +00:00
riastradh 55bbe7aeb3 libm/s_nexttowardf.c: Handle __HAVE_LONG_DOUBLE, LDBL_IMPLICIT_NBIT.
We should arrange to just have LDBL_NBIT unconditionally defined in the
appropriate MD header file, and make LDBL_IMPLICIT_NBIT an alias for
LDBL_NBIT==0.  But for now this will do.
2024-05-05 14:06:47 +00:00
riastradh f8bd6e11b1 libm: Make s_nexttowardf.c work when long double is double.
Seems likely that there are other parts of libm which would benefit
from being defined unconditionally in terms of ieee_ext_u, with
ieee_ext_u as an alias for ieee_double_u, in this scenario.  But I
haven't gone looking yet.
2024-05-05 11:38:03 +00:00
riastradh 816699395b libm: long double is just double on arm, so don't use s_rintl.c.
PR misc/58054
2024-05-05 11:07:49 +00:00
riastradh 8f27842e48 libm: New s_rintl.S for x86.
Prompted by PR lib/58054.
2024-05-05 02:50:11 +00:00
riastradh ebb5e1cc01 s_rintl.c: Reduce FreeBSD diff and fix on ld128 platforms.
EXT_FRACBITS, the number of bits in the _binary encoding_ that stores
the trailing significand field, is never 113.  In IEEE 754 binary128,
it is 112, even though there are 113 bits of precision in the set of
floating-point numbers -- the leading 1 bit is implicit in binary128.
So ld128 platforms like aarch64 and sparc64 were skipping the real
definition and just defining rintl as an alias for rint, which is
wrong.

In contrast, LDBL_MANT_DIG, the number of bits of precision in the set
of floating-point numbers (p, in IEEE 754 parlance), is 113 in IEEE 754
binary128.  This is also the constant used in FreeBSD libm anyway.  So
let's just use that instead of trying to translate it to our private
EXT_FRACBITS (not defined in FreeBSD) with a fencepos terror.  And
delete the buggy rintl=rint alias.

PR lib/58054
2024-05-04 19:21:51 +00:00
skrll 221640878d Remove magic numbers. NFCI. 2024-05-04 14:48:28 +00:00
skrll be2d38de58 makecontext: correct the type to setup register based arguments.
Use __greg_t rather than int for register based arguments. This fixes
various atf tests.
2024-05-04 12:43:36 +00:00
rillig b108f9c1fe mktemp.3: mkdtemp is no longer nonstandard
Reported by Aleksey Cheusov on tech-userlevel.
2024-05-04 05:50:49 +00:00
rillig 29027db22b parsedate.3: resolve contradictory values for 'next' 2024-05-02 18:34:01 +00:00
christos 81769fc7f9 revert previous. 2024-05-02 14:19:56 +00:00
christos b509c1ea3b next should increement by 1 not 2. 2024-05-01 19:59:07 +00:00
christos 9818b366f5 fix clang lint build. 2024-05-01 18:38:15 +00:00
uwe 2f85358c65 execve(2): brush up markup 2024-04-28 23:10:26 +00:00
rillig 3646cc3155 time.3: clarify that *tloc is always set if tloc != NULL 2024-04-28 22:57:16 +00:00
rillig d1b0f9f059 setmode.3: fix typos 2024-04-28 22:43:30 +00:00
rillig a6f58d652c execve.2: fix typo in markup 2024-04-28 22:21:21 +00:00
jdolecek abcb0737b1 it's nanosleep(2), not nanosleep(3) 2024-04-22 21:25:29 +00:00
jdolecek 2bbb505264 allow usleep(3) with useconds >= 1000000
update manpage to mention this interface is obsolete, remove
EINVAL from the ERRORS and mention EINTR instead.

PR lib/58184 by Taylor R Campbell
2024-04-22 21:02:18 +00:00
skrll fe6348de33 Remove some magic numbers by using genassym.cf 2024-04-20 14:09:40 +00:00
christos 28614955c7 PR/58136: Paul Ripke: Fix use after free. 2024-04-13 02:01:38 +00:00
christos 3bab0f2422 avoid lint warning on the vax 2024-04-11 18:41:03 +00:00
rillig 4ed1e5f144 snprintb.3: provide examples for hexadecimal character escapes
Suggested by uwe@, in reaction to the previous commit, which preferred
octal in the examples. Hexadecimal escapes are more familiar to most
programmers, and the chance of mistaking \x14 for decimal 14 is less
than the chance of mistaking octal \014 for decimal 14.
2024-04-08 21:28:35 +00:00
rillig fca116efc7 snprintb.3: clean up formatting and wording, prefer octal in examples
Using hexadecimal character escapes requires separate string literals if
the description starts with one of the letters A-F; octal character
escapes have at most 3 digits, reducing ambiguity.
2024-04-07 14:28:26 +00:00
rillig 442f4c6c59 snprintb: reject combinations of 'f' with ':' as well as 'F' with '='
These combinations would lead to garbled output.
2024-04-07 12:05:23 +00:00
christos 0c83befa2b update em-toggle-overwrite binding (Xose Vazquez Perez) 2024-04-06 13:36:11 +00:00
christos b395dc204e From Jan-Benedict Glaw:
Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.
2024-04-05 22:30:18 +00:00
christos 6b2da37d70 - Create 3 new variables:
MAKELINKLIB that follows MKLINKLIB but can be overwritten by Makefiles
  MAKESTATICLIB that follows MKSTATICLIB but can be overwritten by Makefiles
  LINKINSTALL that follows MAKELINKLIB but can be overwritten by Makefiles
  These give enough control to the module Makefiles so that they don't need
  to override the default library install rules which break the debug sets.
- Remove /usr/libexec/named which duplicated /usr/lib/named
2024-04-05 01:15:59 +00:00
riastradh 561072c7c1 Temporarily make PR t_sp:sigsafe noisier.
This is an attempt to diagnose why it's flaky in the releng testbeds
but not when I run it.  This change will be backed out once we get
new testbed output.
2024-04-04 21:19:25 +00:00
riastradh 3f29093143 rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.
If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112
2024-04-04 17:27:23 +00:00
riastradh 3e7604f627 i386 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946
2024-04-04 00:46:41 +00:00
riastradh df443a3d17 amd64 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
  => Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
  => val==0 is unlikely in longjmp

PR lib/57946
2024-04-04 00:46:30 +00:00
christos b0c6c15390 remove #include <ieeefp.h> for i386 now that it is included in math_private.h 2024-04-03 18:53:41 +00:00
christos b3579e8037 need <ieeefp.h> for i386. 2024-04-03 14:54:50 +00:00
kre 0e71e5a0d1 For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include <ieeefp.h>)

Might fix the i386 build.
2024-04-03 04:40:23 +00:00
christos d89d80aaff reduce diff with FreeBSD 2024-04-03 01:51:01 +00:00
rillig d5bb47fbc4 sparc/fpsetround: fix the nearby signed integer overflow as well
Same as for sparc64 a few days ago.
2024-04-02 20:42:12 +00:00
christos a7add5bb79 fix lint 2024-04-02 20:27:44 +00:00
christos 16095d554f undo accidental commit. 2024-04-02 18:40:50 +00:00
christos 8f219a4edd PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
code for the floating point formats where it works (does not work for 112
bit mantisa in sparc64)
2024-04-02 18:39:51 +00:00
andvar 7f3436c3c9 s/Unfortunatley/Unfortunately/ in comment. 2024-03-30 22:05:07 +00:00
christos 046528e7dc From enh at google dot com in tech-userlevel. Don't limit writes to BUFSIZ,
change the limit to INT_MAX; improves performance dramatically. From:
https://github.com/apple-oss-distributions/Libc/commit/\
c5a3293354e22262702a3add5b2dfc9bb0b93b85\
#diff-3b844a19cfb0aab1a23f7fbc457d3bce7453513730c489a72f66ff89d6557ff3
2024-03-29 22:39:41 +00:00
rillig 7529cf7879 libm/s_logl: suppress lint warnings
Seen on sparc64.
2024-03-26 20:12:47 +00:00
christos 5a13a6eee6 fix insert key (Xose Vazquez Perez) 2024-03-26 18:02:04 +00:00
andvar 132b98a088 Fix few typos in comments. 2024-03-22 19:45:22 +00:00
andvar 4a3e2a8295 s/Cannnot/Cannot/ in error message. 2024-03-22 19:36:56 +00:00
uwe e610bdf867 sysconf(3): a few more markup fixes 2024-03-21 22:27:55 +00:00
uwe 57b3fcda6d sysconf(3): the _SC constants are .Dv 2024-03-21 22:21:40 +00:00
uwe 3b8ede1ce6 sysconf(3): NUL is not a defined variable 2024-03-21 22:17:27 +00:00
uwe afd5650391 sysconf(3): POSIX text doesn't capitalize "option". 2024-03-21 22:14:29 +00:00
wiz 42c4efb6b4 Fix NUL/NULL confusion.
One of these was reported by Mouse in PR 58058.
2024-03-21 14:48:01 +00:00
rillig aabd8f68ba sparc64/fpsetround: avoid shifting into the sign bit
Lint had warned about the constant expression '0x03 << 30' but not about
the structurally equal nonconstant expression '(rnd_dir & 0x03) << 30'.

No binary change.
2024-03-20 06:15:39 +00:00
riastradh eea7d4e0e0 strptime(3): Declare digit d as time_t.
This doesn't make a semantic difference -- d can only take on the ten
values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all
comes out the same whether the type is unsigned or time_t, even if
time_t were int32_t instead of int64_t.

But it pacifies overzealous compilers used by downstream users of
this code.  And while it's silly to use a much wider type (64-bit
signed) than is needed here to store a single digit, it doesn't
really hurt either (32-bit unsigned is much larger than needed too).

PR lib/58041
2024-03-18 16:15:24 +00:00
andvar a5c0af2445 Add missing "e" in few words, in comments and one log message. 2024-03-17 21:48:01 +00:00
andvar bb2336b065 s/argumment/argument/ in documentation. 2024-03-17 21:37:53 +00:00
riastradh 7b531fef3d strptime(3): Reduce unnecessary indentation.
Post-fix tidying.

No functional change intended.

PR lib/58041
2024-03-16 00:16:21 +00:00
riastradh 5f253fa591 strptime(3): Avoid arithmetic overflow.
PR lib/58041
2024-03-16 00:06:45 +00:00
jakllsch be561d813d Sync with OpenBSD 2024-03-14 15:39:23 +00:00
jakllsch 8f746c3921 Remove Reserved usages and ranges thereof
Helps align with future merge
2024-03-14 15:27:22 +00:00
jakllsch 8fc95d6b5f fix typos 2024-03-14 15:23:52 +00:00
christos 08e65c02f2 fix lint 2024-03-11 23:05:35 +00:00
christos 0e8d0976c1 add casts for compat code where time_t is 32 bits. 2024-03-11 23:03:35 +00:00
rillig fd0bc09974 compiler_rt: allow signed bit shifts for __negv
Standard C defines '1 << 31' as undefined behavior, but
https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html allows
it for GCC.
2024-03-10 18:00:13 +00:00
mlelstv 3fb2741729 Don't use uninitialized variable.
Fixes PR 57895.
2024-03-09 13:48:50 +00:00
christos d57953e9b2 pass lint on sparc64 where int_fast32_t is long. 2024-03-07 20:42:04 +00:00
rillig a15b6e013d snprintb.3: fix typo 2024-02-29 21:08:54 +00:00
rillig 4cf4169998 parsedate.y: remove outdated comment
The number of shift/reduce conflicts has grown to 16.
2024-02-29 20:55:35 +00:00
christos a481444702 appease lint 2024-02-27 15:14:15 +00:00
mrg ee803f2386 revert previous - it doesn't mean what i thought and some builds broke. 2024-02-26 20:16:16 +00:00
mrg 35db73b092 skip sanitizers if MKSANITIZER "no". 2024-02-25 20:25:09 +00:00
christos 7648c0702a fabsl is defined in libc... 2024-02-25 19:26:33 +00:00
mrg 4629208b15 fix some fallout from 32-bit fixes for long double functions.
apply namespace.h to remqou*.  add missing weak aliases for some of them,
and normalise checkf for __weak_alias().

now libm.so seems to only have libc undefined symbols.
2024-02-24 19:32:09 +00:00
christos d0129385d6 add missing symbols for non long double architectures. 2024-02-24 15:16:53 +00:00
christos 4851547888 fix the 32 bit tanl symbol. 2024-02-23 13:42:01 +00:00
rillig 69c5b3b0c1 snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The
wording in the manual page has been promising this since 2008. For
snprintb_m, ensure that the output is terminated with two null
characters, to gracefully handle situations in which the caller does not
check whether snprintb returned an error.

If the buffer size is zero, allow the buffer to be a null pointer,
analogous to snprintf.

Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive
(since today).

In the tests, merge the helper functions for snprintb, snprintb_m, as
they were similar enough.

Fix a few 'line_max exceeded' tests, ensuring that they output a '#'
marker, and that the 'complete' tests don't.
2024-02-22 21:04:23 +00:00
rillig d101133e9b snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early
return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS.
Bit fields that extend beyond the msb are still allowed.

Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes
sense when the field starts at bit 0.

Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
2024-02-22 18:26:15 +00:00
rillig aafc9e1277 snprintb.3: sync examples with reality 2024-02-20 20:38:54 +00:00
riastradh fa59e25364 fenv(3): Fix fetestexcept to avoid side effects on trap state.
PR port-amd64/57949
2024-02-20 03:53:48 +00:00
uwe bcbf0090a4 fix typo in comment 2024-02-20 00:09:31 +00:00
rillig fd2741deca mman.h: fix snprintb description for alignment 2^60 2024-02-18 16:55:02 +00:00
kre 7922ccfb13 Revert this part:
strftime %s now uses tm_gmtoff if available.  (Problem and draft
	patch reported by Dag-Erling Smørgrav.)

of the tzcode2924a update.   It is bogus.   The "problem" is/was a simple
misunderstanding of what strftime(%s) is intended to output.  The "fix"
breaks it.
2024-02-18 12:47:08 +00:00