| # Check that LLD does not populate an executable file dynamic symbol table |
| # by unnecessary symbols. |
| # 1. bar.so defines T2 |
| # 2. foo.so defines T1 and references T2 |
| # 3. main.o reference T1 |
| # 4. a.out dynamic table should contain T1 entry only |
| |
| # RUN: yaml2obj -format=elf -docnum 1 %s > %t-bar.o |
| # RUN: yaml2obj -format=elf -docnum 2 %s > %t-foo.o |
| # RUN: yaml2obj -format=elf -docnum 3 %s > %t-main.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: lld -flavor old-gnu -target mipsel -e T0 -o %t.exe --as-needed \ |
| # RUN: %t-main.o %t-foo.so %t-bar.so |
| # RUN: llvm-readobj -dt -dynamic-table %t.exe | 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: 0 |
| # CHECK-NEXT: Binding: Global (0x1) |
| # CHECK-NEXT: Type: Function (0x2) |
| # CHECK-NEXT: Other: 8 |
| # CHECK-NEXT: Section: Undefined (0x0) |
| # CHECK-NEXT: } |
| # CHECK-NEXT: ] |
| |
| # CHECK: 0x00000003 PLTGOT 0x{{[0-9A-F]+}} |
| # CHECK-NEXT: 0x00000001 NEEDED SharedLibrary (dynsym-table-1.test.tmp-foo.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_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: 0x08 |
| |
| # foo.o |
| --- |
| FileHeader: |
| Class: ELFCLASS32 |
| Data: ELFDATA2LSB |
| Type: ET_REL |
| Machine: EM_MIPS |
| Flags: [EF_MIPS_PIC, 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 |
| |
| # main.o |
| --- |
| FileHeader: |
| Class: ELFCLASS32 |
| Data: ELFDATA2LSB |
| Type: ET_REL |
| Machine: EM_MIPS |
| Flags: [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: T1 |
| Type: R_MIPS_32 |
| Symbols: |
| Global: |
| - Name: T0 |
| Type: STT_FUNC |
| Section: .text |
| Size: 0x08 |
| - Name: T1 |
| ... |