[GHC] #15338: ghc-pkg misbehaves after possible miscompilation on m68k and sh4
GHC
ghc-devs at haskell.org
Mon Jul 16 20:41:10 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): Phab:D4959
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Sergei Trofimovich <slyfox@…>):
In [changeset:"8ec48990fee9e245bb2fe40dc6f65b61b8612157/ghc"
8ec48990/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="8ec48990fee9e245bb2fe40dc6f65b61b8612157"
driver: skip -Bsymbolic on unregisterised targets (Trac #15338)
Trac #15338 is yet another example where -Bsymbolic breaks
semantics of a C program: global variable duplication happens
and unsafePerformIO creates two stdout copies.
When -Bsymbolic is not used both C compiler and linker agree
on how global variables are handled. In case of sh4 it consists
on a few assertions:
1. global variable is exported from shared library
2. code is referred to this variable via GOT-like mechanism to allow
interposition
3. global variable is present .bss section on an executable
(as an R_*_COPY relocation: symbol contents is copied at executable
startup time)
4. and symbol in executable interposes symbol in shared library.
This way both code in shared library and code in executable refer
to a copy of global variable in .bss section of an executable.
Unfortunately -Bsymbolic option breaks assumption [2.] and generates
direct references to the symbol. This causes mismatch between
values seen from executable and values seen from shared library code.
This change disables '-Bsymbolic' for unregisterised targets.
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
Test Plan: test 'ghc-pkg --version | cat' to emit data
Reviewers: simonmar, bgamari, jrtc27
Reviewed By: jrtc27
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15338
Differential Revision: https://phabricator.haskell.org/D4959
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15338#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list