[PATCH] D13385: [ELF2] Add -init and -fini switches
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 5 02:24:14 PDT 2015
ikudrin added inline comments.
================
Comment at: ELF/OutputSections.h:334-335
@@ -331,2 +333,4 @@
SymbolTable &SymTab;
+ const ELFSymbolBody<ELFT> *InitSymbolBody = nullptr;
+ const ELFSymbolBody<ELFT> *FiniSymbolBody = nullptr;
};
----------------
ruiu wrote:
> ruiu wrote:
> > InitSymbolBody -> InitSym
> > Likewise Fini.
> These symbols type should be Defined<ELFT>, no? They can't be Undefined<ELFT> which is a subclass of ELFSymbolBody<ELFT>
> These symbols type should be Defined<ELFT>, no? They can't be Undefined<ELFT> which is a subclass of ELFSymbolBody<ELFT>
It sounds strange, but:
```
$ cat > x.s
.globl _start,_init,_fini;
_start:
^C
$ llvm-mc -filetype=obj -triple=x86_64-pc-linux -o x.o x.s
$ ld -shared -o x.out x.o
$ llvm-readobj -dynamic-table -symbols x.out
File: x.out
Format: ELF64-x86-64
Arch: x86_64
AddressSize: 64bit
LoadName:
Symbols [
...
Symbol {
Name: _init (32)
Value: 0x0
Size: 0
Binding: Global (0x1)
Type: None (0x0)
Other: 0
Section: Undefined (0x0)
}
...
Symbol {
Name: _fini (57)
Value: 0x0
Size: 0
Binding: Global (0x1)
Type: None (0x0)
Other: 0
Section: Undefined (0x0)
}
...
]
DynamicSection [ (8 entries)
Tag Type Name/Value
0x000000000000000C INIT 0x0
0x000000000000000D FINI 0x0
0x0000000000000004 HASH 0xE8
0x0000000000000005 STRTAB 0x1C0
0x0000000000000006 SYMTAB 0x118
0x000000000000000A STRSZ 37 (bytes)
0x000000000000000B SYMENT 24 (bytes)
0x0000000000000000 NULL 0x0
]
```
http://reviews.llvm.org/D13385
More information about the llvm-commits
mailing list