[PATCH] D41037: Create reserved symbols early so they can be versioned
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 10 11:09:45 PST 2017
I get the warning even without the patch. Taking a look
Dimitry Andric via Phabricator <reviews at reviews.llvm.org> writes:
> dim added a comment.
>
> When I patch lld trunk https://reviews.llvm.org/rL320307 with this, executables linked by it make readelf (from binutils 2.28) produce a warning:
>
> readelf: Warning: [10]: Info field (0) should index a relocatable section.
>
> And I still don't see any `_end` symbol in the executable.
>
> Full output:
>
> $ readelf -aW test
> ELF Header:
> Magic: 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
> Class: ELF64
> Data: 2's complement, little endian
> Version: 1 (current)
> OS/ABI: UNIX - FreeBSD
> ABI Version: 0
> Type: EXEC (Executable file)
> Machine: Advanced Micro Devices X86-64
> Version: 0x1
> Entry point address: 0x201000
> Start of program headers: 64 (bytes into file)
> Start of section headers: 19216 (bytes into file)
> Flags: 0x0
> Size of this header: 64 (bytes)
> Size of program headers: 56 (bytes)
> Number of program headers: 10
> Size of section headers: 64 (bytes)
> Number of section headers: 38
> Section header string table index: 36
>
> Section Headers:
> [Nr] Name Type Address Off Size ES Flg Lk Inf Al
> [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
> [ 1] .interp PROGBITS 0000000000200270 000270 000015 00 A 0 0 1
> [ 2] .note.tag NOTE 0000000000200288 000288 000030 00 A 0 0 4
> [ 3] .rodata PROGBITS 00000000002002b8 0002b8 0000b9 01 AMS 0 0 1
> [ 4] .dynsym DYNSYM 0000000000200378 000378 000108 18 A 9 1 8
> [ 5] .gnu.version VERSYM 0000000000200480 000480 000016 02 A 4 0 2
> [ 6] .gnu.version_r VERNEED 0000000000200498 000498 000020 00 A 9 1 4
> [ 7] .gnu.hash GNU_HASH 00000000002004b8 0004b8 00004c 00 A 4 0 8
> [ 8] .hash HASH 0000000000200504 000504 000060 04 A 4 0 4
> [ 9] .dynstr STRTAB 0000000000200564 000564 000079 00 A 0 0 1
> readelf: Warning: [10]: Info field (0) should index a relocatable section.
> [10] .rela.plt RELA 00000000002005e0 0005e0 0000a8 18 A 4 0 8
> [11] .eh_frame_hdr PROGBITS 0000000000200688 000688 000034 00 A 0 0 1
> [12] .eh_frame PROGBITS 00000000002006c0 0006c0 0000c0 00 A 0 0 8
> [13] .text PROGBITS 0000000000201000 001000 0005c8 00 AX 0 0 16
> [14] .init PROGBITS 00000000002015c8 0015c8 000013 00 AX 0 0 4
> [15] .fini PROGBITS 00000000002015dc 0015dc 00000e 00 AX 0 0 4
> [16] .plt PROGBITS 00000000002015f0 0015f0 000080 00 AX 0 0 16
> [17] .data PROGBITS 0000000000202000 002000 000034 00 WA 0 0 16
> [18] .got.plt PROGBITS 0000000000202038 002038 000050 00 WA 0 0 8
> [19] .ctors PROGBITS 0000000000203000 003000 000010 00 WA 0 0 8
> [20] .dtors PROGBITS 0000000000203010 003010 000010 00 WA 0 0 8
> [21] .jcr PROGBITS 0000000000203020 003020 000008 00 WA 0 0 8
> [22] .dynamic DYNAMIC 0000000000203028 003028 000130 10 WA 9 0 8
> [23] .bss NOBITS 0000000000204000 003158 000008 00 WA 0 0 8
> [24] .comment PROGBITS 0000000000000000 003158 0001dc 01 MS 0 0 1
> [25] .debug_str PROGBITS 0000000000000000 003334 0001ca 01 MS 0 0 1
> [26] .debug_loc PROGBITS 0000000000000000 0034fe 0002ca 00 0 0 1
> [27] .debug_abbrev PROGBITS 0000000000000000 0037c8 00019e 00 0 0 1
> [28] .debug_info PROGBITS 0000000000000000 003966 000544 00 0 0 1
> [29] .debug_ranges PROGBITS 0000000000000000 003eaa 000030 00 0 0 1
> [30] .debug_macinfo PROGBITS 0000000000000000 003eda 000001 00 0 0 1
> [31] .debug_pubnames PROGBITS 0000000000000000 003edb 00008b 00 0 0 1
> [32] .debug_pubtypes PROGBITS 0000000000000000 003f66 0000d2 00 0 0 1
> [33] .debug_line PROGBITS 0000000000000000 004038 00030a 00 0 0 1
> [34] .debug_aranges PROGBITS 0000000000000000 004342 000080 00 0 0 1
> [35] .symtab SYMTAB 0000000000000000 0043c8 0003d8 18 37 28 8
> [36] .shstrtab STRTAB 0000000000000000 0047a0 00016b 00 0 0 1
> [37] .strtab STRTAB 0000000000000000 00490b 000202 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)
>
> There are no section groups in this file.
>
> Program Headers:
> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000230 0x000230 R 0x8
> INTERP 0x000270 0x0000000000200270 0x0000000000200270 0x000015 0x000015 R 0x1
> [Requesting program interpreter: /libexec/ld-elf.so.1]
> LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x000780 0x000780 R 0x1000
> LOAD 0x001000 0x0000000000201000 0x0000000000201000 0x000670 0x000670 R E 0x1000
> LOAD 0x002000 0x0000000000202000 0x0000000000202000 0x001158 0x002008 RW 0x1000
> DYNAMIC 0x003028 0x0000000000203028 0x0000000000203028 0x000130 0x000130 RW 0x8
> GNU_RELRO 0x003000 0x0000000000203000 0x0000000000203000 0x000158 0x001000 R 0x1
> GNU_EH_FRAME 0x000688 0x0000000000200688 0x0000000000200688 0x000034 0x000034 R 0x1
> GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
> NOTE 0x000288 0x0000000000200288 0x0000000000200288 0x000030 0x000030 R 0x4
>
> Section to Segment mapping:
> Segment Sections...
> 00
> 01 .interp
> 02 .interp .note.tag .rodata .dynsym .gnu.version .gnu.version_r .gnu.hash .hash .dynstr .rela.plt .eh_frame_hdr .eh_frame
> 03 .text .init .fini .plt
> 04 .data .got.plt .ctors .dtors .jcr .dynamic .bss
> 05 .dynamic
> 06 .ctors .dtors .jcr .dynamic
> 07 .eh_frame_hdr
> 08
> 09 .note.tag
>
> Dynamic section at offset 0x3028 contains 19 entries:
> Tag Type Name/Value
> 0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
> 0x0000000000000001 (NEEDED) Shared library: [libc.so.7]
> 0x0000000000000015 (DEBUG) 0x0
> 0x0000000000000017 (JMPREL) 0x2005e0
> 0x0000000000000002 (PLTRELSZ) 168 (bytes)
> 0x0000000000000003 (PLTGOT) 0x202038
> 0x0000000000000014 (PLTREL) RELA
> 0x0000000000000006 (SYMTAB) 0x200378
> 0x000000000000000b (SYMENT) 24 (bytes)
> 0x0000000000000005 (STRTAB) 0x200564
> 0x000000000000000a (STRSZ) 121 (bytes)
> 0x000000006ffffef5 (GNU_HASH) 0x2004b8
> 0x0000000000000004 (HASH) 0x200504
> 0x000000000000000c (INIT) 0x2015c8
> 0x000000000000000d (FINI) 0x2015dc
> 0x000000006ffffff0 (VERSYM) 0x200480
> 0x000000006ffffffe (VERNEED) 0x200498
> 0x000000006fffffff (VERNEEDNUM) 1
> 0x0000000000000000 (NULL) 0x0
>
> Relocation section '.rela.plt' at offset 0x5e0 contains 7 entries:
> Offset Info Type Symbol's Value Symbol's Name + Addend
> 0000000000202050 0000000400000007 R_X86_64_JUMP_SLOT 0000000000201600 atexit at FBSD_1.0 + 0
> 0000000000202058 0000000300000007 R_X86_64_JUMP_SLOT 0000000000201610 _init_tls at FBSD_1.0 + 0
> 0000000000202060 0000000700000007 R_X86_64_JUMP_SLOT 0000000000201620 exit at FBSD_1.0 + 0
> 0000000000202068 0000000900000007 R_X86_64_JUMP_SLOT 0000000000201630 __error at FBSD_1.0 + 0
> 0000000000202070 0000000a00000007 R_X86_64_JUMP_SLOT 0000000000201640 sbrk at FBSD_1.0 + 0
> 0000000000202078 0000000600000007 R_X86_64_JUMP_SLOT 0000000000201650 brk at FBSD_1.0 + 0
> 0000000000202080 0000000800000007 R_X86_64_JUMP_SLOT 0000000000201660 __assert at FBSD_1.0 + 0
>
> The decoding of unwind sections for machine type Advanced Micro Devices X86-64 is not currently supported.
>
> Symbol table '.dynsym' contains 11 entries:
> Num: Value Size Type Bind Vis Ndx Name
> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
> 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
> 2: 0000000000202000 8 OBJECT GLOBAL DEFAULT 17 __progname
> 3: 0000000000201610 0 FUNC GLOBAL DEFAULT UND _init_tls at FBSD_1.0 (2)
> 4: 0000000000201600 0 FUNC GLOBAL DEFAULT UND atexit at FBSD_1.0 (2)
> 5: 0000000000204000 8 OBJECT GLOBAL DEFAULT 23 environ
> 6: 0000000000201650 0 FUNC GLOBAL DEFAULT UND brk at FBSD_1.0 (2)
> 7: 0000000000201620 0 FUNC GLOBAL DEFAULT UND exit at FBSD_1.0 (2)
> 8: 0000000000201660 0 FUNC GLOBAL DEFAULT UND __assert at FBSD_1.0 (2)
> 9: 0000000000201630 0 FUNC GLOBAL DEFAULT UND __error at FBSD_1.0 (2)
> 10: 0000000000201640 0 FUNC GLOBAL DEFAULT UND sbrk at FBSD_1.0 (2)
>
> Symbol table '.symtab' contains 41 entries:
> Num: Value Size Type Bind Vis Ndx Name
> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
> 1: 0000000000200288 24 OBJECT LOCAL DEFAULT 2 abitag
> 2: 00000000002002a0 24 OBJECT LOCAL DEFAULT 2 crt_noinit_tag
> 3: 0000000000201190 115 FUNC LOCAL DEFAULT 13 finalizer
> 4: 0000000000203000 8 OBJECT LOCAL DEFAULT 19 __CTOR_LIST__
> 5: 0000000000203010 8 OBJECT LOCAL DEFAULT 20 __DTOR_LIST__
> 6: 0000000000203020 0 OBJECT LOCAL DEFAULT 21 __JCR_LIST__
> 7: 0000000000201210 53 FUNC LOCAL DEFAULT 13 __do_global_dtors_aux
> 8: 0000000000202018 1 OBJECT LOCAL DEFAULT 17 __do_global_dtors_aux.completed
> 9: 0000000000202010 8 OBJECT LOCAL DEFAULT 17 __do_global_dtors_aux.p
> 10: 0000000000201250 34 FUNC LOCAL DEFAULT 13 frame_dummy
> 11: 00000000002012b0 360 FUNC LOCAL DEFAULT 13 test_brk
> 12: 0000000000201420 366 FUNC LOCAL DEFAULT 13 test_sbrk
> 13: 0000000000203008 8 OBJECT LOCAL DEFAULT 19 __CTOR_END__
> 14: 0000000000203018 8 OBJECT LOCAL DEFAULT 20 __DTOR_END__
> 15: 00000000002006c0 4 OBJECT LOCAL DEFAULT 12 __FRAME_END__
> 16: 0000000000203020 8 OBJECT LOCAL DEFAULT 21 __JCR_END__
> 17: 0000000000201590 54 FUNC LOCAL DEFAULT 13 __do_global_ctors_aux
> 18: 0000000000203028 0 NOTYPE LOCAL HIDDEN 22 _DYNAMIC
> 19: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __fini_array_end
> 20: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __fini_array_start
> 21: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __init_array_end
> 22: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __init_array_start
> 23: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __preinit_array_end
> 24: 0000000000000000 0 NOTYPE LOCAL HIDDEN ABS __preinit_array_start
> 25: 00000000002015dc 0 FUNC LOCAL HIDDEN 15 _fini
> 26: 00000000002015c8 0 FUNC LOCAL HIDDEN 14 _init
> 27: 0000000000202008 8 OBJECT LOCAL HIDDEN 17 __dso_handle
> 28: 0000000000202000 8 OBJECT GLOBAL DEFAULT 17 __progname
> 29: 0000000000201610 0 FUNC GLOBAL DEFAULT UND _init_tls
> 30: 0000000000201000 390 FUNC GLOBAL DEFAULT 13 _start
> 31: 0000000000201600 0 FUNC GLOBAL DEFAULT UND atexit
> 32: 0000000000204000 8 OBJECT GLOBAL DEFAULT 23 environ
> 33: 0000000000201620 0 FUNC GLOBAL DEFAULT UND exit
> 34: 0000000000201280 38 FUNC GLOBAL DEFAULT 13 main
> 35: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
> 36: 0000000000201660 0 FUNC GLOBAL DEFAULT UND __assert
> 37: 0000000000201630 0 FUNC GLOBAL DEFAULT UND __error
> 38: 0000000000201650 0 FUNC GLOBAL DEFAULT UND brk
> 39: 0000000000201640 0 FUNC GLOBAL DEFAULT UND sbrk
> 40: 0000000000202020 20 OBJECT GLOBAL DEFAULT 17 test_data
>
> Histogram for bucket list length (total of 11 buckets):
> Length Number % of total Coverage
> 0 4 ( 36.4%)
> 1 4 ( 36.4%) 40.0%
> 2 3 ( 27.3%) 100.0%
>
> Histogram for `.gnu.hash' bucket list length (total of 2 buckets):
> Length Number % of total Coverage
> 0 0 ( 0.0%)
> 1 0 ( 0.0%) 0.0%
> 2 0 ( 0.0%) 0.0%
> 3 0 ( 0.0%) 0.0%
> 4 1 ( 50.0%) 44.4%
> 5 1 ( 50.0%) 100.0%
>
> Version symbols section '.gnu.version' contains 11 entries:
> Addr: 0000000000200480 Offset: 0x000480 Link: 4 (.dynsym)
> 000: 0 (*local*) 1 (*global*) 1 (*global*) 2 (FBSD_1.0)
> 004: 2 (FBSD_1.0) 1 (*global*) 2 (FBSD_1.0) 2 (FBSD_1.0)
> 008: 2 (FBSD_1.0) 2 (FBSD_1.0) 2 (FBSD_1.0)
>
> Version needs section '.gnu.version_r' contains 1 entries:
> Addr: 0x0000000000200498 Offset: 0x000498 Link: 9 (.dynstr)
> 000000: Version: 1 File: libc.so.7 Cnt: 1
> 0x0010: Name: FBSD_1.0 Flags: none Version: 2
>
> Displaying notes found in: .note.tag
> Owner Data size Description
> FreeBSD 0x00000004 NT_VERSION (version)
> description data: ffffffb6 4f 12 00
> FreeBSD 0x00000004 NT_ARCH (architecture)
> description data: 00 00 00 00
>
>
> https://reviews.llvm.org/D41037
More information about the llvm-commits
mailing list