[LLVMdev] LTO support on Mac

198 views
Skip to first unread message

Rahman Lavaee

unread,
Jan 10, 2015, 5:47:02 PM1/10/15
to llv...@cs.uiuc.edu
Hi,
I'm building LLVM on Mac OS 10.10 and I'm having trouble making LTO work. The system linker dumps the following information when I executed "ld -v"

@(#)PROGRAM:ld  PROJECT:ld64-241.9
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7m armv7em
LTO support using: LLVM version 3.4.2

which tells me that it is correctly pointing to the LLVM that I have built.
However, when I pass any LTO command line arguments like "disable-inling" it complains.

I was previously working on Linux and the gold plugin makes it very convenient. However, that plugin only handles ELF assembly and I can't install it on Mac.

Any idea what is wrong?

--
Rahman

Rafael Espíndola

unread,
Jan 12, 2015, 6:00:19 PM1/12/15
to Rahman Lavaee, llv...@cs.uiuc.edu
I am not sure if there is a supported way of passing extra llvm
options during LTO with ld64.

Cheers,
Rafael
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Nick Kledzik

unread,
Jan 12, 2015, 6:10:12 PM1/12/15
to Rafael Espíndola, Rahman Lavaee, llv...@cs.uiuc.edu


On Jan 12, 2015, at 2:45 PM, Rafael Espíndola <rafael.e...@gmail.com> wrote:
> On 10 January 2015 at 17:43, Rahman Lavaee <r.la...@gmail.com> wrote:
>> Hi,
>> I'm building LLVM on Mac OS 10.10 and I'm having trouble making LTO work.
>> The system linker dumps the following information when I executed "ld -v"
>>
>> @(#)PROGRAM:ld PROJECT:ld64-241.9
>> configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h
>> armv6m armv7m armv7em
>> LTO support using: LLVM version 3.4.2
>>
>> which tells me that it is correctly pointing to the LLVM that I have built.
>> However, when I pass any LTO command line arguments like "disable-inling" it
>> complains.
>>
>> I was previously working on Linux and the gold plugin makes it very
>> convenient. However, that plugin only handles ELF assembly and I can't
>> install it on Mac.
>
>
> I am not sure if there is a supported way of passing extra llvm
> options during LTO with ld64.

You can pass options with -mllvm. But you need to get it to the linker, so when invoking the linker through clang it looks like:

-Wl,-llvm,-myltoopt

That will get it to lto_codegen_debug_options(). But I don’t know what options strings lto_codegen_debug_options() handles.

-Nick

Rahman Lavaee

unread,
Jan 18, 2015, 12:14:33 PM1/18/15
to Nick Kledzik, llv...@cs.uiuc.edu
Thank you Nick. I think it's worth giving LLD a try.
I tried building lld (branch 3.4) on top of llvm 3.4 and got the following error in the last step when it is linking lld.

[100%] Building CXX object tools/lld/tools/lld/CMakeFiles/lld.dir/lld.cpp.o
Linking CXX executable ../../../../bin/lld
ld: library not found for -llldHexagonELFTarget

Can you please help me with that?

On Mon, Jan 12, 2015 at 5:55 PM, Nick Kledzik <kle...@apple.com> wrote:


On Jan 12, 2015, at 2:45 PM, Rafael Espíndola <rafael.e...@gmail.com> wrote:
> On 10 January 2015 at 17:43, Rahman Lavaee <r.la...@gmail.com> wrote:
>> Hi,
>> I'm building LLVM on Mac OS 10.10 and I'm having trouble making LTO work.
>> The system linker dumps the following information when I executed "ld -v"
>>
>> @(#)PROGRAM:ld  PROJECT:ld64-241.9
>> configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h
>> armv6m armv7m armv7em
>> LTO support using: LLVM version 3.4.2
>>
>> which tells me that it is correctly pointing to the LLVM that I have built.
>> However, when I pass any LTO command line arguments like "disable-inling" it
>> complains.
>>
>> I was previously working on Linux and the gold plugin makes it very
>> convenient. However, that plugin only handles ELF assembly and I can't
>> install it on Mac.
>
>
> I am not sure if there is a supported way of passing extra llvm
> options during LTO with ld64.

You can pass options with -mllvm.  But you need to get it to the linker, so when invoking the linker through clang it looks like:

 -Wl,-llvm,-myltoopt

That will get it to lto_codegen_debug_options().  But I don’t know what options strings lto_codegen_debug_options() handles.

-Nick



--
Rahman

Rafael Espíndola

unread,
Jan 19, 2015, 8:11:11 PM1/19/15
to Rahman Lavaee, llv...@cs.uiuc.edu
lld is a relatively new project. You should really try trunk instead of 3.4.

_______________________________________________

Reply all
Reply to author
Forward
0 new messages