[PATCH] [Core] Do not reclaim absolute atoms in resolver
Davide Italiano
davide at freebsd.org
Sun Feb 22 21:09:32 PST 2015
Hi ruiu, shankarke, Bigcheese,
After discussion with Rui, he explained me the Resolver shouldn't reclaim absolute atoms at all.
This was found out while testing --gc-sections for the GNU driver, which cause lld to crash because of reclaim of absolute atoms.
The patch proposed is supposed to fix the problem.
I modified an existing test rather than adding a new one. Let me know if it's fine for you.
http://reviews.llvm.org/D7823
Files:
lib/Core/Resolver.cpp
test/core/absolute-basic.objtxt
Index: lib/Core/Resolver.cpp
===================================================================
--- lib/Core/Resolver.cpp
+++ lib/Core/Resolver.cpp
@@ -383,11 +383,16 @@
// Some type of references prevent referring atoms to be dead-striped.
// Make a reverse map of such references before traversing the graph.
- for (const Atom *atom : _atoms)
+ // While traversing the list of atoms, mark AbsoluteAtoms as live
+ // in order to avoid reclaim.
+ for (const Atom *atom : _atoms) {
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(atom))
for (const Reference *ref : *defAtom)
if (isBackref(ref))
_reverseRef[ref->target()].insert(atom);
+ if (const AbsoluteAtom *absAtom = dyn_cast<AbsoluteAtom>(atom))
+ markLive(absAtom);
+ }
// By default, shared libraries are built with all globals as dead strip roots
if (_context.globalsAreDeadStripRoots())
Index: test/core/absolute-basic.objtxt
===================================================================
--- test/core/absolute-basic.objtxt
+++ test/core/absolute-basic.objtxt
@@ -1,4 +1,4 @@
-# RUN: lld -core %s | FileCheck %s
+# RUN: lld -core --dead-strip %s | FileCheck %s
#
# Test that absolute symbols are parsed and preserved
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7823.20485.patch
Type: text/x-patch
Size: 1252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150223/c01674ff/attachment.bin>
More information about the llvm-commits
mailing list