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

Issue 591436 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Aug 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 537368



Sign in to add a comment

ChromeOS clang could not be launched via ld-linux-x86-64.so.2

Project Member Reported by shenhan@chromium.org, Mar 2 2016

Issue description

In SimpleChrome workflow, toolchain binaries are wrapped with a shell that invokes the binaries via ld-linux-x86-64.so.2, for example, gdb is invoked like below - 

..../ld-linux-x86-64.so.2 --library-path "..." "gdb.real"   "$@"

However, this does not work for clang, 

 /lib64/ld-linux-x86-64.so.2 /usr/bin/clang-3.8 -v  -c ~/test.c
clang version 3.8.0 (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git 4483c0162c2672fc09fb738e9c683ebde1f146f3) (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git fad81ab170b3d422f0aaa15b88157fdb16d3e75d)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.9.x-google
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x-google
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.x-google
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.x-google
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x-google
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/lib64/ld-2.19.so" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -coverage-file /home/shenhan/test.c -resource-dir /lib64/../lib64/clang/3.8.0 -internal-isystem /usr/local/include -internal-isystem /lib64/../lib64/clang/3.8.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/shenhan -ferror-limit 19 -fmessage-length 276 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o test.o -x c /home/shenhan/test.c
-cc1: error while loading shared libraries: -cc1: cannot open shared object file
ld-2.19.so: error: unable to execute command: No such file or directory
ld-2.19.so: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.8.0 (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git 4483c0162c2672fc09fb738e9c683ebde1f146f3) (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git fad81ab170b3d422f0aaa15b88157fdb16d3e75d)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
ld-2.19.so: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
ld-2.19.so: error: unable to execute command: No such file or directory
ld-2.19.so: note: diagnostic msg: Error generating preprocessed source(s).


The clang drive is totally confused by the command line that it passes "-cc1" to "ld-2.19.so"...
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/eac64a83bbaa09396d94b4e5a56ae7d7d660975c

commit eac64a83bbaa09396d94b4e5a56ae7d7d660975c
Author: Han Shen <shenhan@google.com>
Date: Thu Mar 03 18:50:17 2016

Force clang driver to fallback to classical executable detection.

The original executable detection (determine what exactly is argv[0])
gives bogus value while invoked via dynamic
linker (ld-linux-x86-64.so.2), fixed this by forcing fallback to
classical method.

BUG= chromium:591436 
TEST=successfully run clang with ld-linux-x86-64.so.2.

Change-Id: I53fbf8f45aa2c9716084c7b22aeaf7afa9f25f08
Reviewed-on: https://chromium-review.googlesource.com/330128
Commit-Ready: Han Shen <shenhan@chromium.org>
Tested-by: Han Shen <shenhan@chromium.org>
Reviewed-by: Han Shen <shenhan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[add] https://crrev.com/eac64a83bbaa09396d94b4e5a56ae7d7d660975c/sys-devel/llvm/files/clang-executable-detection.patch
[rename] https://crrev.com/eac64a83bbaa09396d94b4e5a56ae7d7d660975c/sys-devel/llvm/llvm-3.8_pre255169-r2.ebuild

Owner: rahulchaudhry@chromium.org
Status: Assigned (was: Untriaged)
@rahul, after your change to solve the other problem, is this fix still needed?
Blocking: 537368
Status: Fixed (was: Assigned)
Yes, it seems like this patch is still necessary. The other fix was for clang++ to correctly detect that it is clang++. That fix did not change anything for clang.

This fix is for clang to correctly figure out argv[0] (it was using "/proc/self/exe", which points to the dynamic linker).

Labels: VerifyIn-54

Comment 6 by dchan@chromium.org, Oct 7 2016

Labels: VerifyIn-55

Comment 7 by dchan@google.com, Nov 19 2016

Labels: VerifyIn-56

Comment 8 by dchan@google.com, Jan 21 2017

Labels: VerifyIn-57

Comment 9 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 10 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 11 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61
Status: Verified (was: Fixed)
Closing. Please reopen it if its not fixed. Thanks!

Sign in to add a comment