niyue commented on code in PR #39098:
URL: https://github.com/apache/arrow/pull/39098#discussion_r1420656676


##########
cpp/src/gandiva/llvm_generator_test.cc:
##########
@@ -100,7 +98,9 @@ TEST_F(TestLLVMGenerator, TestAdd) {
   auto field_sum = std::make_shared<arrow::Field>("out", arrow::int32());
   auto desc_sum = annotator.CheckAndAddInputFieldDescriptor(field_sum);
 
-  std::string fn_name = "codegen";
+  // LLVM 10 doesn't like the expr function name to be the same as the module 
name when
+  // LLJIT is used
+  std::string fn_name = "llvm_gen_test_add_expr";

Review Comment:
   There is a weird behavior of LLVM LLJIT. The LLVM module is created with 
name `codegen`, if later a function is created with the same name `codegen`, it 
can be successfully created, when looking up its function pointer, a successful 
symbol will be returned, however, the function address inside the symbol is 0, 
making it a nullptr and cannot be used.
   
   * This issue happened for LLVM 10 (not sure if it is Linux specific), and 
the same code doesn't have such an issue when using LLVM 14.0.6 on macOS
   * This issue is specific for ORC v2/LLJIT, and MCJIT doesn't have such an 
issue
   
   I have to:
   1) rename the function name in the test case to be more specific and avoid 
conflict
   2) rename the LLVM module name to be more specific and add some random 
suffix (the object's address) to avoid conflict
   
   UPDATE:
   I reported a bug to LLVM, https://github.com/llvm/llvm-project/issues/74903 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to