radeon/llvm: Fix segfault with a specifc libelf implementation
authorTom Stellard <thomas.stellard@amd.com>
Tue, 23 Apr 2013 15:08:30 +0000 (08:08 -0700)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 24 Apr 2013 23:51:25 +0000 (16:51 -0700)
The libelf implementation that is distributed here:
http://www.mr511.de/software/english.html
requires calling elf_version() prior to calling elf_memory()

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeon/radeon_llvm_emit.cpp

index 5b770d0fd0549c1b491e231552589a99c9787bff..55dad9b983c2f2eecd9d5203b60cbd50d9c69357 100644 (file)
@@ -159,6 +159,10 @@ radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
 
    char *elf_buffer;
 
+   /* One of the libelf implementations (http://www.mr511.de/software/english.htm)
+    * requires calling elf_version() before elf_memory().
+    */
+   elf_version(EV_CURRENT);
    elf_buffer = (char*)malloc(data.length());
    memcpy(elf_buffer, data.c_str(), data.length());