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

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 23:20:49 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())
----------------
arichardson wrote:

I think this needs a comment such as "over aligning explicit sections can in some cases break uses such as linker sets that expect precise sizing". I feel like there might have been one down stream that could be used or in one of the MTE patch sets? 

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


More information about the llvm-commits mailing list