[llvm] Make llvm-strip not eat the .gnu_debuglink section (PR #78919)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 21 16:02:47 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: Felix Kellenbenz (felixkellenbenz)

<details>
<summary>Changes</summary>

This fixes #<!-- -->57407 and therefore makes `llvm-strip` not remove the `.gnu_debuglink` section when used as described in #<!-- -->57407.

---
Full diff: https://github.com/llvm/llvm-project/pull/78919.diff


1 Files Affected:

- (modified) llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp (+2) 


``````````diff
diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
index daf03810fd7bff..b6d77d17bae36c 100644
--- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
+++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
@@ -450,6 +450,8 @@ static Error replaceAndRemoveSections(const CommonConfig &Config,
         return false;
       if (StringRef(Sec.Name).starts_with(".gnu.warning"))
         return false;
+      if (StringRef(Sec.Name).starts_with(".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:

``````````

</details>


https://github.com/llvm/llvm-project/pull/78919


More information about the llvm-commits mailing list