aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-14 17:02:39 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-14 17:02:39 -0700
commit8dd5d093f3f298dd140256c56248bb18e4ac8295 (patch)
treed1db369774fcdfa50fd6bee892f12e1314ae482b
parent263d9c76d6975df0a864396919c326063380f75e (diff)
PNaCl ABI: Disallow the "available_externally" linkage type
"define available_externally void @foo()" would mean that the definition of foo() can be dropped from the pexe, because a definition of foo() can be found in an external native library. This is not something we support for a PNaCl pexe. Clang generates "available_externally" for non-static inline function definitions at -O1, but not at -O0, and generally not at -O2 either because inlining removes the "available_externally" definition. "available_externally" gets removed at bitcode link time, so we can disallow it in the ABI checker without any further work required. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3495 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17035015
-rw-r--r--lib/Analysis/NaCl/PNaClABIVerifyModule.cpp1
-rw-r--r--test/NaCl/PNaClABI/linkagetypes.ll8
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
index c0a5e4bcc2..2cc6572606 100644
--- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
+++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp
@@ -108,7 +108,6 @@ void PNaClABIVerifyModule::checkGlobalValueCommon(const GlobalValue *GV) {
switch (GV->getLinkage()) {
// TODO(dschuff): Disallow external linkage
case GlobalValue::ExternalLinkage:
- case GlobalValue::AvailableExternallyLinkage:
case GlobalValue::InternalLinkage:
break;
default:
diff --git a/test/NaCl/PNaClABI/linkagetypes.ll b/test/NaCl/PNaClABI/linkagetypes.ll
index 61a5286838..fffaadc2ee 100644
--- a/test/NaCl/PNaClABI/linkagetypes.ll
+++ b/test/NaCl/PNaClABI/linkagetypes.ll
@@ -35,6 +35,7 @@ target triple = "le32-unknown-nacl"
@gv_extern_weak = extern_weak global [1 x i8]
; CHECK: gv_extern_weak has disallowed linkage type: extern_weak
@gv_avilable_externally = available_externally global [1 x i8] c"x"
+; CHECK: gv_avilable_externally has disallowed linkage type: available_externally
; CHECK-NOT: disallowed
@@ -75,4 +76,9 @@ define dllexport void @dllexport_func() {
}
; CHECK-NEXT: Function extern_weak_func is declared but not defined (disallowed)
; CHECK-NEXT: Function extern_weak_func has disallowed linkage type: extern_weak
-declare extern_weak void @extern_weak_func() \ No newline at end of file
+declare extern_weak void @extern_weak_func()
+
+; CHECK-NEXT: Function avail_ext_func has disallowed linkage type: available_externally
+define available_externally void @avail_ext_func() {
+ ret void
+}