glibc/glibc-upstream-2.39-104.patch
Arjun Shankar 2a30b8f4b2 Sync with upstream branch release/2.39/master
Upstream commit: dcaf51b41e259387602774829c45222d0507f90a

- elf: Change ldconfig auxcache magic number (bug 32231)
- Make tst-strtod-underflow type-generic
- Add crt1-2.0.o for glibc 2.0 compatibility tests
- Add tests of more strtod special cases
- Add more tests of strtod end pointer
- Make tst-strtod2 and tst-strtod5 type-generic
- powerpc64le: Build new strtod tests with long double ABI flags (bug 32145)
- Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)
- Improve NaN payload testing
- Make __strtod_internal tests type-generic
- Fix strtod subnormal rounding (bug 30220)
- More thoroughly test underflow / errno in tst-strtod-round
- Test errno setting on strtod overflow in tst-strtod-round
- Add tests of fread
- stdio-common: Add new test for fdopen
- libio: Attempt wide backup free only for non-legacy code
- debug: Fix read error handling in pcprofiledump
- elf: Fix tst-dlopen-tlsreinit1.out test dependency
- elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)
- elf: Clarify and invert second argument of _dl_allocate_tls_init
- elf: Support recursive use of dynamic TLS in interposed malloc
- nptl: Use <support/check.h> facilities in tst-setuid3
- posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64
- ungetc: Fix backup buffer leak on program exit [BZ #27821]
- ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]
- Make tst-ungetc use libsupport
- stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650]
- support: Add FAIL test failure helper
- string: strerror, strsignal cannot use buffer after dlmopen (bug 32026)
- Define __libc_initial for the static libc
- x86: Fix bug in strchrnul-evex512 [BZ #32078]
- Adjust check-local-headers test for libaudit 4.0
- x32/cet: Support shadow stack during startup for Linux 6.10
- x86-64: Remove sysdeps/x86_64/x32/dl-machine.h
- support: Add options list terminator to the test driver
- manual/stdio: Further clarify putc, putwc, getc, and getwc
- Fix name space violation in fortify wrappers (bug 32052)
- resolv: Fix tst-resolv-short-response for older GCC (bug 32042)
- Add mremap tests
- mremap: Update manual entry
- linux: Update the mremap C implementation [BZ #31968]
- Enhanced test coverage for strncmp, wcsncmp
- Enhance test coverage for strnlen, wcsnlen

Resolves: RHEL-57776
Resolves: RHEL-57777
Resolves: RHEL-61392
2024-11-20 17:12:17 +01:00

175 lines
5.9 KiB
Diff

commit eeff407b196f2ffaadb5d41142688482e4a2a761
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Jul 22 17:47:21 2024 -0700
x86-64: Remove sysdeps/x86_64/x32/dl-machine.h
Remove sysdeps/x86_64/x32/dl-machine.h by folding x32 ARCH_LA_PLTENTER,
ARCH_LA_PLTEXIT and RTLD_START into sysdeps/x86_64/dl-machine.h. There
are no regressions on x86-64 nor x32. There are no changes in x86-64
_dl_start_user. On x32, _dl_start_user changes are
<_dl_start_user>:
mov %eax,%r12d
+ mov %esp,%r13d
mov (%rsp),%edx
mov %edx,%esi
- mov %esp,%r13d
and $0xfffffff0,%esp
mov 0x0(%rip),%edi # <_dl_start_user+0x14>
lea 0x8(%r13,%rdx,4),%ecx
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
(cherry picked from commit 652c6cf26927352fc0e37e4e60c6fc98ddf6d3b4)
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index ff5d45f7cb7cd81d..899f56576f245a3f 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -139,37 +139,37 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
.globl _start\n\
.globl _dl_start_user\n\
_start:\n\
- movq %rsp, %rdi\n\
+ mov %" RSP_LP ", %" RDI_LP "\n\
call _dl_start\n\
_dl_start_user:\n\
# Save the user entry point address in %r12.\n\
- movq %rax, %r12\n\
+ mov %" RAX_LP ", %" R12_LP "\n\
# Save %rsp value in %r13.\n\
- movq %rsp, %r13\n\
+ mov %" RSP_LP ", % " R13_LP "\n\
"\
RTLD_START_ENABLE_X86_FEATURES \
"\
# Read the original argument count.\n\
- movq (%rsp), %rdx\n\
+ mov (%rsp), %" RDX_LP "\n\
# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
# argc -> rsi\n\
- movq %rdx, %rsi\n\
+ mov %" RDX_LP ", %" RSI_LP "\n\
# And align stack for the _dl_init call. \n\
- andq $-16, %rsp\n\
+ and $-16, %" RSP_LP "\n\
# _dl_loaded -> rdi\n\
- movq _rtld_local(%rip), %rdi\n\
+ mov _rtld_local(%rip), %" RDI_LP "\n\
# env -> rcx\n\
- leaq 16(%r13,%rdx,8), %rcx\n\
+ lea 2*" LP_SIZE "(%r13,%rdx," LP_SIZE "), %" RCX_LP "\n\
# argv -> rdx\n\
- leaq 8(%r13), %rdx\n\
+ lea " LP_SIZE "(%r13), %" RDX_LP "\n\
# Clear %rbp to mark outermost frame obviously even for constructors.\n\
xorl %ebp, %ebp\n\
# Call the function to run the initializers.\n\
call _dl_init\n\
# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
- leaq _dl_fini(%rip), %rdx\n\
+ lea _dl_fini(%rip), %" RDX_LP "\n\
# And make sure %rsp points to argc stored on the stack.\n\
- movq %r13, %rsp\n\
+ mov %" R13_LP ", %" RSP_LP "\n\
# Jump to the user's entry point.\n\
jmp *%r12\n\
.previous\n\
@@ -234,8 +234,13 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc,
/* Names of the architecture-specific auditing callback functions. */
+#ifdef __LP64__
#define ARCH_LA_PLTENTER x86_64_gnu_pltenter
#define ARCH_LA_PLTEXIT x86_64_gnu_pltexit
+#else
+#define ARCH_LA_PLTENTER x32_gnu_pltenter
+#define ARCH_LA_PLTEXIT x32_gnu_pltexit
+#endif
#endif /* !dl_machine_h */
diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h
deleted file mode 100644
index c35cee92619923a2..0000000000000000
--- a/sysdeps/x86_64/x32/dl-machine.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Machine-dependent ELF dynamic relocation inline functions. x32 version.
- Copyright (C) 2012-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* Must allow <sysdeps/x86_64/dl-machine.h> to be included more than once.
- See #ifdef RESOLVE_MAP in sysdeps/x86_64/dl-machine.h. */
-#include <sysdeps/x86_64/dl-machine.h>
-
-#ifndef _X32_DL_MACHINE_H
-#define _X32_DL_MACHINE_H
-
-#undef ARCH_LA_PLTENTER
-#undef ARCH_LA_PLTEXIT
-#undef RTLD_START
-
-/* Names of the architecture-specific auditing callback functions. */
-#define ARCH_LA_PLTENTER x32_gnu_pltenter
-#define ARCH_LA_PLTEXIT x32_gnu_pltexit
-
-/* Initial entry point code for the dynamic linker.
- The C function `_dl_start' is the real entry point;
- its return value is the user program's entry point. */
-#define RTLD_START asm ("\n\
-.text\n\
- .p2align 4\n\
-.globl _start\n\
-.globl _dl_start_user\n\
-_start:\n\
- movl %esp, %edi\n\
- call _dl_start\n\
-_dl_start_user:\n\
- # Save the user entry point address in %r12.\n\
- movl %eax, %r12d\n\
- # Read the original argument count.\n\
- movl (%rsp), %edx\n\
- # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
- # argc -> rsi\n\
- movl %edx, %esi\n\
- # Save %rsp value in %r13.\n\
- movl %esp, %r13d\n\
- # And align stack for the _dl_init call.\n\
- and $-16, %esp\n\
- # _dl_loaded -> rdi\n\
- movl _rtld_local(%rip), %edi\n\
- # env -> rcx\n\
- lea 8(%r13,%rdx,4), %ecx\n\
- # argv -> rdx\n\
- lea 4(%r13), %edx\n\
- # Clear %rbp to mark outermost frame obviously even for constructors.\n\
- xorl %ebp, %ebp\n\
- # Call the function to run the initializers.\n\
- call _dl_init\n\
- # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
- lea _dl_fini(%rip), %edx\n\
- # And make sure %rsp points to argc stored on the stack.\n\
- movl %r13d, %esp\n\
- # Jump to the user's entry point.\n\
- jmp *%r12\n\
-.previous\n\
-");
-
-#endif /* !_X32_DL_MACHINE_H */