Commit 2cc20650 authored by Austin Seipp's avatar Austin Seipp

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
parent 3687089f
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment