mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
63dea2c952
This commit adds a new pass that can inject checks before indirect calls to make sure that these calls target known locations. It supports three types of checks and, at compile time, it can take the name of a custom function to call when an indirect call check fails. The default failure function ignores the error and continues. This pass incidentally moves the function JumpInstrTables::transformType from private to public and makes it static (with a new argument that specifies the table type to use); this is so that the CFI code can transform function types at call sites to determine which jump-instruction table to use for the check at that site. Also, this removes support for jumptables in ARM, pending further performance analysis and discussion. Review: http://reviews.llvm.org/D4167 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221708 91177308-0d34-0410-b5e6-96231b3b80d8
36 lines
939 B
LLVM
36 lines
939 B
LLVM
; RUN: llc <%s -fcfi -cfi-type=sub | FileCheck %s
|
|
; ModuleID = 'test.cc'
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|
|
|
|
@_ZTIPKc = external constant i8*
|
|
@_ZTIi = external constant i8*
|
|
|
|
define void @f() unnamed_addr jumptable {
|
|
ret void
|
|
}
|
|
|
|
@a = global void ()* @f
|
|
|
|
; Make sure invoke gets targeted as well as regular calls
|
|
define void @_Z3foov(void ()* %f) uwtable ssp {
|
|
; CHECK-LABEL: _Z3foov:
|
|
entry:
|
|
invoke void %f()
|
|
to label %try.cont unwind label %lpad
|
|
; CHECK: callq __llvm_cfi_pointer_warning
|
|
; CHECK: callq *%rbx
|
|
|
|
lpad:
|
|
%0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
|
|
catch i8* bitcast (i8** @_ZTIi to i8*)
|
|
filter [1 x i8*] [i8* bitcast (i8** @_ZTIPKc to i8*)]
|
|
ret void
|
|
|
|
try.cont:
|
|
ret void
|
|
}
|
|
|