[PATCH] Avoid internalizing dllexported symbols
Yunzhong Gao
Yunzhong_Gao at playstation.sony.com
Wed Nov 27 11:10:49 PST 2013
ygao added you to the CC list for the revision "Avoid internalizing dllexported symbols".
Hi,
This patch teaches Internalize pass to skip dllexported symbols because they could be
referenced in a way that even the linker does not see. This is similar to r100269+r127138
for available_externally symbols.
Could someone take a look whether this is good to go in?
Thanks,
- Gao.
http://llvm-reviews.chandlerc.com/D2280
Files:
test/Transforms/Internalize/lists.ll
lib/Transforms/IPO/Internalize.cpp
Index: test/Transforms/Internalize/lists.ll
===================================================================
--- test/Transforms/Internalize/lists.ll
+++ test/Transforms/Internalize/lists.ll
@@ -48,3 +48,12 @@
define available_externally void @bar() {
ret void
}
+
+; ALL: define dllexport void @export_foo() {
+; FOO_AND_J: define dllexport void @export_foo() {
+; FOO_AND_BAR: define dllexport void @export_foo() {
+; FOO_J_AND_BAR: define dllexport void @export_foo() {
+define dllexport void @export_foo() {
+ ret void
+}
+
Index: lib/Transforms/IPO/Internalize.cpp
===================================================================
--- lib/Transforms/IPO/Internalize.cpp
+++ lib/Transforms/IPO/Internalize.cpp
@@ -115,6 +115,10 @@
if (GV.hasAvailableExternallyLinkage())
return false;
+ // Assume that dllexported symbols are referenced elsewhere
+ if (GV.hasDLLExportLinkage())
+ return false;
+
// Already has internal linkage
if (GV.hasLocalLinkage())
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2280.1.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131127/f0be6ee2/attachment.bin>
More information about the llvm-commits
mailing list