Itay Bookstein 848812a55e [Verifier] Add verification logic for GlobalIFuncs
Verify that the resolver exists, that it is a defined
Function, and that its return type matches the ifunc's
type. Add corresponding check to BitcodeReader, change
clang to emit the correct type, and fix tests to comply.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D112349
2021-10-31 20:00:57 -07:00

26 lines
628 B
LLVM

; RUN: split-file %s %t
; RUN: llvm-link %t/a.ll %t/b.ll -S -o - | FileCheck %s
;; Check that ifuncs are linked in properly.
; CHECK-DAG: @foo = ifunc void (), void ()* ()* @foo_resolve
; CHECK-DAG: define internal void ()* @foo_resolve() {
; CHECK-DAG: @bar = ifunc void (), void ()* ()* @bar_resolve
; CHECK-DAG: define internal void ()* @bar_resolve() {
;--- a.ll
declare void @bar()
;--- b.ll
@foo = ifunc void (), void ()* ()* @foo_resolve
@bar = ifunc void (), void ()* ()* @bar_resolve
define internal void ()* @foo_resolve() {
ret void ()* null
}
define internal void ()* @bar_resolve() {
ret void ()* null
}