-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-readelf] Make llvm-readelf more compatible with GNU readelf.
Summary: This change adds a bunch of options that GNU readelf supports. There is one breaking change when invoked as `llvm-readobj`, and three breaking changes when invoked as `llvm-readelf`: - Add --all (implies --file-header, --program-headers, etc.) - [Breaking] -a is --all instead of --arm-attributes - Add --file-header as an alias for --file-headers - Replace --sections with --sections-headers, keeping --sections as an alias for it - Add --relocs as an alias for --relocations - Add --dynamic as an alias for --dynamic-table - Add --segments as an alias for --program-headers - Add --section-groups as an alias for --elf-section-groups - Add --dyn-syms as an alias for --dyn-symbols - Add --syms as an alias for --symbols - Add --histogram as an alias for --elf-hash-histogram - [Breaking] When invoked as `llvm-readelf`, -s is --symbols instead of --sections - [Breaking] When invoked as `llvm-readelf`, -t is no longer an alias for --symbols Reviewers: MaskRay, phosek, mcgrathr, jhenderson Reviewed By: MaskRay, jhenderson Subscribers: sbc100, aheejin, edd, jhenderson, silvas, echristo, compnerd, kristina, javed.absar, kristof.beyls, llvm-commits, Bigcheese Differential Revision: https://reviews.llvm.org/D54124 llvm-svn: 346685
- Loading branch information
Showing
12 changed files
with
220 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
RUN: llvm-readobj -a %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix ALL | ||
RUN: llvm-readobj --all %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix ALL | ||
|
||
ALL: Format: ELF32-i386 | ||
ALL: Arch: i386 | ||
ALL: AddressSize: 32bit | ||
ALL: LoadName: | ||
ALL: ElfHeader { | ||
ALL: Sections [ | ||
ALL: Relocations [ | ||
ALL: Symbols [ | ||
ALL: ProgramHeaders [ | ||
ALL: Notes [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# In llvm-readobj, -s is an alias for --sections. | ||
RUN: llvm-readobj -s %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix SEC | ||
RUN: llvm-readobj --sections %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix SEC | ||
|
||
# In llvm-readelf, -s is an alias for --symbols. | ||
RUN: llvm-readelf -s %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix SYM | ||
RUN: llvm-readelf --symbols %p/Inputs/trivial.obj.elf-i386 \ | ||
RUN: | FileCheck %s -check-prefix SYM | ||
|
||
SEC: Sections [ | ||
SEC-NEXT: Section { | ||
SEC-NEXT: Index: 0 | ||
SEC-NEXT: Name: (0) | ||
SEC-NEXT: Type: SHT_NULL (0x0) | ||
SEC-NEXT: Flags [ (0x0) | ||
SEC-NEXT: ] | ||
SEC-NEXT: Address: 0x0 | ||
SEC-NEXT: Offset: 0x0 | ||
SEC-NEXT: Size: 0 | ||
SEC-NEXT: Link: 0 | ||
SEC-NEXT: Info: 0 | ||
SEC-NEXT: AddressAlignment: 0 | ||
SEC-NEXT: EntrySize: 0 | ||
SEC-NEXT: } | ||
SEC-NEXT: Section { | ||
SEC-NEXT: Index: 1 | ||
SEC-NEXT: Name: .text (5) | ||
SEC-NEXT: Type: SHT_PROGBITS (0x1) | ||
SEC-NEXT: Flags [ (0x6) | ||
SEC-NEXT: SHF_ALLOC (0x2) | ||
SEC-NEXT: SHF_EXECINSTR (0x4) | ||
SEC-NEXT: ] | ||
SEC-NEXT: Address: 0x0 | ||
SEC-NEXT: Offset: 0x40 | ||
SEC-NEXT: Size: 42 | ||
SEC-NEXT: Link: 0 | ||
SEC-NEXT: Info: 0 | ||
SEC-NEXT: AddressAlignment: 16 | ||
SEC-NEXT: EntrySize: 0 | ||
SEC-NEXT: } | ||
|
||
SYM: Symbol table '.symtab' contains {{.*}} entries: | ||
SYM-NEXT: Num: Value Size Type Bind Vis Ndx Name | ||
SYM-NEXT: 0: {{.*}} NOTYPE {{.*}} UND | ||
SYM-NEXT: 1: {{.*}} FILE {{.*}} trivial.ll | ||
SYM-NEXT: 2: {{.*}} OBJECT {{.*}} .L.str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.