[GHC] #12965: String merging broken on Windows

#12965: String merging broken on Windows
----------------------------------------+---------------------------------
Reporter: bgamari | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Windows
Architecture: Unknown/Multiple | Type of failure: None/Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
----------------------------------------+---------------------------------
#9577 introduced string literal merging via the linker. Unfortunately I
haven't been able to get this to function on Windows, resulting in
testsuite failures of #9577.
Even `gcc` appears to do the wrong thing here,
{{{
$ cat hi.c
#include

#12965: String merging broken on Windows
---------------------------------+----------------------------------------
Reporter: bgamari | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Windows | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+----------------------------------------
Comment (by Ben Gamari

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by Phyx-): Constant merging was disabled on Windows by a stupid check that was introduced late in GCC6. https://github.com/gcc- mirror/gcc/blob/gcc-6-branch/gcc/configure.ac#L2928 The check essentially ensures that only ELF platform support that flag. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: upstream Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * status: new => upstream Comment: Do you know when can we expect a fixed GCC release, Phyx? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: upstream Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * milestone: 8.2.1 => 8.4.1 Comment: Bumping off to 8.4 since we really can't do anything about this ourselves anyways. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: upstream Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * milestone: 8.4.1 => 8.2.1 Comment: I've worked out the changes required for this on `GCC`, but `binutils` may need a patch as well. The one for `GCC` I might be able to get away with as a bugfix, but the `binutils` one... If I'm able to fix them then I can ask the mingw-w64 guys for another patch release. So we don't have to wait for a release. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: upstream Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * milestone: 8.2.1 => 8.4.1 Comment: hmm trac had a mind of it's own. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: upstream Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3384 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * differential: => Phab:D3384 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3384 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * status: upstream => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: upstream Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3384 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * status: patch => upstream Comment: Phyx, what is the status of the upstream gcc patches? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12965: String merging broken on Windows ---------------------------------+---------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: upstream Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3384 Wiki Page: | ---------------------------------+---------------------------------------- Comment (by Phyx-): The specific implementation in GCC/binutils won't work for non-ELF targets it turns out. However I have an implementation that should do this using a similar method as the D compiler uses by leveraging ld's `.gnu.linkonce` support for PE targets. This method however needs a guarantee from the compiler that it doesn't output duplicate string constants, or GAS will end up merging them and breaking the approach. (This is what was going wrong in the Diff as WIP on Phab). It seems that GHC doesn't do this at the moment, it only happens to have this effect some of the them due to CSEing. So I have written a new string constant pooling pass that does this. In order to make it lightweight I changed the syntax to allow multiple labels at definition site. Such that I don't have to actually change the usage sites. I've changed all the back-ends but have a bug to fix and still need to figure out how to test the llvm, macos and unregister changes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12965#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC