summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-08-09 22:30:28 +0200
committerMarek Olšák <[email protected]>2017-08-10 13:24:23 +0200
commit4630ede1021d49c610de1274dc9d1006b843e46b (patch)
tree34c53eebe107b14f23881d6c1daefe0dd5eca4ea /src/gallium/drivers
parent2437ebd7059062d59d2d9b8c6c91977432a5aafa (diff)
ac: fail shader compilation if libelf is replaced by an incompatible version
UE4Editor has this issue. This commit prevents hangs (release build) or assertion failures (debug build). It doesn't fix the editor, but catastrophic scenarios are prevented. Cc: 17.1 17.2 <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index df37267d37d..7a59c90c3e0 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -148,7 +148,10 @@ unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
buffer_size = LLVMGetBufferSize(out_buffer);
buffer_data = LLVMGetBufferStart(out_buffer);
- ac_elf_read(buffer_data, buffer_size, binary);
+ if (!ac_elf_read(buffer_data, buffer_size, binary)) {
+ fprintf(stderr, "radeonsi: cannot read an ELF shader binary\n");
+ diag.retval = 1;
+ }
/* Clean up */
LLVMDisposeMemoryBuffer(out_buffer);