[llvm] [CHERI][RISCV] Do not attempt to pass in an alignment granule for globals with explicit sections. (PR #218189)

TarcĂ­sio Fischer via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 05:02:56 PDT 2026


================
@@ -788,7 +788,9 @@ MCSymbol *AsmPrinter::getSymbolPreferLocal(const GlobalValue &GV) const {
 
 /// EmitGlobalVariable - Emit the specified global variable to the .s file.
 void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
-  MaybeAlign AlignmentGranule = getRequiredGlobalAlignmentGranule(*GV);
+  MaybeAlign AlignmentGranule = std::nullopt;
+  if (!GV->hasSection())
+    AlignmentGranule = getRequiredGlobalAlignmentGranule(*GV);
----------------
tarcisiofischer wrote:

Thank you for letting me know about this!
Unfortunately we are not moving forward with the idea in the near future. Things may change, but for now I am dropping that PR.

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


More information about the llvm-commits mailing list