Commit graph

2160 commits

Author SHA1 Message Date
Petr Vorel ae7a94e5e3 Remove --enable-obsolete-nsl configure flag
this means that *always* libnsl is only built as shared library for
backward compatibility and the NSS modules libnss_nis and libnss_nisplus
are not built at all, libnsl's headers aren't installed.

This compatibility is kept only for architectures and ABIs that have
been added in or before version 2.28.

Replacement implementations based on TIRPC, which additionally support
IPv6, are available from <https://github.com/thkukuk/>.

This change does not affect libnss_compat which does not depended
on libnsl since 2.27 and thus can be used without NIS.

libnsl code depends on Sun RPC, e.g. on --enable-obsolete-rpc (installed
libnsl headers use installed Sun RPC headers), which will be removed in
the following commit.
2020-07-08 17:25:57 +02:00
Szabolcs Nagy a2a83bf6d9 aarch64: add NEWS entry about branch protection support
This is a new security feature that relies on architecture
extensions and needs glibc to be built with a gcc configured
with branch protection.
2020-07-08 15:02:38 +01:00
Florian Weimer 94d9c76e4a nss: Remove cryptographic key support from nss_files, nss_nis, nss_nisplus
The interface has hard-coded buffer sizes and is therefore tied to
DES.  It also does not match current practice where different
services on the same host use different key material.

This change simplifies removal of the sunrpc code.
2020-07-07 20:20:22 +02:00
Adhemerval Zanella 325081b9eb string: Add strerrorname_np and strerrordesc_np
The strerrorname_np returns error number name (e.g. "EINVAL" for EINVAL)
while strerrordesc_np returns string describing error number (e.g
"Invalid argument" for EINVAL).  Different than strerror,
strerrordesc_np does not attempt to translate the return description,
both functions return NULL for an invalid error number.

They should be used instead of sys_errlist and sys_nerr, both are
thread and async-signal safe.  These functions are GNU extensions.

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 15:02:57 -03:00
Adhemerval Zanella bfe05aa289 string: Add sigabbrev_np and sigdescr_np
The sigabbrev_np returns the abbreviated signal name (e.g. "HUP" for
SIGHUP) while sigdescr_np returns the string describing the error
number (e.g "Hangup" for SIGHUP).  Different than strsignal,
sigdescr_np does not attempt to translate the return description and
both functions return NULL for an invalid signal number.

They should be used instead of sys_siglist or sys_sigabbrev and they
are both thread and async-signal safe.  They are added as GNU
extensions on string.h header (same as strsignal).

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:57:14 -03:00
Adhemerval Zanella 28aff04781 string: Implement strerror in terms of strerror_l
If the thread is terminated then __libc_thread_freeres will free the
storage via __glibc_tls_internal_free.

It is only within the calling thread that this matters.  It makes
strerror MT-safe.

Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:10:58 -03:00
Adhemerval Zanella f13d260190 signal: Move sys_errlist to a compat symbol
The symbol is deprecated by strerror since its usage imposes some issues
such as copy relocations.

Its internal name is also changed to _sys_errlist_internal to avoid
static linking usage.  The compat code is also refactored by removing
the over enginered errlist-compat.c generation from manual entried and
extra comment token in linker script file.  It disantangle the code
generation from manual and simplify both Linux and Hurd compat code.

The definitions from errlist.c are moved to errlist.h and a new test
is added to avoid a new errno entry without an associated one in manual.

Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
on all affected platforms.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:10:58 -03:00
Adhemerval Zanella b1ccfc061f signal: Move sys_siglist to a compat symbol
The symbol was deprecated by strsignal and its usage imposes issues
such as copy relocations.

Its internal name is changed to __sys_siglist and __sys_sigabbrev to
avoid static linking usage.  The compat code is also refactored, since
both Linux and Hurd usage the same strategy: export the same array with
different object sizes.

The libSegfault change avoids calling strsignal on the SIGFAULT signal
handler (the current usage is already sketchy, adding a call that
potentially issue locale internal function is even sketchier).

Checked on x86_64-linux-gnu and i686-linux-gnu. I also run a check-abi
on all affected platforms.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:10:58 -03:00
Florian Weimer 706ad1e7af Add the __libc_single_threaded variable
The variable is placed in libc.so, and it can be true only in
an outer libc, not libcs loaded via dlmopen or static dlopen.
Since thread creation from inner namespaces does not work,
pthread_create can update __libc_single_threaded directly.

Using __libc_early_init and its initial flag, implementation of this
variable is very straightforward.  A future version may reset the flag
during fork (but not in an inner namespace), or after joining all
threads except one.

Reviewed-by: DJ Delorie <dj@redhat.com>
2020-07-06 11:15:58 +02:00
Mathieu Desnoyers 0c76fc3c2b Linux: Perform rseq registration at C startup and thread creation
Register rseq TLS for each thread (including main), and unregister for
each thread (excluding main).  "rseq" stands for Restartable Sequences.

See the rseq(2) man page proposed here:
  https://lkml.org/lkml/2018/9/19/647

