Failing compiler-rt LTO test

Hi,

I'm trying to build clang/LLVM and am hitting a test failure in
compiler-rt/test/safestack/lto.c.

I believe the issue is that we've configured clang to use ld.bfd as the
linker. ld.bfd has plugin support as described here:

https://llvm.org/docs/GoldPlugin.html

compiler-rt/test/lit.common.cfg isn't set up to know about ld.bfd:

elif config.host_os == 'Linux' and is_linux_lto_supported():
  config.lto_supported = True
  config.lto_launch =
  if config.use_lld:
    config.lto_flags = ["-fuse-ld=lld"]
  else:
    config.lto_flags = ["-fuse-ld=gold"]

The test ends up passing -fuse-ld=gold and clang barfs.

It seems to me the correct thing to do is update lit.common.cfg to
support ld.bfd but I'm not sure exactly how to do that. I can't find
where "config" is defined. I think we'd want a config.use_bfd or
something. Maybe a config.use_gold as well for good measure.

Thoughts?

                            -David

Hi,

I’m trying to build clang/LLVM and am hitting a test failure in
compiler-rt/test/safestack/lto.c.

I believe the issue is that we’ve configured clang to use ld.bfd as the
linker. ld.bfd has plugin support as described here:

https://llvm.org/docs/GoldPlugin.html

I didn’t even realize that that doc indicated support for ld.bfd. Looks like the change was made in June 2017, without any associated review. I need to revert at least part of the patch, as it actually removed some instructions for building gold with plugins enabled, and replaced it with instructions for ld.bfd.

Adding Davide, who commented on the associated bug, for thoughts: https://bugs.llvm.org/show_bug.cgi?id=32760.
Also looking for comments from others in the community who may have more history or experience on the gold plugin interactions with ld.bfd.

My understanding in the past is that we didn’t officially support using the llvm gold plugin with ld.bfd. We don’t have any bots that test that combination (which is why you see the code below in lit.common.cfg). In my mind, that means using the llvm gold plugin with ld.bfd is at your own risk (and therefore I would like to remove the wording around using ld.bfd from the above doc, or at least add that disclaimer).

Can you use gold or lld instead?

Teresa

My understanding in the past is that we didn't officially support
using the llvm gold plugin with ld.bfd. We don't have any bots that
test that combination (which is why you see the code below in
lit.common.cfg). In my mind, that means using the llvm gold plugin
with ld.bfd is at your own risk (and therefore I would like to remove
the wording around using ld.bfd from the above doc, or at least add
that disclaimer).

Can you use gold or lld instead?

Thanks Teresa! We are indeed planning to use gold eventually. At first
I thought the tests were failing because ld.bfd wasn't supported but
then I saw the web page and got confused. :slight_smile: I posted the question
because I wanted to make sure we hadn't broken anything.

For now I'll just ignore the failures knowing they'll go away when we
switch.

                            -David

Great, glad you are planning to use gold (lld also is fine, it hooks directly into the LLVM sources without needing a plugin).

For now I have reverted the change to the doc, to avoid confusion.

Thanks!
Teresa

Unfortunately lld won't work for us yet due to a lack of linker script
features (sorry, I don't know the details).

Thanks for fixing up the docs.

                       -David

Teresa Johnson via llvm-dev <llvm-dev@lists.llvm.org> writes:

My take is that the change should be reverted, but you already did it
, so, thanks.
In general, we shouldn't really document combinations we don't test
using bots or document as best-effort/not-officially-supported.

Thank you,