[PATCH] D55237: LTO: Don't internalize available_externally globals.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 16:12:47 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348321: LTO: Don't internalize available_externally globals. (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55237?vs=176503&id=176727#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55237/new/

https://reviews.llvm.org/D55237

Files:
  llvm/trunk/lib/LTO/LTO.cpp
  llvm/trunk/test/LTO/Resolution/X86/available-externally.ll


Index: llvm/trunk/test/LTO/Resolution/X86/available-externally.ll
===================================================================
--- llvm/trunk/test/LTO/Resolution/X86/available-externally.ll
+++ llvm/trunk/test/LTO/Resolution/X86/available-externally.ll
@@ -0,0 +1,16 @@
+; RUN: opt -module-summary -o %t.bc %s
+; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,px -r %t.bc,bar, -o %t2
+; RUN: llvm-nm %t2.1 | FileCheck %s
+
+; CHECK: U bar
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void ()* @foo() {
+  ret void ()* @bar
+}
+
+define available_externally void @bar() {
+  ret void
+}
Index: llvm/trunk/lib/LTO/LTO.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTO.cpp
+++ llvm/trunk/lib/LTO/LTO.cpp
@@ -365,7 +365,10 @@
                // Ignore local and appending linkage values since the linker
                // doesn't resolve them.
                !GlobalValue::isLocalLinkage(S->linkage()) &&
-               !GlobalValue::isAppendingLinkage(S->linkage()))
+               S->linkage() != GlobalValue::AppendingLinkage &&
+               // We can't internalize available_externally globals because this
+               // can break function pointer equality.
+               S->linkage() != GlobalValue::AvailableExternallyLinkage)
       S->setLinkage(GlobalValue::InternalLinkage);
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55237.176727.patch
Type: text/x-patch
Size: 1422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/e4b35472/attachment.bin>


More information about the llvm-commits mailing list