forked from OSchip/llvm-project
106 lines
3.0 KiB
Plaintext
106 lines
3.0 KiB
Plaintext
# Check that LLD does not populate a shared library dynamic symbol table
|
|
# by unnecessary symbols.
|
|
# 1. bar.so defines T2 and T3
|
|
# 2. foo.so defines T1 and references T2
|
|
# 4. foo.so dynamic table should contain T1 and T2 entries only
|
|
|
|
# RUN: yaml2obj -format=elf -docnum 1 %s > %t-bar.o
|
|
# RUN: yaml2obj -format=elf -docnum 2 %s > %t-foo.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-bar.so %t-bar.o
|
|
# RUN: lld -flavor old-gnu -target mipsel -shared -o %t-foo.so %t-foo.o %t-bar.so
|
|
# RUN: llvm-readobj -dt -dynamic-table %t-foo.so | FileCheck %s
|
|
|
|
# CHECK: DynamicSymbols [
|
|
# CHECK-NEXT: Symbol {
|
|
# CHECK-NEXT: Name: @ (0)
|
|
# CHECK-NEXT: Value: 0x0
|
|
# CHECK-NEXT: Size: 0
|
|
# CHECK-NEXT: Binding: Local (0x0)
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
# CHECK-NEXT: Other: 0
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: Symbol {
|
|
# CHECK-NEXT: Name: T1@ ({{.*}})
|
|
# CHECK-NEXT: Value: {{.*}}
|
|
# CHECK-NEXT: Size: 8
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
# CHECK-NEXT: Type: Function (0x2)
|
|
# CHECK-NEXT: Other: 0
|
|
# CHECK-NEXT: Section: .text (0x4)
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: Symbol {
|
|
# CHECK-NEXT: Name: T2@ ({{.*}})
|
|
# CHECK-NEXT: Value: 0x0
|
|
# CHECK-NEXT: Size: 0
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
# CHECK-NEXT: Type: Function (0x2)
|
|
# CHECK-NEXT: Other: 0
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK: 0x00000003 PLTGOT 0x{{[0-9A-F]+}}
|
|
# CHECK-NEXT: 0x00000001 NEEDED SharedLibrary (dynsym-table-2.test.tmp-bar.so)
|
|
# CHECK-NEXT: 0x00000000 NULL 0x0
|
|
|
|
# bar.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x08
|
|
Symbols:
|
|
Global:
|
|
- Name: T2
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x04
|
|
- Name: T3
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Value: 0x04
|
|
Size: 0x04
|
|
|
|
# foo.o
|
|
---
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_MIPS
|
|
Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
|
|
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
AddressAlign: 0x04
|
|
Size: 0x08
|
|
- Name: .rel.text
|
|
Type: SHT_REL
|
|
Link: .symtab
|
|
AddressAlign: 0x08
|
|
Info: .text
|
|
Relocations:
|
|
- Offset: 0
|
|
Symbol: T2
|
|
Type: R_MIPS_CALL16
|
|
Symbols:
|
|
Global:
|
|
- Name: T1
|
|
Type: STT_FUNC
|
|
Section: .text
|
|
Size: 0x08
|
|
- Name: T2
|
|
...
|