New issue
Advanced search Search tips

Issue 672718 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Swiftshader link error on LLD build on Linux

Project Member Reported by tzik@chromium.org, Dec 9 2016

Issue description

swiftshader/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
 

Comment 1 by sugoi@chromium.org, Dec 9 2016

Cc: -sugoi@chromium.org
Owner: sugoi@chromium.org
Status: Assigned (was: Available)
Looking into it

Comment 2 by sugoi@chromium.org, Dec 9 2016

Cc: tzik@chromium.org
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?

Comment 3 by tzik@chromium.org, Dec 12 2016

Cc: thakis@chromium.org
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/

Comment 4 by sugoi@chromium.org, 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?

Comment 5 by tzik@chromium.org, 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/

Comment 6 by sugoi@chromium.org, 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.
Cc: -tzik@chromium.org sugoi@chromium.org
Owner: tzik@chromium.org
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