-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many projects use this option. There are two ways to use it. You can either a) Just use --strip-debug and keep the old file with debug content or b) you can use --strip-debug, --only-keep-debug, and --add-gnu-debuglink all in conjunction to create two separate files, the stripped file and the debug file. --only-keep-debug is more complicated than --strip-debug because it keeps the section headers without keeping section contents. That's not really supported by llvm-objcopy at the moment but I plan on adding it. So this change just supports a) and options to support b) will come soon. Differential Revision: https://reviews.llvm.org/D39919 llvm-svn: 318094
- Loading branch information
1 parent
33f8399
commit 1bfefc1
Showing
2 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# RUN: yaml2obj %s > %t | ||
# RUN: llvm-objcopy -strip-debug %t %t2 | ||
# RUN: llvm-readobj -file-headers -sections -symbols %t2 | FileCheck %s | ||
|
||
!ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .debugfoo | ||
Type: SHT_PROGBITS | ||
Content: "00000000" | ||
- Name: .text | ||
Type: SHT_PROGBITS | ||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ] | ||
AddressAlign: 0x0000000000000010 | ||
Content: "00000000" | ||
Symbols: | ||
Global: | ||
- Name: foo | ||
Section: .text | ||
- Name: debugfoo | ||
Section: .debugfoo | ||
|
||
# CHECK: SectionHeaderCount: 5 | ||
|
||
# CHECK: Name: .text | ||
# CHECK: Name: .symtab | ||
# CHECK: Name: .strtab | ||
# CHECK: Name: .shstrtab | ||
|
||
# Check that *only* foo is copied and not debugfoo | ||
# CHECK: Symbols [ | ||
# CHECK-NEXT: Symbol { | ||
# CHECK-NEXT: Name: | ||
# CHECK-NEXT: Value: | ||
# CHECK-NEXT: Size: | ||
# CHECK-NEXT: Binding: | ||
# CHECK-NEXT: Type: | ||
# CHECK-NEXT: Other: | ||
# CHECK-NEXT: Section: Undefined | ||
# CHECK-NEXT: } | ||
# CHECK-NEXT: Symbol { | ||
# CHECK-NEXT: Name: foo | ||
# CHECK-NEXT: Value: | ||
# CHECK-NEXT: Size: | ||
# CHECK-NEXT: Binding: Global | ||
# CHECK-NEXT: Type: | ||
# CHECK-NEXT: Other: | ||
# CHECK-NEXT: Section: .text | ||
# CHECK-NEXT: } | ||
# CHECK-NEXT: ] |
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