[cfe-dev] Can't compile using -O4 option

Marcin Mirosław marcin at mejor.pl
Sun Oct 30 14:27:52 PDT 2011


Hello,
what i'm doing wrong? I'm trying to compile "hello world"[1], clang throws:
$ COMPILER_PATH="/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/" clang a.c
-L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/ -O4
/tmp/a-2eDXZa.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

With -v:
$ COMPILER_PATH="/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/" clang a.c
-L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/ -O4 -v
clang version 3.1 (trunk)
Target: i386-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-llvm-bc
-disable-free -disable-llvm-verifier -main-file-name a.c
-mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.21.1
-momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.1
-fmodule-cache-path /var/tmp/clang-module-cache -O3
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 140
-fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/a-DoYYaK.o -x c a.c
clang -cc1 version 3.1 based upon llvm 3.1svn hosted on i386-pc-linux-gnu
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/clang/3.1/include
 /usr/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 -o a.out /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtbegin.o
-L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/ -L/lib -L/usr/lib
/tmp/a-DoYYaK.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtend.o /usr/lib/crtn.o
/tmp/a-DoYYaK.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
$  stat /tmp/a-DoYYaK.o
stat: cannot stat `/tmp/a-DoYYaK.o': No such file or directory

Clang-r143319, gentoo.
Is it posible to do LTO at such simple case? Thanks for any help.

[1]- $ cat a.c
#include <stdio.h>
int main (void)
{
  printf ("Hello World!");
    return 0;
}



More information about the cfe-dev mailing list