[Mesa-dev] LLVMInitializeAMDGPU* undefined?

Marek Olšák maraeo at gmail.com
Fri Mar 11 09:36:09 UTC 2016


On Fri, Mar 11, 2016 at 4:50 AM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> On Fri, 2016-03-11 at 10:09 +0800, Chih-Wei Huang wrote:
>> 2016年3月10日 下午6:47於 "Marek Olšák" <maraeo at gmail.com>寫道:
>> >
>> >
>> > Those functions are only supported by LLVM 3.7 and later, and if
>> > you
>> > have such a version, the AMDGPU backend must be enabled in your
>> > LLVM
>> > build.
>> Yes, I knew that.
>> But seems you misunderstood my question.
>>
>> It's a compile time error instead of a linking time error:
>>
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c: In
>> function 'init_r600_target':
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:106:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUTargetInfo'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTargetInfo();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:107:2:
>> error: implicit declaration of function 'LLVMInitializeAMDGPUTarget'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTarget();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:108:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUTargetMC'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUTargetMC();
>>   ^
>> external/mesa/src/gallium/drivers/radeon/radeon_llvm_emit.c:109:2:
>> error: implicit declaration of function
>> 'LLVMInitializeAMDGPUAsmPrinter'
>> [-Werror=implicit-function-declaration]
>>   LLVMInitializeAMDGPUAsmPrinter();
>>   ^
>>
>> cc1: some warnings being treated as errors
>>
>>
>> Some proposed patches on the mesa side:
>>
>> https://sourceforge.net/p/android-x86/external_mesa/ci/f6611f58cf89a4
>> 0e013b20180604f65707b6e73e/
>> (add a header to declare the functions)
>>
>> https://github.com/maurossi/mesa/commit/deb3a6ebb7fdba688b0331bd0e4b2
>> 7acfc9d869f
>> (disable implicit declaration warnings)
>>
>> But I'm still not sure whether if it should be fixed on the mesa
>> side.
>>
>> So my question is, what kind of fix do we want (i.e., acceptable by
>> the upstream)?
>
> this is the result of using llvm without AMDGPU backend. the header
> "llvm-c/Target.h" includes "llvm/Config/Targets.def" and declares
> functions based on backends listed there (selected at llvm build time).
>
> Your "llvm/Config/Targets.def" needs to include this line:
> LLVM_TARGET(AMDGPU)
>
> otherwise the functions are not declared.
> probably the only patch needed on mesa side is to detect this at
> configure time.

I think Mesa does detect this at configure time, but this thread is
about Android (not using configure).

Marek


More information about the mesa-dev mailing list