diff options
author | Roland Scheidegger <[email protected]> | 2018-12-21 02:41:31 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2018-12-21 17:37:00 +0100 |
commit | 171983dc89435d951ebfa42018546fb77d89d018 (patch) | |
tree | 816bbbc596a78e37487b8ca01c2a36faecf2a89e /src/gallium/auxiliary | |
parent | f3b1acff48492cf1b0dc0f5dab71ecc3f5806265 (diff) |
gallivm: abort when trying to use non-existing intrinsic
Whenever llvm removes an intrinsic (we're using), we're hitting segfaults
due to llvm doing calls to address 0 in the jitted code instead.
However, Jose figured out we can actually detect this with
LLVMGetIntrinsicID(), so use this to abort, so we don't have to wonder
what got broken. (Of course, someone still needs to fix the code to
no longer use this intrinsic.)
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_intr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c b/src/gallium/auxiliary/gallivm/lp_bld_intr.c index 74ed16f33f0..cf1f058ff38 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c @@ -241,6 +241,16 @@ lp_build_intrinsic(LLVMBuilderRef builder, function = lp_declare_intrinsic(module, name, ret_type, arg_types, num_args); + /* + * If llvm removes an intrinsic we use, we'll hit this abort (rather + * than a call to address zero in the jited code). + */ + if (LLVMGetIntrinsicID(function) == 0) { + _debug_printf("llvm (version 0x%x) found no intrinsic for %s, going to crash...\n", + HAVE_LLVM, name); + abort(); + } + if (!set_callsite_attrs) lp_add_func_attributes(function, attr_mask); |