[PATCH] Fix to use %note instead of @note as an ELF section note on ARM architecture

Karel Gardas karel.gardas at centrum.cz
Mon Jun 13 12:42:20 CEST 2011


Sorry, this is a wrong version of the patch. I'm going to resend correct 
one.

Karel

On 06/13/11 12:29 PM, Karel Gardas wrote:
> 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 ",\\\"\\\", at 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




More information about the Cvs-ghc mailing list