Linker error with -flto

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Linker error with -flto

Robert Purves
$ cat test.c
struct Foo
{
        int x, y;
};

int main( void )
{
        struct Foo f = { 0, 0 };
        return 0;
}

$ llvm-gcc-4.2 test.c
$ llvm-gcc-4.2 test.c -flto
$ clang test.c
$ clang test.c -flto
Intrinsic prototype has incorrect number of arguments!
void (i8*, i8, i64, i32, i1)* @llvm.memset.p0i8.i64
Broken module found, compilation aborted!
Stack dump:
0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
1. Running pass 'Module Verifier' on function '@main'
clang: error: linker command failed due to signal 6 (use -v to see invocation)

$ clang --version
Apple clang version 1.5 (tags/Apple/clang-60)
Target: x86_64-apple-darwin10
Thread model: posix

With debugging info turned on, the error message is different:
$ clang test.c -flto -gdwarf2
ld: in /var/folders/88/88AKX+F62RWmd++8ZOxBkU+++TQ/-Tmp-/cc-qjdqFJ.o, could not parse object file /var/folders/88/88AKX+F62RWmd++8ZOxBkU+++TQ/-Tmp-/cc-qjdqFJ.o: Unknown instruction
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Robert P.


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Linker error with -flto

Chris Lattner

On Jun 23, 2010, at 11:02 PM, Robert Purves wrote:

> $ cat test.c
> struct Foo
> {
> int x, y;
> };
>
> int main( void )
> {
> struct Foo f = { 0, 0 };
> return 0;
> }
>
> $ llvm-gcc-4.2 test.c
> $ llvm-gcc-4.2 test.c -flto
> $ clang test.c
> $ clang test.c -flto
> Intrinsic prototype has incorrect number of arguments!
> void (i8*, i8, i64, i32, i1)* @llvm.memset.p0i8.i64
> Broken module found, compilation aborted!
> Stack dump:
> 0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
> 1. Running pass 'Module Verifier' on function '@main'
> clang: error: linker command failed due to signal 6 (use -v to see invocation)

This sounds like you're using clang with an old liblto.  Try replacing the liblto (in /usr/lib/libLTO.dylib and /Developer/usr/lib/libLTO.dylib) with the one built when you built clang.

-Chris

>
> $ clang --version
> Apple clang version 1.5 (tags/Apple/clang-60)
> Target: x86_64-apple-darwin10
> Thread model: posix
>
> With debugging info turned on, the error message is different:
> $ clang test.c -flto -gdwarf2
> ld: in /var/folders/88/88AKX+F62RWmd++8ZOxBkU+++TQ/-Tmp-/cc-qjdqFJ.o, could not parse object file /var/folders/88/88AKX+F62RWmd++8ZOxBkU+++TQ/-Tmp-/cc-qjdqFJ.o: Unknown instruction
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
> Robert P.
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Linker error with -flto

Robert Purves

Chris Lattner wrote:

>> $ cat test.c
>> struct Foo
>> {
>> int x, y;
>> };
>>
>> int main( void )
>> {
>> struct Foo f = { 0, 0 };
>> return 0;
>> }
>>
>> $ llvm-gcc-4.2 test.c
>> $ llvm-gcc-4.2 test.c -flto
>> $ clang test.c
>> $ clang test.c -flto
>> Intrinsic prototype has incorrect number of arguments!
>> void (i8*, i8, i64, i32, i1)* @llvm.memset.p0i8.i64
>> Broken module found, compilation aborted!
>> Stack dump:
>> 0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
>> 1. Running pass 'Module Verifier' on function '@main'
>> clang: error: linker command failed due to signal 6 (use -v to see invocation)
>
> This sounds like you're using clang with an old liblto.  Try replacing the liblto (in /usr/lib/libLTO.dylib and /Developer/usr/lib/libLTO.dylib) with the one built when you built clang.

I didn't build it. Everything is from the recent Xcode 3.2.3 release

$ ls -l /usr/lib/libLTO.dylib
-rwxrwxr-x  1 root  admin  25934400 11 May 11:49 /usr/lib/libLTO.dylib
$ ls -l /Developer/usr/lib/libLTO.dylib
-rwxrwxr-x  1 root  admin  25934400 11 May 11:49 /Developer/usr/lib/libLTO.dylib

> $ clang --version
> Apple clang version 1.5 (tags/Apple/clang-60)

Robert P.


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Linker error with -flto

Chris Lattner

On Jun 24, 2010, at 12:30 AM, Robert Purves wrote:

>>> Broken module found, compilation aborted!
>>> Stack dump:
>>> 0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
>>> 1. Running pass 'Module Verifier' on function '@main'
>>> clang: error: linker command failed due to signal 6 (use -v to see invocation)
>>
>> This sounds like you're using clang with an old liblto.  Try replacing the liblto (in /usr/lib/libLTO.dylib and /Developer/usr/lib/libLTO.dylib) with the one built when you built clang.
>
> I didn't build it. Everything is from the recent Xcode 3.2.3 release
>
> $ ls -l /usr/lib/libLTO.dylib
> -rwxrwxr-x  1 root  admin  25934400 11 May 11:49 /usr/lib/libLTO.dylib
> $ ls -l /Developer/usr/lib/libLTO.dylib
> -rwxrwxr-x  1 root  admin  25934400 11 May 11:49 /Developer/usr/lib/libLTO.dylib

That turns out to be a serious bug in Xcode 3.2.3.  I'll file a bug internally, thanks!

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev