Swiftshader link error on LLD build on Linux |
||||
Issue descriptionswiftshader/libEGL.so fails to link on LLD build (use_lld=true). That is due to undefined references from unused hidden functions. Gold doesn't emit the error for the undefined reference when the function is removed by -ffunction-sections and -Wl,--gc-sections, while LLD handles it as an error. We should probably add some missing deps or sources to the libEGL build files. [74/2/2] SOLINK swiftshader/libEGL.so FAILED: swiftshader/libEGL.so swiftshader/libEGL.so.TOC python "/mnt/ssd2/home/tzik/backpack/chrome/src/build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="swiftshader/libEGL.so" --tocfile="swiftshader/libEGL.so.TOC" --output="swiftshader/libEGL.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -m64 -pthread -Wl,-O1 -Wl,--gc-sections --sysroot=../../build/linux/debian_wheezy_amd64-sysroot -L/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/lib/x86_64-linux-gnu -L/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/x86_64-linux-gnu -L/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -Wl,-rpath-link=/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib -Wl,-rpath-link=/mnt/ssd2/home/tzik/backpack/chrome/src/build/linux/debian_wheezy_amd64-sysroot/usr/lib -Werror -o "swiftshader/libEGL.so" -Wl,-soname="libEGL.so" @"swiftshader/libEGL.so.rsp" undefined symbol: _ZN11ETC_Decoder6DecodeEPKhPhiiiiiiNS_9InputTypeE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw10deallocateEPv in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw12allocateZeroEmm in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw12logPrecisionE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw17quadLayoutEnabledE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw24complementaryDepthBufferE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw4halfC1Ef in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw4halfaSES0_ in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw5CPUID10enableSSE2E in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw5CPUID3SSEE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw5CPUID4SSE2E in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw5CPUID9enableSSEE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw8Resource4lockENS_8AccessorE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw8Resource6unlockEv in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw8Resource8destructEv in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw8ResourceC1Em in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZNK2sw4halfcvfEv in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Surface.o undefined symbol: _ZN2sw14sRGB8toLinear8Eh in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Image.o undefined symbol: _ZN2sw7Blitter4blitEPNS_7SurfaceERKNS_9SliceRectES2_S5_bb in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Image.o undefined symbol: _ZN2sw7blitterE in obj/third_party/swiftshader/src/OpenGL/libEGL/swiftshader_libEGL/Image.o
,
Dec 9 2016
Hi tzik@, I don't usually use LLD locally for tests, and I see that it doesn't seem to be in chromium by default. From what I see, it seems to require 'llvm_force_head_revision=true' in order to get LLVM, which should contain LLD. When I set this flag, I immediately get the ".../third_party/llvm' is not a working copy" error. Now, I'm guessing that I need to use svn to pull the LLVM repo, but I can't seem to find documentation on how to do this properly. Could you point me in the right direction? What is the correct way to setup LLD on an Ubuntu system?
,
Dec 12 2016
Oh, I wasn't aware that we don't have the bundled lld like the bundled clang. My local build seems to use another lld build, I built separately. To build and use LLD locally in the Chromium tree, run: LLVM_FORCE_HEAD_REVISION=1 ./tools/clang/scripts/update.py --force-local-build --without-android and edit out/Release/args.gn to have `use_lld = true` and `use_goma = false`. Nico: Does it make sense to bundle LLD into our prebuilt toolchain? https://codereview.chromium.org/2560423004/
,
Dec 12 2016
Hi tzik@, I'm afraid you're going to have to be more specific about your current configuration, because every test I've done using the instructions you gave me succeeded in linking correctly. I used: use_lld=true use_goma=false I tried 'is_debug' true and false. Both cases passed. Is there anything else in your out/Release/args.gn file?
,
Dec 13 2016
I don't understand what's wrong (or what's unintentionally well). But, I think an easy repro without lld itself is removing -Wl,--gc-sections from standard linker options: https://codereview.chromium.org/2572733002/
,
Mar 20 2017
Hi tzik@, can you still reproduce this issue? SwiftShader has been updated a few times since, so if you can still reproduce it, could you update the terminal output with the errors you are getting? Thanks.
,
Sep 6
Delegating to tzik@ so he can follow up on this issue or close it if it is no longer reproducible. |
||||
►
Sign in to add a comment |
||||
Comment 1 by sugoi@chromium.org
, Dec 9 2016Owner: sugoi@chromium.org
Status: Assigned (was: Available)