[llvm-dev] Problems using Clang with LLD on embedded ARM
Davide Italiano via llvm-dev
llvm-dev at lists.llvm.org
Sun Feb 26 14:16:49 PST 2017
On Sun, Feb 26, 2017 at 3:10 AM, Sean Silva <chisophugis at gmail.com> wrote:
> On Sat, Feb 25, 2017 at 9:38 PM, Sean Vig via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> I stopped into IRC to ask about a problem I've been having using Clang in
>> conjunction with LLD to compile and link for an embedded project on Cortex-M
>> ARM processor.
>> First, I am able to separately compile with a call to clang and link with
>> a call to lld, but I cannot use clang to link using lld using the
>> -fuse-ld=lld flag. I have the output from `clang -v -fuse-ld=lld -target
>> arm-none-eabi main.c -o main` here , where calling `clang -target
>> arm-none-eabi -c main.c -o main.o` and `ld.lld main.o -o main` work fine.
>> Doing the compiling and linking for my host computer works just fine using
>> -fuse-ld=lld, and I verified that it is using LLD by checking the .comments
>> section in the generated elf.
> For that triple, Clang seems to be calling into GCC driver
> (/usr/bin/arm-none-eabi-gcc) for linking and GCC doesn't recognize
> -fuse-ld=lld (supposedly -fuse-ld=gold selects ld.gold, -fuse-ld=bfd selects
> ld.bfd and you would expect -fuse-lld=lld to select ld.lld, but it doesn't
> work like that apparently).
> @Renato: Do you know why Clang is forwarding to GCC like this for linking?
> If we need to live with this arrangement for a long time we should
> definitely invest in teaching GCC about -fuse-ld=lld
> @Davide: is there any chance you could revive that GCC patch to add support
> for LLD?
I can probably find some time to revive that support next week
(sorry it's GDC week this week and I won't likely have time
for anything compiler-related).
More information about the llvm-dev