[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/25381] New: Support section flag 'o' (SHF_LINK_ORDER)
From: |
i at maskray dot me |
Subject: |
[Bug gas/25381] New: Support section flag 'o' (SHF_LINK_ORDER) |
Date: |
Tue, 14 Jan 2020 01:34:02 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25381
Bug ID: 25381
Summary: Support section flag 'o' (SHF_LINK_ORDER)
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
% cat a.c
void foo(){}
void bar(){}
% clang -fpatchable-function-entry=2 -ffunction-sections -S a.c # clang HEAD
https://reviews.llvm.org/D72222 https://reviews.llvm.org/D72222
% grep __patchable a.s
.section
__patchable_function_entries,"awo",@progbits,foo,unique,0
.section
__patchable_function_entries,"awo",@progbits,bar,unique,1
% clang -fpatchable-function-entry=2 -ffunction-sections -c a.c
% readelf -S a.o
...
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .strtab STRTAB 0000000000000000 000210 000087 00
0 0 1
[ 2] .text PROGBITS 0000000000000000 000040 000000 00 AX
0 0 4
[ 3] .text.foo PROGBITS 0000000000000000 000040 000008 00 AX
0 0 16
[ 4] __patchable_function_entries PROGBITS 0000000000000000 000048
000008 00 WAL 3 0 8
[ 5] .rela__patchable_function_entries RELA 0000000000000000
0001b0 000018 18 14 4 8
[ 6] .text.bar PROGBITS 0000000000000000 000050 000008 00 AX
0 0 16
[ 7] __patchable_function_entries PROGBITS 0000000000000000 000058
000008 00 WAL 6 0 8
[ 8] .rela__patchable_function_entries RELA 0000000000000000
0001c8 000018 18 14 7 8
...
The section flag 'o' takes an argument (`,foo` and `,bar` above), adds
SHF_LINK_ORDER to sh_flags, and sets sh_link to sh_shndx of the target symbol.
You may try `clang -fstack-size-section -ffunction-sections` with older clang
(clang >= 8).
https://sourceware.org/bugzilla/show_bug.cgi?id=25380 tracks the section
linkage feature (`,unique`)
This can be seen as a lightweight COMDAT. See
https://gcc.gnu.org/ml/gcc/2020-01/msg00067.html (__patchable_function_entries
is flawed) https://sourceware.org/ml/binutils/2019-11/msg00266.html
(SHF_LINK_ORDER and --gc-sections)
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug gas/25381] New: Support section flag 'o' (SHF_LINK_ORDER),
i at maskray dot me <=