[GHC] #8781: check if GNU nm is realy needed and if so let configure detect gnm

#8781: check if GNU nm is realy needed and if so let configure detect gnm ----------------------------------+---------------------------------------- Reporter: maeder | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.1-rc1 Component: Build System | Operating System: Solaris Keywords: | Type of failure: Building GHC failed Architecture: x86 | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | ----------------------------------+---------------------------------------- building ghc-7.8.20140130 under Solaris fails with a non-GNU nm as follows: {{{ inplace/bin/deriveConstants --gen-header -o includes/dist- derivedconstants/header/DerivedConstants.h --tmpdir includes/dist- derivedconstants/header/ --gcc-program "/opt/csw/bin/gcc" --gcc-flag -U__i686 --gcc-flag -fno-stack-protector --gcc-flag -Iincludes --gcc-flag -Iincludes/dist --gcc-flag -Iincludes/dist-derivedconstants/header --gcc- flag -Iincludes/dist-ghcconstants/header --gcc-flag -Irts --gcc-flag -fcommon --nm-program "/usr/ccs/bin/nm" Can't find "STD_HDR_SIZE" gmake[1]: *** [includes/dist-derivedconstants/header/DerivedConstants.h] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): To fix that it's IMHO a matter of extending deriveConstants to also support POSIX nm output. For example with POSIX nm and '-p' option we get very near to what GNU nm provides, but still there are some differences which should be handled by deriveConstants. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by kgardas): * owner: => kgardas -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by kgardas): * status: new => patch Comment: Attached patch fixes that. It basically enhances deriveConstants utility to also support Solaris' nm program. Christian please test it. I've tested it here on Solaris 11.1 and Solaris 10 update 8. I'm using PATH which is set to Single Unix Specification 3 standard, that means nm is taken from /usr/xpg4/bin directory -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): BTW: Is this issue a regression? (let's say in comparison with 7.6.x?) If it is, then we may attempt to push it to Austin for inclusion in 7.8.1? If not, then let's wait and ask for merge into HEAD? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Your nm-patch worked for me, too! {{{ /usr/ccs/bin/nm -bash-3.2$ nm -V nm: Software Generation Utilities (SGU) Solaris-ELF (4.0) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): I'm still missing a solution in ghc-7.8-rc2, but my preferred way is simply using gnm (via a link called nm). The provided patch for !DeriveConstants.hs works but looks a bit scary. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): Christian, I've not pushed this patch to Austin for inclusion in 7.8.1 as I've though it's already too late and the patches now in RCx times should be quite safe or fix real regression. Let's see after 7.8.1 is out of door if Austin thinks this may be merged into HEAD or not. What do you find on this patch scary? It simply uses and parses different output from Solaris nm than it's provided from GNU nm and it also automatically test if its using GNU or Solaris' nm and behaves accordingly. So what's problem with it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): It's sort of duplicate (but different) code that is difficult to maintain (for various nm versions). How did the code look like for ghc-7.6.3 that used to work? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Curiously, I did not find differences related to nm. http://git.haskell.org/ghc.git/history/refs/heads/master:/utils/deriveConsta... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): The whole utils/deriveConstants did not exist in ghc-7.6.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): Thanks for investigation. In its light, have you changed your attitude to my proposed patch? I'm afraid that if we're going to support several nm output formats, then either the code looks like you criticize or we need to employ some Haskell library for parsing which I'm not sure if it's not over-kill in this simple case. I'm curious how things work on MacOSX or *BSDs. IIRC On Windows we're using GNU tools and no other commercial UNIX besides Solaris looks supported... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): I think, I've a better patch. Always call "nm -P" (for POSIX.2 standard output). The output looks like {{{ derivedConstantMAX_Vanilla_REG C 0000000b 0000000b }}} for gnm or like {{{ derivedConstantMAX_Vanilla_REG D 1 b }}} for Solaris nm. So just take the first and last word (of 4 words) to extract the name and the size. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Somehow my comment for OS X got lost. The patches are not yet working on OS X. "nm -V" fails on Mac. The third word is the size and leading underscores must be ignored. I'll provide a patch checking for "C" in the second word and extracting the size from the third word. (For GNU nm the third and last words are identical.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Is there maybe a problem under windows with "nm -P"? I cannot test it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): On Windows IIRC mingw tools are used which means IMHO GNU nm but I'm not able to test that neither... Are you able to change your patch to git patch? If not, I may try to find the time to do that... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Please make a git patch and maybe extend the comment for the three formats: {{{ "_derivedConstantMAX_Vanilla_REG C b 0" Mac OS X "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" GNU "derivedConstantMAX_Vanilla_REG D 1 b" Solaris }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): Austin, could you be so kind and merge the "change deriveConstants to use nm in a POSIX way" patch to HEAD? This basically allows us to use Solaris' own nm and not need to rely on GNU nm on this OS. Also it preserves compatibility with GNU nm of course! Thanks! Karel -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm
----------------------------------------+-----------------------------
Reporter: maeder | Owner: kgardas
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Build System | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Solaris | Architecture: x86
Type of failure: Building GHC failed | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
----------------------------------------+-----------------------------
Comment (by Austin Seipp

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: fixed | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged, thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm
----------------------------------------+-----------------------------
Reporter: maeder | Owner: kgardas
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Build System | Version: 7.8.1-rc1
Resolution: fixed | Keywords:
Operating System: Solaris | Architecture: x86
Type of failure: Building GHC failed | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
----------------------------------------+-----------------------------
Comment (by Austin Seipp

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by thoughtpolice): * owner: kgardas => * status: closed => new * resolution: fixed => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by kgardas): * owner: => kgardas -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): It would be interesting to see the failure. Is the additional "-P" option the problem or is there yet another output format produced for: {{{ nm -P includes/dist-derivedconstants/header/tmp.o }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): It's all discussed on ghc-devs@, I've also provided a fix for this for windows guys testing. The output on windows from gnu nm is three words list: {{{ _derivedConstantCINT_SIZE C 00000005 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by kgardas): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Sorry, I don't like this patch as it contains duplicate code. Let's improve it for ghc-7.8.2 (whatever ends up in ghc-7.8.1 now) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): I propose the code as follows: {{{ parseNmLine xs0 = case words xs0 of x0 : x1 : x2 : r -> case stripPrefix prefix $ dropWhile (== '_') x0 of Just name -> case readHex $ case r of [x3] | x1 /= "C" -> x3 _ -> x2 of [(size, "")] -> Just (name, size) _ -> Nothing _ -> Nothing _ -> Nothing }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Well, it could be much less indented, too, after the first line. If you think, that the second is too long break it after "->" or use single letter names for x0, x1 and x2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by jberthold): Maybe repetition is not good, but let me suggest to clarify which part is responsible for which variant of nm output. Also, one could use the Maybe monad instead of nested case expressions. how about this one: {{{ parseNmLine xs0 = case words xs0 of -- "_derivedConstantMAX_Vanilla_REG C b 0" Mac OS X -- "derivedConstantMAX_Vanilla_REG C 0000000b 0000000b" GNU -- "_derivedConstantMAX_Vanilla_REG C 000000b" MinGW x0 : "C" : x2 : r -> mkMapping x0 x2 -- "derivedConstantMAX_Vanilla_REG D 1 b" Solaris x0 : _ : x2 : x3 : [] -> mkMapping x0 x3 other -> Nothing mkMapping x0 x2 = do name <- stripPrefix $ dropWhile (== '_') x0 size <- case readHex x2 of [(n,"")] -> return n _ -> fail "not hex" return (name, size) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Yes, also not bad. The unused "r" in the first case should be a "_". The pattern "x0 : _ : x2 : x3 : []" should be "[x0, _, x2, x3]". Following stripPrefix the actual "prefix" is missing. The actual cases for "case ... of" should be (less indented) on separate lines in order to avoid re-intenting lines when changing (ie. names) in "size <- case readHex x2 of". Also after "do" a line break should follow (for the same reason as after "of") (If the do-notation based on the monad instance is really an improvement is a matter of taste.) The comments clutter the code too much (in my eyes, but that's again a matter of taste) One advantage over my code is, that "C" is matched by a pattern (rather than using the Eq instance). After this style discussion I suggest, that Karel should create an improved patch and Austin decides to apply it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:31 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): Replying to [comment:30 jberthold]:
{{{ [...] -- "derivedConstantMAX_Vanilla_REG D 1 b" Solaris x0 : _ : x2 : x3 : [] -> mkMapping x0 x3 [...] }}}
IMHO there should be "D" used in the code, since otherwise I'm not sure this will work correctly on Solaris and not match anything else. {{{ x0 : 'D' : x2 : x3 : [] -> mkMapping x0 x3 }}} otherwise also nice! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:32 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): No, checking if it is not a 'C' is enough and ensure by the first case. (Surely, one could apply stricter tests, but I think that's unnecessary as no error handling is done anyway.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:33 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): No, it's not! Especially if we're doing all those exercises to make this piece of code better. The problem with {{{ x0 : _ : x2 : x3 : [] -> mkMapping x0 x3 }}} is that it matches {{{ tmp.c f 0 0 }}} line which is the last line in Solaris's nm -P tmp.o output. So you match Solaris case and pass it down to mkMapping where stripPrefix will produce Nothing and you ends with (Nothing, 0) pair being returned. IMHO not good. So if you'd like to make this piece of code nice, also please let's make it correct. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:34 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): No, no pair is returned by simply Nothing that is ignored later. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:35 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by kgardas): Replying to [comment:35 maeder]:
No, no pair is returned by simply Nothing that is ignored later.
Sorry, I don't understand. I still see that four members list is matched and mkMapping is invoked with x0 and x3 as its params. Isn't that true? So if I'm not mistaken then mkMapping is invoked for: {{{ tmp.c f 0 0 }}} which is IMHO not good. Or is it? Please correct me if I'm wrong. Thanks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:36 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Yes, mkMapping is invoked and returns Nothing, that is ignored by catMaybes in line 635. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:37 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): However, matching for the 'D' is no bad idea, as it yields Nothing earlier. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:38 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): My patch should be merged to the ghc-7.8 branch, too. (The file !DeriveConstants.hs has a further non-conflicting change in HEAD.) I cannot test it under windows. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:39 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Comment (by maeder): Just for the record. Under 64bit windows (as described wiki:Building/Preparation/Windows/MSYS2) I get the "nm -p" output: {{{ derivedConstantMAX_Vanilla_REG C 000000000000000b }}} (without leading underscore) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:40 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: patch Priority: normal | Milestone: 7.8.3 Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by maeder): * milestone: => 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:41 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: merge Priority: normal | Milestone: 7.8.3 Component: Build System | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by thoughtpolice): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:42 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8781: check if GNU nm is really needed and if so let configure detect gnm ----------------------------------------+----------------------------- Reporter: maeder | Owner: kgardas Type: feature request | Status: closed Priority: normal | Milestone: 7.8.3 Component: Build System | Version: 7.8.1-rc1 Resolution: fixed | Keywords: Operating System: Solaris | Architecture: x86 Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------------+----------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: This should all be merged, thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8781#comment:43 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC