[commit: ghc] master: Use objdump instead of nm to derive constants on OpenBSD (2cc2065)

git at git.haskell.org git at git.haskell.org
Tue Oct 21 21:50:30 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2cc206505d248ac8c706aa85342a895857c9f091/ghc

>---------------------------------------------------------------

commit 2cc206505d248ac8c706aa85342a895857c9f091
Author: Austin Seipp <austin at well-typed.com>
Date:   Tue Oct 21 14:58:21 2014 -0500

    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


>---------------------------------------------------------------

2cc206505d248ac8c706aa85342a895857c9f091
 utils/deriveConstants/DeriveConstants.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index 9bf2160..72605d7 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)



More information about the ghc-commits mailing list