[PATCH] Fix to use %note instead of @note as an ELF section note on ARM architecture
Simon Marlow
marlowsd at gmail.com
Tue Jun 14 11:23:48 CEST 2011
On 13/06/2011 11:44, 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 | 15 ++++++++++++++-
> compiler/utils/Platform.hs | 3 +++
> 2 files changed, 17 insertions(+), 1 deletions(-)
Thanks, I'll apply this.
Cheers,
Simon
> diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
> index afbd03e..c623969 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,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 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