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

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 07:35:40 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);
----------------
resistor wrote:

I went ahead and moved this into the target hook.

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


More information about the llvm-commits mailing list