<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang's gcc-toolchain flag seems not working"
   href="https://llvm.org/bugs/show_bug.cgi?id=31264">31264</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang's gcc-toolchain flag seems not working
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>taenaru@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17709" name="attach_17709" title="Hello World application build with clang --gnu-toolchain=$(TOOLCHAIN_PATH)">attachment 17709</a> <a href="attachment.cgi?id=17709&action=edit" title="Hello World application build with clang --gnu-toolchain=$(TOOLCHAIN_PATH)">[details]</a></span>
Hello World application build with clang --gnu-toolchain=$(TOOLCHAIN_PATH)

Hello,

I have met an issue with the "--gcc-toolchain" flag. As I understand that
option , it is intended to be used when we want to point out to clang where
necessary external GCC utilities are (like linker, assembler stuff, etc.).

I tried to use ARM GCC toolchain with clang, but it seemed that
"--gcc-toolchain" worked only during compilation. There is the output below:

System info:

OS: Linux ubuntu 4.8.0-27-generic #29-Ubuntu SMP Thu Oct 20 21:03:13 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux

Clang: clang version 3.8.1-12ubuntu1 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

ARM GCC: arm-linux-gnueabihf-gcc (Linaro GCC 6.1-2016.08) 6.1.1 20160711
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GCC toolchain used:
<a href="https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabihf.tar.xz">https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabihf.tar.xz</a>

# TOOLCHAIN_PATH = /home/vpetrigo/gcc-x86_64-arm-linux-gnueabihf

# content of the gcc-x86_64-arm-linux-gnueabihf folder:
#  arm-linux-gnueabihf/
#  bin/
#  include/
#  lib/
#  libexec/
#  share/

Here I have a simple "Hello World" application:
# main.c content
#include <stdio.h>

int main() {
        printf("Hello world\n");

        return 0;
}

I tried to invoke the clang like this:
`clang -target arm-linux-gnueabihf
--sysroot=/home/vpetrigo/gcc-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc
--gcc-toolchain=/home/vpetrigo/gcc-x86_64-arm-linux-gnueabihf main.c -o main
-v`

The output is inside the attachment (see output.log)

As you can see during the linkage state /usr/bin/ld was used. But I provide the
valid toolchain path and there is `arm-linux-gnueabihf-ld` executable inside
the bin/ subfolder.

If I make a symlink of `arm-linux-gnueabihf-ld` and put it into the /usr/bin
folder, building works fine then.

Could you tell me if I misunderstand that flag and all necessary GCC utils must
be in the /usr/bin folder?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>