[llvm] [RISCV] Put Large Code Model Constant Pools in .text (PR #151393)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 13:55:34 PDT 2025


================
@@ -161,6 +161,15 @@ bool RISCVELFTargetObjectFile::isConstantInSmallSection(
 MCSection *RISCVELFTargetObjectFile::getSectionForConstant(
     const DataLayout &DL, SectionKind Kind, const Constant *C,
     Align &Alignment) const {
+
+  // The large code model has to put constant pools close to the program, so we
+  // put them in the .text section. Large code model doesn't support PIC, so
+  // there should be no dynamic relocations that would require `.data.rel.ro`
+  // (which could be too far away anyway).
+  if (TM->getCodeModel() == CodeModel::Large) {
----------------
topperc wrote:

Drop curly braces

https://github.com/llvm/llvm-project/pull/151393


More information about the llvm-commits mailing list