ghc/11662.patch

32 lines
1.3 KiB
Diff

From bed85f7bc358fdca4677a3070b94ea544bb9e7ff Mon Sep 17 00:00:00 2001
From: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Date: Mon, 27 Nov 2023 12:34:47 +0100
Subject: [PATCH] llvmGen: Align objects in the data section
Objects in the data section may be referenced via tagged pointers.
Thus, align those objects to a 4- or 8-byte boundary for 32- or 64-bit
platforms, respectively. Note, this may need to be reconsidered if
objects with a greater natural alignment requirement are emitted as e.g.
128-bit atomics.
Fixes #24163.
---
compiler/GHC/CmmToLlvm/Data.hs | 1 +
1 file changed, 1 insertion(+)
diff --git a/compiler/GHC/CmmToLlvm/Data.hs b/compiler/GHC/CmmToLlvm/Data.hs
index caac121413c..5e8912e3bc7 100644
--- a/compiler/GHC/CmmToLlvm/Data.hs
+++ b/compiler/GHC/CmmToLlvm/Data.hs
@@ -89,6 +89,7 @@ genLlvmData (sec, CmmStaticsRaw lbl xs) = do
align = case sec of
Section CString _ -> if (platformArch platform == ArchS390X)
then Just 2 else Just 1
+ Section Data _ -> Just $ platformWordSizeInBytes platform
_ -> Nothing
const = if sectionProtection sec == ReadOnlySection
then Constant else Global
--
GitLab