Those are based on glibc master branch commit 3ee1e0ec5c.
The rseq system call was merged into Linux 4.18.

The TLS_STATIC_SURPLUS define is increased to leave additional room for
dlopen'd initial-exec TLS, which keeps elf/tst-auditmany working.

The increase (76 bytes) is larger than 32 bytes because it has not been
increased in quite a while.  The cost in terms of additional TLS storage
is quite significant, but it will also obscure some initial-exec-related
dlopen failures.
2020-07-06 10:21:16 +02:00
Florian Weimer ec41af45a6 nptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2020-06-02 11:59:18 +02:00
Florian Weimer 02802fafcf signal: Deprecate additional legacy signal handling functions
This needs a few test adjustments: In some cases, sigignore was
used for convenience (replaced with xsignal with SIG_IGN).  Tests
for the deprecated functions need to disable
-Wdeprecated-declarations, and for the sigmask deprecation,
-Wno-error.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-05-25 18:32:28 +02:00
Martin Sebor 901ac8431c Mention GCC 10 attribute access.
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2020-05-20 09:40:34 -06:00
Josh Triplett cad64f778a ldconfig: Default to the new format for ld.so.cache
glibc has supported this format for close to 20 years.
2020-05-19 14:41:48 +02:00
Gabriel F. T. Gomes 051be01f6b powerpc64le: Enable support for IEEE long double
On platforms where long double may have two different formats, i.e.: the
same format as double (64-bits) or something else (128-bits), building
with -mlong-double-128 is the default and function calls in the user
program match the name of the function in Glibc.  When building with
-mlong-double-64, Glibc installed headers redirect such calls to the
appropriate function.

Likewise, the internals of glibc are now built against IEEE long double.
However, the only (minimally) notable usage of long double is difftime.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-04-30 08:52:08 -05:00
Paul E. Murphy 50545f5aa0 powerpc64le: raise GCC requirement to 7.4 for long double transition
Add compiler feature tests to ensure we can build ieee128 long double.
These test for -mabi=ieeelongdouble, -mno-gnu-attribute, and -Wno-psabi.

Likewise, verify some compiler bugs have been addressed.  These aren't
helpful for building glibc, but may cause test failures when testing
the new long double.  See notes below from Raji.

On powerpc64le, some older compiler versions give error for the function
signbit() for 128-bit floating point types.  This is fixed by PR83862
in gcc 8.0 and backported to gcc6 and gcc7.  This patch adds a test
to check compiler version to avoid compiler errors during make check.

Likewise, test for -mno-gnu-attribute support which was

On powerpc64le, a few files are built on IEEE long double mode
(-mabi=ieeelongdouble), whereas most are built on IBM long double mode
(-mabi=ibmlongdouble, the default for -mlong-double-128).  Since binutils
2.31, linking object files with different long double modes causes
errors similar to:

  ld: libc_pic.a(s_isinfl.os) uses IBM long double,
      libc_pic.a(ieee128-qefgcvt.os) uses IEEE long double.
  collect2: error: ld returned 1 exit status
  make[2]: *** [../Makerules:649: libc_pic.os] Error 1

The warnings are fair and correct, but in order for glibc to have
support for both long double modes on powerpc64le, they have to be
ignored.  This can be accomplished with the use of -mno-gnu-attribute
option when building the few files that require IEEE long double mode.

However, -mno-gnu-attribute is not available in GCC 6, the minimum
version required to build glibc, so this patch adds a test for this
feature in powerpc64le builds, and fails early if it's not available.

Co-Authored-By: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
Co-Authored-By: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2020-04-30 08:52:08 -05:00
Florian Weimer 6d246cb852 misc: Remove sstk from the autogenerated system call list
This change should not have an effect because the system call was
never defined.  Also add the misssing attribute_compat_text_section
attribute to the sstk function (a minor optimization).  Also update the
NEWS file to document the change.

