[GHC] #9886: Undefined reference to `__sync_fetch_and_xor_8'
#9886: Undefined reference to `__sync_fetch_and_xor_8' -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (CodeGen) | Operating System: Keywords: | Unknown/Multiple Architecture: powerpc | Type of failure: Building Difficulty: Unknown | GHC failed Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Compiling on PowerPC with git head (0c9c2d899e63b810), compile terminates with: {{{ /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_xor_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_and_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_nand_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_val_compare_and_swap_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_sub_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_add_8' /home/ghc-upstream/libraries/ghc-prim/dist-install/build/ libHSghcpr_FgrV6cgh2JHBlbcx1OSlwt-ghc7.9.20141214.so: undefined reference to `__sync_fetch_and_or_8' }}} Looks like some new primops that need to be implemented for powerpc. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------------+--------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------------+--------------------------- Comment (by erikd): There is a quick and *very* dirty hack to get GHC compiling here ( https://phabricator.haskell.org/D560#15871 ) but it doesn't actually fix the problem, just prevent the compile error. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------------+--------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------------+--------------------------- Comment (by tibbe): I believe we fixed this on x86 by requiring i686. Can't find the ticket right now. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------------+--------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | ----------------------------------------------+--------------------------- Comment (by tibbe): The x86 issue was fixed in #9346. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Changes (by erikd): * owner: => erikd * version: 7.8.3 => 7.11 Comment: It seems that these `__sync_fetch_*` function were used around gcc 4.4 but have been replaced in gcc 4.8 with a different set of functions `__atomic_*`. Working on a patch to sort this out. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Changes (by erikd): * cc: erikd (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by erikd): For some reason GCC doesn't seem to have 8 bit versions of any of the atomic functions. No idea why. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by erikd): Bah, turns out it was a lack of the 64 bit versions of these that was the problem all along. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Changes (by slyfox): * cc: slyfox (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by erikd): It seems the 64 bit primpos are *only* needed on 32 bit architectures and then only for the native code generators. For x86 via the native code generator we needed #9346 as mentioned by @tibbe, but the arm backend did need anything because that omly compilers via LLVM. That leaves PowerPC as the remaining 32 bit architecture with an NCG. However, if I hack the 64 bit primops like (for example) this: {{{#!c StgWord64 hs_atomic_add64(volatile StgWord64 *x, StgWord64 val) { #if WORD_SIZE_IN_BITS == 32 printf ("%s : %s not implemented.\n", __FILE__, __func__) ; exit (1); #else return __sync_fetch_and_add(x, val); #endif } }}} then building the compiler runs to completion and futhermore, the one test for these atomic primops, `testsuite/tests/concurrent/should_run/AtomicPrimops.hs` passes. It turns out this test operates on Int which on 32 bit platforms is a 32 bit value. This makes me wonder if its worth the trouble of implementing these if they aren't used anywhere. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: PowerPC : Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: PowerPC : Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by erikd): Replying to [comment:9 erikd]:
It seems the 64 bit primpos are *only* needed on 32 bit architectures and then only for the native code generators.
Correction, the 64 bit primops are *not* needed on 32 bit architectures because there is currently no way to call them from Haskell code. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: PowerPC : Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Comment (by Erik de Castro Lopo <erikd@…>): In [changeset:"19440ae2bb256f75934949ae57934caee3831a80/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="19440ae2bb256f75934949ae57934caee3831a80" ghc-prim : Hide 64 bit primops when the word size is 32 bits (fixes #9886). Summary: These primops were failing to compile on PowerPC (32 bit). There is also currently no way to call into these primops from Haskell code. Currently, the *only* way to call any of these C hs_atomic_* functions is via the fetch*IntArray primops which are only defined for Int values and Int is always the native word size. When these functions can be called (and tested) from Haskell code, then it will be worth while implementing them. Test Plan: Compile and run on x86, x86_64, powerpc and arm: testsuite/tests/concurrent/should_run/AtomicPrimops.hs Reviewers: tibbe, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D702 GHC Trac Issues: #9886 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: PowerPC : Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler (CodeGen) | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Changes (by erikd): * status: new => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:13> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9886: PowerPC : Undefined reference to `__sync_fetch_and_xor_8' ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler (CodeGen) | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------------+---------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed * milestone: => 7.10.1 Comment: Merged (via bd785d101766a1207b8d27a45b6ae0bf83cd678a), thanks Erik. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9886#comment:14> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC