[PATCH] D72056: [RISCV] Generate PIC address sequence for medany -fno-pic

James Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 1 11:45:43 PST 2020


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/TargetMachine.cpp:192
       return false;
+    // RISC-V non-small code models prefer avoiding copy relocations.
+    if (TT.isRISCV() && getCodeModel() != CodeModel::Small)
----------------
MaskRay wrote:
> jrtc27 wrote:
> > Are we sure we want to do this and take the performance hit over GCC due to the extra level of indirection on every single extern global access? If this is the solution to take for extern weak, I think we should limit it to just that and have a separate discussion about non-extern-weak.
> I'd like to know more about `-mcmodel=medany -fno-pic`'s use cases. I guess @bsdjhb's FreeBSD kernel use case can probably be met by `-mcmodel=medany -fpie`.
> 
> I think there is no precedent which differs extern-strong and extern-weak. If GOT relaxation works, we can make this unconditional.
> 
>   // RISC-V prefer avoiding copy relocations.
>   if (TT.isRISCV()
>     return false;
It can, but that implies GOT accesses for anything extern, which will hurt kernel performance.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72056/new/

https://reviews.llvm.org/D72056





More information about the cfe-commits mailing list