summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Add IPPROTO_ETHERNET and IPPROTO_MPTCP from Linux 5.6 to netinet/in.h."alistair/rv32.nextAlistair Francis2020-04-251-4/+0
| | | | This reverts commit f9ac84f92f151e07586c55e14ed628d493a5929d.
* COVER: glibc port for 32-bit RISC-V (RV32)Alistair Francis2020-04-251-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch set contains the glibc port for 32-bit RISC-V. This is based on the original work from Zong Li [1] and has been updated to use a 64-bit time_t. This requires a 5.4+ kernel and all of the testing has been done using the 5.4 stable kernel. Nothing fails when running ./scripts/build-many-glibcs.py (for all targets) on my x86-64 machine. This is the current list of tests that fail when running inside QEMU RV32 system emulation on the 5.4 kernel: FAIL: elf/tst-ldconfig-ld_so_conf-update FAIL: io/tst-lockf FAIL: misc/test-errno-linux FAIL: nss/tst-nss-files-hosts-long FAIL: resolv/tst-resolv-res_init-thread FAIL: stdio-common/bug22 FAIL: stdlib/tst-strfrom FAIL: stdlib/tst-strfrom-locale FAIL: sysvipc/test-sysvmsg ---Links--- 1: https://sourceware.org/ml/libc-alpha/2018-07/msg00892.html The latest version of my work can be found here: https://github.com/alistair23/glibc/tree/alistair/rv32.next This specific version can be found here: https://github.com/alistair23/glibc/tree/alistair/rv32.1 ---Changelog--- v1: - Update based from feedback on RFCv6 - Improve test passing - There are only 9 tests failing now - Rebase on Lukasz's work - Send only the RV32 specific patches (other patches are already merged or on the list) RFC v6: - Rebase on top of accetpted patches - Fix issues so that the tests actually run RFC v5: - Hopefully finally get the correct layout for the *64 syscalls - Sort out the Changelog RFC v4: - Continue to fix things that weren't working - Update the coding style to match glibc - Update the __ASSUME_TIME64_SYSCALLS work to better match Lukasz's work RFC v3: - Remove all "Hack" patches - Incorporate upstream comments - Ensure we don't break RV64 - Lot's more testing and fixes RFC v2: - Add Lukasz's patches - Update the non HACK syscalls after feedback - define __ASSUME_TIME64_SYSCALLS and __ASSUME_RLIM64_SYSCALLS - Remove lockf64.c - Other smaller changes from RFC v1
* Add RISC-V 32-bit target to build-many-glibcs.pyZong Li2020-04-251-0/+15
| | | | | | | Support building three variant of 32 bit RISC-V glibc as follows: - riscv32-linux-gnu-rv32imac-ilp32 - riscv32-linux-gnu-rv32imafdc-ilp32 - riscv32-linux-gnu-rv32imafdc-ilp32d
* Documentation for the RISC-V 32-bit portZong Li2020-04-252-0/+7
| | | | | There is already RISC-V 64-bit port information in the documentation. Let's add some documentation entries for the RISC-V 32-bit as well.
* RISC-V: Add rv32 path to RTLDLIST in lddZong Li2020-04-251-1/+1
|
* riscv32: Specify the arch_minimum_kernel as 5.4Alistair Francis2020-04-252-0/+8
|
* RISC-V: Build Infastructure for 32-bitZong Li2020-04-259-8/+67
| | | | | | This patch lays out the top-level orginazition of the RISC-V 32-bit port. It contains all the Implies files as well as various other fragments of build infastructure for the RISC-V 32-bit port.
* RISC-V: Fix llrint and llround missing exceptions on RV32Zong Li2020-04-251-0/+38
| | | | | | | Similar to the fix for MIPS, ARM and S/390, RV32 is missing correct exception on overflow from llrint and llround functions because cast from floating-point types to long long do not result in correct exceptions on overflow.
* RISC-V: Add the RV32 libm-test-ulpsAlistair Francis2020-04-252-0/+1402
| | | | | Add a libm-test-ulps for RV32, generated by running `make regen-ulps`. This is different to the RV64 one.
* RISC-V: Add ABI listsAlistair Francis2020-04-2513-0/+3499
| | | | Use the check-api and update-abi to generate the abilist for rv32.
* RISC-V: Hard float support for 32-bitZong Li2020-04-254-0/+124
| | | | | This patch contains hardware floating-point support for the RV32IF and RV32IFD
* RISC-V: The ABI implementation for 32-bitZong Li2020-04-256-5/+121
| | | | | This patch adds the ABI implementation about 32 bit version. It contains the Linux-specific and RISC-V architecture code, I've collected here.
* RISC-V: nptl: update default pthread-offsets.hAlistair Francis2020-04-251-2/+11
| | | | Update the RISC-V pthread-offsets.h values to support RV32.
* RISC-V: Add arch-syscall.h for RV32Alistair Francis2020-04-251-0/+283
|
* RISC-V: Add path of library directories for the 32-bitZong Li2020-04-251-2/+15
| | | | | | | | | | | | | | For the recommand of 64 bit version, we add the libraries path of 32 bit in this patch. The status of RV32 binaries under RV64 kernels is that the ISA optionally supports having different XLEN for user and supervisor modes, but AFAIK there's no silicon that implements this feature, and the Linux kernel doesn't support it yet. For the recommand of 64 bit version, we add the libraries path of 32 bit in this patch. This includes a fix to avoid an out of bound array check when building with GCC 8.2.
* RISC-V: Support dynamic loader for the 32-bitZong Li2020-04-251-1/+1
| | | | Add the LD_SO_ABI definition for RISC-V 32-bit.
* RISC-V: Add support for 32-bit vDSO callsAlistair Francis2020-04-251-6/+13
|
* RISC-V: Define __NR_* as __NR_*_time64/64 for 32-bitAlistair Francis2020-04-251-0/+61
|
* RISC-V: Use 64-bit time_t and off_t for RV32 and RV64Alistair Francis2020-04-254-0/+166
| | | | | | | | | | | | | | | | | | | Using the original glibc headers under bits/ let's make small modifications to use 64-bit time_t and off_t for both RV32 and RV64. For the typesizes.h, here are justifications for the changes from the generic version (based on Arnd's very helpful feedback): - All the !__USE_FILE_OFFSET64 types (__off_t, __ino_t, __rlim_t, ...) are changed to match the 64-bit replacements. - __time_t is defined to 64 bit, but no __time64_t is added. This makes sense as we don't have the time64 support for other 32-bit architectures yet, and it will be easy to change when that happens. - __suseconds_t is 64-bit. This matches what we use the kernel ABI for the few drivers that are relying on 'struct timeval' input arguments in ioctl, as well as the adjtimex system call. It means that timeval has to be defined without the padding, unlike timespec, which needs padding.
* generic/typesizes.h: Add support for 32-bit arches with 64-bit typesAlistair Francis2020-04-251-12/+25
| | | | | | | | | Update the default typesizes.h to match the new kernel sizes for 32-bit architectures with a 64-bit time_t and friends. This follows the sizes used for RV32 which is a y2038 safe architecture added after Linux 5.1. Reviewed-by: Vineet Gupta <vgupta@synopsys.com> Tested-by: Vineet Gupta <vgupta@synopsys.com>
* sysv: linux: Pass 64-bit version of semctl syscallAlistair Francis2020-04-257-4/+235
| | | | | | | | | | | | | | | The semctl_syscall() function passes a union semun to the kernel. The union includes struct semid_ds as a member. On 32-bit architectures the Linux kernel provides a *_high version of the 32-bit sem_otime and sem_ctime values. These can be combined to get a 64-bit version of the time. This patch adjusts the struct semid_ds to support the *_high versions of sem_otime and sem_ctime. For 32-bit systems with a 64-bit time_t this can be used to get a 64-bit time from the two 32-bit values. Due to alignment differences between 64-bit and 32-bit variables we also need to set nsems to ensure it's correct.
* semctl: Remove the sem-pad.h fileAlistair Francis2020-04-2411-117/+141
| | | | | | | Remove the sem-pad.h file and instead have architectures override the struct semid_ds via the bits/types/struct_semid_ds.h file. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* bits/sem.h: Split out struct semid_dsAlistair Francis2020-04-243-23/+45
| | | | | | | Split out the struct semid_ds into it's own file. This will allow us to have architectures specify their own version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove most gmp-mparam.h headers.Joseph Myers2020-04-245-146/+0
| | | | | | | | | | | | | | Most gmp-mparam.h headers in glibc define various macros to the same values they would be defined to by the generic version of that header, plus macros IEEE_DOUBLE_BIG_ENDIAN or IEEE_DOUBLE_MIXED_ENDIAN related to the representation of double. The latter macros are in turn only used in gmp-impl.h to define union ieee_double_extract, which is not used in glibc. Thus all of these headers, except for the generic one and those that define _LONG_LONG_LIMB for ILP32 configurations with 64-bit registers, are redundant, and this patch removes them. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch.
* elf: Implement __libc_early_initFlorian Weimer2020-04-2413-10/+283
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is defined in libc.so, and the dynamic loader calls right after relocation has been finished, before any ELF constructors or the preinit function is invoked. It is also used in the static build for initializing parts of the static libc. To locate __libc_early_init, a direct symbol lookup function is used, _dl_lookup_direct. It does not search the entire symbol scope and consults merely a single link map. This function could also be used to implement lookups in the vDSO (as an optimization). A per-namespace variable (libc_map) is added for locating libc.so, to avoid repeated traversals of the search scope. It is similar to GL(dl_initfirst). An alternative would have been to thread a context argument from _dl_open down to _dl_map_object_from_fd (where libc.so is identified). This could have avoided the global variable, but the change would be larger as a result. It would not have been possible to use this to replace GL(dl_initfirst) because that global variable is used to pass the function pointer past the stack switch from dl_main to the main program. Replacing that requires adding a new argument to _dl_init, which in turn needs changes to the architecture-specific libc.so startup code written in assembler. __libc_early_init should not be used to replace _dl_var_init (as it exists today on some architectures). Instead, _dl_lookup_direct should be used to look up a new variable symbol in libc.so, and that should then be initialized from the dynamic loader, immediately after the object has been loaded in _dl_map_object_from_fd (before relocation is run). This way, more IFUNC resolvers which depend on these variables will work. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* elf: Introduce <elf_machine_sym_no_match.h>Florian Weimer2020-04-244-23/+79
| | | | | | | | | | | MIPS needs to ignore certain existing symbols during symbol lookup. The old scheme uses the ELF_MACHINE_SYM_NO_MATCH macro, with an inline function, within its own header, with a sysdeps override for MIPS. This allows re-use of the function from another file (without having to include <dl-machine.h> or providing the default definition for ELF_MACHINE_SYM_NO_MATCH). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Add a syscall test for [BZ #25810]H.J. Lu2020-04-222-1/+168
| | | | | | | Add a test to pass 64-bit long arguments to syscall with undefined upper 32 bits on x32. Tested on i386, x86-64 and x32 as well as with build-many-glibcs.py.
* elf: Support lld-style link map for librtld.mapFangrui Song2020-04-211-1/+2
| | | | | | | | | | | | | GNU ld and gold's -Map include a line like: path/to/build/libc_pic.a(check_fds.os) lld -Map does not have the archive member list, but we can still derive the members from the following output VMA LMA Size Align Out In Symbol ... 1a1c0 1a1c0 e2 16 path/to/build/libc_pic.a(check_fds.os):(.text)
* signal: Only handle on NSIG signals on signal functions (BZ #25657)Adhemerval Zanella2020-04-218-94/+246
| | | | | | | | | | | | | | | The upper bits of the sigset_t s not fully initialized in the signal mask calls that return information from kernel (sigprocmask, sigpending, and pthread_sigmask), since the exported sigset_t size (1024 bits) is larger than Linux support one (64 or 128 bits). It might make sigisemptyset/sigorset/sigandset fail if the mask is filled prior the call. This patch changes the internal signal function to handle up to supported Linux signal number (_NSIG), the remaining bits are untouched. Checked on x86_64-linux-gnu and i686-linux-gnu.
* linux: Use pthread_sigmask on sigprocmaskAdhemerval Zanella2020-04-214-15/+27
| | | | | | | With pthread_sigmask on libc.so, it allows implement sigprocmask on top of pthread_sigmask. Checked on x86_64-linux-gnu.
* ia64: Remove sigprocmask/sigblock objects from libpthreadAdhemerval Zanella2020-04-212-4/+3
| | | | | | | | | | | | | It is required because __libc_unwind_longjmp (used on thread cancellation) calls __sigprocmask. Replace with a direct call. They are required because __libc_unwind_longjmp (used for thread cancellation) calls __sigprocmask. Replace this with a direct call. The sigblock function is not exported and is not used internally, so it can be removed. Checked on cross build for ia64-linux-gnu.
* nptl: Move pthread_sigmask implementation to libcAdhemerval Zanella2020-04-2161-34/+77
| | | | | | | | | | | This is part of the libpthread removal project: <https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html> A new symbol version is added on libc to force loading failure instead of lazy binding one for newly binaries with old loaders. Checked with a build against all affected ABIs.
* Bug 25819: Update to Unicode 13.0.0Mike FABIAN2020-04-2115-1439/+3838
| | | | | | | | | 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
* ARC: Update syscall-names.list for ARC specific syscallsVineet Gupta2020-04-201-0/+3
|
* Revert "x86_64: Add SSE sfp-exceptions"Adhemerval Zanella2020-04-202-60/+1
| | | | | | | | | | | The __sfp_handle_exceptions is not fully correct regarding raising exceptions, since there is no direct way to raise only FP_EX_OVERFLOW nor FP_EX_UNDERFLOW for SSE mode. Both libgcc and feraiseexcept rely on x87 mode to accomplish it. This reverts commit 460ee50de054396cc9791ff4cfdc2f5029fb923d. Checked on x86_64.
* provide y2038 safe socket constants for default/asm-generic ABIVineet Gupta2020-04-191-2/+14
| | | | | | | These will be used by upcoming RV32 and ARC ports and any future ports. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
* x86_64: Add SSE sfp-exceptionsAdhemerval Zanella2020-04-172-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | The exported x86_64 fenv.h functions operate on both i387 and SSE (since they should work on both float, double, and long double) while the internal libc_fe* set either SSE (float, double, and float128) or i387 (long double). The libgcc __sfp_handle_exceptions (used on float128 implementation), however, will set either SEE or i387 exception depending of the exception to raise. This broke the internal assumption of float128 where only SSE operations will be used. This patch reimplements the libgcc __sfp_handle_exceptions to use only SSE operations and sets libgcc to use it instead of its own implementation. And I think we should fix libgcc in a similar manner, since checking on config/i386/64/sfp-machine.h it already only supports SSE rounding mode and x86_64 ABI also expectes float128 to use SSE registers [1] (although it is not clear on how future implementation might implement it). Checked on x86_64-linux-gnu. [1] https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI
* Remove __NO_MATH_INLINESAdhemerval Zanella2020-04-176-26/+3
| | | | | | With fenvinline.h removal the flag is not used anymore. Checked on x86_64-linux-gnu.
* i686: Add INTERNAL_SYSCALL_NCS 6 argument supportAdhemerval Zanella2020-04-171-30/+49
| | | | | | | | It is required for i686 BZ#12683 support when building with -Os or -fno-omit-frame-pointer on some gcc versions. It is not used on current code. Check on i686-linux-gnu.
* Reset converter state after second wchar_t output (Bug 25734)Carlos O'Donell2020-04-153-4/+176
| | | | | | | | | | | | | An input BIG5-HKSCS character may be converted into at most 2 wchar_t characters. After outputting the second whcar_t character (which was saved in the converter state) we must reset the state. If we fail to reset the state we will be stuck continually copying that character to the output even if we have further input to consider. We add a new test case that covers the 4 BIG5-HKSCS characters that may become 2 wchar_t characters. Reviewed-by: Tom Honermann <tom@honermann.net>
* Fix typo in posix/tst-fnmatch.input (Bug 25790)Carlos O'Donell2020-04-151-1/+1
| | | | Reported-by: Michael Builov <mbuilov@gmail.com>
* Linux: Remove <sys/sysctl.h> and the sysctl functionFlorian Weimer2020-04-1514-277/+51
| | | | | | | | | | | | | | | 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>
* posix: Add wait4 test caseAlistair Francis2020-04-142-1/+211
| | | | Add a wait4 test case based on the waitid test case.
* linux: wait4: Fix incorrect return value comparisonAlistair Francis2020-04-141-10/+9
| | | | | | | | | | Patch 600f00b "linux: Use long time_t for wait4/getrusage" introduced two bugs: - The usage32 struct was set if the wait4 syscall had an error. - For 32-bit systems the usage struct was set even if it was specified as NULL. This patch fixes the two issues.
* hurd: add mach_print functionSamuel Thibault2020-04-142-0/+4
| | | | | * mach/Versions (GLIBC_2.32): Add mach_print. * sysdeps/mach/hurd/i386/libc.abilist (GLIBC_2.32): Add mach_print.
* x32: Properly pass long to syscall [BZ #25810]H.J. Lu2020-04-132-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | X32 has 32-bit long and pointer with 64-bit off_t. Since x32 psABI requires that pointers passed in registers must be zero-extended to 64bit, x32 can share many syscall interfaces with LP64. When a LP64 syscall with long and unsigned long arguments is used for x32, these arguments must be properly extended to 64-bit. Otherwise if the upper 32 bits of the register have undefined value, such a syscall will be rejected by kernel. Enforce zero-extension for pointers and array system call arguments. For integer types, extend to int64_t (the full register) using a regular cast, resulting in zero or sign extension based on the signedness of the original type. For void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); we now generate 0: 41 f7 c1 ff 0f 00 00 test $0xfff,%r9d 7: 75 1f jne 28 <__mmap64+0x28> 9: 48 63 d2 movslq %edx,%rdx c: 89 f6 mov %esi,%esi e: 4d 63 c0 movslq %r8d,%r8 11: 4c 63 d1 movslq %ecx,%r10 14: b8 09 00 00 40 mov $0x40000009,%eax 19: 0f 05 syscall That is 1. addr is unchanged. 2. length is zero-extend to 64 bits. 3. prot is sign-extend to 64 bits. 4. flags is sign-extend to 64 bits. 5. fd is sign-extend to 64 bits. 6. offset is unchanged. For int arguments, since kernel uses only the lower 32 bits and ignores the upper 32 bits in 64-bit registers, these work correctly. Tested on x86-64 and x32. There are no code changes on x86-64.
* Add GRND_INSECURE from Linux 5.6 to sys/random.hJoseph Myers2020-04-092-0/+4
| | | | | | | | | | This patch adds the GRND_INSECURE constant from Linux 5.6 to glibc's sys/random.h. This is also added to the documentation. The constant acts as a no-op for the Hurd implementation (as that doesn't check whether the flags are known), which is semantically fine, while older Linux kernels reject unknown flags with an EINVAL error. Tested for x86_64.
* Update kernel version to 5.6 in tst-mman-consts.py.Joseph Myers2020-04-091-1/+1
| | | | | | | | This patch updates the kernel version in the test tst-mman-consts.py to 5.6. (There are no new constants covered by this test in 5.6 that need any other header changes.) Tested with build-many-glibcs.py.
* Update mips libm-test-ulpsAdhemerval Zanella2020-04-082-54/+56
|
* Update alpha libm-test-ulpsAdhemerval Zanella2020-04-081-27/+28
|