This is an archive of the discontinued LLVM Phabricator instance.

Add clang flag equivalent to clang-cl /Zl flag
ClosedPublic

Authored by akhuang on Sep 15 2022, 11:16 AM.

Details

Summary

The /Zl flag omits default C runtime library name from obj files.
This patch just adds an equivalent clang driver flag.

Event Timeline

akhuang created this revision.Sep 15 2022, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 11:16 AM
akhuang requested review of this revision.Sep 15 2022, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 11:16 AM
mstorsjo added inline comments.Sep 15 2022, 12:57 PM
clang/include/clang/Driver/Options.td
2230

Initially, I'm not entirely sure about the option name - initially it feels weird/clumsy, but after thinking about it, I'm not sure if I can come up with something better either. Maybe just -fms-omit-default-lib?

hans added a comment.Sep 15 2022, 1:51 PM

Could the new flag be marked as an Alias in the tablegen, so that we don't need to do any code changes for it?

Could the new flag be marked as an Alias in the tablegen, so that we don't need to do any code changes for it?

It appears before _SLASH_Zl in the file so we'd have to move it out of place. We could alias /Zl to the new flag.

akhuang updated this revision to Diff 462042.Sep 21 2022, 4:53 PM
akhuang marked an inline comment as done.

Change name of flag, and alias /Zl to this flag.

hans accepted this revision.Sep 21 2022, 10:02 PM

lgtm

clang/include/clang/Driver/Options.td
2231

Might as well add a help text while we're here?

This revision is now accepted and ready to land.Sep 21 2022, 10:02 PM
mstorsjo added inline comments.Sep 21 2022, 10:37 PM
clang/test/Driver/cl-runtime-flags.c
101

This testcase doesn't seem to be updated with the new name of the option?

akhuang updated this revision to Diff 462230.Sep 22 2022, 10:22 AM
akhuang marked an inline comment as done.

Fix flag name in test case

mstorsjo accepted this revision.Sep 22 2022, 12:30 PM

LGTM, thanks!

This revision was automatically updated to reflect the committed changes.