This is an archive of the discontinued LLVM Phabricator instance.

[mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'
ClosedPublic

Authored by vstefanovic on Jan 17 2019, 2:13 PM.

Details

Summary

These two options enable/disable emission of R_{MICRO}MIPS_JALR fixups along
with PIC calls. The linker may then try to turn PIC calls into direct jumps.
By default, these fixups do get emitted by the backend, use
'-mno-relax-pic-calls' to omit them.

Diff Detail

Repository
rL LLVM

Event Timeline

vstefanovic created this revision.Jan 17 2019, 2:13 PM
atanasyan accepted this revision.Jan 18 2019, 5:10 AM

LGTM with a nit.

lib/Driver/ToolChains/Clang.cpp
1720 ↗(On Diff #182397)

It's not necessary to call the MakeArgString here. You can write just CmdArgs.push_back("-mips-jalr-reloc=0");.

This revision is now accepted and ready to land.Jan 18 2019, 5:10 AM
This revision was automatically updated to reflect the committed changes.
sdardis added inline comments.Jan 18 2019, 2:23 PM
cfe/trunk/include/clang/Driver/Options.td
2423

I think this help text could be a little better. Instead of implying that the compiler could turn PIC calls into direct calls, something like "Produce relaxation hints for linkers to try optimizing PIC call sequences into direct calls", I believe describes the optimization better. Likewise in the negative sense for the -mno-relax-pic-calls.

vstefanovic marked an inline comment as done.Jan 22 2019, 1:46 PM
vstefanovic added inline comments.
cfe/trunk/include/clang/Driver/Options.td
2423

Hi Simon, I'll replace the text with your version, it's better indeed. Thanks.