This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add -Bsymbolic to arguments for GNU linker
ClosedPublic

Authored by jhuber6 on Feb 4 2022, 10:00 AM.

Details

Summary

This patch adds the '-Bsymbolic' flag when we perform linking for the
offloading device. We already pass '-fvisibility=protected' but this is
not properly handled when using the bfd linker as is described in
https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic.
Previously this caused linker errors when creating the shared library.

Diff Detail

Event Timeline

jhuber6 created this revision.Feb 4 2022, 10:00 AM
jhuber6 requested review of this revision.Feb 4 2022, 10:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2022, 10:00 AM
jhuber6 updated this revision to Diff 406022.Feb 4 2022, 10:01 AM

Clang format.

Can we drop an xfail in an existing test as part of this patch?

clang/lib/Driver/ToolChains/Gnu.cpp
576

Perhaps a comment to the effect that the symbols are protected which makes Bsymbolic redundant, except in that it works around an issue in bfd?

Can we drop an xfail in an existing test as part of this patch?

We can drop an XFAIL for AMDGPU, but that's not related to the problem this fixes, we don't have any XFAIL lines for x86 tests.

jhuber6 updated this revision to Diff 406027.EditedFeb 4 2022, 10:14 AM

More informative comment.

This revision is now accepted and ready to land.Feb 4 2022, 10:21 AM
This revision was automatically updated to reflect the committed changes.