Page MenuHomePhabricator

[Driver] Allow -specs and -nostartfiles to be forwarded to GCC
ClosedPublic

Authored by pzheng on Sep 4 2020, 2:03 PM.

Details

Summary

With 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee, these two options are no longer
forwarded to GCC. This patch restores the original behavior.

Diff Detail

Event Timeline

pzheng created this revision.Sep 4 2020, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2020, 2:03 PM
pzheng requested review of this revision.Sep 4 2020, 2:03 PM
MaskRay accepted this revision.Sep 4 2020, 2:51 PM

LGTM.

clang/test/Driver/gcc_forward.c
5

Moving nostartfiles before nostdlib to keep an alphabetical order.

Similarly, specs can precede static.

This revision is now accepted and ready to land.Sep 4 2020, 2:51 PM
MaskRay added a comment.EditedSep 4 2020, 2:52 PM

Can D83648 be closed now?

BTW, can you describe a bit about your use cases? Forwarding options to gcc does not seem common nowadays...

pzheng marked an inline comment as done.Sep 4 2020, 3:06 PM

Can D83648 be closed now?

Yes, I have closed it.

BTW, can you describe a bit about your use cases? Forwarding options to gcc does not seem common nowadays...

It's probably not used very common, but we do have some baremetal use cases still relying on these flags to be propagated to GCC.

clang/test/Driver/gcc_forward.c
5

Thanks for pointing this out. I did not realize the flags are ordered. Will update the patch shortly.

pzheng updated this revision to Diff 290038.Sep 4 2020, 3:07 PM
pzheng marked an inline comment as done.

Updated the test case.

This revision was landed with ongoing or failed builds.Sep 4 2020, 3:10 PM
This revision was automatically updated to reflect the committed changes.

LGTM.

It's probably not used very common, but we do have some baremetal use cases still relying on these flags to be propagated to GCC.

Thanks for the explanation! (Though I think in these cases calling ld or ld.lld directly might be better?)

And apologies about the friction but I hope the current behavior is better than the previous whether many unrelated options can be forwarded and many can cause warnings on GCC side.

pzheng added a comment.Sep 4 2020, 3:27 PM

LGTM.

It's probably not used very common, but we do have some baremetal use cases still relying on these flags to be propagated to GCC.

Thanks for the explanation! (Though I think in these cases calling ld or ld.lld directly might be better?)

And apologies about the friction but I hope the current behavior is better than the previous whether many unrelated options can be forwarded and many can cause warnings on GCC side.

No worries. Hopefully, these flags are the only outliers. Thanks for reviewing the patch!