[Mesa-dev] [PATCH] radeon/llvm: Fix segfault with a specifc libelf implementation

Tom Stellard tom at stellard.net
Tue Apr 23 08:10:18 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

The libelf implementation that is distributed here:
http://www.mr511.de/software/english.html
requires calling elf_version() prior to calling elf_memory()
---
 src/gallium/drivers/radeon/radeon_llvm_emit.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
index d2dc035..ede4d5c 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
@@ -158,6 +158,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());
 
-- 
1.7.11.4



More information about the mesa-dev mailing list