It looks like where x86 assembly is using '@' character,
ARM assembly requires '%' character. This makes a problem in the patch
814edf44433801e37318ce79082ac6991dbc87dd 'Force re-linking if
the options have changed (#4451)' which makes linking assembly
file uncompilable on ARM. This patch fixes this.
---
 compiler/main/DriverPipeline.hs |   11 ++++++++++-
 compiler/utils/Platform.hs      |    3 +++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index afbd03e..73d8704 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,12 @@ mkExtraObjToLinkIntoBinary dflags dep_packages = do
             escape :: String -> String
             escape = concatMap (charToC.fromIntegral.ord)
 
+            elfSectionNote :: String
+            elfSectionNote = case platformArch defaultTargetPlatform of
+                               ArchX86 || ArchPPC || 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 e4f97bd..5069801 100644
--- a/compiler/utils/Platform.hs
+++ b/compiler/utils/Platform.hs
@@ -37,6 +37,7 @@ data Arch
        | ArchPPC
        | ArchPPC_64
        | ArchSPARC
+        | ArchARM
        deriving (Show, Eq)
        
 
@@ -80,6 +81,8 @@ defaultTargetArch     = ArchPPC
 defaultTargetArch      = ArchPPC_64
 #elif sparc_TARGET_ARCH
 defaultTargetArch      = ArchSPARC
+#elif arm_TARGET_ARCH
+defaultTargetArch       = ArchARM
 #else
 defaultTargetArch      = ArchUnknown
 #endif
-- 
1.7.4.3


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to