[llvm-bugs] [Bug 44775] New: section flag 'o' (SHF_LINK_ORDER) is incorrectly handled
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Feb 4 11:10:17 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44775
Bug ID: 44775
Summary: section flag 'o' (SHF_LINK_ORDER) is incorrectly
handled
Product: new-bugs
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: hjl.tools at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
[hjl at gnu-cfl-1 lld-1]$ cat x.s
.section .text,"ax",%progbits,unique,1
.globl _start
_start:
.dc.a xxx
.section .text,"ax",%progbits,unique,2
xxx:
.byte 0
.section .text,"ax",%progbits,unique,3
yyy:
.byte 0
.section .foo,"ao",%progbits,yyy
.dc.a 0
.section .foo,"ao",%progbits,xxx
.dc.a 0
[hjl at gnu-cfl-1 lld-1]$ make llvm.o
llvm-mc -filetype=obj -triple=x86_64 -o llvm.o x.s
[hjl at gnu-cfl-1 lld-1]$ readelf -SW llvm.o
There are 9 section headers, starting at offset 0x120:
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 0000f0 000030 00
0 0 1
[ 2] .text PROGBITS 0000000000000000 000040 000000 00 AX
0 0 4
[ 3] .text PROGBITS 0000000000000000 000040 000008 00 AX
0 0 1
[ 4] .rela.text RELA 0000000000000000 0000d8 000018 18
8 3 8
[ 5] .text PROGBITS 0000000000000000 000048 000001 00 AX
0 0 1
[ 6] .text PROGBITS 0000000000000000 000049 000001 00 AX
0 0 1
[ 7] .foo PROGBITS 0000000000000000 00004a 000010 00 AL
6 0 1
[ 8] .symtab SYMTAB 0000000000000000 000060 000078 18
1 4 8
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
[hjl at gnu-cfl-1 lld-1]$
Only one section foo was generated and I got
[hjl at gnu-cfl-1 lld-1]$ make y.lld
ld.lld --gc-sections -o y.lld llvm.o
[hjl at gnu-cfl-1 lld-1]$ readelf -SW y.lld
There are 6 section headers, starting at offset 0x2098:
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 0000000000201000 001000 000009 00 AX
0 0 1
[ 2] .comment PROGBITS 0000000000000000 002000 000012 01 MS
0 0 1
[ 3] .symtab SYMTAB 0000000000000000 002018 000048 18
5 2 8
[ 4] .shstrtab STRTAB 0000000000000000 002060 00002a 00
0 0 1
[ 5] .strtab STRTAB 0000000000000000 00208a 00000c 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
[hjl at gnu-cfl-1 lld-1]$
Section foo is missing. I am expecting:
[hjl at gnu-cfl-1 lld-1]$ make x.o
as -o x.o x.s
[hjl at gnu-cfl-1 lld-1]$ readelf -SW x.o
There are 14 section headers, starting at offset 0x240:
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 PROGBITS 0000000000000000 000040 000008 00 AX
0 0 1
[ 5] .rela.text RELA 0000000000000000 0001d8 000018 18 I
11 4 8
[ 6] .text PROGBITS 0000000000000000 000048 000001 00 AX
0 0 1
[ 7] .text PROGBITS 0000000000000000 000049 000001 00 AX
0 0 1
[ 8] .foo PROGBITS 0000000000000000 00004a 000008 00 AL
7 0 1
[ 9] .foo PROGBITS 0000000000000000 000052 000008 00 AL
6 0 1
[10] .note.gnu.property NOTE 0000000000000000 000060 000030 00 A
0 0 8
[11] .symtab SYMTAB 0000000000000000 000090 000138 18
12 12 8
[12] .strtab STRTAB 0000000000000000 0001c8 000010 00
0 0 1
[13] .shstrtab STRTAB 0000000000000000 0001f0 000049 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
[hjl at gnu-cfl-1 lld-1]$ make x.lld
ld.lld --gc-sections -o x.lld x.o
[hjl at gnu-cfl-1 lld-1]$ readelf -SW x.lld
There are 7 section headers, starting at offset 0x20a0:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .foo PROGBITS 0000000000200120 000120 000008 00 AL
2 0 1
[ 2] .text PROGBITS 0000000000201000 001000 000009 00 AX
0 0 1
[ 3] .comment PROGBITS 0000000000000000 002000 000012 01 MS
0 0 1
[ 4] .symtab SYMTAB 0000000000000000 002018 000048 18
6 2 8
[ 5] .shstrtab STRTAB 0000000000000000 002060 00002f 00
0 0 1
[ 6] .strtab STRTAB 0000000000000000 00208f 00000c 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
[hjl at gnu-cfl-1 lld-1]$
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200204/002b8cbc/attachment-0001.html>
More information about the llvm-bugs
mailing list