diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-07 16:35:57 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-07 16:35:57 +0000 |
commit | 62ed8d3e35d25853e32db946a0a60da0bbf862e1 (patch) | |
tree | 75efb8772a0567777f39114fbce38e526f85807d /test | |
parent | 47b0c0a9a0d920917e1fb10ac1c851c6e3b8aa27 (diff) | |
download | external_llvm-62ed8d3e35d25853e32db946a0a60da0bbf862e1.zip external_llvm-62ed8d3e35d25853e32db946a0a60da0bbf862e1.tar.gz external_llvm-62ed8d3e35d25853e32db946a0a60da0bbf862e1.tar.bz2 |
Support OpenBSD's native frame protection conventions.
OpenBSD's stack smashing protection differs slightly from other
platforms:
1. The smash handler function is "__stack_smash_handler(const char
*funcname)" instead of "__stack_chk_fail(void)".
2. There's a hidden "long __guard_local" object that gets linked
into each executable and DSO.
Patch by Matthew Dempsky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/X86/stack-protector.ll | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/CodeGen/X86/stack-protector.ll b/test/CodeGen/X86/stack-protector.ll index 1e9ca1d..6191ce6 100644 --- a/test/CodeGen/X86/stack-protector.ll +++ b/test/CodeGen/X86/stack-protector.ll @@ -2,6 +2,7 @@ ; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-X64 %s ; RUN: llc -code-model=kernel -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-KERNEL-X64 %s ; RUN: llc -mtriple=x86_64-apple-darwin < %s -o - | FileCheck --check-prefix=DARWIN-X64 %s +; RUN: llc -mtriple=amd64-pc-openbsd < %s -o - | FileCheck --check-prefix=OPENBSD-AMD64 %s %struct.foo = type { [16 x i8] } %struct.foo.0 = type { [4 x i8] } @@ -69,6 +70,10 @@ entry: ; DARWIN-X64: test1b: ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard ; DARWIN-X64: callq ___stack_chk_fail + +; OPENBSD-AMD64: test1b: +; OPENBSD-AMD64: movq __guard_local(%rip) +; OPENBSD-AMD64: callq __stack_smash_handler %a.addr = alloca i8*, align 8 %buf = alloca [16 x i8], align 16 store i8* %a, i8** %a.addr, align 8 |