forked from OSchip/llvm-project
100 lines
2.9 KiB
Plaintext
100 lines
2.9 KiB
Plaintext
# Tests the --export-dynamic (-E) flag. When creating a dynamic executable and
|
|
# receiving this flag, the linker should export all globally visible symbols in
|
|
# its dynamic symbol table.
|
|
|
|
#RUN: yaml2obj -format=elf %s -o=%t.o
|
|
#RUN: lld -flavor gnu -target x86_64 -E %t.o -e=main -o %t1
|
|
#RUN: llvm-readobj -dt %t1 | FileCheck -check-prefix CHECKSYMS %s
|
|
|
|
#CHECKSYMS: myfunc1@
|
|
#CHECKSYMS: main@
|
|
#CHECKSYMS: myvar1@
|
|
|
|
# The object file below was generated with the following code:
|
|
#
|
|
# (command line clang -c prog.c -o prog.o)
|
|
#
|
|
# int myvar1 = 22;
|
|
#
|
|
# static int mysecretvar = 11;
|
|
#
|
|
# int myfunc1() {
|
|
# return 23;
|
|
# }
|
|
#
|
|
# static int mysecretfunc() {
|
|
# return 42;
|
|
# }
|
|
#
|
|
# int main() {
|
|
# return mysecretfunc() + mysecretvar;
|
|
# }
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
OSABI: ELFOSABI_GNU
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x0000000000000010
|
|
Content: 554889E5B8170000005DC30F1F440000554889E54883EC10C745FC00000000E81C000000030425000000004883C4105DC36666666666662E0F1F840000000000554889E5B82A0000005DC3
|
|
- Name: .rela.text
|
|
Type: SHT_RELA
|
|
Link: .symtab
|
|
AddressAlign: 0x0000000000000008
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0x0000000000000027
|
|
Symbol: .data
|
|
Type: R_X86_64_32S
|
|
Addend: 4
|
|
- Name: .data
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
AddressAlign: 0x0000000000000004
|
|
Content: 160000000B000000
|
|
- Name: .bss
|
|
Type: SHT_NOBITS
|
|
Flags: [ SHF_WRITE, SHF_ALLOC ]
|
|
AddressAlign: 0x0000000000000004
|
|
Content: ''
|
|
Symbols:
|
|
Local:
|
|
- Name: mysecretfunc
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x0000000000000040
|
|
Size: 0x000000000000000B
|
|
- Name: mysecretvar
|
|
Type: STT_OBJECT
|
|
Section: .data
|
|
Value: 0x0000000000000004
|
|
Size: 0x0000000000000004
|
|
- Name: .text
|
|
Type: STT_SECTION
|
|
Section: .text
|
|
- Name: .data
|
|
Type: STT_SECTION
|
|
Section: .data
|
|
- Name: .bss
|
|
Type: STT_SECTION
|
|
Section: .bss
|
|
Global:
|
|
- Name: main
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x0000000000000010
|
|
Size: 0x0000000000000021
|
|
- Name: myfunc1
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x000000000000000B
|
|
- Name: myvar1
|
|
Type: STT_OBJECT
|
|
Section: .data
|
|
Size: 0x0000000000000004
|