-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ObjCopy: support
--dump-section
on COFF
Add support for --dump-section on COFF files. This is helpful for extracting specific content from an object file on Windows. Differential Revision: https://reviews.llvm.org/D150305 Reviewed By: @alexander-shaposhnikov, @jhenderson, @hjyamauchi
- Loading branch information
Showing
3 changed files
with
72 additions
and
8 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
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,35 @@ | ||
# RUN: yaml2obj %s -o %t.obj | ||
# RUN: llvm-objcopy --dump-section .data=%t.dat %t.obj | ||
# RUN: wc -c %t.dat | FileCheck %s --ignore-case -check-prefix CHECK-EMPTY-SIZE | ||
# RUN: llvm-objcopy --dump-section .text.f=%t.txt %t.obj | ||
# RUN: od -t x1 %t.txt | FileCheck %s --ignore-case -check-prefix CHECK-TEXT-F | ||
# RUN: not llvm-objcopy --dump-section non-existent=/dev/null %t.obj 2>&1 | FileCheck %s -check-prefix CHECK-NO-SECTION | ||
# RUN: not llvm-objcopy --dump-section .text=%T %t.obj 2>&1 | FileCheck -DOBJ=%t.obj -DMSG=%errc_EISDIR %s -check-prefix CHECK-INVALID-DESTINATION | ||
|
||
# CHECK-EMPTY-SIZE: 0 | ||
|
||
# CHECK-TEXT-F: 0000000 b8 20 00 00 00 c3 | ||
|
||
# CHECK-NO-SECTION: section 'non-existent' not found | ||
|
||
# CHECK-INVALID-DESTINATION: error: '[[OBJ]]': [[MSG]] | ||
|
||
--- !COFF | ||
header: | ||
Machine: IMAGE_FILE_MACHINE_AMD64 | ||
Characteristics: [ ] | ||
sections: | ||
- Name: .text | ||
Characteristics: [ ] | ||
Alignment: 4 | ||
SectionData: '' | ||
- Name: .data | ||
Characteristics: [ ] | ||
Alignment: 4 | ||
SectionData: '' | ||
- Name: .text.f | ||
Characteristics: [ ] | ||
Alignment: 16 | ||
SectionData: B820000000C3 | ||
symbols: | ||
... |