OSDN Git Service

[lld-link] preserve @llvm.used symbols in LTO
authorBob Haarman <llvm@inglorion.net>
Wed, 20 Feb 2019 00:26:01 +0000 (00:26 +0000)
committerBob Haarman <llvm@inglorion.net>
Wed, 20 Feb 2019 00:26:01 +0000 (00:26 +0000)
Summary:
We translate @llvm.used to COFF by generating /include directives
in the .drectve section. However, in LTO links, this happens after
directives have already been processed, so the new directives do
not take effect. This change marks @llvm.used symbols as GCRoots
so that they are preserved as intended.

Fixes PR40733.

Reviewers: rnk, pcc, ruiu

Reviewed By: ruiu

Subscribers: mehdi_amini, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58255

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354410 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/LTO/LTO.h

index 1f9d764..ab4d874 100644 (file)
@@ -139,6 +139,7 @@ public:
     using irsymtab::Symbol::getCOFFWeakExternalFallback;
     using irsymtab::Symbol::getSectionName;
     using irsymtab::Symbol::isExecutable;
+    using irsymtab::Symbol::isUsed;
   };
 
   /// A range over the symbols in this InputFile.