Fixes commit 9cc93ba097
("misc: Turn sstk into a compat symbol").
2020-04-28 17:13:25 +02:00
Mike FABIAN 8645f62469 Bug 25819: Update to Unicode 13.0.0
Unicode 13.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 13.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Total added characters in newly generated CHARMAP: 5930
Total added characters in newly generated WIDTH: 5536
2020-04-21 18:17:23 +02:00
Florian Weimer 076f09afba Linux: Remove <sys/sysctl.h> and the sysctl function
Linux 5.5 remove the system call in commit
61a47c1ad3a4dc6882f01ebdc88138ac62d0df03 ("Linux: Remove
<sys/sysctl.h>").  Therefore, the compat function is just a stub that
sets ENOSYS.

Due to SHLIB_COMPAT, new ports will not add the sysctl function anymore
automatically.

x32 already lacks the sysctl function, so an empty sysctl.c file is
used to suppress it.  Otherwise, a new compat symbol would be added.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-04-15 17:17:32 +02:00
Florian Weimer 8f7a75d700 elf: Implement DT_AUDIT, DT_DEPAUDIT support [BZ #24943]
binutils ld has supported --audit, --depaudit for a long time,
only support in glibc has been missing.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-04-03 16:26:10 +02:00
Aurelien Jarno 07d16a6deb Add NEWS entry for CVE-2020-1751 (bug 25423)
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-03-24 22:49:32 +01:00
Aurelien Jarno 39a05214fe Add NEWS entry for CVE-2020-1752 (bug 25414) 2020-03-19 22:53:00 +01:00
Aurelien Jarno 15ab195229 Add NEWS entry for CVE-2020-10029 (bug 25487) 2020-03-11 12:20:26 +01:00
Siddhesh Poyarekar f7be48d8c1 NEWS: Set fill-column hint to 72
Match up with list-fixed-bugs.py and also with the fact that many
email clients default to 72 chars when composing emails.

Reviewed-by: Joseph Myers <joseph@codesourcery.com>
2020-02-07 07:57:04 +05:30
Mike FABIAN ae199e7d64 Fix ckb_IQ [BZ #9809]
Add ckb_IQ to SUPPORTED file.
Add ckb_IQ.UTF-8.in collation test file.
Mention new ckb_IQ locale in NEWS.
2020-02-03 10:19:20 +01:00
Siddhesh Poyarekar d8775136b5 Open master for 2.32 development
happy hacking!
2020-02-01 17:22:50 +05:30
Siddhesh Poyarekar e7daa7fcf7 Add bugs fixed in 2.31 in NEWS 2020-02-01 17:16:54 +05:30
Siddhesh Poyarekar f1bb5499d1 Add note to NEWS about kernel headers dependency on risc-v
It was discovered that RISC-V 64-bit still needs kernel headers >= 5.0
to be installed to build correctly:

https://gitlab.com/kubu93/toolchains-builder/-/jobs/422726962

Fix up the NEWS item to make that clear.
2020-02-01 17:16:54 +05:30
Szabolcs Nagy 2cd01a1df2 Add NEWS entry about 64-bit time_t syscall use on 32-bit targets
This internal change ideally should not affect the public API or ABI,
but there is a widespread use of seccomp sandboxes, even on 32-bit
targets, that don't handle new Linux syscall usage well, so it's
worth mentioning in the NEWS.

Co-authored-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-01-31 10:00:48 +00:00
Dragan Mladjenovic ba44e5b508 Add NEWS entry about the change in handling of PT_GNU_STACK on MIPS
The change was introduced in:

commit 33bc9efd91
Author: Dragan Mladjenovic <dmladjenovic@wavecomp.com>
Date:   Fri Aug 23 16:38:04 2019 +0000

    mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels

and probably requires a small explanation.

Co-authored-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-01-23 19:58:55 +05:30
Zack Weinberg 521c7fc65f
Revise NEWS description of changes to gettimeofday etc.
Mostly English grammar and style improvements.  The bullet list is
reorganized a little for clarity.  The details of exactly which
Linux-based ports still report system-wide time zone information
from gettimeofday has been removed, as this is not intended to be
something people should rely on.

Also clarify the deprecation of older SPARC ISAs, based on the fact
that “SPARC version 7” is actually the very first version of the SPARC
ISA (Sun Microsystems was very fond of letting the marketing
department pick version numbers).

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-01-09 09:46:46 -05:00
Siddhesh Poyarekar 97ff54d2fc Drop dependency of dist target on ChangeLog
We no longer write manual ChangeLog entries since they are
auto-generated at release time.  Drop dependency of the `make dist`
target on the file and document the fact that the latest ChangeLog
entries can be read in the highest numbered ChangeLog.N file in
ChangeLog.old.

The ChangeLog.old/ChangeLog.20 file for 2.31 will thus be generated
just before tagging a release.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2020-01-09 13:28:08 +05:30
Florian Weimer a1bd5f8673 Linux: Use system call tables during build
Use <arch-syscall.h> instead of <asm/unistd.h> to obtain the system
call numbers.  A few direct includes of <asm/unistd.h> need to be
removed (if the system call numbers are already provided indirectly
by <sysdep.h>) or replaced with <sys/syscall.h>.

Current Linux headers for alpha define the required system call names,
so most of the _NR_* hacks are no longer needed.  For the 32-bit arm
architecture, eliminate the INTERNAL_SYSCALL_ARM macro, now that we
have regular system call names for cacheflush and set_tls.  There are
more such cleanup opportunities for other architectures, but these
cleanups are required to avoid macro redefinition errors during the
build.

For ia64, it is desirable to use <asm/break.h> directly to obtain
the break number for system calls (which is not a system call number
itself).  This requires replacing __BREAK_SYSCALL with
__IA64_BREAK_SYSCALL because the former is defined as an alias in
<asm/unistd.h>, but not in <asm/break.h>.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2020-01-02 10:18:23 +01:00
Joseph Myers 5f72f9800b Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2020.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  As well as the usual annual
updates, mainly dates in --version output (minus libc.texinfo which
previously had to be handled manually but is now successfully updated
by update-copyrights), there is a fix to
sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h where a typo in
the copyright notice meant it failed to be updated automatically.

Please remember to include 2020 in the dates for any new files added
in future (which means updating any existing uncommitted patches you
have that add new files to use the new copyright dates in them).
2020-01-01 00:21:22 +00:00
Joseph Myers d614a75396 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Florian Weimer 79e0cd7b3c Lazy binding failures during dlopen/dlclose must be fatal [BZ #24304]
If a lazy binding failure happens during the execution of an ELF
constructor or destructor, the dynamic loader catches the error
and reports it using the dlerror mechanism.  This is undesirable
because there could be other constructors and destructors that
need processing (which are skipped), and the process is in an
inconsistent state at this point.  Therefore, we have to issue
a fatal dynamic loader error error and terminate the process.

Note that the _dl_catch_exception in _dl_open is just an inner catch,
to roll back some state locally.  If called from dlopen, there is
still an outer catch, which is why calling _dl_init via call_dl_init
and a no-exception is required and cannot be avoiding by moving the
_dl_init call directly into _dl_open.

_dl_fini does not need changes because it does not install an error
handler, so errors are already fatal there.

Change-Id: I6b1addfe2e30f50a1781595f046f44173db9491a
2019-11-27 20:55:35 +01:00
Florian Weimer 446997ff14 resolv: Implement trust-ad option for /etc/resolv.conf [BZ #20358]
This introduces a concept of trusted name servers, for which the
AD bit is passed through to applications.  For untrusted name
servers (the default), the AD bit in responses are cleared, to
provide a safe default.

This approach is very similar to the one suggested by Pavel Šimerda
in <https://bugzilla.redhat.com/show_bug.cgi?id=1164339#c15>.

The DNS test framework in support/ is enhanced with support for
setting the AD bit in responses.

Tested on x86_64-linux-gnu.

Change-Id: Ibfe0f7c73ea221c35979842c5c3b6ed486495ccc
2019-11-27 20:54:37 +01:00
Adhemerval Zanella 5d9b7b9fa7 Remove 32 bit sparc v7 support
The patch is straighforward:

  - The sparc32 v8 implementations are moved as the generic ones.

  - A configure test is added to check for either __sparc_v8__ or
    __sparc_v9__.

  - The triple names are simplified and sparc implies sparcv8.

The idea is to keep support on sparcv8 architectures that does support
CAS instructions, such as LEON3/LEON4.

Checked on a sparcv9-linux-gnu and sparc64-linux-gnu.

Tested-by: Andreas Larsson <andreas@gaisler.com>
2019-11-27 09:37:57 -03:00
Marcin Kościelnicki d5dfad4326 rtld: Check __libc_enable_secure before honoring LD_PREFER_MAP_32BIT_EXEC (CVE-2019-19126) [BZ #25204]
The problem was introduced in glibc 2.23, in commit
b9eb92ab05
("Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT").
2019-11-21 12:56:44 +01:00
Talachan Mon c5fbd7c3ea Add new locale: mnw_MM (Mon language spoken in Myanmar) [BZ #25139] 2019-11-06 08:15:16 +01:00
Mike Crowe 3ef5e118f2 nptl: Fix niggles with pthread_clockjoin_np
Joseph Myers spotted[1] that 69ca4b54c1 added
pthread_clockjoin_np to sysdeps/nptl/pthread.h but not to its hppa-specific
equivalent sysdeps/unix/sysv/linux/hppa/pthread.h.

Rafal Luzynski spotted[2] typos in the NEWS entry and manual updates too.

Florian Weimer spotted[3] that the clockid parameter was not using a
reserved identifier in pthread.h.

[1] https://sourceware.org/ml/libc-alpha/2019-11/msg00016.html
[2] https://sourceware.org/ml/libc-alpha/2019-11/msg00019.html
[3] https://sourceware.org/ml/libc-alpha/2019-11/msg00022.html

Reviewed-by: Joseph Myers <joseph@codesourcery.com>
Reviewed-by: Rafal Luzynski <digitalfreak@lingonborough.com>
Reviewed-by: Florian Weimer <fw@deneb.enyo.de>
2019-11-04 16:44:49 -03:00
Mike Crowe 69ca4b54c1 nptl: Add pthread_clockjoin_np
Introduce pthread_clockjoin_np as a version of pthread_timedjoin_np that
accepts a clockid_t parameter to indicate which clock the timeout should be
measured against. This mirrors the recently-added POSIX-proposed "clock"
wait functions.

Checked on x86_64-linux-gnu.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2019-11-01 11:23:43 -03:00
Adhemerval Zanella 5e46749c64 Use clock_gettime to implement gettimeofday.
Consolidate generic gettimeofday implementation to use clock_gettime.
Linux ports that still provide gettimeofday through vDSO are not
changed.

Remove sysdeps/unix/clock_gettime.c, which implemented clock_gettime
using gettimeofday; new OS ports must provide a real implementation of
clock_gettime.

Rename sysdeps/mach/gettimeofday.c to sysdeps/mach/clock_gettime.c and
convert into an implementation of clock_gettime.  It only supports
CLOCK_REALTIME; Mach does not appear to have any support for monotonic
clocks.  It uses __host_get_time, which provides at best microsecond
resolution.  Hurd is currently using sysdeps/posix/clock_getres.c for
clock_getres; its output for CLOCK_REALTIME is based on
sysconf (_SC_CLK_TCK), and I do not know whether that gives the
correct result.

Unlike settimeofday, there are no known uses of gettimeofday's
vestigial "get time zone" feature that are not bugs.  (The per-process
timezone support in localtime and friends is unrelated, and the
programs that set the kernel's offset between the hardware clock and
UTC do not need to read it back.)  Therefore, this feature is dummied
out.  Henceforth, if gettimeofday's "struct timezone" argument is not
NULL, it will write zeroes to both fields.  Any program that is
actually looking at this data will thus think it is running in UTC,
which is probably more correct than whatever it was doing before.

[__]gettimeofday no longer has any internal callers, so we can now
remove its internal prototype and PLT bypass aliases.  The
__gettimeofday@GLIBC_2.0 export remains, in case it is used by any
third-party code.

It also allows to simplify the arch-specific implementation on x86 and
powerpc to remove the hack to disable the internal route to non iFUNC
variant for internal symbol.

This patch also fixes a missing optimization on aarch64, powerpc, and
x86 where the code used on static build do not use the vDSO.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.

Co-authored-by: Zack Weinberg <zackw@panix.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-30 17:11:10 -03:00
Zack Weinberg 2b5fea833b Consolidate and deprecate ftime
ftime is an obsolete variation on gettimeofday, offering only
millisecond time resolution; it was probably a system call in ooold
versions of BSD Unix.  For historic reasons, we had three
implementations of it.  These are all consolidated into time/ftime.c,
and then the function is deprecated.

For some reason, the implementation of ftime in terms of gettimeofday
was rounding rather than truncating microseconds to milliseconds.  In
all the other places where we use a higher-resolution time function to
implement a lower-resolution one, we truncate.  ftime is changed to
match, just for tidiness' sake.

Like gettimeofday, ftime tries to report the time zone, and using that
information is always a bug.  This patch dummies out the reported
timezone information; the timezone and dstflag fields of the
returned "struct timeb" will always be zero.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, and powerpc-linux-gnu.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-30 17:11:10 -03:00
Zack Weinberg c3f9aef063 Use clock_settime to implement settimeofday.
Unconditionally, on all ports, use clock_settime to implement
settimeofday.  Remove sysdeps/unix/clock_settime.c, which implemented
clock_settime by calling settimeofday; new OS ports must henceforth
provide a real implementation of clock_settime.

Hurd had a real implementation of settimeofday but not of
clock_settime; this patch converts it into an implementation of
clock_settime.  It only supports CLOCK_REALTIME and microsecond
resolution; Hurd/Mach does not appear to have any support for
finer-resolution clocks.

The vestigial "set time zone" feature of settimeofday complicates the
generic settimeofday implementation a little.  The only remaining uses
of this feature that aren't just bugs, are using it to inform the
Linux kernel of the offset between the hardware clock and UTC, on
systems where the hardware clock doesn't run in UTC (usually because
of dual-booting with Windows).  There currently isn't any other way to
do this.  However, the callers that do this call settimeofday with
_only_ the timezone argument non-NULL.  Therefore, glibc's new
behavior is: callers of settimeofday must supply one and only one of
the two arguments.  If both arguments are non-NULL, or both arguments
are NULL, the call fails and sets errno to EINVAL.

When only the timeval argument is supplied, settimeofday calls
__clock_settime(CLOCK_REALTIME), same as stime.

When only the timezone argument is supplied, settimeofday calls a new
internal function called __settimezone.  On Linux, only, this function
will pass the timezone structure to the settimeofday system call.  On
all other operating systems, and on Linux architectures that don't
define __NR_settimeofday, __settimezone is a stub that always sets
errno to ENOSYS and returns -1.

The settimeoday syscall is enabled on Linux by the flag
COMPAT_32BIT_TIME, which is an option to either 32-bits ABIs or COMPAT
builds (defined usually by 64-bit kernels that want to support 32-bit
 ABIs, such as x86).  The idea to future 64-bit time_t only ABIs
is to not provide settimeofday syscall.

The same semantics are implemented for Linux/Alpha's GLIBC_2.0 compat
symbol for settimeofday.

There are no longer any internal callers of __settimeofday, so the
internal prototype is removed.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-30 17:05:14 -03:00
Zack Weinberg 12cbde1dae Use clock_settime to implement stime; withdraw stime.
Unconditionally, on all ports, use clock_settime to implement stime,
not settimeofday or a direct syscall.  Then convert stime into a
compatibility symbol and remove its prototype from time.h.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-30 17:05:14 -03:00
Paul Eggert 5a82c74822 Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:

sed -ri '
  s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
  s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
  $(find $(git ls-files) -prune -type f \
      ! -name '*.po' \
      ! -name 'ChangeLog*' \
      ! -path COPYING ! -path COPYING.LIB \
      ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
      ! -path manual/texinfo.tex ! -path scripts/config.guess \
      ! -path scripts/config.sub ! -path scripts/install-sh \
      ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
      ! -path INSTALL ! -path  locale/programs/charmap-kw.h \
      ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
      ! '(' -name configure \
            -execdir test -f configure.ac -o -f configure.in ';' ')' \
      ! '(' -name preconfigure \
            -execdir test -f preconfigure.ac ';' ')' \
      -print)

and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:

  chmod a+x sysdeps/unix/sysv/linux/riscv/configure
  # Omit irrelevant whitespace and comment-only changes,
  # perhaps from a slightly-different Autoconf version.
  git checkout -f \
    sysdeps/csky/configure \
    sysdeps/hppa/configure \
    sysdeps/riscv/configure \
    sysdeps/unix/sysv/linux/csky/configure
  # Omit changes that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
  git checkout -f \
    sysdeps/powerpc/powerpc64/ppc-mcount.S \
    sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
  # Omit change that caused a pre-commit check to fail like this:
  # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
  git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 02:43:31 -07:00
Joseph Myers f9fabc1b02 Add tgmath.h macros for narrowing functions.
When adding some of the TS 18661 narrowing functions for glibc 2.28, I
deferred adding corresponding <tgmath.h> support because of unresolved
questions about the specification for those type-generic macros,
especially in relation to _FloatN and _FloatNx types.

Those issues are now clarified in the response to Clarification
Request 13 to TS 18661-3, and this patch adds the deferred tgmath.h
support.  As with other tgmath.h macros, there are fairly
straightforward implementations based on __builtin_tgmath for GCC 8
and later, which result in exactly the right function being called in
each case, and more complicated implementations for GCC 7 and earlier,
which generally result in a function being called whose arguments have
the right format (i.e. an alias for the right function), but which
might not be exactly the function name specified by TS 18661.

In one case with older compilers (f32x* macros, where the type
_Float64x exists and all the arguments have type _Float32 or
_Float32x), there is a further relaxation and the function called may
have arguments narrower than the one specified by the TS, but still
wide enough to represent the arguments exactly, so the result of the
call is unchanged (as this does not affect any case where rounding of
integer arguments might be involved).  With GCC 6 or before this is
inherently unavoidable (but still harmless and not detectable by how
the compiled program behaves, unless it redefines the functions in
question like the testcases do) because _Float32x and _Float64 are
both typedefs for double in that case but the specified semantics
result in different functions, with different argument formats, being
called for those two argument types.

Tests for the new macros are handled through gen-tgmath-tests.py,
which deals with the special-case handling for older GCC.

Tested as follows: with the full glibc testsuite on x86_64 and x86
(with GCC 6, 7 and 8); with the math/ tests on aarch64 and arm (with
GCC 6, 7 and 8); with build-many-glibcs.py (with GCC 6, 7 and 9).

	* math/tgmath.h [__HAVE_FLOAT128X]: Give error.
	[(__HAVE_FLOAT64X && !__HAVE_FLOAT128)
	|| (__HAVE_FLOAT128 && !__HAVE_FLOAT64X)]: Likewise.
	(__TGMATH_2_NARROW_F): Likewise.
	(__TGMATH_2_NARROW_D): New macro.
	(__TGMATH_2_NARROW_F16): Likewise.
	(__TGMATH_2_NARROW_F32): Likewise.
	(__TGMATH_2_NARROW_F64): Likewise.
	(__TGMATH_2_NARROW_F32X): Likewise.
	(__TGMATH_2_NARROW_F64X): Likewise.
	[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F): Likewise.
	[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F16): Likewise.
	[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F32): Likewise.
	[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F64): Likewise.
	[__HAVE_BUILTIN_TGMATH] (__TGMATH_NARROW_FUNCS_F32X): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fadd): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dadd): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fdiv): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (ddiv): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fmul): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dmul): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (fsub): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT_C2X)] (dsub): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16add):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16div):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16mul):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT16] (f16sub):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32add):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32div):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32mul):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32] (f32sub):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
	&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64add): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
	&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64div): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
	&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64mul): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64
	&& (__HAVE_FLOAT64X || __HAVE_FLOAT128)] (f64sub): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xadd):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xdiv):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xmul):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT32X] (f32xsub):
	Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
	&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xadd): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
	&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xdiv): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
	&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xmul): Likewise.
	[__GLIBC_USE (IEC_60559_TYPES_EXT) && __HAVE_FLOAT64X
	&& (__HAVE_FLOAT128X || __HAVE_FLOAT128)] (f64xsub): Likewise.
	* math/gen-tgmath-tests.py (Type): Add members
	non_standard_real_argument_types_list, long_double_type,
	complex_float64_type and float32x_ext_type.
	(Type.__init__): Set the new members.
	(Type.floating_type): Add new argument floatn.
	(Type.real_floating_type): Likewise.
	(Type.can_combine_types): Likewise.
	(Type.combine_types): Likewise.
	(Type.init_types): Create internal Float32x_ext type.
	(Tests.__init__): Define Float32x_ext in generated C code.
	(Tests.add_tests): Handle narrowing functions.
	(Tests.add_all_tests): Likewise.
	(Tests.tests_text): Allow variation in mant_dig for narrowing
	functions with compilers before GCC 8.
	* math/Makefile (tgmath3-narrow-types): New variable.
	(tgmath3-narrow-macros): Likewise.
	(tgmath3-macros): Add $(tgmath3-narrow-macros).
