[llvm-dev] Problems using Clang with LLD on embedded ARM
Sean Vig via llvm-dev
llvm-dev at lists.llvm.org
Sun Feb 26 14:25:57 PST 2017
Hi Sean
On Sun, Feb 26, 2017 at 5:10 AM, Sean Silva <chisophugis at gmail.com> wrote:
>
> 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?
>
> (though it does seem like we still fail H.J.'s test case in
> https://bugs.llvm.org//show_bug.cgi?id=28414 has not yet been fixed. I
> further reduced it. Seems to be related to symbol versioning. We don't
> recognize that `.symver bar, foo@@VERS` is a definition of `foo`.
> )
>
>
> If you are building your own LLD, can you see if the attached patch fixes
> it for you? If not, can you add `--reproduce /tmp/repro.tar` to your link
> command line and upload repro.tar somewhere for us?
>
Thanks! I applied that patch and it links with -flto now, but it looks like
there are now some other problems. First, it seems to be dropping things
that I try to KEEP in the linker script, even when I don't use
--gc-sections, namely my interrupt vector table. Second, when using thin
LTO, it starts trying to link symbols __aeabi_memclr4 and __aeabi_uidiv,
which I don't think it should since I am using -ffreestanding -fno-builtins
when compiling (with full lto or no lto, it does not try to link these
symbols).
I just sent an email to register for a bugzilla account, I can report there
with a minimally reproducible example for these problems.
>
> @Renato, do you know if there is any way for us to
> implement getBitcodeMachineKind in a sane way so that we don't fill in a
> long tail of cases of inferring EM_* from the triple? It seems that the
> EM_* choices are buried very deep in the backend, so it might not be
> feasible :(
>
> What kind of issues have you been running into?
>
> Linker scripts are certainly one area that we have been slowly filling in
> the long tail of compatibility, it would be great if you filed bugs with
> any issues you encounter! If the files are small enough and you can share
> them, it can be as simple as just adding `--reproduce /tmp/repro.tar` to
> your link command line (or setting LLD_REPRODUCE=/tmp/repro.tar in the
> environment) and attach repro.tar to a bug report whenever you encounter an
> issue (even if repro.tar is larger, you can try hosting on google drive /
> dropbox etc., compressing with xz also often helps). Or if it is a parsing
> problem just attaching the problematic linker script to the bug report
> might be enough.
>
I haven't hit anything that looked like a bug, just features that aren't
implemented, or that work slightly differently between ld linker scripts.
I'd be happy to make additional feature requests for those on the bug
tracker, too.
Regarding objcopy, that is something that we have wanted to write for a
> long time (but it has never quite been a priority). As objcopy supports a
> bewildering set of different options, it would be useful for you to file a
> bug about what specific options/features you need. We don't really have a
> bugzilla component for objcopy yet, so you can just throw it under llvm-nm
> (another one of the binutils, close enough) in https://bugs.llvm.org/enter
> _bug.cgi?product=tools
>
Sounds good.
Thanks for the patch and the help.
Sean
>
> -- Sean Silva
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170226/fd795532/attachment.html>
More information about the llvm-dev
mailing list