diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-03-05 10:19:59 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-03-06 07:27:03 +0800 |
commit | 596130591ae4b058a529cc1318b95e624559054c (patch) | |
tree | 98320d019b57fcd1af9e43c41db38a919a2a723a /elf/Makefile | |
parent | 50351e05707f982c06c6d4d7c8fc819f6a5f66f5 (diff) | |
download | glibc-596130591ae4b058a529cc1318b95e624559054c.zip glibc-596130591ae4b058a529cc1318b95e624559054c.tar.gz glibc-596130591ae4b058a529cc1318b95e624559054c.tar.bz2 |
static-pie: Skip the empty PT_LOAD segment at offset 0 [BZ #32763]
As shown in
https://sourceware.org/bugzilla/show_bug.cgi?id=25237
linker may generate an empty PT_LOAD segments at offset 0:
Elf file type is EXEC (Executable file)
Entry point 0x4000e8
There are 3 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
0x00000000000000f0 0x00000000000000f0 R E 0x1000
LOAD 0x0000000000000000 0x0000000000410000 0x0000000000410000
0x0000000000000000 0x0000000000b5dce8 RW 0x10000
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 0x10
Section to Segment mapping:
Segment Sections...
00 .text
01 .bss
02
Skip the empty PT_LOAD segment at offset 0 to support such binaries.
This fixes BZ #32763.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'elf/Makefile')
-rw-r--r-- | elf/Makefile | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile index 41f01b5..6f2489c 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1137,12 +1137,14 @@ tests += \ tst-dlopen-pie \ tst-dlopen-self-pie \ tst-dlopen-tlsmodid-pie \ + tst-pie-bss \ tst-pie1 \ tst-pie2 \ # tests tests-pie += \ tst-dlopen-self-pie \ tst-dlopen-tlsmodid-pie \ + tst-pie-bss \ tst-pie1 \ tst-pie2 \ # tests-pie @@ -1157,9 +1159,11 @@ LDFLAGS-tst-pie-address += $(load-address-ldflag)=$(pde-load-address) ifeq (yes,$(enable-static-pie)) tests += \ tst-pie-address-static \ + tst-pie-bss-static \ # tests tests-static += \ tst-pie-address-static \ + tst-pie-bss-static \ # tests-static LDFLAGS-tst-pie-address-static += \ $(load-address-ldflag)=$(pde-load-address) @@ -2082,6 +2086,7 @@ $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \ CFLAGS-tst-pie1.c += $(pie-ccflag) CFLAGS-tst-pie2.c += $(pie-ccflag) +CFLAGS-tst-pie-bss.c += $(pie-ccflag) CFLAGS-tst-pie-address.c += $(pie-ccflag) $(objpfx)tst-piemod1.so: $(libsupport) |