# Conditions: # a) Linking a non-shared 32-bit executable file. # b) Relocations' targets are symbols defined in the shared object. # Check: # a) Emitting R_MIPS_REL32 relocation. # b) Applying addendum from the original relocation. # # RUN: yaml2obj -format=elf -docnum 1 %s > %t-so.o # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o # RUN: yaml2obj -format=elf -docnum 2 %s > %t-o.o # RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o.o %t.so # RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s # RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s # RAW: Contents of section .data: # RAW-NEXT: 402000 01000000 # REL: Relocations [ # REL-NEXT: Section (5) .rel.dyn { # REL-NEXT: 0x402000 R_MIPS_REL32 T1 0x0 # REL-NEXT: } # REL-NEXT: ] # 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: 4 AddressAlign: 16 Flags: [SHF_EXECINSTR, SHF_ALLOC] Symbols: Global: - Name: T1 Section: .text Type: STT_FUNC Value: 0 Size: 4 # o.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 Size: 4 AddressAlign: 16 Flags: [SHF_EXECINSTR, SHF_ALLOC] - Name: .data Type: SHT_PROGBITS Size: 4 AddressAlign: 16 Flags: [SHF_WRITE, SHF_ALLOC] - Name: .rel.data Type: SHT_RELA Info: .data AddressAlign: 4 Relocations: - Offset: 0 Symbol: T1 Type: R_MIPS_32 Addend: 1 Symbols: Global: - Name: T0 Section: .text Type: STT_FUNC Value: 0 Size: 4 - Name: T1 Type: STT_FUNC - Name: D0 Section: .data Type: STT_OBJECT Value: 0 Size: 4 ...