[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/23428] ld does not put program headers in a code-only load segme
From: |
nsz at port70 dot net |
Subject: |
[Bug ld/23428] ld does not put program headers in a code-only load segment |
Date: |
Sat, 11 Aug 2018 11:21:08 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23428
--- Comment #14 from nsz at port70 dot net ---
> @Szabolcs: If you rebuild gcc-8 on Debian testing with "--enable-cet=auto"
> added to CONFARGS in debian/rules2, then you should be able to reproduce the
> musl-gcc crash (after removing the --build-id workaround from
> musl-gcc.specs!).
>
> (It appears that "--enable-cet=auto" is the important difference between
> Arch's
> and Debian's GCC packages.)
thanks, i could reproduce the issue:
it seems ld tries to add a dummy .note.gnu.property to force the
program headers into a load segment, but if there is already a
.note.gnu.property in some of the input object files then it just
tries to merge those and don't add a dummy note at all, however
the merging rules may produce an empty note in the end and then
the note section is dropped.
# cat i.c
int i;
# gcc -fcf-protection=full -c i.c
# readelf -n i.o
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
Properties: x86 feature: IBT, SHSTK
# cat t.s
.globl _start
_start:
ret
# gcc -c t.s
# ld t.o
# readelf -ln a.out
Elf file type is EXEC (Executable file)
Entry point 0x401000
There are 3 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
0x0000000000000108 0x0000000000000108 R 0x1000
LOAD 0x0000000000001000 0x0000000000401000 0x0000000000401000
0x0000000000000001 0x0000000000000001 R E 0x1000
NOTE 0x00000000000000e8 0x00000000004000e8 0x00000000004000e8
0x0000000000000020 0x0000000000000020 R 0x8
Section to Segment mapping:
Segment Sections...
00 .note.gnu.property
01 .text
02 .note.gnu.property
Displaying notes found in: .note.gnu.property
Owner Data size Description
GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
Properties: x86 ISA used: i486
# ld t.o i.o
# readelf -ln a.out
Elf file type is EXEC (Executable file)
Entry point 0x401000
There are 3 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000001000 0x0000000000401000 0x0000000000401000
0x0000000000000001 0x0000000000000001 R E 0x1000
LOAD 0x0000000000002000 0x0000000000402000 0x0000000000402000
0x0000000000000000 0x0000000000000008 RW 0x1000
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RWE 0x10
Section to Segment mapping:
Segment Sections...
00 .text
01 .bss
02
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, nsz at port70 dot net, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/09
- [Bug ld/23428] ld does not put program headers in a code-only load segment, nsz at port70 dot net, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/10
- [Bug ld/23428] ld does not put program headers in a code-only load segment,
nsz at port70 dot net <=
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, cvs-commit at gcc dot gnu.org, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, evangelos at foutrelis dot com, 2018/08/11
- [Bug ld/23428] ld does not put program headers in a code-only load segment, cvs-commit at gcc dot gnu.org, 2018/08/12
- [Bug ld/23428] ld does not put program headers in a code-only load segment, hjl.tools at gmail dot com, 2018/08/22