# Conditions: # a) Linking a shared library. # b) The first relocation modifies a regular .text section. # c) The second relocation modifies a .pdr section without SHF_ALLOC flag. # Check: # a) There should be no PLT entries. # b) Linker creates a single R_MIPS_REL32 relocation. # # RUN: yaml2obj -format=elf %s > %t.o # RUN: lld -flavor old-gnu -target mipsel -shared -o %t.so %t.o # RUN: llvm-readobj -dt -r -s %t.so | FileCheck -check-prefix=SYM %s # RUN: llvm-readobj -mips-plt-got %t.so | FileCheck -check-prefix=GOT %s # SYM: Sections [ # SYM: Section { # SYM-NOT: Name: .plt ({{[0-9]+}}) # SYM: Relocations [ # SYM-NEXT: Section (4) .rel.dyn { # SYM-NEXT: 0x[[ADDR:[0-9A-Z]+]] R_MIPS_REL32 T0 0x0 # SYM-NEXT: } # SYM-NEXT: ] # SYM: Symbol { # SYM: Name: @ (0) # SYM-NEXT: Value: 0x0 # SYM-NEXT: Size: 0 # SYM-NEXT: Binding: Local (0x0) # SYM-NEXT: Type: None (0x0) # SYM-NEXT: Other: 0 # SYM-NEXT: Section: Undefined (0x0) # SYM-NEXT: } # SYM: Symbol { # SYM: Name: T1@ (4) # SYM-NEXT: Value: 0x104 # SYM-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5) # SYM-NEXT: } # SYM: Symbol { # SYM: Name: T0@ (1) # SYM-NEXT: Value: 0x[[ADDR]] # SYM-NEXT: Size: 4 # SYM-NEXT: Binding: Global (0x1) # SYM-NEXT: Type: Function (0x2) # SYM-NEXT: Other: 0 # SYM-NEXT: Section: .text (0x5) # SYM-NEXT: } # GOT: Local entries [ # GOT-NEXT: ] # GOT-NEXT: Global entries [ # GOT-NEXT: Entry { # GOT-NEXT: Address: 0x1008 # GOT-NEXT: Access: -32744 # GOT-NEXT: Initial: 0x100 # GOT-NEXT: Value: 0x100 # GOT-NEXT: Type: Function (0x2) # GOT-NEXT: Section: .text (0x5) # GOT-NEXT: Name: T0@ (1) # GOT-NEXT: } # GOT-NEXT: ] 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: 8 AddressAlign: 16 Flags: [SHF_EXECINSTR, SHF_ALLOC] - Name: .rel.text Type: SHT_REL Info: .text AddressAlign: 4 Relocations: - Offset: 0 Symbol: T0 Type: R_MIPS_32 - Name: .pdr Type: SHT_PROGBITS Size: 8 AddressAlign: 16 Flags: [] - Name: .rel.pdr Type: SHT_REL Info: .pdr AddressAlign: 4 Relocations: - Offset: 0 Symbol: T1 Type: R_MIPS_32 Symbols: Global: - Name: T0 Section: .text Type: STT_FUNC Value: 0 Size: 4 - Name: T1 Section: .text Type: STT_FUNC Value: 4 Size: 4