[PATCH] D58255: [lld-link] preserve @llvm.used symbols in LTO
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 19 16:25:35 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354410: [lld-link] preserve @llvm.used symbols in LTO (authored by inglorion, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58255?vs=186924&id=187469#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58255/new/
https://reviews.llvm.org/D58255
Files:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/test/COFF/used-lto.ll
llvm/trunk/include/llvm/LTO/LTO.h
Index: lld/trunk/test/COFF/used-lto.ll
===================================================================
--- lld/trunk/test/COFF/used-lto.ll
+++ lld/trunk/test/COFF/used-lto.ll
@@ -0,0 +1,15 @@
+; REQUIRES: x86
+; RUN: llvm-as -o %t.obj %s
+; RUN: lld-link -dll -debug -opt:ref -noentry -out:%t.dll %t.obj
+; RUN: llvm-pdbutil dump -publics %t.pdb | FileCheck %s
+
+; CHECK: S_PUB32 {{.*}} `foo`
+
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+ at llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
+
+define void @foo() {
+ ret void
+}
Index: lld/trunk/COFF/InputFiles.cpp
===================================================================
--- lld/trunk/COFF/InputFiles.cpp
+++ lld/trunk/COFF/InputFiles.cpp
@@ -688,6 +688,8 @@
Sym = Symtab->addRegular(this, SymName);
}
Symbols.push_back(Sym);
+ if (ObjSym.isUsed())
+ Config->GCRoot.push_back(Sym);
}
Directives = Obj->getCOFFLinkerOpts();
}
Index: llvm/trunk/include/llvm/LTO/LTO.h
===================================================================
--- llvm/trunk/include/llvm/LTO/LTO.h
+++ llvm/trunk/include/llvm/LTO/LTO.h
@@ -139,6 +139,7 @@
using irsymtab::Symbol::getCOFFWeakExternalFallback;
using irsymtab::Symbol::getSectionName;
using irsymtab::Symbol::isExecutable;
+ using irsymtab::Symbol::isUsed;
};
/// A range over the symbols in this InputFile.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58255.187469.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190220/198e145f/attachment.bin>
More information about the llvm-commits
mailing list