[llvm] [LLVM/CodeGen] Use the correct address space when building structor tables. (PR #171247)
Owen Anderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 19:27:29 PST 2025
https://github.com/resistor created https://github.com/llvm/llvm-project/pull/171247
No in-tree target exercises this, but it's needed for CHERI, and I believe its correctness is verifiable by inspection.
Co-authored-by: Alex Richardson <alexrichardson at google.com>
>From 39dc8ce9289d6bbaae45f52591f28e1a6186329c Mon Sep 17 00:00:00 2001
From: Owen Anderson <resistor at mac.com>
Date: Mon, 8 Dec 2025 21:18:20 -0600
Subject: [PATCH] [LLVM/CodeGen] Use the correct address space when building
structor tables.
No in-tree target exercises this, but it's needed for CHERI, and I believe its correctness is verifiable by inspection.
Co-authored-by: Alex Richardson <alexrichardson at google.com>
---
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 3aa245b7f3f1e..c459b80baf4ab 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -3473,7 +3473,7 @@ void AsmPrinter::emitXXStructorList(const DataLayout &DL, const Constant *List,
if (!TM.Options.UseInitArray)
std::reverse(Structors.begin(), Structors.end());
- const Align Align = DL.getPointerPrefAlignment();
+ const Align Align = DL.getPointerPrefAlignment(DL.getProgramAddressSpace());
for (Structor &S : Structors) {
const TargetLoweringObjectFile &Obj = getObjFileLowering();
const MCSymbol *KeySym = nullptr;
More information about the llvm-commits
mailing list