-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Description
When assembling the following for AArch64:
.section .text.unlikely,"ax",@progbits
.Ltmp4:
b .Ltmp4
LLVM's section headers:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .strtab STRTAB 0000000000000000 000078 000029 00 0 0 1
[ 2] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4
[ 3] .text.unlikely PROGBITS 0000000000000000 000040 000004 00 AX 0 0 1
[ 4] .symtab SYMTAB 0000000000000000 000048 000030 18 1 2 8
GNU as section headers:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 1
[ 2] .data PROGBITS 0000000000000000 000040 000000 00 WA 0 0 1
[ 3] .bss NOBITS 0000000000000000 000040 000000 00 WA 0 0 1
[ 4] .text.unlikely PROGBITS 0000000000000000 000040 000004 00 AX 0 0 4
[ 5] .symtab SYMTAB 0000000000000000 000048 000090 18 6 6 8
[ 6] .strtab STRTAB 0000000000000000 0000d8 000004 00 0 0 1
[ 7] .shstrtab STRTAB 0000000000000000 0000dc 00003b 00 0 0 1
As a result of the LLVM behavior, we can end up misaligning the .text.unlikely section (e.g. if a preceding section contains data of size not a multiple of 4) and causing a crash at runtime.
I think the GNU as behavior makes more sense, and we should adopt that behavior.
Metadata
Metadata
Assignees
Labels
No labels