summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-06-15 22:16:51 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-06-15 22:16:51 +0000
commit58af6d1594778173f757131bdc25f850e00c7420 (patch)
tree773688f5bebc8273170d7831d24aa314dc5d8f58
parent1b66f5dc82a82ab0a3c0ea837bafc7a00e792b32 (diff)
downloadbcm5719-llvm-58af6d1594778173f757131bdc25f850e00c7420.tar.gz
bcm5719-llvm-58af6d1594778173f757131bdc25f850e00c7420.zip
Add safestack attribute to LLVMAttribute enum and Go bindings. Correct
constants in commented-out part of LLVMAttribute enum. Add tests that verify that the safestack attribute is only allowed as a function attribute. llvm-svn: 239772
-rw-r--r--llvm/bindings/go/llvm/ir.go2
-rw-r--r--llvm/bindings/go/llvm/ir_test.go2
-rw-r--r--llvm/include/llvm-c/Core.h18
-rw-r--r--llvm/test/Assembler/invalid-safestack-param.ll4
-rw-r--r--llvm/test/Assembler/invalid-safestack-return.ll4
5 files changed, 21 insertions, 9 deletions
diff --git a/llvm/bindings/go/llvm/ir.go b/llvm/bindings/go/llvm/ir.go
index e5916a1bacf..1f00cd58473 100644
--- a/llvm/bindings/go/llvm/ir.go
+++ b/llvm/bindings/go/llvm/ir.go
@@ -160,6 +160,8 @@ const (
InAllocaAttribute Attribute = 1 << 43
NonNullAttribute Attribute = 1 << 44
JumpTableAttribute Attribute = 1 << 45
+ ConvergentAttribute Attribute = 1 << 46
+ SafeStackAttribute Attribute = 1 << 47
)
//-------------------------------------------------------------------------
diff --git a/llvm/bindings/go/llvm/ir_test.go b/llvm/bindings/go/llvm/ir_test.go
index 981c94aa63e..edeeab935db 100644
--- a/llvm/bindings/go/llvm/ir_test.go
+++ b/llvm/bindings/go/llvm/ir_test.go
@@ -53,6 +53,7 @@ func TestAttributes(t *testing.T) {
{AlwaysInlineAttribute, "alwaysinline"},
{BuiltinAttribute, "builtin"},
{ByValAttribute, "byval"},
+ {ConvergentAttribute, "convergent"},
{InAllocaAttribute, "inalloca"},
{InlineHintAttribute, "inlinehint"},
{InRegAttribute, "inreg"},
@@ -78,6 +79,7 @@ func TestAttributes(t *testing.T) {
{ReturnedAttribute, "returned"},
{ReturnsTwiceAttribute, "returns_twice"},
{SExtAttribute, "signext"},
+ {SafeStackAttribute, "safestack"},
{StackProtectAttribute, "ssp"},
{StackProtectReqAttribute, "sspreq"},
{StackProtectStrongAttribute, "sspstrong"},
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 73bff0b7ec4..874d46386bf 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -161,15 +161,15 @@ typedef enum {
/* FIXME: These attributes are currently not included in the C API as
a temporary measure until the API/ABI impact to the C API is understood
and the path forward agreed upon.
- LLVMAddressSafety = 1ULL << 32,
- LLVMStackProtectStrongAttribute = 1ULL<<33,
- LLVMCold = 1ULL << 34,
- LLVMOptimizeNone = 1ULL << 35,
- LLVMInAllocaAttribute = 1ULL << 36,
- LLVMNonNullAttribute = 1ULL << 37,
- LLVMJumpTableAttribute = 1ULL << 38,
- LLVMDereferenceableAttribute = 1ULL << 39,
- LLVMDereferenceableOrNullAttribute = 1ULL << 40,
+ LLVMSanitizeAddressAttribute = 1ULL << 32,
+ LLVMStackProtectStrongAttribute = 1ULL<<35,
+ LLVMColdAttribute = 1ULL << 40,
+ LLVMOptimizeNoneAttribute = 1ULL << 42,
+ LLVMInAllocaAttribute = 1ULL << 43,
+ LLVMNonNullAttribute = 1ULL << 44,
+ LLVMJumpTableAttribute = 1ULL << 45,
+ LLVMConvergentAttribute = 1ULL << 46,
+ LLVMSafeStackAttribute = 1ULL << 47,
*/
} LLVMAttribute;
diff --git a/llvm/test/Assembler/invalid-safestack-param.ll b/llvm/test/Assembler/invalid-safestack-param.ll
new file mode 100644
index 00000000000..b9046c4c33b
--- /dev/null
+++ b/llvm/test/Assembler/invalid-safestack-param.ll
@@ -0,0 +1,4 @@
+; RUN: not llvm-as -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: error: invalid use of function-only attribute
+declare void @foo(i32 safestack %x)
diff --git a/llvm/test/Assembler/invalid-safestack-return.ll b/llvm/test/Assembler/invalid-safestack-return.ll
new file mode 100644
index 00000000000..605e72e84c8
--- /dev/null
+++ b/llvm/test/Assembler/invalid-safestack-return.ll
@@ -0,0 +1,4 @@
+; RUN: not llvm-as -o /dev/null %s 2>&1 | FileCheck %s
+
+; CHECK: error: invalid use of function-only attribute
+declare safestack void @foo()
OpenPOWER on IntegriCloud