mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Revert "[llvm-objcopy] Match GNU behaviour regarding file symbols"
This reverts commit 7c65e88d0bc85ff2732a4e23c397ff842b97b828. Broke non ELF targets.
This commit is contained in:
parent
1e469f4962
commit
920851081d
@ -9,16 +9,6 @@
|
|||||||
# RUN: llvm-strip --keep-file-symbols --strip-symbol foo %t -o %t4
|
# RUN: llvm-strip --keep-file-symbols --strip-symbol foo %t -o %t4
|
||||||
# RUN: llvm-readobj --symbols %t4 | FileCheck %s --check-prefix=STRIP
|
# RUN: llvm-readobj --symbols %t4 | FileCheck %s --check-prefix=STRIP
|
||||||
|
|
||||||
# RUN: llvm-objcopy --keep-file-symbols --strip-debug %t %t5
|
|
||||||
# RUN: llvm-readobj --symbols %t5 | FileCheck %s --check-prefix=STRIPDEBUG
|
|
||||||
# RUN: llvm-objcopy --keep-file-symbols --strip-unneeded %t %t6
|
|
||||||
# RUN: llvm-readobj --symbols %t6 | FileCheck %s --check-prefix=STRIPDEBUG
|
|
||||||
|
|
||||||
# RUN: llvm-strip --keep-file-symbols --strip-debug %t -o %t7
|
|
||||||
# RUN: llvm-readobj --symbols %t7 | FileCheck %s --check-prefix=STRIPDEBUG
|
|
||||||
# RUN: llvm-strip --keep-file-symbols --strip-unneeded %t -o %t8
|
|
||||||
# RUN: llvm-readobj --symbols %t8 | FileCheck %s --check-prefix=STRIPDEBUG
|
|
||||||
|
|
||||||
!ELF
|
!ELF
|
||||||
FileHeader:
|
FileHeader:
|
||||||
Class: ELFCLASS64
|
Class: ELFCLASS64
|
||||||
@ -26,9 +16,6 @@ FileHeader:
|
|||||||
Type: ET_REL
|
Type: ET_REL
|
||||||
Machine: EM_X86_64
|
Machine: EM_X86_64
|
||||||
Sections:
|
Sections:
|
||||||
- Name: .debugfoo
|
|
||||||
Type: SHT_PROGBITS
|
|
||||||
Content: "00000000"
|
|
||||||
- Name: .text
|
- Name: .text
|
||||||
Type: SHT_PROGBITS
|
Type: SHT_PROGBITS
|
||||||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
||||||
@ -43,9 +30,6 @@ Symbols:
|
|||||||
Type: STT_FUNC
|
Type: STT_FUNC
|
||||||
Section: .text
|
Section: .text
|
||||||
Binding: STB_GLOBAL
|
Binding: STB_GLOBAL
|
||||||
- Name: debugfoo
|
|
||||||
Section: .debugfoo
|
|
||||||
Binding: STB_GLOBAL
|
|
||||||
|
|
||||||
#STRIPALL: Symbols [
|
#STRIPALL: Symbols [
|
||||||
#STRIPALL-NEXT: Symbol {
|
#STRIPALL-NEXT: Symbol {
|
||||||
@ -96,43 +80,4 @@ Symbols:
|
|||||||
#STRIP-NEXT: Other: 0
|
#STRIP-NEXT: Other: 0
|
||||||
#STRIP-NEXT: Section: .text
|
#STRIP-NEXT: Section: .text
|
||||||
#STRIP-NEXT: }
|
#STRIP-NEXT: }
|
||||||
#STRIP-NEXT: Symbol {
|
|
||||||
#STRIP-NEXT: Name: debugfoo
|
|
||||||
#STRIP-NEXT: Value: 0x0
|
|
||||||
#STRIP-NEXT: Size: 0
|
|
||||||
#STRIP-NEXT: Binding: Global
|
|
||||||
#STRIP-NEXT: Type: None
|
|
||||||
#STRIP-NEXT: Other: 0
|
|
||||||
#STRIP-NEXT: Section: .debugfoo
|
|
||||||
#STRIP-NEXT: }
|
|
||||||
#STRIP-NEXT:]
|
#STRIP-NEXT:]
|
||||||
|
|
||||||
#STRIPDEBUG: Symbols [
|
|
||||||
#STRIPDEBUG-NEXT: Symbol {
|
|
||||||
#STRIPDEBUG-NEXT: Name:
|
|
||||||
#STRIPDEBUG-NEXT: Value: 0x0
|
|
||||||
#STRIPDEBUG-NEXT: Size: 0
|
|
||||||
#STRIPDEBUG-NEXT: Binding: Local
|
|
||||||
#STRIPDEBUG-NEXT: Type: None
|
|
||||||
#STRIPDEBUG-NEXT: Other: 0
|
|
||||||
#STRIPDEBUG-NEXT: Section: Undefined
|
|
||||||
#STRIPDEBUG-NEXT: }
|
|
||||||
#STRIPDEBUG-NEXT: Symbol {
|
|
||||||
#STRIPDEBUG-NEXT: Name: foo
|
|
||||||
#STRIPDEBUG-NEXT: Value: 0x0
|
|
||||||
#STRIPDEBUG-NEXT: Size: 0
|
|
||||||
#STRIPDEBUG-NEXT: Binding: Local
|
|
||||||
#STRIPDEBUG-NEXT: Type: File
|
|
||||||
#STRIPDEBUG-NEXT: Other: 0
|
|
||||||
#STRIPDEBUG-NEXT: Section: .text
|
|
||||||
#STRIPDEBUG-NEXT: }
|
|
||||||
#STRIPDEBUG-NEXT: Symbol {
|
|
||||||
#STRIPDEBUG-NEXT: Name: bar
|
|
||||||
#STRIPDEBUG-NEXT: Value: 0x0
|
|
||||||
#STRIPDEBUG-NEXT: Size: 0
|
|
||||||
#STRIPDEBUG-NEXT: Binding: Global
|
|
||||||
#STRIPDEBUG-NEXT: Type: Function
|
|
||||||
#STRIPDEBUG-NEXT: Other: 0
|
|
||||||
#STRIPDEBUG-NEXT: Section: .text
|
|
||||||
#STRIPDEBUG-NEXT: }
|
|
||||||
#STRIPDEBUG-NEXT:]
|
|
@ -116,8 +116,6 @@ Symbols:
|
|||||||
- Name: debugfoo
|
- Name: debugfoo
|
||||||
Section: .debugfoo
|
Section: .debugfoo
|
||||||
Binding: STB_GLOBAL
|
Binding: STB_GLOBAL
|
||||||
- Name: filesymbol
|
|
||||||
Type: STT_FILE
|
|
||||||
|
|
||||||
# CHECK: SectionHeaderCount: 5
|
# CHECK: SectionHeaderCount: 5
|
||||||
|
|
||||||
@ -126,7 +124,7 @@ Symbols:
|
|||||||
# CHECK: Name: .strtab
|
# CHECK: Name: .strtab
|
||||||
# CHECK: Name: .shstrtab
|
# CHECK: Name: .shstrtab
|
||||||
|
|
||||||
# Check that *only* foo is copied and not debugfoo or filesymbol.
|
# Check that *only* foo is copied and not debugfoo
|
||||||
# CHECK: Symbols [
|
# CHECK: Symbols [
|
||||||
# CHECK-NEXT: Symbol {
|
# CHECK-NEXT: Symbol {
|
||||||
# CHECK-NEXT: Name:
|
# CHECK-NEXT: Name:
|
||||||
|
@ -667,10 +667,8 @@ parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
|
|||||||
Config.KeepFileSymbols = InputArgs.hasArg(OBJCOPY_keep_file_symbols);
|
Config.KeepFileSymbols = InputArgs.hasArg(OBJCOPY_keep_file_symbols);
|
||||||
Config.DecompressDebugSections =
|
Config.DecompressDebugSections =
|
||||||
InputArgs.hasArg(OBJCOPY_decompress_debug_sections);
|
InputArgs.hasArg(OBJCOPY_decompress_debug_sections);
|
||||||
if (Config.DiscardMode == DiscardType::All) {
|
if (Config.DiscardMode == DiscardType::All)
|
||||||
Config.StripDebug = true;
|
Config.StripDebug = true;
|
||||||
Config.KeepFileSymbols = true;
|
|
||||||
}
|
|
||||||
for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbol))
|
for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbol))
|
||||||
if (Error E = Config.SymbolsToLocalize.addMatcher(NameOrPattern::create(
|
if (Error E = Config.SymbolsToLocalize.addMatcher(NameOrPattern::create(
|
||||||
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
|
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
|
||||||
@ -940,10 +938,8 @@ parseStripOptions(ArrayRef<const char *> ArgsArr,
|
|||||||
!Config.StripAllGNU && Config.SymbolsToRemove.empty())
|
!Config.StripAllGNU && Config.SymbolsToRemove.empty())
|
||||||
Config.StripAll = true;
|
Config.StripAll = true;
|
||||||
|
|
||||||
if (Config.DiscardMode == DiscardType::All) {
|
if (Config.DiscardMode == DiscardType::All)
|
||||||
Config.StripDebug = true;
|
Config.StripDebug = true;
|
||||||
Config.KeepFileSymbols = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Config.DeterministicArchives =
|
Config.DeterministicArchives =
|
||||||
InputArgs.hasFlag(STRIP_enable_deterministic_archives,
|
InputArgs.hasFlag(STRIP_enable_deterministic_archives,
|
||||||
|
@ -420,9 +420,6 @@ static Error updateAndRemoveSymbols(const CopyConfig &Config, Object &Obj) {
|
|||||||
if (Config.StripAll || Config.StripAllGNU)
|
if (Config.StripAll || Config.StripAllGNU)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Config.StripDebug && Sym.Type == STT_FILE)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (Config.SymbolsToRemove.matches(Sym.Name))
|
if (Config.SymbolsToRemove.matches(Sym.Name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user