Index: test/Object/elf-reloc-no-sym.test =================================================================== --- test/Object/elf-reloc-no-sym.test +++ /dev/null @@ -1,7 +0,0 @@ -RUN: llvm-readobj -r %p/Inputs/elf-reloc-no-sym.x86_64 | FileCheck %s - -CHECK: Relocations [ -CHECK-NEXT: Section (1) .rela.plt { -CHECK-NEXT: 0x4011D8 R_X86_64_IRELATIVE - 0x400120 -CHECK-NEXT: } -CHECK-NEXT: ] Index: test/Object/objdump-reloc-shared.test =================================================================== --- test/Object/objdump-reloc-shared.test +++ /dev/null @@ -1,5 +0,0 @@ -RUN: llvm-objdump -r %p/Inputs/elf-reloc-no-sym.x86_64 \ -RUN: | FileCheck %s - -; CHECK: elf-reloc-no-sym.x86_64: file format ELF64-x86-64 -; CHECK-NOT: {{.}} Index: test/tools/llvm-objdump/relocations-in-nonreloc.test =================================================================== --- /dev/null +++ test/tools/llvm-objdump/relocations-in-nonreloc.test @@ -0,0 +1,61 @@ +## Check that objdump doesn't print relocations in non-relocatable object files. + +# RUN: yaml2obj --docnum=1 %s -o %t1 +# RUN: llvm-objdump -r %t1 | FileCheck %s -DFILE=%t1 --check-prefix=FMT --implicit-check-not={{.}} +# RUN: yaml2obj --docnum=2 %s -o %t2 +# RUN: llvm-objdump -r %t2 | FileCheck %s -DFILE=%t2 --check-prefix=FMT --implicit-check-not={{.}} +# RUN: yaml2obj --docnum=3 %s -o %t3 +# RUN: llvm-objdump -r %t3 | FileCheck %s -DFILE=%t3 --check-prefixes=FMT,REL --implicit-check-not={{.}} + +# FMT: [[FILE]]: file format ELF64-x86-64 + +# REL: RELOCATION RECORDS FOR []: +# REL-NEXT: 0000000000000000 R_X86_64_IRELATIVE *ABS* + +## Executable. +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Relocations: + - Offset: 0x0 + Type: R_X86_64_IRELATIVE + Addend: 0 + +## DSO. +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 +Sections: + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Relocations: + - Offset: 0x0 + Type: R_X86_64_IRELATIVE + Addend: 0 + +## Relocatable. +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Relocations: + - Offset: 0x0 + Type: R_X86_64_IRELATIVE + Addend: 0 Index: test/tools/llvm-readobj/elf-reloc-no-sym.test =================================================================== --- /dev/null +++ test/tools/llvm-readobj/elf-reloc-no-sym.test @@ -0,0 +1,27 @@ +## Check llvm-readobj is able to dump relocations that +## do not use symbols. + +# RUN: yaml2obj %s -o %t +# RUN: llvm-readobj -r %t | FileCheck %s + +# CHECK: Relocations [ +# CHECK-NEXT: Section (1) .rela.plt { +# CHECK-NEXT: 0x4011D8 R_X86_64_IRELATIVE - 0x400120 +# CHECK-NEXT: } +# CHECK-NEXT: ] + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 + Entry: 0x0000000000400140 +Sections: + - Name: .rela.plt + Type: SHT_RELA + Flags: [ SHF_ALLOC, SHF_INFO_LINK ] + Relocations: + - Offset: 0x00000000004011D8 + Type: R_X86_64_IRELATIVE + Addend: 4194592