[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/27753] -mx86-used-note= defaulting to yes regresses
From: |
i at maskray dot me |
Subject: |
[Bug gas/27753] -mx86-used-note= defaulting to yes regresses |
Date: |
Fri, 18 Jun 2021 16:16:51 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27753
--- Comment #6 from Fangrui Song <i at maskray dot me> ---
A dynamic loader needs PT_GNU_PROPERTY to know the ISA usage of a component.
.note.gnu.property makes up PT_GNU_PROPERTY. Therefore, the section needs to
SHF_ALLOC to be part of the program image.
% cat a.c
int main() {}
% gcc -o a a.c -nostdlib -Wl,-N -static -Wl,-Ttext=0x10000 -fuse-ld=bfd
/usr/bin/ld.bfd: warning: cannot find entry symbol _start; defaulting to
0000000000010000
If you use objcopy -O binary, you will notice that the output as 4mib. Why?
Because the linker generates .note.gnu.build-id . You need -Wl,--build-id=none
to remove it.
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .text PROGBITS 0000000000010000 000190 00000b 00 WAX
0 0 1
[ 2] .note.gnu.property NOTE 0000000000400190 0001d8 000030 00 A
0 0 8
[ 3] .note.gnu.build-id NOTE 00000000004001c0 000208 000024 00 A
0 0 4
[ 4] .eh_frame PROGBITS 0000000000010010 0001a0 000038 00 A
0 0 8
[ 5] .comment PROGBITS 0000000000000000 00022c 00002e 01 MS
0 0 1
[ 6] .symtab SYMTAB 0000000000000000 000260 000120 18
7 7 8
[ 7] .strtab STRTAB 0000000000000000 000380 000022 00
0 0 1
[ 8] .shstrtab STRTAB 0000000000000000 0003a2 00005a 00
0 0 1
You may use -Wa,-mx86-used-note=no to remove .note.gnu.property
GNU ld -z separate-code has a separate issue, the segment layout isn't
particular good: https://sourceware.org/bugzilla/show_bug.cgi?id=24490
two R around RX are wasteful. Ideally there is only one R and it precedes RX.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, i at maskray dot me, 2021/06/17
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, jbeulich at suse dot com, 2021/06/18
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses,
i at maskray dot me <=
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, jbeulich at suse dot com, 2021/06/21
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, hjl.tools at gmail dot com, 2021/06/21
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, jbeulich at suse dot com, 2021/06/21
- [Bug gas/27753] -mx86-used-note= defaulting to yes regresses, hjl.tools at gmail dot com, 2021/06/21