[cfe-dev] Bug with -O4

Chris Lattner clattner at apple.com
Tue Apr 28 11:03:29 PDT 2009


On Apr 28, 2009, at 12:48 AM, Robert Purves wrote:

> I'm not sure what I expect -O4 to do, but clang's response was a
> surprise.

As others have mentioned, -O4 with clang and llvm-gcc enables link- 
time-optimization, which GCC doesn't support.  With GCC -O3 and -O4  
(and -O99) are the same.

What OS are you developing on?  If you're on the mac, or if you use  
the new Binutils "gold" linker for linux, you might have a solution.   
Otherwise, the fix is "don't do that".

-Chris

>
>
> $ cat test.c
> int main( void ) { return 0; }
> $ gcc test.c -O4
> $ llvm-gcc-4.2 test.c -O4
> $ clang test.c -O4
> ld warning: in /var/folders/88/88AKX+F62RWmd++8ZOxBkU+++TI/-Tmp-/cc-
> NuzMfl.o, file is not of required architecture
> Undefined symbols:
>   "_main", referenced from:
>       start in crt1.10.5.o
> ld: symbol(s) not found
>
>
> Robert P.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list