50 lines · plain
1# REQUIRES: mips2# Check that we correctly write addends if the output use Elf_Rel but the input3# uses Elf_Rela4 5# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t-rela.o6# RUN: llvm-readobj -h -S --section-data -r %t-rela.o \7# RUN: | FileCheck -check-prefix INPUT-RELA %s8 9# INPUT-RELA: ElfHeader {10# INPUT-RELA: Class: 64-bit11# INPUT-RELA: DataEncoding: BigEndian12# INPUT-RELA: Section {13# INPUT-RELA: Name: .data14# INPUT-RELA: SectionData (15# INPUT-RELA-NEXT: 0000: 00000000 00000000 ABCDEF00 1234567816# ^--- No addend here since it uses RELA17# INPUT-RELA: Relocations [18# INPUT-RELA-NEXT: Section ({{.+}}) .rela.data {19# INPUT-RELA-NEXT: 0x0 R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE foo 0x554420# INPUT-RELA-NEXT: }21# INPUT-RELA-NEXT: ]22 23# Previously the addend to the dynamic relocation in the .data section24# was not copied if the input file used RELA and the output uses REL.25# Check that it works now:26# RUN: ld.lld -shared -o %t.so %t-rela.o -verbose27# RUN: llvm-readobj -h -S --section-data -r %t.so \28# RUN: | FileCheck -check-prefix RELA-TO-REL %s29 30# RELA-TO-REL: ElfHeader {31# RELA-TO-REL: Class: 64-bit32# RELA-TO-REL: DataEncoding: BigEndian33# RELA-TO-REL: Section {34# RELA-TO-REL: Name: .data35# RELA-TO-REL: Address: 0x[[DATA:[0-9A-F]+]]36# RELA-TO-REL: SectionData (37# RELA-TO-REL-NEXT: 0000: 00000000 00005544 ABCDEF00 1234567838# ^--- Addend for relocation in .rel.dyn39# RELA-TO-REL: Relocations [40# RELA-TO-REL-NEXT: Section ({{.+}}) .rel.dyn {41# RELA-TO-REL-NEXT: 0x[[DATA]] R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE foo42# RELA-TO-REL-NEXT: }43# RELA-TO-REL-NEXT: ]44 45.extern foo46 47.data48.quad foo + 0x554449.quad 0xabcdef001234567850