There are a few .set mips* assembler directives used in the MIPS specific
sysdep code that force an instruction to be assembled for a specific ISA.
The reason for these is to allow an instruction to be encoded when it might
not be supported in the current ISA (when the code is run the Linux kernel
will trap and emulate any unsupported instructions). Unfortunately forcing
a specific ISA means that when assembling for a newer ISA, where the
instruction has a different encoding, the wrong encoding will be used.
* sysdeps/mips/bits/atomic.h [_MIPS_SIM == _ABIO32] (MIPS_PUSH_MIPS2):
Only use .set mips2 if the current ISA is below mips2.
* sysdeps/mips/sys/tas.h [_MIPS_SIM == _ABIO32] (_test_and_set):
Likewise.
* sysdeps/mips/nptl/tls.h (READ_THREAD_POINTER): Only use .set
mips32r2 if the current ISA is below mips32r2.
* sysdeps/mips/tls-macros.h (TLS_RDHWR): New define.
(TLS_IE): Updated to use the TLD_RDHWR macro.
(TLS_LE): Likewise.
* sysdeps/unix/mips/sysdep.h (__mips_isa_rev): Moved out of #ifdef
__ASSEMBLER__ condition.
when initial make call has subdir= explicitly set.
* sysdeps/mach/Makefile ($(patsubst
mach%,m\%h%,$(mach-before-compile))): Force subdir to mach when
calling $(MAKE).
* sysdeps/mach/hurd/Makefile ($(patsubst %,$(hurd-objpfx)hurd/%.%,auth
io fs process)): Force subdir to hurd when calling $(MAKE).
($(common-objpfx)hurd/../mach/RPC_task_get_sampled_pcs.c): Force
subdir to mach when calling $(MAKE).
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/linkmap.h to plain linkmap.h to follow that
convention.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
[BZ #14912]
* bits/linkmap.h: Move to ...
* sysdeps/generic/linkmap.h: ...here.
* sysdeps/aarch64/bits/linkmap.h: Move to ...
* sysdeps/aarch64/linkmap.h: ...here.
* sysdeps/arm/bits/linkmap.h: Move to ...
* sysdeps/arm/linkmap.h: ...here.
* sysdeps/hppa/bits/linkmap.h: Move to ...
* sysdeps/hppa/linkmap.h: ...here.
* sysdeps/ia64/bits/linkmap.h: Move to ...
* sysdeps/ia64/linkmap.h: ...here.
* sysdeps/mips/bits/linkmap.h: Move to ...
* sysdeps/mips/linkmap.h: ...here.
* sysdeps/s390/bits/linkmap.h: Move to ...
* sysdeps/s390/linkmap.h: ...here.
* sysdeps/sh/bits/linkmap.h: Move to ...
* sysdeps/sh/linkmap.h: ...here.
* sysdeps/x86/bits/linkmap.h: Move to ...
* sysdeps/x86/linkmap.h: ...here.
* include/link.h: Include <linkmap.h> instead of <bits/linkmap.h>.
Commit f4491417cc introduced some warnings
when building GLIBC with GCC 5.x. similar to those fixed by commit
dd6e8af6ba. This patch fixes those warnings.
* sysdeps/unix/sysv/linux/socketpair.c: Use the address of the
first member of struct sv in syscall macro.
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/stdio-lock.h to plain stdio-lock.h to follow
that convention.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
[BZ #14912]
* bits/stdio-lock.h: Move to ...
* sysdeps/generic/stdio-lock.h: ...here.
(_BITS_STDIO_LOCK_H): Rename macro to _STDIO_LOCK_H.
* sysdeps/nptl/bits/stdio-lock.h: Move to ...
* sysdeps/nptl/stdio-lock.h: ...here.
(_BITS_STDIO_LOCK_H): Rename macro to _STDIO_LOCK_H.
* include/libio.h: Include <stdio-lock.h> instead of
<bits/stdio-lock.h>.
* sysdeps/nptl/fork.c: Likewise.
* sysdeps/pthread/flockfile.c: Likewise.
* sysdeps/pthread/ftrylockfile.c: Likewise.
* sysdeps/pthread/funlockfile.c: Likewise.
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/m68k-vdso.h to plain m68k-vdso.h to follow
that convention.
[BZ #14912]
* sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: Move to ...
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: ...here.
* sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Include
<m68k-vdso.h> instead of <bits/m68k-vdso.h>.
* sysdeps/unix/sysv/linux/m68k/init-first.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise.
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/libc-tsd.h to plain libc-tsd.h to follow that
convention.
Tested for x86_64 (testing, and that installed stripped shared
libraries are unchanged by the patch).
[BZ #14912]
* bits/libc-tsd.h: Move to ...
* sysdeps/generic/libc-tsd.h: ...here.
(_GENERIC_BITS_LIBC_TSD_H): Rename macro to _GENERIC_LIBC_TSD_H.
* sysdeps/mach/hurd/bits/libc-tsd.h: Move to ...
* sysdeps/mach/hurd/libc-tsd.h: ...here.
(_BITS_LIBC_TSD_H): Rename macro to _LIBC_TSD_H.
* include/ctype.h: Include <libc-tsd.h> instead of
<bits/libc-tsd.h>.
* include/rpc/rpc.h: Likewise.
* locale/localeinfo.h: Likewise.
* sunrpc/rpc_thread.c: Likewise.
* sysdeps/mach/hurd/malloc-machine.h: Likewise.
* sysdeps/nptl/malloc-machine.h: Likewise.
The bits/libc-lock.h and bits/stdio-lock.h headers are installed, but
not used by any other installed header.
Accordingly, this patch stops these headers from being installed. A
followup is intended to move these headers out of the bits/ namespace.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* Makefile (headers): Remove bits/libc-lock.h.
* libio/Makefile (headers): Remove bits/stdio-lock.h.
Every so often someone gets confused by the fact that the installed
<bits/stdio-lock.h> header includes the non-installed <lowlevellock.h>
header.
This inclusion is not in fact a bug, because <bits/stdio-lock.h> only
gets included by any header that users should include directly if
_IO_MTSAFE_IO is defined, and that's an internal define used when
building libio, not a feature test macro it's valid for users to
define. However, on general principles it's best to have as little as
possible in the installed headers that is inapplicable for valid uses
of the installed glibc.
This patch moves the include of <bits/stdio-lock.h> to the internal
header include/libio.h, so that even if someone defines _IO_MTSAFE_IO
it won't get included. This is intended as preparation for stopping
<bits/stdio-lock.h> and <bits/libc-lock.h> from being installed at all
(after this patch they aren't used in any installed header; formally
of course they don't need to be installed even before this patch, but
stopping them being installed before removing the #include would just
exacerbate the confusion described above), and then moving those out
of the bits/ namespace in accordance with the principle that that
namespace is only for installed headers.
The tests scanf15.c and scanf17.c avoid the internal headers; after
this patch that means they need to undefine _IO_MTSAFE_IO as well as
_LIBC so as to get a working _IO_lock_t definition for libio.h. This
brings them closer to using the headers as an installed program would,
which clearly accords with the intent of those tests.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* libio/libio.h [_IO_MTSAFE_IO]: Remove include of
<bits/stdio-lock.h> and commented-out include of <comthread.h>.
* include/libio.h [!_ISOMAC && _IO_MTSAFE_IO]: Include
<bits/stdio-lock.h>.
* stdio-common/scanf15.c (_IO_MTSAFE_IO): Undefine.
* stdio-common/scanf17.c (_IO_MTSAFE_IO): Likewise.
This patch adds new constants from Linux 4.2 to netinet/in.h:
IPPROTO_MPLS and IP_BIND_ADDRESS_NO_PORT (both in
include/uapi/linux/in.h in Linux; one directly in netinet/in.h, one in
bits/in.h in glibc).
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* inet/netinet/in.h (IPPROTO_MPLS): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/in.h (IP_BIND_ADDRESS_NO_PORT): New
macro.
This patch adds move TCP_* values to sysdeps/gnu/netinet/tcp.h to
bring it up to date with Linux 4.2. TCP_SAVE_SYN and TCP_SAVED_SYN
are new in 4.2, TCP_NOTSENT_LOWAT and TCP_CC_INFO are older (Szabolcs
previously noted in
<https://sourceware.org/ml/libc-alpha/2015-06/msg00938.html> that this
header was out of date in glibc).
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* sysdeps/gnu/netinet/tcp.h (TCP_NOTSENT_LOWAT): New macro.
(TCP_CC_INFO): Likewise.
(TCP_SAVE_SYN): Likewise.
(TCP_SAVED_SYN): Likewise.
The fix for BZ #17273 introduced a single byte of memory corruption when
the line is entirely blank. It would walk back past the start of the
buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
buffer = '\n';
end_ptr = buffer;
while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
end_ptr--;
*end_ptr = '\0';
Fix that and rework the tests. Adding the testcase for BZ #17273 to the
existing \040 parser does not really make sense as it's unrelated, and
leads to confusing behavior: it implicitly relies on the new entry being
longer than the previous entry (since it just rewinds the FILE*). Split
it out into its own dedicated testcase instead.
strptime's %z specifier parses a string consisting of a sign ('+'
or '-'), two hours digits, and optionally two minutes digits, into a
tm.tm_gmtoff field containing the signed number of seconds the time
zone is offset from UTC time.
The time/tst-strptime2.c program passes a short list of strings through
strptime, validating that either the gmtoff value returned matches an
expected value, or that strptime returns an expected NULL for invalid
strings (for example, when the minutes portion of the string is outside
of the range 00 to 59, or the sign is missing before the hours digits).
In review of strptime fixes, Carlos O'Donell expressed a wish that
the test function iterate through the entire range of all possible
numeric strings (-9999 to +9999) which could be passed to strptime %z,
and validate the correct response.
Specifically, the test will look for a NULL response from strptime
when:
* sign ('+' or '-') is not present before the first digit (invalid
format).
* A sign and no digits are found (invalid format).
* A sign and one digit are found (invalid format).
* A sign and three digits are found (invalid format).
* A sign and four digits (-9999 to +9999) are found but the last
two digits (minutes) are in the range 60 to 99.
The test will look for a success response from strptime with
tm.tm_gmtoff matching the calculated tm_gmtoff value when:
* A sign and four digits are found (-9999 to +9999), and the last
two digits (minutes) are in the range 00 to 59.
* A sign and two digit strings are found (-99 to +99).
The test's iteration over the possible digit values results in 22223
test strings prepared, tested, and passed by strptime.
The test supports a --verbose command line option which will show
the test results of every test input, and a final summary of all
tests. Here is some sample output:
PASS: input "1113472456 1030", expected: invalid, return value NULL
PASS: input "1113472456 +", expected: invalid, return value NULL
PASS: input "1113472456 -", expected: invalid, return value NULL
PASS: input "1113472456 +0", expected: invalid, return value NULL
PASS: input "1113472456 -0", expected: invalid, return value NULL
PASS: input "1113472456 +1", expected: invalid, return value NULL
...
PASS: input "1113472456 +9", expected: invalid, return value NULL
PASS: input "1113472456 -9", expected: invalid, return value NULL
PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0
PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0
PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600
PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600
PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200
...
PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400
PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400
PASS: input "1113472456 +000", expected: invalid, return value NULL
PASS: input "1113472456 -000", expected: invalid, return value NULL
PASS: input "1113472456 +001", expected: invalid, return value NULL
...
PASS: input "1113472456 +999", expected: invalid, return value NULL
PASS: input "1113472456 -999", expected: invalid, return value NULL
PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0
PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0
PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60
PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60
...
PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540
PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540
PASS: input "1113472456 +0060", expected: invalid, return value NULL
PASS: input "1113472456 -0060", expected: invalid, return value NULL
...
PASS: input "1113472456 +0099", expected: invalid, return value NULL
PASS: input "1113472456 -0099", expected: invalid, return value NULL
PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600
PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600
PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660
...
PASS: input "1113472456 +9999", expected: invalid, return value NULL
PASS: input "1113472456 -9999", expected: invalid, return value NULL
PASS: 22223 input strings: 0 fail, 22223 pass
Any failing test will result in printing the failed line to stdout, and
will trigger the printing of the summary line at the of all tests. For
example:
FAIL: input "1113472456 1030", expected: invalid, return value NULL,
got: valid, tm.tm_gmtoff 37800
FAIL: 22223 input strings: 1 fail, 22222 pass
Topic: strptime supports a %z input field descriptor, which parses a
time zone offset from UTC time into the broken-out time field tm_gmtoff.
Problems:
1) In the current implementation, the minutes portion calculation is
correct only for minutes evenly divisible by 3. This is because the
minutes value is converted to decimal time, but inadequate precision
leads to rounding which calculates results that are too low for
some values.
For example, due to rounding, a +1159 offset string results in an
incorrect tm_gmtoff of 43128 (== 11 * 3600 + 58.8 * 60) seconds,
instead of 43140 (== 11 * 3600 + 59 * 60) seconds. In contrast,
a +1157 offset (minutes divisible by 3) does not cause the bug,
and results in a correct tm_gmtoff of 43020.
2) strptime's %z specifier will not parse time offsets less than
-1200 or greater than +1200, or if only hour digits are present, less
than -12 or greater than +12. It will return NULL for offsets outside
that range. These limits do not meet historical and modern use cases:
* Present day exceeds the +1200 limit:
- Pacific/Auckland (New Zealand) summer time is +1300.
- Pacific/Kiritimati (Christmas Island) is +1400.
- Pacific/Apia (Samoa) summer time is +1400.
* Historical offsets exceeded +1500/-1500.
* POSIX supports -2459 to +2559.
* Offsets up to +/-9959 may occasionally be useful.
* Paul Eggert's notes provide additional detail:
- https://sourceware.org/ml/libc-alpha/2014-12/msg00068.html
- https://sourceware.org/ml/libc-alpha/2014-12/msg00072.html
3) tst-strptime2, part of the 'make check' test suite, does not test
for the above problems.
Corrective actions:
1) In time/strptime_l.c, calculate the offset from the hour and
minute portions directly, without the rounding errors introduced by
decimal time.
2) Remove the +/-1200 range limit, permitting strptime to parse offsets
from -9959 through +9959.
3) Add zone offset values to time/tst-strptime2.c.
* Test minutes evenly divisible by three (+1157) and not evenly
divisible by three (+1158 and +1159).
* Test offsets near the old and new range limits (-1201, -1330, -2459,
-2500, -99, -9959, +1201, +1330, +1400, +1401, +2559, +2600, +99,
and +9959)
The revised strptime passes all old and new tst-strptime2 tests.
This patch fixes the default wordsize-32 mmap implementation offset
calculation for negative values. Current code uses signed shift
operation to calculate the multiple size to use with syscall and
it is implementation defined. Change it to use a division base
on mmap page size (default being as before, 4096).
Tested on armv7hf.
[BZ #18877]
* posix/Makefile (tests): Add tst-mmap-offset.
* posix/tst-mmap.c: New file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c (__mmap): Fix
offset calculation for negative values.
We detect i586 and i686 features at run-time by checking CX8 and CMOV
CPUID features bits. We can use these information to select the best
implementation in ix86 multiarch. HAS_I586/HAS_I686 is true if i586/i686
instructions are available on the processor.
Due to the reordering and the other nifty extensions in i686, it is not
really good to use heavily i586 optimized code on an i686. It's better
to use i486 code if it isn't an i586. USE_I586/USE_I686 is true if
i586/i686 implementation should be used for the processor. USE_I586
is true only if i686 instructions aren't available. If i686 instructions
are available, we always choose i686 or i486 implementation, in that order,
and we never choose i586 implementation for i686-class processors.
* sysdeps/i386/init-arch.h: New file.
* sysdeps/i386/i586/init-arch.h: Likewise.
* sysdeps/i386/i686/init-arch.h: Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Set bit_I586
bit if CX8 is available. Set bit_I686 bit if CMOV is available.
* sysdeps/x86/cpu-features.h (bit_I586): New.
(bit_I686): Likewise.
(bit_CX8): Likewise.
(bit_CMOV): Likewise.
(index_CX8): Likewise.
(index_CMOV): Likewise.
(index_I586): Likewise.
(index_I686): Likewise.
(reg_CX8): Likewise.
(reg_CMOV): Likewise.
(HAS_I586): Defined as HAS_ARCH_FEATURE (I586) if i586 isn't
available at compile-time.
(HAS_I686): Defined as HAS_ARCH_FEATURE (I686) if i686 isn't
available at compile-time.
* sysdeps/x86/init-arch.h (USE_I586): New macro.
(USE_I686): Likewise.
GCC 6 puts out warnings in a different location then GCC 5. Move the
DIAG macros so that the warnings are supressed for both compilers.
ChangeLog:
* soft-fp/fmasf4.c: Add include of sys/cdefs.h.
Move DIAG_PUSH_NEEDS_COMMENT, DIAG_IGNORE_NEEDS_COMMENT to front of
file, move DIAG_POP_NEEDS_COMMENT to end of file.
* soft-fp/fmadf4.c: Ditto.
* soft-fp/fmatf4.c: Ditto.
Since glibc doesn't support i386 any more, we can remove i486 subdirectory.
* sysdeps/i386/i586/Implies: Removed.
* sysdeps/i386/i686/Implies: Likewise.
Since glibc doesn't support i386 any more, we can move i486/strlen.S
to strlen.S.
* sysdeps/i386/i486/strlen.S: Moved to ...
* sysdeps/i386/strlen.S: Here.
Since glibc doesn't support i386 any more, we can move i486/strcat.S
to strcat.S.
* sysdeps/i386/i486/strcat.S: Moved to ...
* sysdeps/i386/strcat.S: Here.
* sysdeps/i386/i686/multiarch/strcat.S: Updated.
Since glibc doesn't support i386 any more, we can move
i486/pthread_spin_trylock.S to pthread_spin_trylock.S
* sysdeps/i386/i486/pthread_spin_trylock.S: Moved to ...
* sysdeps/i386/pthread_spin_trylock.S: Here.
* sysdeps/i386/i586/pthread_spin_trylock.S: Removed.
* sysdeps/i386/i686/pthread_spin_trylock.S: Updated.
Since glibc doesn't support i386 any more, we can move
i486/string-inlines.c to string-inlines.c.
* sysdeps/i386/i486/string-inlines.c: Moved to ...
* sysdeps/i386/string-inlines.c: Here.
Since glibc doesn't support i386 any more, we can move i486/bits/atomic.h
to bits/atomic.h.
* sysdeps/i386/i486/bits/atomic.h: Moved to ...
* sysdeps/i386/bits/atomic.h: Here.
As with other spots in the code, GCC 4.8 unnecessarily complains about
an uninitialized variable in tanl calcs, so this patch disables. With
it, the library and sees the usual set of test passes.
* sysdeps/ieee754/ldbl-96/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
Linux commit b4b56f9ecab40f3b4ef53e130c9f6663be491894 introduced
a new HWCAP2 bit to indicate that the kernel now aborts a memory
transaction when a syscall is made. This patch adds that bit to
sysdeps/powerpc/bits/hwcap.h.
2015-08-26 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
* sysdeps/powerpc/bits/hwcap.h: Add PPC_FEATURE2_HTM_NOSC.
* sysdeps/powerpc/dl-procinfo.c:
(_dl_powerpc_cap_flags): Added descriptor for this hwcap
feature so it shows when LD_SHOW_AUXV=1.
Power ISA 2.07B section B.5.5 relaxed the barrier requirement around a
TLE enabled lock. It is now identical to a traditional lock.
2015-08-26 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__arch_compare_and_exchange_val_32_acq): Remove and use common
definition. ISA 2.07B no longer requires full sync.
Replace BZERO_P with USE_AS_BZERO in i586/i686 memset.S to support i386
multi-arch memset. Also we should check SHARED not PIC for libc.so
since libc.a may be compiled with PIC.
* sysdeps/i386/i586/bzero.S (USE_AS_BZERO): New.
* sysdeps/i386/i686/bzero.S (USE_AS_BZERO): Likewise.
* sysdeps/i386/i586/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): New.
* sysdeps/i386/i686/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): Don't define if
__memset_chk or USE_AS_BZERO are defined.