aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-11-15 11:28:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-11-15 11:28:02 +0000
commit669733def213b68bd7ec5d82d00cf5f0b4265bfb (patch)
treeaa08f1d06b71808a9d52bb18296b932f4c4081dc
parentec774bd9f013421113ab1b79420d1266d106a0c5 (diff)
downloadsrc-669733def213b68bd7ec5d82d00cf5f0b4265bfb.tar.gz
src-669733def213b68bd7ec5d82d00cf5f0b4265bfb.zip
MFC r367623:
Merge commit 8df4e6094 from llvm git (by Fangrui Song): [ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections Fixes PR48071 * The Rust compiler produces SHF_ALLOC `.debug_gdb_scripts` (which normally does not have the flag) * `.debug_gdb_scripts` sections are removed from `inputSections` due to --strip-debug/--strip-all * When processing --gc-sections, pieces of a SHF_MERGE section can be marked live separately `=>` segfault when marking liveness of a `.debug_gdb_scripts` which is not split into pieces (because it is not in `inputSections`) This patch circumvents the problem by not treating SHF_ALLOC ".debug*" as debug sections (to prevent --strip-debug's stripping) (which is still useful on its own). Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D91291 This should fix lld segfaulting when linking the rust-based parts of the devel/py-maturin port. Reported by: Nick Venenga <nijave@gmail.com> PR: 250783
Notes
Notes: svn path=/stable/11/; revision=367704
-rw-r--r--contrib/llvm-project/lld/ELF/InputSection.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/llvm-project/lld/ELF/InputSection.h b/contrib/llvm-project/lld/ELF/InputSection.h
index fe2c3c516a96..8098e813d18a 100644
--- a/contrib/llvm-project/lld/ELF/InputSection.h
+++ b/contrib/llvm-project/lld/ELF/InputSection.h
@@ -358,7 +358,8 @@ private:
};
inline bool isDebugSection(const InputSectionBase &sec) {
- return sec.name.startswith(".debug") || sec.name.startswith(".zdebug");
+ return (sec.flags & llvm::ELF::SHF_ALLOC) == 0 &&
+ (sec.name.startswith(".debug") || sec.name.startswith(".zdebug"));
}
// The list of all input sections.