This is an archive of the discontinued LLVM Phabricator instance.

Make -defsym a driver option
AbandonedPublic

Authored by salari01 on Mar 30 2017, 8:09 AM.

Details

Summary

Extended the integrated assembler -Wa,-defsym option to be usable with the Clang driver. Both options are handled in the same way. Using -defsym when not assembling files shows an unused argument warning.

Diff Detail

Event Timeline

salari01 created this revision.Mar 30 2017, 8:09 AM
rogfer01 added inline comments.
lib/Driver/ToolChains/Clang.cpp
1882

I wonder if you should break; here if validation fails like the original code did?

salari01 added inline comments.Mar 30 2017, 8:43 AM
lib/Driver/ToolChains/Clang.cpp
1882

The reason for removing it is that this way, all erroneous -defsym options specified can be listed during the same invocation. This provides a better user experience than tackling them one at a time, as with the original code.

rogfer01 added inline comments.Mar 30 2017, 8:46 AM
lib/Driver/ToolChains/Clang.cpp
1882

Ah, I see, thanks!

salari01 marked 3 inline comments as done.Mar 30 2017, 8:57 AM
sanwou01 edited edge metadata.

Hi Salman,

This essentially looks good to me. I don't think I'm the right person to LGTM this however, so I've added some reviewers who might be able to have a look.

Thanks,
Sanne

rnk edited edge metadata.Apr 7 2017, 8:16 AM

-Wl,--defsym is also a pretty common linker option. I'm hesitant to add this to the driver interface, since it seems like they could easily be confused.

include/clang/Driver/Options.td
546

I'm pretty sure this shouldn't be in "d_Group":

def d_Group : OptionGroup<"<d group>">, Group<Preprocessor_Group>,
              DocName<"Dumping preprocessor state">, DocBrief<[{
Flags allowing the state of the preprocessor to be dumped in various ways.}]>;
salari01 abandoned this revision.Apr 25 2017, 5:19 AM
In D31496#721262, @rnk wrote:

-Wl,--defsym is also a pretty common linker option. I'm hesitant to add this to the driver interface, since it seems like they could easily be confused.

I see. Was not aware of that linker option. Having looked it up now, I agree that the risk of confusion with the linker option outweighs the convenience of having this as a Driver option. I'll adandon this revision.