jrtc27 wrote: isPositionIndependent() needs to use LLA/LGA as appropriate based on whether the symbol is local. Plus -mcmodel=medium needs to use LGA for extern weak. See RISCVTargetLowering::getAddr for the full set of behaviours needed. https://github.com/llvm/llvm-project/pull/70091