Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.2

http://hackage.haskell.org/trac/ghc/changeset/1b299728d0806e8cb89c49cc3a731f9e22ec711d

>---------------------------------------------------------------

commit 1b299728d0806e8cb89c49cc3a731f9e22ec711d
Author: Karel Gardas <[email protected]>
Date:   Mon Jun 13 12:44:12 2011 +0200

    Fix to use %note instead of @note as an ELF section note on ARM architecture
    
    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 |   15 ++++++++++++++-
 compiler/utils/Platform.hs      |    4 ++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index c7bc823..112dac0 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 f3749ca..40e4a01 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



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

Reply via email to