<html>
    <head>
      <base href="http://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 --- - Driver program ignores *link_libgcc option in spec file"
   href="http://llvm.org/bugs/show_bug.cgi?id=20042">20042</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Driver program ignores *link_libgcc option in spec file
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>sstewartgallus00@mylangara.bc.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12659" name="attach_12659" title="Spec file">attachment 12659</a> <a href="attachment.cgi?id=12659&action=edit" title="Spec file">[details]</a></span>
Spec file

Arguable, it's silly to expect compatibility between GCC and Clang when working
at such a low level but it might be useful to add this feature.

I'm trying to cross compile sources on Linux to Windows and want to link with
the correct startup and exit files.

To do so, I put the following option in my spec file:

*link_libgcc:
-L/usr/lib/gcc/i686-w64-mingw32/4.6

This should link with the Mingw startup and exit files but Clang ignores this
option.

The full script and spec file I use to compile is attached.

The error is as follows:

<span class="quote">> i686-w64-mingw32-clang -v ~/mine/documents/public/programming/snippets/hello_world/hello.c</span >
clang version 3.4 (tags/RELEASE_34/final)
Target: i686-w64-mingw32
Thread model: posix
Found candidate GCC installation:
/home/sstewartgallus/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.6.3
Found candidate GCC installation: /usr/lib/gcc/i686-w64-mingw32/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.5.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-w64-mingw32/4.6
Selected GCC installation: /usr/lib/gcc/i686-w64-mingw32/4.6
 "/home/sstewartgallus/local/bin/clang" -cc1 -triple i686-w64-mingw32 -emit-obj
-mrelax-all -disable-free -main-file-name hello.c -mrelocation-model static
-mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-cpu pentium4
-target-linker-version 2.22 -v -resource-dir
/home/sstewartgallus/local/bin/../lib/clang/3.4 -D gnu_scanf=__scanf__ -D
gnu_printf=__printf__ -I /usr/i686-w64-mingw32/include
-I/home/sstewartgallus/local/include -fdebug-compilation-dir
/home/sstewartgallus/mine/documents/public/programming/snippets/scripts
-ferror-limit 19 -fmessage-length 98 -mstackrealign -fno-use-cxa-atexit
-fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-slp -o
/tmp/hello-043a92.o -x c
/home/sstewartgallus/mine/documents/public/programming/snippets/hello_world/hello.c
clang -cc1 version 3.4 based upon LLVM 3.4 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory
"/home/sstewartgallus/local/bin/../lib/clang/3.4/../../../i686-w64-mingw32/include"
ignoring nonexistent directory
"/home/sstewartgallus/local/bin/../lib/clang/3.4/../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/mingw/include"
ignoring duplicate directory "/home/sstewartgallus/local/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /usr/i686-w64-mingw32/include
 /usr/local/include
 /home/sstewartgallus/local/bin/../lib/clang/3.4/include
 /home/sstewartgallus/local/include
 /usr/include
End of search list.
/home/sstewartgallus/mine/documents/public/programming/snippets/hello_world/hello.c:131:2:
warning: 
      No method of setting the process not dumpable is defined for this
platform [-W#warnings]
#warning No method of setting the process not dumpable is defined for this
platform
 ^
1 warning generated.
 "/home/sstewartgallus/local/bin/gcc"
-specs=/home/sstewartgallus/mine/documents/public/programming/snippets/scripts/i686-w64-mingw32.spec
-I /usr/i686-w64-mingw32/include -D gnu_scanf=__scanf__ -D
gnu_printf=__printf__ -fno-builtin-_setjmp -v -m32 -o a.out /tmp/hello-043a92.o
Using built-in specs.
Reading specs from
/home/sstewartgallus/mine/documents/public/programming/snippets/scripts/i686-w64-mingw32.spec
COLLECT_GCC=/home/sstewartgallus/local/bin/gcc
COLLECT_LTO_WRAPPER=/home/sstewartgallus/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/sstewartgallus/others/src/gcc-4.9.0/configure
--disable-multilib
Thread model: posix
gcc version 4.9.0 (GCC) 
COMPILER_PATH=/home/sstewartgallus/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/:/home/sstewartgallus/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/:/home/sstewartgallus/local/libexec/gcc/x86_64-unknown-linux-gnu/:/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/:/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/home/sstewartgallus/local/lib/../lib/:/home/sstewartgallus/.cabal/lib/../lib/:/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/:/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/home/sstewartgallus/local/lib/:/home/sstewartgallus/.cabal/lib/:/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-specs=/home/sstewartgallus/mine/documents/public/programming/snippets/scripts/i686-w64-mingw32.spec'
'-I' '/usr/i686-w64-mingw32/include' '-D' 'gnu_scanf=__scanf__' '-D'
'gnu_printf=__printf__' '-fno-builtin-_setjmp' '-v' '-m32' '-o' 'a.out'
'-mtune=generic' '-march=x86-64'
 i686-w64-mingw32-ld -m i386pe -Bdynamic -o a.out crt2.o
/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/crtbegin.o
-L/usr/lib/gcc/i686-w64-mingw32/4.6 /tmp/hello-043a92.o -lmingw32 -lgcc_eh
-lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt
/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/crtend.o
i686-w64-mingw32-ld: cannot find crt2.o: No such file or directory
/home/sstewartgallus/local/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/crtbegin.o:
file not recognized: File format not recognized
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see
invocation)</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>