2019-08-21 12:06:44 +00:00
Joseph Myers 42760d7646 Make totalorder and totalordermag functions take pointer arguments.
The resolution of C floating-point Clarification Request 25
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2397.htm#dr_25> is
that the totalorder and totalordermag functions should take pointer
arguments, and this has been adopted in C2X (with const added; note
that the integration of this change into C2X is present in the C
standard git repository but postdates the most recent public PDF
draft).

This patch updates glibc accordingly.  As a defect resolution, the API
is changed unconditionally rather than supporting any sort of TS
18661-1 mode for compilation with the old version of the API.  There
are compat symbols for existing binaries that pass floating-point
arguments directly.  As a consequence of changing to pointer
arguments, there are no longer type-generic macros in tgmath.h for
these functions.

Because of the fairly complicated logic for creating libm function
aliases and determining the set of aliases to create in a given glibc
configuration, rather than duplicating all that in individual source
files to create the versioned and compat symbols, the source files for
the various versions of totalorder functions are set up to redefine
weak_alias before using libm_alias_* macros to create the symbols
required.  In turn, this requires creating a separate alias for each
symbol version pointing to the same implementation (see binutils bug
<https://sourceware.org/bugzilla/show_bug.cgi?id=23840>), which is
done automatically using __COUNTER__.  (As I noted in
<https://sourceware.org/ml/libc-alpha/2018-10/msg00631.html>, it might
well make sense for glibc's symbol versioning macros to do that alias
creation with __COUNTER__ themselves, which would somewhat simplify
the logic in the totalorder source files.)

It is of course desirable to test the compat symbols.  I did this with
the generic libm-test machinery, but didn't wish to duplicate the
actual tables of test inputs and outputs, and thought it risky to
attempt to have a single object file refer to both default and compat
versions of the same function in order to test them together.  Thus, I
created libm-test-compat_totalorder.inc and
libm-test-compat_totalordermag.inc which include the generated .c
files (with the processed version of those tables of inputs) from the
non-compat tests, and added appropriate dependencies.  I think this
provides sufficient test coverage for the compat symbols without also
needing to make the special ldbl-96 and ldbl-128ibm tests (of
peculiarities relating to the representations of those formats that
can't be covered in the generic tests) run for the compat symbols.

Tests of compat symbols need to be internal tests, meaning _ISOMAC is
not defined.  Making some libm-test tests into internal tests showed
up two other issues.  GCC diagnoses duplicate macro definitions of
__STDC_* macros, including __STDC_WANT_IEC_60559_TYPES_EXT__; I added
an appropriate conditional and filed
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91451> for this issue.
On ia64, include/setjmp.h ends up getting included indirectly from
libm-symbols.h, resulting in conflicting definitions of the STR macro
(also defined in libm-test-driver.c); I renamed the macros in
include/setjmp.h.  (It's arguable that we should have common internal
headers used everywhere for stringizing and concatenation macros.)

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* math/bits/mathcalls.h
	[__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN]
	(totalorder): Take pointer arguments.
	[__GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN]
	(totalordermag): Likewise.
	* manual/arith.texi (totalorder): Likewise.
	(totalorderf): Likewise.
	(totalorderl): Likewise.
	(totalorderfN): Likewise.
	(totalorderfNx): Likewise.
	(totalordermag): Likewise.
	(totalordermagf): Likewise.
	(totalordermagl): Likewise.
	(totalordermagfN): Likewise.
	(totalordermagfNx): Likewise.
	* math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): Remove macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (totalorder): Likewise.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (totalordermag): Likewise.
	* math/Versions (GLIBC_2.31): Add totalorder, totalorderf,
	totalorderl, totalordermag, totalordermagf, totalordermagl,
	totalorderf32, totalorderf64, totalorderf32x, totalordermagf32,
	totalordermagf64, totalordermagf32x, totalorderf64x,
	totalordermagf64x, totalorderf128 and totalordermagf128.
	* math/Makefile (libm-test-funcs-noauto): Add compat_totalorder
	and compat_totalordermag.
	(libm-test-funcs-compat): New variable.
	(libm-tests-compat): Likewise.
	(tests): Do not include compat tests.
	(tests-internal): Add compat tests.
	($(foreach t,$(libm-tests-base),
	$(objpfx)$(t)-compat_totalorder.o)): Depend
	on $(objpfx)libm-test-totalorder.c.
	($(foreach t,$(libm-tests-base),
	$(objpfx)$(t)-compat_totalordermag.o): Depend on
	$(objpfx)libm-test-totalordermag.c.
	(tgmath3-macros): Remove totalorder and totalordermag.
	* math/libm-test-compat_totalorder.inc: New file.
	* math/libm-test-compat_totalordermag.inc: Likewise.
	* math/libm-test-driver.c (struct test_ff_i_data): Update comment.
	(RUN_TEST_fpfp_b): New macro.
	(RUN_TEST_LOOP_fpfp_b): Likewise.
	* math/libm-test-totalorder.inc (totalorder_test_data): Use
	TEST_fpfp_b.
	(totalorder_test): Condition on [!COMPAT_TEST].
	(do_test): Likewise.
	* math/libm-test-totalordermag.inc (totalordermag_test_data): Use
	TEST_fpfp_b.
	(totalordermag_test): Condition on [!COMPAT_TEST].
	(do_test): Likewise.
	* math/gen-tgmath-tests.py (Tests.add_all_tests): Remove
	totalorder and totalordermag.
	* math/test-tgmath.c (NCALLS): Change to 132.
	(F(compile_test)): Do not call totalorder or totalordermag.
	(F(totalorder)): Remove.
	(F(totalordermag)): Likewise.
	* include/float.h (__STDC_WANT_IEC_60559_TYPES_EXT__): Do not
	define if [__STDC_WANT_IEC_60559_TYPES_EXT__].
	* include/setjmp.h [!_ISOMAC] (STR_HELPER): Rename to
	SJSTR_HELPER.
	[!_ISOMAC] (STR): Rename to SJSTR.  Update call to STR_HELPER.
	[!_ISOMAC] (TEST_SIZE): Update call to STR.
	[!_ISOMAC] (TEST_ALIGN): Likewise.
	[!_ISOMAC] (TEST_OFFSET): Likewise.
	* sysdeps/ieee754/dbl-64/s_totalorder.c: Include <shlib-compat.h>
	and <first-versions.h>.
	(__totalorder): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalordermag): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalorder): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalordermag): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/float128/float128_private.h
	(__totalorder_compatl): New macro.
	(__totalordermag_compatl): Likewise.
	* sysdeps/ieee754/flt-32/s_totalorderf.c: Include <shlib-compat.h>
	and <first-versions.h>.
	(__totalorderf): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/flt-32/s_totalordermagf.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalordermagf): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/ldbl-128/s_totalorderl.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalorderl): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/ldbl-128/s_totalordermagl.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalordermagl): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c: Include
	<shlib-compat.h>.
	(__totalorderl): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c: Include
	<shlib-compat.h>.
	(__totalordermagl): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/ldbl-96/s_totalorderl.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalorderl): Take pointer arguments.  Add symbol versions and
	compat symbols.
	* sysdeps/ieee754/ldbl-96/s_totalordermagl.c: Include
	<shlib-compat.h> and <first-versions.h>.
	(__totalordermagl): Take pointer arguments.  Add symbol versions
	and compat symbols.
	* sysdeps/ieee754/ldbl-opt/nldbl-totalorder.c (totalorderl): Take
	pointer arguments.
	* sysdeps/ieee754/ldbl-opt/nldbl-totalordermag.c (totalordermagl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c
	(do_test): Update calls to totalorderl and totalordermagl.
	* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c (do_test):
	Update calls to totalorderl and totalordermagl.
	* sysdeps/mach/hurd/i386/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/csky/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2019-08-15 15:18:34 +00:00
Joseph Myers 777d75fbc0 Add feature test macro _ISOC2X_SOURCE.
This patch starts preparation for C2X support in glibc headers by
adding a feature test macro _ISOC2X_SOURCE and corresponding
__GLIBC_USE (ISOC2X).  (I chose to use the newer __GLIBC_USE style for
this rather than the older __USE_* macros tested with #ifdef.)  As
with other such macros, C2X features are also enabled by compiling for
a standard newer than C17, or by using _GNU_SOURCE.

This patch does not itself enable anything new in the headers for C2X;
that is to be done in followup patches.  (For example, most of the TS
18661-1 functions should be declared for C2X without any
__STDC_WANT_IEC_60559_BFP_EXT__ being needed, but the ones that
18661-1 adds to Annex F because of their close relation to IEEE 754
formats do still need the WANT macro in C2X.)

Once C2X becomes an actual standard we'll presumably move to using the
actual year in the feature test macro and __GLIBC_USE, with some
period when both macro spellings are accepted, as was done with
_ISOC9X_SOURCE.

Tested for x86_64.

	* include/features.h (_ISOC2X_SOURCE): New feature test macro.
	Undefine and define to 1 if [_GNU_SOURCE].
	(__GLIBC_USE_ISOC2X): New macro.  Undefine and redefine depending
	on [_ISOC2X_SOURCE] and [__STDC_VERSION__ > 201710L].
	(__USE_ISOC11): Also define to 1 if [_ISOC2X_SOURCE].
	(__USE_ISOC99): Likewise.
	(__USE_ISOC95): Likewise.
	* manual/creature.texi (_ISOC2X_SOURCE): Document.
2019-08-13 11:26:00 +00:00