# Check that external symbol defined in the executable file # and referenced by R_MICROMIPS_CALL16 relocation has a corresponded # entry in the local GOT section. # # Build shared library # RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o # Build executable # RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o # RUN: lld -flavor gnu -target mipsel -e glob \ # RUN: --output-filetype=yaml -o %t.exe %t-o.o %t.so # RUN: FileCheck -check-prefix=GOT %s < %t.exe # GOT header # GOT: - type: got # GOT: content: [ 00, 00, 00, 00 ] # GOT: alignment: 4 # GOT: section-choice: custom-required # GOT: section-name: .got # GOT: permissions: rw- # GOT: - type: got # GOT: content: [ 00, 00, 00, 80 ] # GOT: alignment: 4 # GOT: section-choice: custom-required # GOT: section-name: .got # GOT: permissions: rw- # Local GOT entry for 'glob' symbol # GOT: - ref-name: L000 # GOT: type: got # GOT: content: [ 00, 00, 00, 00 ] # GOT: alignment: 4 # GOT: section-choice: custom-required # GOT: section-name: .got # GOT: permissions: rw- # GOT: references: # GOT: - kind: R_MIPS_32 # GOT: offset: 0 # GOT: target: glob # Global GOT entry for 'T1' symbol # GOT: - ref-name: L001 # GOT: type: got # GOT: content: [ 00, 00, 00, 00 ] # GOT: alignment: 4 # GOT: section-choice: custom-required # GOT: section-name: .got # GOT: permissions: rw- # GOT: references: # GOT: - kind: LLD_R_MIPS_GLOBAL_GOT # GOT: offset: 0 # GOT: target: T1 # so.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 Size: 0x0C AddressAlign: 16 Flags: [SHF_EXECINSTR, SHF_ALLOC] Symbols: Global: - Name: T1 Section: .text Type: STT_FUNC Value: 0x0 Size: 4 # o.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_32R2, EF_MIPS_MICROMIPS ] Sections: - Name: .text Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] AddressAlign: 0x04 Size: 0x08 - Name: .rel.text Type: SHT_REL Link: .symtab AddressAlign: 0x04 Info: .text Relocations: - Offset: 0x00 Symbol: glob Type: R_MICROMIPS_CALL16 - Offset: 0x04 Symbol: T1 Type: R_MICROMIPS_CALL16 Symbols: Local: - Name: .text Type: STT_SECTION Section: .text Global: - Name: glob Section: .text Other: [ STO_MIPS_MICROMIPS ] - Name: T1 ...