diff options
author | PHO <pho@cielonegro.org> | 2011-11-30 17:46:27 +0900 |
---|---|---|
committer | PHO <pho@cielonegro.org> | 2011-12-08 10:57:28 +0900 |
commit | 3640d374f3501c0addb1be273ecc0f10f93be10d (patch) | |
tree | 17a23f00548a6ecbe1728bfdd561247ed8cc94e4 /compiler | |
parent | 8b48562e8cd773b4bc162edb4fc6d05a7654c7e1 (diff) | |
download | haskell-3640d374f3501c0addb1be273ecc0f10f93be10d.tar.gz |
Detect cases where as(1) doesn't recognise .ident directive (#5408)
.ident directives are usually ignored by as(1), and in some cases (like Darwin/PPC) they even raise an error.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/SysTools.lhs | 2 | ||||
-rw-r--r-- | compiler/nativeGen/AsmCodeGen.lhs | 11 | ||||
-rw-r--r-- | compiler/utils/Platform.hs | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 4a51b313e2..23906c69bc 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -193,6 +193,7 @@ initSysTools mbMinusB ; targetArch <- readSetting "target arch" ; targetOS <- readSetting "target os" ; targetHasGnuNonexecStack <- readSetting "target has GNU nonexec stack" + ; targetHasIdentDirective <- readSetting "target has .ident directive" ; targetHasSubsectionsViaSymbols <- readSetting "target has subsections via symbols" ; myExtraGccViaCFlags <- getSetting "GCC extra via C opts" -- On Windows, mingw is distributed with GHC, @@ -257,6 +258,7 @@ initSysTools mbMinusB platformArch = targetArch, platformOS = targetOS, platformHasGnuNonexecStack = targetHasGnuNonexecStack, + platformHasIdentDirective = targetHasIdentDirective, platformHasSubsectionsViaSymbols = targetHasSubsectionsViaSymbols }, sTmpDir = normalise tmpdir, diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index 0d8aab146b..f9167f26a0 100644 --- a/compiler/nativeGen/AsmCodeGen.lhs +++ b/compiler/nativeGen/AsmCodeGen.lhs @@ -525,12 +525,15 @@ makeImportsDoc dflags imports (if platformHasGnuNonexecStack (targetPlatform dflags) then Pretty.text ".section .note.GNU-stack,\"\",@progbits" else Pretty.empty) + Pretty.$$ -- And just because every other compiler does, lets stick in -- an identifier directive: .ident "GHC x.y.z" - Pretty.$$ let compilerIdent = Pretty.text "GHC" Pretty.<+> - Pretty.text cProjectVersion - in Pretty.text ".ident" Pretty.<+> - Pretty.doubleQuotes compilerIdent + (if platformHasIdentDirective (targetPlatform dflags) + then let compilerIdent = Pretty.text "GHC" Pretty.<+> + Pretty.text cProjectVersion + in Pretty.text ".ident" Pretty.<+> + Pretty.doubleQuotes compilerIdent + else Pretty.empty) where -- Generate "symbol stubs" for all external symbols that might diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 027c510546..7253af1274 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -23,6 +23,7 @@ data Platform platformArch :: Arch, platformOS :: OS, platformHasGnuNonexecStack :: Bool, + platformHasIdentDirective :: Bool, platformHasSubsectionsViaSymbols :: Bool } deriving (Read, Show, Eq) |