This is an archive of the discontinued LLVM Phabricator instance.

[mips] Notify user that `-mabicalls` is ignored on non-PIC N64 ABI
ClosedPublic

Authored by atanasyan on Aug 9 2017, 2:07 PM.

Details

Summary

The -mabicalls option does not make sense in the case of non position independent code for the N64 ABI. After this change the driver shows a warning that -mabicalls is ignored in that case.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Aug 9 2017, 2:07 PM
sdardis edited edge metadata.Aug 10 2017, 3:54 AM

Slight tweak to the summary:

The -mabicalls option does not have a sense in case of non position independent code on N64 ABI. After this change driver starts to show a warning that -mabicalls is ignored in that case.

The -mabicalls option does not make sense in the case of non position independent code for the N64 ABI. After this change the driver shows a warning that -mabicalls is ignored in that case.

I think the major change in this patch is overly complex for what it should be, suggestion inline.

include/clang/Basic/DiagnosticDriverKinds.td
297 ↗(On Diff #110477)

and the N64 ABI

lib/Driver/ToolChains/Arch/Mips.cpp
233–253 ↗(On Diff #110477)

I think this logic can be simplified to:

bool UseAbiCalls = false;                                                                                            

Arg *ABICallsArg =
    Args.getLastArg(options::OPT_mabicalls, options::OPT_mno_abicalls);                                              
UseAbiCalls =
    !ABICallsArg || 
    (ABICallsArg && ABICallsArg->getOption().matches(options::OPT_mabicalls));                                       

if (UseAbiCalls && IsN64 && NonPIC) {
  D.Diag(diag::warn_drv_unsupported_abicalls);                                                                       
  UseAbiCalls = false;                                                                                               
}                                                                                                                    

if (!UseAbiCalls)
  Features.push_back("+noabicalls");                                                                                 
else
  Features.push_back("-noabicalls");

As that way we immediately pick up the implicit case or explicit case of using -mabicalls and we can simply pick out the N64 && NonPic && UseAbiCalls case to warn and fix.

Although we don't need to add "-noabicalls" to the Features vector, the backend defaults to that, though the tests expect it.

atanasyan updated this revision to Diff 110561.Aug 10 2017, 5:41 AM
atanasyan edited the summary of this revision. (Show Details)
  • Addressed review comments.

Nit: my comment on line 297, "non position-independent code and N64 ABI" should be "non position-independent code and the N64 ABI".

LGTM otherwise.

This revision was automatically updated to reflect the committed changes.