mirror of
https://github.com/apache/impala.git
synced 2025-12-30 03:01:44 -05:00
For LLVM IR UDF, Impalad will link an external LLVM module in which the IR UDF is defined with the main module. If it happens that a symbol is defined in both modules, LLVM may choose to discard the one defined in the external module. The discarded function and its callee will not be present in the linked module. In IMPALA-4595, udf-sample.cc was compiled without any optimization. Duplicated definition such as StringVal::null() may have different inlining level between the external module and the main module. When the duplicated definition in the external module is discarded, some of its callee functions (which are not inlined) may not be defined in the main module so they can no longer be located in the linked module. This trips up some code in the LlvmCodegen::LinkModule(). In particular, when parsing for functions in external module which are materialized during linking, certain functions may not be present due to the reason above. Impalad will hit a DCHECK in debug build or crash due to null pointer access in release build. This change fixes the problem above by taking into account that certain functions may not be defined anymore after linking. This change also fixes two incorrect status propagation in fe-support.cc. Change-Id: Iaa056a0c888bfcc95b412e1bc1063bb607b58ab7 Reviewed-on: http://gerrit.cloudera.org:8080/5384 Reviewed-by: Michael Ho <kwho@cloudera.com> Tested-by: Impala Public Jenkins