diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index dfe843e1d4b7a4be9221208b60287ef7013f3348..3c25d2f26eadfd54a7960ac0931b5b8205c0d8e5 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -434,6 +434,8 @@ static Error replaceAndRemoveSections(const CommonConfig &Config, return false; if (StringRef(Sec.Name).startswith(".gnu.warning")) return false; + if (StringRef(Sec.Name).startswith(".gnu_debuglink")) + return false; // We keep the .ARM.attribute section to maintain compatibility // with Debian derived distributions. This is a bug in their // patchset as documented here: diff --git a/llvm/test/tools/llvm-objcopy/ELF/strip-all.test b/llvm/test/tools/llvm-objcopy/ELF/strip-all.test index 20f3c9addf556b981440b6e075e6e532f9fc0797..ba27a3509c6a31c786187683eaaa11b1c6e8cf8e 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-all.test +++ b/llvm/test/tools/llvm-objcopy/ELF/strip-all.test @@ -68,16 +68,19 @@ Sections: Flags: [ ] - Name: .gnu.warning.foo Type: SHT_PROGBITS + - Name: .gnu_debuglink + Type: SHT_PROGBITS ProgramHeaders: # Use an arbitrary segment type to show that the segment type is unimportant. - Type: 0x61234567 FirstSec: non_alloc_in_segment LastSec: non_alloc_in_segment -# CHECK: SectionHeaderCount: 6 +# CHECK: SectionHeaderCount: 7 # CHECK: Name: non_alloc_in_segment # CHECK: Name: .bss # CHECK: Name: .text # CHECK: Name: .gnu.warning.foo +# CHECK: Name: .gnu_debuglink # CHECK: Name: .shstrtab