[Mesa-dev] [PATCH 7/9] radeonsi: avoid a crash in gallivm_dispose_target_library_info

Marek Olšák maraeo at gmail.com
Tue Apr 17 00:52:18 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 09b9f588a6f..490a090da87 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -157,22 +157,25 @@ static void si_init_compiler(struct si_screen *sscreen,
 	compiler->data_layout = LLVMCopyStringRepOfTargetData(data_layout);
 	LLVMDisposeTargetData(data_layout);
 }
 
 static void si_destroy_compiler(struct si_compiler *compiler)
 {
 	if (compiler->data_layout)
 		LLVMDisposeMessage((char*)compiler->data_layout);
 	if (compiler->passmgr)
 		LLVMDisposePassManager(compiler->passmgr);
+#if HAVE_LLVM < 0x0500 || HAVE_LLVM >= 0x0700
+	/* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */
 	if (compiler->target_library_info)
 		gallivm_dispose_target_library_info(compiler->target_library_info);
+#endif
 	if (compiler->tm)
 		LLVMDisposeTargetMachine(compiler->tm);
 }
 
 /*
  * pipe_context
  */
 static void si_destroy_context(struct pipe_context *context)
 {
 	struct si_context *sctx = (struct si_context *)context;
-- 
2.17.0



More information about the mesa-dev mailing list