[Mesa-dev] [clover/spirv] radeonsi/NIR (with Nine) - final linking failed on libOpenCL.so.1.0.0

Dieter Nützel Dieter at nuetzel-hh.de
Mon Sep 30 01:31:43 UTC 2019


Sorry Aaron,

that I haven't had the time to save you some time...

I've only set CFLAGS="-fPIC" and CXXFLAGS="-fPIC"
and run

cmake ..
make llvm-spirv -j`nproc`

And could rebuild mesa with -Dopencl-spirv=true 
-Dgallium-opencl=standalone

Only old luxmark-linux64-v2.0 (scene 'LuxBall Sky') show corruption with 
_both_ libOpenCL versions (with and _without_ spirv functionality).

@Karol
Do you suggest any special tests?

Thanks,
Dieter


Am 30.09.2019 02:39, schrieb Aaron Watry:
> Yup.
> 
> I thought I had tried to do that, but I probably messed it up.  I just
> ran the following for the spirv translator and was able to rebuild
> mesa with the spirv functionality enabled:
> mkdir build
> cd build
> CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="-fPIC" ccmake ../
> CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="-fPIC" make -j && sudo make 
> install
> 
> 
> On Thu, Sep 26, 2019 at 2:34 AM Karol Herbst <kherbst at redhat.com> 
> wrote:
>> 
>> I think you only need to recompile the translator with -fPIC enabled.
>> At least that's what the error is saying.
>> 
>> On Thu, Sep 26, 2019 at 6:53 AM Aaron Watry <awatry at gmail.com> wrote:
>> >
>> > Pretty sure I'm running into the same thing trying to build clover
>> > with llvm-spirv enabled.  If it's a known solution, I wouldn't mind
>> > having some time saved :)
>> >
>> > --Aaron
>> >
>> > On Wed, Sep 25, 2019 at 10:30 AM Dieter Nützel <Dieter at nuetzel-hh.de> wrote:
>> > >
>> > > Hello Karol and Pierre,
>> > >
>> > > tried it on radeonsi/NIR with Nine and OpenCL enabled
>> > > (-Dgallium-nine=true -Dopencl-spirv=true -Dgallium-opencl=standalone).
>> > >
>> > > I think I have all SPIRV-LLVM-Translator stuff in place
>> > > (/opt/llvm/projects/SPIRV-LLVM-Translator/). Resulting lib is installed
>> > > at /usr/local/lib/libLLVMSPIRVLib.a.
>> > >
>> > > Do I need a shared version (*.so ) of it? 'ld' output point at this
>> > > (relocation R_X86_64_32 against symbol `_ZTVN4SPIR13PrimitiveTypeE' can
>> > > not be used when making a shared object; recompile with -fPIC).
>> > >
>> > > Thanks,
>> > > Dieter
>> > >
>> > > [1384/1384] Linking target
>> > > src/gallium/targets/opencl/libOpenCL.so.1.0.0.
>> > > FAILED: src/gallium/targets/opencl/libOpenCL.so.1.0.0
>> > > ccache c++  -o src/gallium/targets/opencl/libOpenCL.so.1.0.0
>> > > -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC
>> > > -Wl,--start-group -Wl,-soname,libOpenCL.so.1 -Wl,--whole-archive
>> > > src/gallium/state_trackers/clover/libclover.a -Wl,--no-whole-archive
>> > > src/gallium/auxiliary/pipe-loader/libpipe_loader_dynamic.a
>> > > src/loader/libloader.a src/util/libxmlconfig.a src/util/libmesa_util.a
>> > > src/gallium/auxiliary/libgallium.a src/compiler/nir/libnir.a
>> > > src/compiler/libcompiler.a src/gallium/state_trackers/clover/libclllvm.a
>> > > src/gallium/state_trackers/clover/libclspirv.a
>> > > src/gallium/state_trackers/clover/libclnir.a -Wl,--gc-sections
>> > > -Wl,--version-script /opt/mesa/src/gallium/targets/opencl/opencl.sym
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../lib64/libz.so -pthread
>> > > -lm -ldl /usr/lib64/libunwind.so /usr/lib64/libelf.so
>> > > /usr/local/lib/libclangCodeGen.a /usr/local/lib/libclangFrontendTool.a
>> > > /usr/local/lib/libclangFrontend.a /usr/local/lib/libclangDriver.a
>> > > /usr/local/lib/libclangSerialization.a /usr/local/lib/libclangParse.a
>> > > /usr/local/lib/libclangSema.a /usr/local/lib/libclangAnalysis.a
>> > > /usr/local/lib/libclangAST.a /usr/local/lib/libclangASTMatchers.a
>> > > /usr/local/lib/libclangEdit.a /usr/local/lib/libclangLex.a
>> > > /usr/local/lib/libclangBasic.a /usr/lib64/libdrm.so
>> > > /usr/lib64/libexpat.so -L/usr/local/lib -lLLVM-10svn -lsensors
>> > > -L/usr/local/lib -lLLVM-10svn /usr/local/lib/libLLVMSPIRVLib.a
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../lib64/libSPIRV-Tools.so
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../lib64/libSPIRV-Tools-link.so
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../lib64/libSPIRV-Tools-opt.so
>> > > -Wl,--end-group
>> > > '-Wl,-rpath,$ORIGIN/../../auxiliary/pipe-loader:$ORIGIN/../../../loader:$ORIGIN/../../../util:$ORIGIN/../../auxiliary:$ORIGIN/../../../compiler/nir:$ORIGIN/../../../compiler'
>> > > -Wl,-rpath-link,/opt/mesa/build/src/gallium/auxiliary/pipe-loader
>> > > -Wl,-rpath-link,/opt/mesa/build/src/loader
>> > > -Wl,-rpath-link,/opt/mesa/build/src/util
>> > > -Wl,-rpath-link,/opt/mesa/build/src/gallium/auxiliary
>> > > -Wl,-rpath-link,/opt/mesa/build/src/compiler/nir
>> > > -Wl,-rpath-link,/opt/mesa/build/src/compiler
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVWriter.cpp.o): relocation
>> > > R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not
>> > > be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(PreprocessMetadata.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVDebug.cpp.o): relocation
>> > > R_X86_64_32 against `.bss' can not be used when making a shared object;
>> > > recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVDecorate.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZTVN5SPIRV20SPIRVDecorateGenericE' can not
>> > > be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVEntry.cpp.o): relocation
>> > > R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not
>> > > be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVFunction.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZTVN5SPIRV22SPIRVFunctionParameterE' can
>> > > not be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVInstruction.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZTVN5SPIRV16SPIRVInstructionE' can not be
>> > > used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVModule.cpp.o): relocation
>> > > R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not
>> > > be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVStream.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVType.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVValue.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(LLVMToSPIRVDbgTran.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(OCL20ToSPIRV.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(OCL21ToSPIRV.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(OCLTypeToSPIRV.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZN5SPIRV14OCLTypeToSPIRV2IDE' can not be
>> > > used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(OCLUtil.cpp.o): relocation R_X86_64_32
>> > > against `.rodata' can not be used when making a shared object; recompile
>> > > with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVLowerBool.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVLowerConstExpr.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZN5SPIRV15SPIRVLowerConstE' can not be used
>> > > when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVLowerMemmove.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVLowerOCLBlocks.cpp.o): relocation
>> > > R_X86_64_32 against `.bss' can not be used when making a shared object;
>> > > recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVLowerSPIRBlocks.cpp.o): relocation
>> > > R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not
>> > > be used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVRegularizeLLVM.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVUtil.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(SPIRVBasicBlock.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZTVN5SPIRV15SPIRVBasicBlockE' can not be
>> > > used when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(FunctionDescriptor.cpp.o): relocation
>> > > R_X86_64_32 against `.rodata' can not be used when making a shared
>> > > object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(Mangler.cpp.o): relocation R_X86_64_32
>> > > against `.rodata' can not be used when making a shared object; recompile
>> > > with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(ManglingUtils.cpp.o): relocation
>> > > R_X86_64_32S against symbol `_ZN4SPIR12MangledTypesE' can not be used
>> > > when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > /usr/local/lib/libLLVMSPIRVLib.a(ParameterType.cpp.o): relocation
>> > > R_X86_64_32 against symbol `_ZTVN4SPIR13PrimitiveTypeE' can not be used
>> > > when making a shared object; recompile with -fPIC
>> > > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld:
>> > > final link failed: nonrepresentable section on output
>> > > collect2: error: ld returned 1 exit status
>> > > _______________________________________________
>> > > mesa-dev mailing list
>> > > mesa-dev at lists.freedesktop.org
>> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> 


More information about the mesa-dev mailing list