mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
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>
30 lines
1,013 B
C
30 lines
1,013 B
C
/* Test PIE with an empty PT_LOAD segment at offset 0.
|
|
Copyright (C) 2025 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/>. */
|
|
|
|
#include <stdio.h>
|
|
|
|
char bss[0xb5dce8] __attribute__ ((aligned (65536)));
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
printf ("Hello\n");
|
|
return 0;
|
|
}
|
|
|
|
#include <support/test-driver.c>
|