[Mesa-dev] [PATCH 06/12] android: amd/common: fix LLVMInitializeAMDGPU* functions declaration
Nicolai Hähnle
nhaehnle at gmail.com
Tue Jan 10 15:21:35 UTC 2017
Patches 4-6:
Acked-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 10.01.2017 01:53, Mauro Rossi wrote:
> LLVMInitializeAMDGPU* functions need to be explicitly declared
> and mesa expects them via <llvm-c/Target.h> header,
> but LLVM needs to be instructed to invoke its own LLVM_TARGET(AMDGPU) macro,
> or the functions will not be available.
>
> A new llvm cflag (-DFORCE_BUILD_AMDGPU) serves this purpose,
> the same mechanism is used also by other llvm targets e.g. FORCE_BUILD_ARM
>
> A necessary prerequisite is to have AMDGPU target handled accordingly
> in llvm config files i.e. {Target,AsmParser,AsmPrinter}.def
> for llvm device build includes.
>
> This avoids the following building errors:
>
> external/mesa/src/amd/common/ac_llvm_util.c:43:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetInfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> LLVMInitializeAMDGPUTargetInfo();
> ^
> external/mesa/src/amd/common/ac_llvm_util.c:44:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTarget' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> LLVMInitializeAMDGPUTarget();
> ^
> external/mesa/src/amd/common/ac_llvm_util.c:45:2: error: implicit declaration of function 'LLVMInitializeAMDGPUTargetMC' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> LLVMInitializeAMDGPUTargetMC();
> ^
> external/mesa/src/amd/common/ac_llvm_util.c:46:2: error: implicit declaration of function 'LLVMInitializeAMDGPUAsmPrinter' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> LLVMInitializeAMDGPUAsmPrinter();
> ^
> ---
> src/amd/Android.common.mk | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/amd/Android.common.mk b/src/amd/Android.common.mk
> index df65c24..c7fd193 100644
> --- a/src/amd/Android.common.mk
> +++ b/src/amd/Android.common.mk
> @@ -30,6 +30,8 @@ LOCAL_MODULE := libmesa_amd_common
>
> LOCAL_SRC_FILES := $(AMD_COMPILER_FILES)
>
> +LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU # instructs LLVM to declare LLVMInitializeAMDGPU* functions
> +
> LOCAL_C_INCLUDES := \
> $(MESA_TOP)/include \
> $(MESA_TOP)/src \
>
More information about the mesa-dev
mailing list