summaryrefslogtreecommitdiff
path: root/utils/deriveConstants
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2014-10-21 14:58:21 -0500
committerAustin Seipp <austin@well-typed.com>2014-10-21 14:58:21 -0500
commit2cc206505d248ac8c706aa85342a895857c9f091 (patch)
tree1fa82c8dde105793f6a18f7f9ee4df4591e33665 /utils/deriveConstants
parent3687089fd55e3c8d2710da5c9fb4b53c6c84e0cf (diff)
downloadhaskell-2cc206505d248ac8c706aa85342a895857c9f091.tar.gz
Use objdump instead of nm to derive constants on OpenBSD
Summary: OpenBSD's nm doesn't support the -P option and there appears to be no other way to get the desired information from it. Reviewers: kgardas, #ghc, austin Reviewed By: kgardas, #ghc, austin Subscribers: austin, ggreif Projects: #ghc Differential Revision: https://phabricator.haskell.org/D332 GHC Trac Issues: #9549
Diffstat (limited to 'utils/deriveConstants')
-rw-r--r--utils/deriveConstants/DeriveConstants.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index 9bf21609f1..72605d755e 100644
--- a/utils/deriveConstants/DeriveConstants.hs
+++ b/utils/deriveConstants/DeriveConstants.hs
@@ -643,7 +643,10 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
oFile = tmpdir </> "tmp.o"
writeFile cFile cStuff
execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile])
- xs <- readProcess nmProgram ["-P", oFile] ""
+ xs <- case os of
+ "openbsd" -> readProcess "/usr/bin/objdump" ["--syms", oFile] ""
+ _ -> readProcess nmProgram ["-P", oFile] ""
+
let ls = lines xs
ms = map parseNmLine ls
m = Map.fromList $ catMaybes ms
@@ -723,6 +726,7 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
('_' : n) : "C" : s : _ -> mkP n s
n : "C" : s : _ -> mkP n s
[n, "D", _, s] -> mkP n s
+ [s, "O", "*COM*", _, n] -> mkP n s
_ -> Nothing
where mkP r s = case (stripPrefix prefix r, readHex s) of
(Just name, [(size, "")]) -> Just (name, size)