[commit: ghc] ghc-7.8: change deriveConstants to use nm in a POSIX way (fixes #8781) (e7563ec)

Christian Maeder Christian.Maeder at dfki.de
Mon Mar 24 10:25:31 UTC 2014


Hi,

sorry, I've missed this thread.

Did you just run "nm" or "nm -P" on 
includes/dist-derivedconstants/header/tmp.o?

The comment should say how the output looks like. For GNU nm (without 
option -P) is was:

"0000000b C derivedConstantMAX_Vanilla_REG"

if it is now:

"_derivedConstantBlaBlah_Blah C 000001b"

for "nm -P" on Windows the patch could (and should) be adjusted, easily.
(The 4th word only needs to be present and taken if the second word is 
not a "C", which is only the case under Solaris.)

HTH Christian

Am 23.03.2014 17:51, schrieb Jost Berthold:
> Hello,
>
> With the patch to deriveConstants, a build on an older Windows (32bit
> Vista, MinGW32 installation, which used to work) now fails with error
>
>      Can't find "STD_HDR_SIZE"
>
> I ran the nm command manually on the generated o file
> (includes/dist-derivedconstants/header/tmp.o) and saw that the output
> follows pattern
>
> _derivedConstantBlaBlah_Blah C 000001b
>
> so it does not match the four-word pattern in the patch.
>
> Is this a problem with my setup, or does it fail for other people on
> Windows as well?
>
> Thanks,
> Jost
>
> On 03/23/2014 08:46 AM, ghc-commits-request at haskell.org wrote:
>> Message: 6
>> Date: Sun, 23 Mar 2014 02:01:50 +0000 (UTC)
>> From: git at git.haskell.org
>> To: ghc-commits at haskell.org
>> Subject: [commit: ghc] ghc-7.8: change deriveConstants to use nm in a
>>     POSIX way (fixes #8781) (e7563ec)
>> Message-ID: <20140323020150.1DCE82406B at ghc.haskell.org>
>> Content-Type: text/plain; charset=utf-8
>>
>> Repository : ssh://git@git.haskell.org/ghc
>>
>> On branch  : ghc-7.8
>> Link       :
>> http://ghc.haskell.org/trac/ghc/changeset/e7563ec2e03740074903036bf129fc972b623c23/ghc
>>
>>
>>> ---------------------------------------------------------------
>>
>> commit e7563ec2e03740074903036bf129fc972b623c23
>> Author: Karel Gardas <karel.gardas at centrum.cz>
>> Date:   Sat Mar 22 22:33:05 2014 +0100
>>
>>      change deriveConstants to use nm in a POSIX way (fixes #8781)
>>
>>      The patch provided by Christian Maeder <Christian.Maeder at dfki.de>
>>
>>      Signed-off-by: Karel Gardas <karel.gardas at centrum.cz>
>>      Signed-off-by: Austin Seipp <austin at well-typed.com>
>>      (cherry picked from commit 045b28033a33a48d31951240a8cb35f2b78345dc)
>>
>>
>>> ---------------------------------------------------------------
>>
>> e7563ec2e03740074903036bf129fc972b623c23
>>   utils/deriveConstants/DeriveConstants.hs |   30
>> ++++++++++--------------------
>>   1 file changed, 10 insertions(+), 20 deletions(-)
>>
>> diff --git a/utils/deriveConstants/DeriveConstants.hs
>> b/utils/deriveConstants/DeriveConstants.hs
>> index 10df61c..54ee6a1 100644
>> --- a/utils/deriveConstants/DeriveConstants.hs
>> +++ b/utils/deriveConstants/DeriveConstants.hs
>> @@ -638,7 +638,7 @@ getWanted verbose tmpdir gccProgram gccFlags
>> nmProgram
>>                oFile = tmpdir </> "tmp.o"
>>            writeFile cFile cStuff
>>            execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o",
>> oFile])
>> -         xs <- readProcess nmProgram [oFile] ""
>> +         xs <- readProcess nmProgram ["-P", oFile] ""
>>            let ls = lines xs
>>                ms = map parseNmLine ls
>>                m = Map.fromList $ catMaybes ms
>> @@ -707,27 +707,17 @@ getWanted verbose tmpdir gccProgram gccFlags
>> nmProgram
>>             doWanted (ClosurePayloadMacro {}) = []
>>             doWanted (FieldTypeGcptrMacro {}) = []
>>
>> -          -- parseNmLine parses nm output that looks like
>> -          -- "0000000b C derivedConstantMAX_Vanilla_REG"
>> +          -- parseNmLine parses "nm -P" output that looks like
>> +          -- "_derivedConstantMAX_Vanilla_REG C b 0" Mac OS X
>> +          -- "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" GNU
>> +          -- "derivedConstantMAX_Vanilla_REG D        1        b"
>> Solaris
>>             -- and returns ("MAX_Vanilla_REG", 11)
>> -          parseNmLine xs0 = case break (' ' ==) xs0 of
>> -                            (x1, ' ' : xs1) ->
>> -                                case break (' ' ==) xs1 of
>> -                                (x2, ' ' : x3) ->
>> -                                    case readHex x1 of
>> -                                    [(size, "")] ->
>> -                                        case x2 of
>> -                                        "C" ->
>> -                                            let x3' = case x3 of
>> -                                                      '_' : rest -> rest
>> -                                                      _          -> x3
>> -                                            in case stripPrefix
>> prefix x3' of
>> -                                               Just name ->
>> -                                                   Just (name, size)
>> -                                               _ -> Nothing
>> -                                        _ -> Nothing
>> -                                    _ -> Nothing
>> +          parseNmLine xs0 = case words xs0 of
>> +                            [x0, x1, x2, x3] -> case stripPrefix
>> prefix $ dropWhile (== '_') x0 of
>> +                              Just name -> case readHex $ if x1 ==
>> "C" then x2 else x3 of
>> +                                [(size, "")] -> Just (name, size)
>>                                   _ -> Nothing
>> +                              _ -> Nothing
>>                               _ -> Nothing
>>
>>             -- If an Int value is larger than 2^28 or smaller
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>



More information about the ghc-devs mailing list