This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Don't passs --dynamic-linker in -r mode
ClosedPublic

Authored by brad on Jul 13 2022, 6:11 PM.

Details

Summary

As mentioned in commit 57e43ebc42d4e572cab1e84532115c364d5db92a..

No behavior change as GNU ld/gold/ld.lld ignore --dynamic-linker in -r mode.
This change makes the intention clearer as we already suppress --dynamic-linker
for -shared, -static, and -static-pie.

Diff Detail

Event Timeline

brad created this revision.Jul 13 2022, 6:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 6:11 PM
brad requested review of this revision.Jul 13 2022, 6:11 PM
MaskRay accepted this revision.Jul 13 2022, 6:14 PM

Thanks! This is trivially correct but consider giving folks one day to respond.

This revision is now accepted and ready to land.Jul 13 2022, 6:14 PM
brad added a comment.Jul 13 2022, 6:18 PM

Thanks! This is trivially correct but consider giving folks one day to respond.

Sure thing. No problem.

brad added a comment.EditedJul 14 2022, 7:34 AM

One question, should the backends be passing -pie when using -r? I had adjusted the tests but cannot remember why I had changed the logic of the backend before submitting the diff. I had originally had -pie disabled with -r for Ananas and NetBSD.

I noticed Fuchsia has...

if (!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_r))
  CmdArgs.push_back("-pie");

-r -pie feels like an error to me. gcc -dumpspecs uses %{static|shared|r:;!no-pie:-pie}, which means -r overrides -pie.
Either match the behavior if report an error. If reporting an error adds too much complexity, just match the behavior.
We just shouldn't let -pie override -r.

phosek accepted this revision.Jul 14 2022, 11:54 AM

LGTM

brad updated this revision to Diff 444791.Jul 14 2022, 1:52 PM

Disable -pie when using -r.

This revision was landed with ongoing or failed builds.Jul 16 2022, 5:13 PM
This revision was automatically updated to reflect the committed changes.