about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* aarch64: fix SVE ACLE check for bootstrap glibc buildsSzabolcs Nagy2023-05-042-2/+2
| | | | | | | | | | | | | | arm_sve.h depends on stdint.h but that relies on libc headers unless compiled in freestanding mode. Without this change a bootstrap glibc build (that uses a compiler without installed libc headers) failed with checking for availability of SVE ACLE... In file included from [...]/arm_sve.h:28, from conftest.c:1: [...]/stdint.h:9:16: fatal error: stdint.h: No such file or directory 9 | # include_next <stdint.h> | ^~~~~~~~~~ compilation terminated. configure: error: mathvec is enabled but compiler does not have SVE ACLE. [...]
* Enable libmvec support for AArch64Joe Ramsay2023-05-0332-19/+983
| | | | | | | | | | | | | | | | | | | | | | | This patch enables libmvec on AArch64. The proposed change is mainly implementing build infrastructure to add the new routines to ABI, tests and benchmarks. I have demonstrated how this all fits together by adding implementations for vector cos, in both single and double precision, targeting both Advanced SIMD and SVE. The implementations of the routines themselves are just loops over the scalar routine from libm for now, as we are more concerned with getting the plumbing right at this point. We plan to contribute vector routines from the Arm Optimized Routines repo that are compliant with requirements described in the libmvec wiki. Building libmvec requires minimum GCC 10 for SVE ACLE. To avoid raising the minimum GCC by such a big jump, we allow users to disable libmvec if their compiler is too old. Note that at this point users have to manually call the vector math functions. This seems to be acceptable to some downstream users. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* hurd: Enable x86_64 build scriptSamuel Thibault2023-05-023-1/+9
| | | | This now passes crossbuilds.
* hurd 64bit: Make dev_t word typeSamuel Thibault2023-05-021-1/+1
| | | | | | | dev_t are 64bit on Linux ports, so better increase their size on 64bit Hurd. It happens that this helps with BZ 23084 there: st_dev has type fsid_t (quad) and is specified by POSIX to have type dev_t. Making dev_t 64bit makes these match.
* malloc: Really fix tst-memalign-3 link against threadsSamuel Thibault2023-05-021-1/+2
| | | | All the tst malloc variants need the thread linking flags.
* malloc: Fix tst-memalign-3 link against threadsSamuel Thibault2023-05-021-0/+1
|
* Use GCC 13 branch, Linux 6.3 in build-many-glibcs.pyJoseph Myers2023-05-021-2/+2
| | | | | | | | This patch updates build-many-glibcs.py to use Linux 6.3 and GCC 13 branch by default. Tested with build-many-glibcs.py (host-libraries, compilers and glibc builds).
* Mark various cold functions as __COLDSergey Bugaev2023-05-014-11/+11
| | | | | | | | | | GCC docs explicitly list perror () as a good candidate for using __attribute__ ((cold)). So apply __COLD to perror () and similar functions. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131223.2507236-3-bugaevc@gmail.com>
* Fix regex type usageнаб2023-05-012-15/+15
| | | | | | | | | | | include/regex.h had not been updated during the int -> Idx transition, and the prototypes don't matched the definitions in regexec.c. In regcomp.c, most interfaces were updated for Idx, except for two ones guarded by #if _LIBC. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* hurd 64bit: Fix struct msqid_ds and shmid_ds fieldsSamuel Thibault2023-05-018-37/+169
| | | | | | | | The standards want msg_lspid/msg_lrpid/shm_cpid/shm_lpid to be pid_t, see BZ 23083 and 23085. We can leave them __rpc_pid_t on i386 for ABI compatibility, but avoid hitting the issue on 64bit.
* hurd 64bit: Fix ipc_perm fields typesSamuel Thibault2023-05-016-53/+71
| | | | | | | | | | | The standards want uid/cuid to be uid_t, gid/cgid to be gid_t and mode to be mode_t, see BZ 23082. We can leave them short ints on i386 for ABI compatibility, but avoid hitting the issue on 64bit. bits/ipc.h ends up being exactly the same in sysdeps/gnu/ and sysdeps/unix/sysv/linux/, so remove the latter.
* hurd 64bit: Fix flock fields typesSamuel Thibault2023-05-014-27/+95
| | | | | | | The standards want l_type and l_whence to be short ints, see BZ 23081. We can leave them ints on i386 for ABI compatibility, but avoid hitting the issue on 64bit.
* hurd 64bit: Add data for check-c++-typesSamuel Thibault2023-05-011-0/+67
|
* hurd 64bit: Fix pthread_t/thread_t type to longSamuel Thibault2023-05-017-2/+100
| | | | So that they can be trivially cast to pointer type, like with nptl.
* socket: Fix tst-cmsghdr-skeleton.c use of cmsg_lenSamuel Thibault2023-05-011-1/+1
| | | | | | | cmsg_len is supposed to be socklen_t according to standards, but it was made size_t on Linux, see BZ 16919. For ports that have it socklen_t, SIZE_MAX is too large. We can however explicitly cast it to the type of cmsg_len so it will fit according to that type.
* hurd 64bit: Add missing data file for check-localplt testSamuel Thibault2023-05-011-0/+44
|
* hurd 64bit: Add missing libanlSamuel Thibault2023-05-014-1/+7
| | | | The move of libanl to libc was in glibc 2.34 for nptl only.
* hurd: Also XFAIL missing SA_NOCLDWAIT on 64bitSamuel Thibault2023-05-012-1/+6
|
* hurd: Fix tst-writev testSamuel Thibault2023-05-011-0/+5
| | | | There is no compile-time IOV_MAX constraint on GNU/Hurd
* nptl: move tst-x86-64-tls-1 to nptl-only testsSamuel Thibault2023-05-013-2/+4
| | | | It is essentially nptl-only.
* hurd: Add expected abilist files for x86_64Sergey Bugaev2023-05-0112-0/+3687
| | | | | | | | | | These were created by creating stub files, running 'make update-abi', and reviewing the results. Also, set baseline ABI to GLIBC_2.38, the (upcoming) first glibc release to first have x86_64-gnu support. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Replace reply port with a dead name on failed interruptionSergey Bugaev2023-05-013-21/+20
| | | | | | | | | | | | | If we're trying to interrupt an interruptible RPC, but the server fails to respond to our __interrupt_operation () call, we instead destroy the reply port we were expecting the reply to the RPC on. Instead of deallocating the name completely, replace it with a dead name, so the name won't get reused for some other right, and deallocate it in _hurd_intr_rpc_mach_msg once we return from the signal handler. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429201822.2605207-4-bugaevc@gmail.com>
* Define __mig_strlen to support dynamically sized strings in hurd RPCsFlavio Cruz2023-05-015-2/+31
| | | | | | | We make lib{mach,hurd}user.so only call __mig_strlen which can be relocated before libc.so is relocated, similar to what is done with __mig_memcpy. Message-Id: <ZE8DTRDpY2hpPZlJ@jupiter.tail36e24.ts.net>
* mach: Disable 32bit compatibility modeSamuel Thibault2023-05-011-0/+1
| | | | | 32bit compatibility is the default for now with 64bit gnumach, until 64bit userland is ready. Here we however want native 64bit userland anyway.
* hurd: Make it possible to call memcpy very earlySergey Bugaev2023-05-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, in static builds, the first code that runs is _start, in e.g. sysdeps/x86_64/start.S, which quickly calls __libc_start_main, passing it the argv etc. Among the first things __libc_start_main does is initializing the tunables (based on env), then CPU features, and then calls _dl_relocate_static_pie (). Specifically, this runs ifunc resolvers to pick, based on the CPU features discovered earlier, the most suitable implementation of "string" functions such as memcpy. Before that point, calling memcpy (or other ifunc-resolved functions) will not work. In the Hurd port, things are more complex. In order to get argv/env for our process, glibc normally needs to do an RPC to the exec server, unless our args/env are already located on the stack (which is what happens to bootstrap processes spawned by GNU Mach). Fetching our argv/env from the exec server has to be done before the call to __libc_start_main, since we need to know what our argv/env are to pass them to __libc_start_main. On the other hand, the implementation of the RPC (and other initial setup needed on the Hurd before __libc_start_main can be run) is not very trivial. In particular, it may (and on x86_64, will) use memcpy. But as described above, calling memcpy before __libc_start_main can not work, since the GOT entry for it is not yet initialized at that point. Work around this by pre-filling the GOT entry with the baseline version of memcpy, __memcpy_sse2_unaligned. This makes it possible for early calls to memcpy to just work. The initial value of the GOT entry is unused on x86_64, and changing it won't interfere with the relocation being performed later: once _dl_relocate_static_pie () is called, the baseline version will get replaced with the most suitable one, and that is what subsequent calls of memcpy are going to call. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429201822.2605207-6-bugaevc@gmail.com>
* hurd: Implement longjmp for x86_64Sergey Bugaev2023-05-012-0/+219
| | | | | | | | Checked on x86_64-gnu. [samuel.thibault@ens-lyon.org: Restored same comments as on i386] Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429201822.2605207-3-bugaevc@gmail.com>
* hurd: Implement sigreturn for x86_64Sergey Bugaev2023-05-011-0/+162
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429201822.2605207-2-bugaevc@gmail.com>
* Make __mach_msg_destroy portable for x86_64Flavio Cruz2023-05-011-4/+5
| | | | | | We need to align on uintptr_t to make this work for x86_64, otherwise things will go wrong when RPCs return errors. Message-Id: <ZE3aPH7uCEDti47H@jupiter.tail36e24.ts.net>
* hurd: Mark error functions as __COLDSergey Bugaev2023-04-292-5/+5
| | | | | | | | This should hopefully hint the compiler that they are unlikely to be called. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131223.2507236-2-bugaevc@gmail.com>
* cdefs.h: Define __COLDSergey Bugaev2023-04-291-0/+7
| | | | | | | This expands to __attribute__ ((cold)) when supported. It should be used to mark up functions that are invoked rarely. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Fix FS_RETRY_MAGICAL "machtype" handlingSergey Bugaev2023-04-291-7/+4
| | | | | | | | | | | | | | | | | We need to set file_name, not update retryname. This is what the other branches do. Before this change, any attempt to access such a file would segfault due to file_name being unset: $ settrans -ac /tmp/my-machtype /hurd/magic machtype $ cat /tmp/my-machtype Segmentation fault Checked on i686-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-7-bugaevc@gmail.com>
* hurd: Respect existing FD_CLOEXEC in S_msg_set_fdSergey Bugaev2023-04-291-1/+7
| | | | | | | | | If the process has set the close-on-exec flag for the file descriptor, it expects the file descriptor to get closed on exec, even if we replace what the file descriptor refers to. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-6-bugaevc@gmail.com>
* hurd: Don't leak the auth port in msg* RPCsSergey Bugaev2023-04-291-9/+58
| | | | | | | | | | | | | | | | | | | | | The leak can be easily reproduced (and observed) using the portinfo tool: $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 127) $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 253) $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 379) $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 505) $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 631) Checked on i686-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-5-bugaevc@gmail.com>
* hurd: Make _exit work during early boot-upSergey Bugaev2023-04-291-2/+3
| | | | | | | | | | | | | | | | | | If any of the early boot-up tasks calls exit () or returns from main (), terminate it properly instead of crashing on trying to dereference _hurd_ports and getting forcibly terminated by the kernel. We sadly cannot make the __USEPORT macro do the check for _hurd_ports being unset, because it evaluates to the value of the expression provided as the second argument, and that can be of any type; so there is no single suitable fallback value for the macro to evaluate to in case _hurd_ports is unset. Instead, each use site that wants to care for this case will have to do its own checking. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-4-bugaevc@gmail.com>
* hurd: Mark various conditions as unlikelySergey Bugaev2023-04-292-7/+7
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-3-bugaevc@gmail.com>
* hurd: Move libc_hidden_def's aroundSergey Bugaev2023-04-291-4/+5
| | | | | | | | | | | | | Each libc_hidden_def should be placed immediately next to its function, not in some random unrelated place. No functional change. Fixes: 653d74f12abea144219af00400ed1f1ac5dfa79f "hurd: Global signal disposition" Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-2-bugaevc@gmail.com>
* hurd: Simplify _hurd_critical_section_lock a bitSergey Bugaev2023-04-291-13/+6
| | | | | | | | This block of code was doing exactly what _hurd_self_sigstate does; so just call that and let it do its job. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230429131354.2507443-1-bugaevc@gmail.com>
* __check_pf: Add a cancellation cleanup handler [BZ #20975]H.J. Lu2023-04-282-0/+17
| | | | | | | | | | | | | | | | | | | | There are reports for hang in __check_pf: https://github.com/JoeDog/siege/issues/4 It is reproducible only under specific configurations: 1. Large number of cores (>= 64) and large number of threads (> 3X of the number of cores) with long lived socket connection. 2. Low power (frequency) mode. 3. Power management is enabled. While holding lock, __check_pf calls make_request which calls __sendto and __recvmsg. Since __sendto and __recvmsg are cancellation points, lock held by __check_pf won't be released and can cause deadlock when thread cancellation happens in __sendto or __recvmsg. Add a cancellation cleanup handler for __check_pf to unlock the lock when cancelled by another thread. This fixes BZ #20975 and the siege hang issue.
* Remap __GLIBC_FLT_EVAL_METHOD to 0 if __FLT_EVAL_METHOD__ is -1Kito Cheng2023-04-281-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __GLIBC_FLT_EVAL_METHOD will effect the definition of float_t and double_t, currently we'll set __GLIBC_FLT_EVAL_METHOD to 2 when __FLT_EVAL_METHOD__ is -1, that means we'll define float_t and double_t to long double. However some target isn't natively (HW) support long double like AArch64 and RISC-V, they defined long double as 128-bits IEEE 754 floating point type. That means setting __GLIBC_FLT_EVAL_METHOD to 2 will cause very inefficient code gen for those target who didn't provide native support for long double, and that's violate the spirit float_t and double_t - most efficient types at least as wide as float and double. So this patch propose to remap __GLIBC_FLT_EVAL_METHOD to 0 rather than 2 when __FLT_EVAL_METHOD__ is -1, which means we'll use float/double rather than long double for float_t and double_t. Note: __FLT_EVAL_METHOD__ == -1 means the precision is indeterminable, which means compiler might using indeterminable precision during optimization/code gen, clang will set this value to -1 when fast math is enabled. Note: Default definition float_t and double_t in current glibc: | __GLIBC_FLT_EVAL_METHOD | float_t | double_t | 0 or 16 | float | double | 1 | double | doulbe | 2 | long double | long double More complete list see math/math.h Note: RISC-V has defined ISA extension to support 128-bits IEEE 754 floating point operations, but only rare RISC-V core will implement that. Related link: [1] LLVM issue (__FLT_EVAL_METHOD__ is set to -1 with Ofast. #60781): https://github.com/llvm/llvm-project/issues/60781 [2] Last version of this patch: https://sourceware.org/pipermail/libc-alpha/2023-February/145622.html Acked-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com> Link: https://inbox.sourceware.org/libc-alpha/20230314151948.12892-1-kito.cheng@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
* riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.Hsiangkai Wang2023-04-284-0/+60
| | | | | | | | | | | | | | | | | | | | | In some cases, we do not want to go through the resolver for function calls. For example, functions with vector arguments will use vector registers to pass arguments. In the resolver, we do not save/restore the vector argument registers for lazy binding efficiency. To avoid ruining the vector arguments, functions with vector arguments will not go through the resolver. To achieve the goal, we will annotate the function symbols with STO_RISCV_VARIANT_CC flag and add DT_RISCV_VARIANT_CC tag in the dynamic section. In the first pass on PLT relocations, we do not set up to call _dl_runtime_resolve. Instead, we resolve the functions directly. Signed-off-by: Hsiangkai Wang <kai.wang@sifive.com> Signed-off-by: Vincent Chen <vincent.chen@sifive.com> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Link: https://inbox.sourceware.org/libc-alpha/20230314162512.35802-1-kito.cheng@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
* elf.h: add PT_GNU_SFRAMEIndu Bhagat2023-04-281-0/+1
| | | | | | Support for SFrame format is available in Binutils 2.40. The GNU ld merges the input .sframe sections and creates an output .sframe section in a segment PT_GNU_SFRAME.
* Fix Hurd getcwd build with GCC >= 13Joseph Myers2023-04-271-2/+3
| | | | | | | | | | | | | | | | | | | | | The build of glibc for i686-gnu has been failing for a while with GCC mainline / GCC 13: ../sysdeps/mach/hurd/getcwd.c: In function '__hurd_canonicalize_directory_name_internal': ../sysdeps/mach/hurd/getcwd.c:242:48: error: pointer 'file_name' may be used after 'realloc' [-Werror=use-after-free] 242 | file_namep = &buf[file_namep - file_name + size / 2]; | ~~~~~~~~~~~^~~~~~~~~~~ ../sysdeps/mach/hurd/getcwd.c:236:25: note: call to 'realloc' here 236 | buf = realloc (file_name, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~ Fix by doing the subtraction before the reallocation. Tested with build-many-glibcs.py for i686-gnu. [samuel.thibault@ens-lyon.rg: Removed mention of this being a bug] Message-Id: <18587337-7815-4056-ebd0-724df262d591@codesourcery.com>
* Regenerate sysdeps/mach/hurd/bits/errno.hJoseph Myers2023-04-261-0/+19
| | | | | This file was out of date, as shown by build-many-glibcs.py runs resulting in a modified source directory.
* locale/programs/locarchive.c: Remove unnecessary check in add_locale_archiveFrédéric Bérat2023-04-261-1/+1
| | | | | | | Since asprintf is called "if (mask & XPG_NORM_CODESET)" there is no point in checking the mask again within the asprintf call. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* manual: document posix_openpt (bug 17010)Gavin Smith2023-04-261-3/+33
| | | | | | | | State that getpt is similar to posix_openpt. Use posix_openpt instead of getpt in example. Signed-off-by: Gavin Smith <gavinsmith0123@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* if_index: Remove unneeded alloca.h includeJoe Simmons-Talbott2023-04-261-1/+0
| | | | | Nothing is being used from this header. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* gethostid: Do not include alloca.hJoe Simmons-Talbott2023-04-261-1/+0
| | | | | Nothing from alloca.h is being used here. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* socket: Add a test for MSG_CMSG_CLOEXECSergey Bugaev2023-04-252-0/+127
| | | | | | | | | | | | | | | This checks that: * We can send and receive fds over Unix domain sockets using SCM_RIGHTS; * msg_controllen, cmsg_level, cmsg_type, cmsg_len are all filled in correctly on receive; * Most importantly, the received fd has or has not the close-on-exec flag set depending on whether we pass MSG_CMSG_CLOEXEC to recvmsg (). Checked on i686-gnu and x86_64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423160548.126576-4-bugaevc@gmail.com>
* hurd: Do not take any flag from the CMSG_DATASamuel Thibault2023-04-251-1/+3
| | | | | | As fixed in 0822e3552a78 ("hurd: Don't pass FD_CLOEXEC in CMSG_DATA"), senders currently don't have any flag to pass. We shouldn't blindly take random flags that senders could be erroneously giving us.
* hurd: Implement MSG_CMSG_CLOEXECSergey Bugaev2023-04-242-2/+7
| | | | | | | | | | | | | | | This is a new flag that can be passed to recvmsg () to make it atomically set the CLOEXEC flag on all the file descriptors received using the SCM_RIGHTS mechanism. This is useful for all the same reasons that the other XXX_CLOEXEC flags are useful: namely, it provides atomicity with respect to another thread of the same process calling (fork and then) exec at the same time. This flag is already supported on Linux and FreeBSD. The flag's value, 0x40000, is choosen to match FreeBSD's. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423160548.126576-2-bugaevc@gmail.com>