Index: test/NaCl/PNaClABI/global-attributes.ll |
diff --git a/test/NaCl/PNaClABI/global-attributes.ll b/test/NaCl/PNaClABI/global-attributes.ll |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0690bd4a5f84a42bc72a91c7f18bb3b7c536df5b |
--- /dev/null |
+++ b/test/NaCl/PNaClABI/global-attributes.ll |
@@ -0,0 +1,68 @@ |
+; RUN: not pnacl-abicheck < %s | FileCheck %s |
+ |
+; Global variable attributes |
+ |
+; CHECK: Variable var_with_section has disallowed "section" attribute |
+@var_with_section = internal global [1 x i8] zeroinitializer, section ".some_section" |
+ |
+; PNaCl programs can depend on data alignments in general, so we allow |
+; "align" on global variables. |
+; CHECK-NOT: var_with_alignment |
+@var_with_alignment = internal global [4 x i8] zeroinitializer, align 8 |
+ |
+; TLS variables must be expanded out by ExpandTls. |
+; CHECK-NEXT: Variable tls_var has disallowed "thread_local" attribute |
+@tls_var = internal thread_local global [4 x i8] zeroinitializer |
+ |
+; CHECK-NEXT: Variable var_with_unnamed_addr has disallowed "unnamed_addr" attribute |
+@var_with_unnamed_addr = internal unnamed_addr constant [1 x i8] c"x" |
+ |
+; CHECK-NEXT: Variable var_ext_init has disallowed "externally_initialized" attribute |
+@var_ext_init = internal externally_initialized global [1 x i8] c"x" |
+ |
+ |
+; Function attributes |
+ |
+; CHECK-NEXT: Function func_with_attrs has disallowed attributes: noreturn nounwind |
+define internal void @func_with_attrs() noreturn nounwind { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_arg_attrs has disallowed attributes: inreg zeroext |
+define internal void @func_with_arg_attrs(i32 inreg zeroext) { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_callingconv has disallowed calling convention: fastcc (8) |
+define internal fastcc void @func_with_callingconv() { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_section has disallowed "section" attribute |
+define internal void @func_with_section() section ".some_section" { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_alignment has disallowed "align" attribute |
+define internal void @func_with_alignment() align 1 { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_gc has disallowed "gc" attribute |
+define internal void @func_with_gc() gc "my_gc_func" { |
+ ret void |
+} |
+ |
+; CHECK-NEXT: Function func_with_unnamed_addr has disallowed "unnamed_addr" attribute |
+define internal void @func_with_unnamed_addr() unnamed_addr { |
+ ret void |
+} |
+ |
+; CHECK-NOT: disallowed |
+; If another check is added, there should be a check-not in between each check |
+ |
+ |
+; This stops the verifier from complaining about the lack of an entry point. |
+define void @_start(i32 %arg) { |
+ ret void |
+} |