[GHC] #15338: ghc-pkg misbehaves after possible miscompilation on m68k and sh4
GHC
ghc-devs at haskell.org
Wed Jul 11 06:39:51 UTC 2018
#15338: ghc-pkg misbehaves after possible miscompilation on m68k and sh4
-------------------------------------+-------------------------------------
Reporter: glaubitz | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.3
Resolution: | Keywords:
Operating System: Linux | Architecture: m68k
Type of failure: Incorrect result | Test Case:
at runtime |
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by slyfox):
Replying to [comment:3 slyfox]:
> I'll keep debugging.
I think I understand breakage mechanics now:
The example above breaks because '''stdout''' haskell closure is evaluated
twice:
- once in the test binary
- once in shared library
and creates two objects. '''hFlush''' is called only for second (shared
library) object because it is called from there.
Duplication happens because '''base_GHCziIOziHandleziFD_stdout_closure'''
(closure behind '''System.IO.stdout''' object) is copied by the linker
'''COPY''' relocation:
{{{
$ objdump -R -D bug/ghc-pkg
00415248 <base_GHCziIOziHandleziFD_stdout_closure>:
...
415248: R_SH_COPY
base_GHCziIOziHandleziFD_stdout_closure
}}}
It should be just an external reference like '''R_SH_GLOB_DAT''' instead.
Normally '''COPY''' relocations are used only for immutable ('''const'''
in C land) data. But '''_closure'''s are mutable. I'll double-check
generated C code and file a toolchain bug upstream.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15338#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list