summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/main/DriverPipeline.hs15
-rw-r--r--compiler/utils/Platform.hs4
2 files changed, 18 insertions, 1 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index c7bc823823..112dac0439 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1440,7 +1440,10 @@ mkExtraObjToLinkIntoBinary dflags dep_packages = do
| isWindowsTarget = empty
| otherwise = hcat [
text "__asm__(\"\\t.section ", text ghcLinkInfoSectionName,
- text ",\\\"\\\",@note\\n",
+ text ",\\\"\\\",",
+ text elfSectionNote,
+ text "\\n",
+
text "\\t.ascii \\\"", info', text "\\\"\\n\");" ]
where
-- we need to escape twice: once because we're inside a C string,
@@ -1450,6 +1453,16 @@ mkExtraObjToLinkIntoBinary dflags dep_packages = do
escape :: String -> String
escape = concatMap (charToC.fromIntegral.ord)
+ elfSectionNote :: String
+ elfSectionNote = case platformArch defaultTargetPlatform of
+ ArchX86 -> "@note"
+ ArchX86_64 -> "@note"
+ ArchPPC -> "@note"
+ ArchPPC_64 -> "@note"
+ ArchSPARC -> "@note"
+ ArchARM -> "%note"
+ ArchUnknown -> panic "elfSectionNote ArchUnknown"
+
-- The "link info" is a string representing the parameters of the
-- link. We save this information in the binary, and the next time we
-- link, if nothing else has changed, we use the link info stored in
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs
index f3749ca09c..40e4a015df 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -39,6 +39,7 @@ data Arch
| ArchPPC
| ArchPPC_64
| ArchSPARC
+ | ArchARM
deriving (Show, Eq)
@@ -63,6 +64,7 @@ target32Bit p = case platformArch p of
ArchPPC -> True
ArchPPC_64 -> False
ArchSPARC -> True
+ ArchARM -> True
-- | This predicates tells us whether the OS supports ELF-like shared libraries.
@@ -95,6 +97,8 @@ defaultTargetArch = ArchPPC
defaultTargetArch = ArchPPC_64
#elif sparc_TARGET_ARCH
defaultTargetArch = ArchSPARC
+#elif arm_TARGET_ARCH
+defaultTargetArch = ArchARM
#else
defaultTargetArch = ArchUnknown
#endif