2019-08-20 16:23:57 +08:00
|
|
|
## 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={{.}}
|
|
|
|
|
[llvm-objdump] Print file format in lowercase to match GNU output.
Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. llvm-objdump prints `ELF64-x86-64` right now, even though piping that into llvm-objcopy refuses that as a valid arch to use.
As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779
Reviewers: MaskRay, jhenderson, alexshap
Reviewed By: MaskRay
Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D74433
2020-02-12 03:55:40 +08:00
|
|
|
# FMT: [[FILE]]: file format elf64-x86-64
|
2019-08-20 16:23:57 +08:00
|
|
|
|
|
|
|
# REL: RELOCATION RECORDS FOR []:
|
2020-02-11 19:10:57 +08:00
|
|
|
# REL-NEXT: OFFSET TYPE VALUE
|
|
|
|
# REL-NEXT: 0000000000000123 R_X86_64_NONE *ABS*+0x141
|
2019-08-20 16:23:57 +08:00
|
|
|
|
|
|
|
## Executable.
|
|
|
|
--- !ELF
|
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS64
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_EXEC
|
|
|
|
Machine: EM_X86_64
|
|
|
|
Sections:
|
|
|
|
- Name: .rela.plt
|
|
|
|
Type: SHT_RELA
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x123
|
|
|
|
Type: R_X86_64_NONE
|
|
|
|
Addend: 321
|
|
|
|
|
|
|
|
## DSO.
|
|
|
|
--- !ELF
|
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS64
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_DYN
|
|
|
|
Machine: EM_X86_64
|
|
|
|
Sections:
|
|
|
|
- Name: .rela.plt
|
|
|
|
Type: SHT_RELA
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x123
|
|
|
|
Type: R_X86_64_NONE
|
|
|
|
Addend: 321
|
|
|
|
|
|
|
|
## Relocatable.
|
|
|
|
--- !ELF
|
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS64
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_REL
|
|
|
|
Machine: EM_X86_64
|
|
|
|
Sections:
|
|
|
|
- Name: .rela.plt
|
|
|
|
Type: SHT_RELA
|
|
|
|
Relocations:
|
|
|
|
- Offset: 0x123
|
|
|
|
Type: R_X86_64_NONE
|
|
|
|
Addend: 321
|