New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 708840 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Apr 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocked on:
issue 713784



Sign in to add a comment

Official+branded builds are broken if compiled with ThinLTO

Project Member Reported by krasin@chromium.org, Apr 6 2017

Issue description

Currently, LTO Linux bot is broken:
https://build.chromium.org/p/chromium.fyi/builders/LTO%20Linux/builds/2375

I have reproduced the issue locally, including with the toolchain build on my machine, r298539 (that the revision of the stable Clang toolchain at the moment):

$ gn gen out/cfi-thin-lto-tot '--args=is_chrome_branded=true is_official_build=true is_clang=true is_component_build=false is_debug=false allow_posix_link_time_opt=true is_cfi=true use_
thin_lto=true symbol_level=2 clang_use_chrome_plugins=false use_lld=true clang_base_path="/usr/local/google/home/krasin/src/llvm.org/release-build"' --check
$ ninja -C out/cfi-thin-lto-tot/ nacl_helper                                                                                                                                     ninja: Entering directory `out/cfi-thin-lto-tot/'
[15020/15020] LINK ./nacl_helper
FAILED: nacl_helper nacl_helper.map.gz 
python "../../build/toolchain/gcc_link_wrapper.py" --output="./nacl_helper" --map-file "./nacl_helper.map.gz" -- ../../../../src/llvm.org/release-build/bin/clang++ -pie -Wl,--fatal-warnings -Wl,--build-id=sha1 -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 -flto=thin -Wl,--thinlto-jobs=8 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,-plugin-opt,-function-sections -m64 -pthread -Werror -Wl,-O1 -Wl,--gc-sections --sysroot=../../build/linux/debian_jessie_amd64-sysroot -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib -fsanitize=cfi-vcall -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,--export-dynamic -o "./nacl_helper" -Wl,--start-group @"./nacl_helper.rsp"  -Wl,--end-group  -ldl -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -lpangocairo-1.0 -lpango-1.0 -lcairo -lfreetype -lfontconfig -lexpat -lgio-2.0 -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lXtst -lXss -lXrandr -lgconf-2 -lresolv -lpci -lasound -lm -lz -ldbus-1 -latk-1.0 
#0 0x0000000000520e8f llvm::sys::PrintStackTrace(llvm::raw_ostream&) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Unix/Signals.inc:406:0
#1 0x000000000051ed8e llvm::sys::RunSignalHandlers() /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Signals.cpp:45:0
#2 0x000000000051eefc SignalHandler(int) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Unix/Signals.inc:246:0
#3 0x00007f45c9f7f330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00000000020ba240 llvm::SHA1::update(llvm::ArrayRef<unsigned char>) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/SHA1.cpp:215:0
#5 0x00000000020ba4a4 llvm::SHA1::hash(llvm::ArrayRef<unsigned char>) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/SHA1.cpp:276:0
#6 0x000000000062986a memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:51:0
#7 0x000000000062986a operator() /usr/local/google/home/krasin/src/llvm.org/llvm/tools/lld/ELF/SyntheticSections.cpp:391:0
#8 0x000000000062986a std::_Function_handler<void (unsigned char*, llvm::ArrayRef<unsigned char>), lld::elf::BuildIdSection::writeBuildId(llvm::ArrayRef<unsigned char>)::{lambda(unsigned char*, llvm::ArrayRef<unsigned char>)#3}>::_M_invoke(std::_Any_data const&, unsigned char*, llvm::ArrayRef<unsigned char>) /usr/include/c++/4.8/functional:2071:0
#9 0x0000000000629f56 std::_Function_handler<void (unsigned long), lld::elf::BuildIdSection::computeHash(llvm::ArrayRef<unsigned char>, std::function<void (unsigned char*, llvm::ArrayRef<unsigned char>)>)::{lambda(unsigned long)#1}>::_M_invoke(std::_Any_data const&, unsigned long) /usr/include/c++/4.8/functional:2073:0
#10 0x00000000005b5b40 void lld::parallel_for<unsigned long, std::function<void (unsigned long)> >(unsigned long, unsigned long, std::function<void (unsigned long)>)::{lambda()#1}::operator()() const /usr/local/google/home/krasin/src/llvm.org/llvm/tools/lld/include/lld/Core/Parallel.h:323:0
#11 0x00000000005b5b40 std::_Function_handler<void (), void lld::parallel_for<unsigned long, std::function<void (unsigned long)> >(unsigned long, unsigned long, std::function<void (unsigned long)>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) /usr/include/c++/4.8/functional:2071:0
#12 0x000000000057504d lld::TaskGroup::spawn(std::function<void ()>)::{lambda()#1}::operator()() const /usr/local/google/home/krasin/src/llvm.org/llvm/tools/lld/include/lld/Core/Parallel.h:190:0
#13 0x000000000057504d std::_Function_handler<void (), lld::TaskGroup::spawn(std::function<void ()>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) /usr/include/c++/4.8/functional:2071:0
#14 0x0000000000575ab3 ~_Function_base /usr/include/c++/4.8/functional:2029:0
#15 0x0000000000575ab3 ~function /usr/include/c++/4.8/functional:2174:0
#16 0x0000000000575ab3 lld::internal::ThreadPoolExecutor::work() /usr/local/google/home/krasin/src/llvm.org/llvm/tools/lld/include/lld/Core/Parallel.h:157:0
#17 0x00007f45c98daa60 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1a60)
#18 0x00007f45c9f77184 start_thread /build/eglibc-MjiXCM/eglibc-2.19/nptl/pthread_create.c:312:0
#19 0x00007f45c9042bed clone /build/eglibc-MjiXCM/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113:0
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: linker command failed due to signal (use -v to see invocation)
ninja: build stopped: subcommand failed.

I am currently building with Clang ToT, r299600 to see if this still a thing.
 
Does this mean that official builds are currently broken?
We have not yet enabled ThinLTO for the official builds. So, no, it does not mean that.
But that's why I didn't want to switch all bots to LLD+ThinLTO at once: I knew we'll have to resolve a number of issues before we can enable everywhere. First the DRM stuff, now this.

Comment 4 by p...@chromium.org, Apr 6 2017

Should we be passing -k to ninja on the bots? It seems like we could have caught this sooner if we were doing that.
Yes, I am in favor of enabling this option, because it will us to dig logs to see when an issue is started to appear (if it's a recent regression, for instance). Or spot multiple issues, like in this case.
Yes, this is happening with ToT:

$ time -p ninja -C out/cfi-thin-lto-tot/ nacl_helper 
ninja: Entering directory `out/cfi-thin-lto-tot/'
[17674/17675] LINK ./nacl_helper*** Error in `/usr/local/google/home/krasin/chr33/src/out/cfi-thin-lto-tot/../../../../src/llvm.org/release-build/bin/ld.lld': free(): invalid size: 0x00000000214f6830 ***
[17675/17675] LINK ./nacl_helper
FAILED: nacl_helper nacl_helper.map.gz 
python "../../build/toolchain/gcc_link_wrapper.py" --output="./nacl_helper" --map-file "./nacl_helper.map.gz" -- ../../../../src/llvm.org/release-build/bin/clang++ -pie -Wl,--fatal-warnings -Wl,--build-id=sha1 -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 -flto=thin -Wl,--thinlto-jobs=8 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,-plugin-opt,-function-sections -m64 -pthread -Werror -Wl,-O1 -Wl,--gc-sections --sysroot=../../build/linux/debian_jessie_amd64-sysroot -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/lib/x86_64-linux-gnu -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib -Wl,-rpath-link=/usr/local/google/home/krasin/chr33/src/build/linux/debian_jessie_amd64-sysroot/usr/lib -fsanitize=cfi-vcall -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,--export-dynamic -o "./nacl_helper" -Wl,--start-group @"./nacl_helper.rsp"  -Wl,--end-group  -ldl -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lnss3 -lnssutil3 -lsmime3 -lplds4 -lplc4 -lnspr4 -lpangocairo-1.0 -lpango-1.0 -lcairo -lfreetype -lfontconfig -lexpat -lgio-2.0 -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lXtst -lXss -lXrandr -lgconf-2 -lresolv -lpci -lasound -lm -lz -ldbus-1 -latk-1.0 
#0 0x000000000052213f llvm::sys::PrintStackTrace(llvm::raw_ostream&) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x000000000052003e llvm::sys::RunSignalHandlers() /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Signals.cpp:44:0
#2 0x00000000005201ac SignalHandler(int) /usr/local/google/home/krasin/src/llvm.org/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007f32959db330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f32949d7c37 gsignal /build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f32949db028 abort /build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f3294a142a4 /build/eglibc-MjiXCM/eglibc-2.19/libio/../sysdeps/posix/libc_fatal.c:175:0
#7 0x00007f3294a2056e malloc_printerr /build/eglibc-MjiXCM/eglibc-2.19/malloc/malloc.c:4996:0
#8 0x00007f3294a2056e _int_free /build/eglibc-MjiXCM/eglibc-2.19/malloc/malloc.c:3840:0
#9 0x00000000005770c4 std::deque<std::function<void ()>, std::allocator<std::function<void ()> > >::_M_pop_back_aux() /usr/include/c++/4.8/bits/deque.tcc:508:0
#10 0x00000000005770c4 std::deque<std::function<void ()>, std::allocator<std::function<void ()> > >::pop_back() /usr/include/c++/4.8/bits/stl_deque.h:1451:0
#11 0x00000000005770c4 std::stack<std::function<void ()>, std::deque<std::function<void ()>, std::allocator<std::function<void ()> > > >::pop() /usr/include/c++/4.8/bits/stl_stack.h:215:0
#12 0x00000000005770c4 lld::internal::ThreadPoolExecutor::work() /usr/local/google/home/krasin/src/llvm.org/llvm/tools/lld/include/lld/Core/Parallel.h:158:0
#13 0x00007f3295336a60 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1a60)
#14 0x00007f32959d3184 start_thread /build/eglibc-MjiXCM/eglibc-2.19/nptl/pthread_create.c:312:0
#15 0x00007f3294a9ebed clone /build/eglibc-MjiXCM/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113:0
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: linker command failed due to signal (use -v to see invocation)
ninja: build stopped: subcommand failed.

Blockedon: 711864
Blockedon: -711864

Comment 9 by krasin@chromium.org, Apr 17 2017

Cc: h...@chromium.org
As of today, this is no longer happening with Clang ToT (confirmed by two people). May I ask for another Clang roll? That will unblock gold -> lld conversion.

Hans, Nico, what are your plans regarding that?
The last roll was 5 days ago (https://codereview.chromium.org/2816593003). If we need a new roll, file a bug for one. I'm clang sheriff this week so I can give it a go. I'm out tomorrow (Tue) but in the rest of the week.

Comment 11 by h...@chromium.org, Apr 17 2017

The ToT bots that do CFI and/or ThinLTO are all red (and have been for a while):

https://build.chromium.org/p/chromium.fyi/builders/ThinLTO%20Linux%20ToT
https://build.chromium.org/p/chromium.fyi/builders/CFI%20Linux%20ToT
https://build.chromium.org/p/chromium.fyi/builders/CFI%20ThinLTO%20Linux%20ToT

We'll need to do a roll anyway, but if this is supposed to work I'd expect those bots to be green.
This is  https://crbug.com/686980 . I have a workaround locally, figuring out how to send it for a review (swiftshader stuff is not like the rest of Chromium, a little bit)
Ewww :-/ if users are really supposed to do stuff like that, can we at least have a real driver option? -Xclang isn't supposed to be a stable API...

Comment 15 by p...@chromium.org, Apr 17 2017

> Ewww :-/

Agreed, but...

> if users are really supposed to do stuff like that

They aren't, though. Ideally, users should fix their code not to rely on --gc-sections. Using an -Xclang flag seems appropriate as a workaround, as long as the swiftshader developers are aware of the need to fix. As Ivan mentioned in the commit message, we plan to make --gc-sections + ThinLTO more powerful, which should also allow us to remove this workaround.

> can we at least have a real driver option? -Xclang isn't supposed to be a stable API...

I'd rather not add -fno-lto-unit to the stable command line interface, because such a flag should always be unnecessary once we improve --gc-sections, and it would complicate the user interface by adding another flag that users would need to reason about (basically you may only use this flag if *no* translation unit in your linkage unit uses either of the -fwhole-program-vtables or -fsanitize=cfi features).
All fixes submitted, Clang ToT is mostly green (the only issue I see is multiple Windows bots are red; most likely a single cause)

Comment 17 by h...@chromium.org, Apr 20 2017

Blockedon: 713784
Status: Fixed (was: Untriaged)

Sign in to add a comment