about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
...
* hurd: Fix ld.so nameSamuel Thibault2023-05-061-0/+1
| | | | This was set to ld-x86-64.so.1 in gcc.
* hurd: Add ioperm symbol on x86_64Samuel Thibault2023-05-062-0/+6
|
* aarch64: More configure checks for libmvecSzabolcs Nagy2023-05-052-6/+48
| | | | | Check assembler and linker support too, not just SVE ACLE in the compiler, since variant PCS requires at least binutils 2.32.1.
* aarch64: SVE ACLE configure test cleanupsSzabolcs Nagy2023-05-052-16/+27
| | | | Use more idiomatic configure test for better autoconf cache and logs.
* hppa: Fix 'concurrency' typo in commentSam James2023-05-052-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* Update sysdeps/mach/hurd/ioctl.c to make it more portableFlavio Cruz2023-05-051-20/+27
| | | | | | | | | | | | | | | Summary of the changes: - Update msg_align to use ALIGN_UP like we have done in previous patches. Use it below whenever necessary to avoid repeating the same alignment logic. - Define BAD_TYPECHECK to make it easier to do type checking in a few places below. - Update io2mach_type to use designated initializers. - Make RetCodeType use mach_msg_type_t. mach_msg_type_t is 8 byte for x86_64, so this make it portable. - Also call msg_align for _IOT_COUNT2/_IOT_TYPE2 since it is more correct. Message-Id: <ZFMvVsuFKwIy2dUS@jupiter.tail36e24.ts.net>
* 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-0329-104/+968
| | | | | | | | | | | | | | | | | | | | | | | 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 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.
* 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-016-2/+98
| | | | So that they can be trivially cast to pointer type, like with nptl.
* hurd 64bit: Add missing data file for check-localplt testSamuel Thibault2023-05-011-0/+44
|
* hurd 64bit: Add missing libanlSamuel Thibault2023-05-013-0/+6
| | | | The move of libanl to libc was in glibc 2.34 for nptl only.
* hurd: Also XFAIL missing SA_NOCLDWAIT on 64bitSamuel Thibault2023-05-011-0/+5
|
* 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-011-18/+7
| | | | | | | | | | | | | 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-011-1/+2
| | | | | | | 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>
* 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>
* 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>
* __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.
* riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.Hsiangkai Wang2023-04-282-0/+47
| | | | | | | | | | | | | | | | | | | | | 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>
* 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.
* 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>
* 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>
* hurd: Don't pass FD_CLOEXEC in CMSG_DATASamuel Thibault2023-04-241-2/+2
| | | | | | | | | | | | | | | | | | | The flags are used by _hurd_intern_fd, which takes O_* flags, not FD_*. Also, it is of no concern to the receiving process whether or not the sender process wants to close its copy of sent file descriptor upon exec, and it should not influence whether or not the received file descriptor gets the FD_CLOEXEC flag set in the receiving process. The latter should in fact be dependent on the MSG_CMSG_CLOEXEC flag being passed to the recvmsg () call, which is going to be implemented in the following commit. Fixes 344e755248ce02c0f8d095d11cc49e340703d926 "hurd: Support sending file descriptors over Unix sockets" Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Implement prefer_map_32bit_exec tunableSergey Bugaev2023-04-248-23/+33
| | | | | | | This makes the prefer_map_32bit_exec tunable no longer Linux-specific. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423215526.346009-4-bugaevc@gmail.com>
* hurd: Don't attempt to deallocate MACH_PORT_DEADSergey Bugaev2023-04-242-4/+4
| | | | | | | ...in some more places. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423215526.346009-2-bugaevc@gmail.com>
* hurd: Only deallocate addrport when it's validSergey Bugaev2023-04-245-6/+10
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423160548.126576-3-bugaevc@gmail.com>
* hurd: Implement MAP_32BITSergey Bugaev2023-04-243-7/+12
| | | | | | | | | | | | | | | | | | | | This is a flag that can be passed to mmap () to request that the mapping being established should be located in the lower 2 GB area of the address space, so only the lower 31 (not 32) bits can be set in its address, and the address can be represented as a 32-bit integer without truncating it. This flag is intended to be compatible with Linux, FreeBSD, and Darwin flags of the same name. Out of those systems, it appears Linux and FreeBSD take MAP_32BIT to mean "map 31 bit", whereas Darwin allows the 32nd bit to be set in the address as well. The Hurd follows Linux and FreeBSD behavior. Unlike on those systems, on the Hurd MAP_32BIT is defined on all supported architectures (which currently are only i386 and x86_64). Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230423215526.346009-1-bugaevc@gmail.com>
* Use O_CLOEXEC in more places (BZ #15722)Sergey Bugaev2023-04-221-3/+6
| | | | | | | | | | | | | When opening a temporary file without O_CLOEXEC we risk leaking the file descriptor if another thread calls (fork and then) exec while we have the fd open. Fix this by consistently passing O_CLOEXEC everywhere where we open a file for internal use (and not to return it to the user, in which case the API defines whether or not the close-on-exec flag shall be set on the returned fd). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230419160207.65988-4-bugaevc@gmail.com>
* hurd: Don't migrate reply port into __init1_tcbheadSergey Bugaev2023-04-213-17/+19
| | | | | | | | | | | | | | | Properly differentiate between setting up the real TLS with TLS_INIT_TP, and setting up the early TLS (__init1_tcbhead) in static builds. In the latter case, don't yet migrate the reply port into the TCB, and don't yet set __libc_tls_initialized to 1. This also lets us move the __init1_desc assignment inside _hurd_tls_init (). Fixes cd019ddd892e182277fadd6aedccc57fa3923c8d "hurd: Don't leak __hurd_reply_port0" Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Make dl-sysdep's open () cope with O_IGNORE_CTTYSergey Bugaev2023-04-201-2/+2
| | | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230419160207.65988-6-bugaevc@gmail.com>
* Created tunable to force small pages on stack allocation.Cupertino Miranda2023-04-201-0/+6
| | | | | | | | | | Created tunable glibc.pthread.stack_hugetlb to control when hugepages can be used for stack allocation. In case THP are enabled and glibc.pthread.stack_hugetlb is set to 0, glibc will madvise the kernel not to use allow hugepages for stack allocations. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* linux: Re-flow and sort multiline Makefile definitionsAdhemerval Zanella2023-04-201-48/+158
|
* hurd: Microoptimize sigreturnSergey Bugaev2023-04-181-3/+9
| | | | Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* hurd: Fix restoring reply port in sigreturnSergey Bugaev2023-04-171-12/+23
| | | | | | | | | We must not use the user's reply port (scp->sc_reply_port) for any of our own RPCs, otherwise various things break. So, use MACH_PORT_DEAD as a reply port when destroying our reply port, and make sure to do this after _hurd_sigstate_unlock (), which may do a gsync_wake () RPC. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* math: Improve fmod(f) performanceWilco Dijkstra2023-04-172-77/+101
| | | | | | | | | | | | | Optimize the fast paths (x < y) and (x/y < 2^12). Delay handling of special cases to reduce the number of instructions executed before the fast paths. Performance improvements for fmod: Skylake Zen2 Neoverse V1 subnormals 11.8% 4.2% 11.5% normal 3.9% 0.01% -0.5% close-exponents 6.3% 5.6% 19.4% Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hurd: Only check for TLS initialization inside rtld or in static buildsSergey Bugaev2023-04-146-33/+83
| | | | | | | | | | | | | | | | | | | | | When glibc is built as a shared library, TLS is always initialized by the call of TLS_INIT_TP () macro made inside the dynamic loader, prior to running the main program (see dl-call_tls_init_tp.h). We can take advantage of this: we know for sure that __LIBC_NO_TLS () will evaluate to 0 in all other cases, so let the compiler know that explicitly too. Also, only define _hurd_tls_init () and TLS_INIT_TP () under the same conditions (either !SHARED or inside rtld), to statically assert that this is the case. Other than a microoptimization, this also helps with avoiding awkward sharing of the __libc_tls_initialized variable between ld.so and libc.so that we would have to do otherwise -- we know for sure that no sharing is required, simply because __libc_tls_initialized would always be set to true inside libc.so. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230319151017.531737-25-bugaevc@gmail.com>
* hurd: Remove __hurd_local_reply_portSergey Bugaev2023-04-143-14/+60
| | | | | | | | | | | | | | | | | | Now that the signal code no longer accesses it, the only real user of it was mig-reply.c, so move the logic for managing the port there. If we're in SHARED and outside of rtld, we know that __LIBC_NO_TLS () always evaluates to 0, and a TLS reply port will always be used, not __hurd_reply_port0. Still, the compiler does not see that __hurd_reply_port0 is never used due to its address being taken. To deal with this, explicitly compile out __hurd_reply_port0 when we know we won't use it. Also, instead of accessing the port via THREAD_SELF->reply_port, this uses THREAD_GETMEM and THREAD_SETMEM directly, avoiding possible miscompilations. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
* malloc: Assure that THP mode read do write OOB end of stringtAdhemerval Zanella2023-04-141-0/+2
|