[GHC] #11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8
#11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8 --------------------------------+---------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Keywords: | Operating System: Linux Architecture: powerpc | Type of failure: Building GHC failed Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------+---------------------------------------- Ever since [changeset:"04e8366608fee4f5e3358acc855bc6f556c3f508/ghc"] I've been getting this on powerpc/linux: {{{ /home/erikd/Git/ghc-upstream/rts/dist/build/libHSrts.a(Linker.o): In function `m32_free_internal': /home/erikd/Git/ghc-upstream/rts/Linker.c:1220:0: error: undefined reference to `__sync_sub_and_fetch_8' collect2: error: ld returned 1 exit status }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11036> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8 ----------------------------------------+------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Changes (by erikd): * owner: => erikd Comment: Looks like the following fix will work. {{{ diff --git a/rts/Linker.c b/rts/Linker.c index 98969b9..e7bb8f0 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1217,7 +1217,7 @@ static void m32_allocator_init(m32_allocator m32) { * You shouldn't have to use this method. Use `m32_free` instead. */ static void m32_free_internal(void * addr) { - uint64_t c = __sync_sub_and_fetch((uint64_t*)addr, 1); + uintptr_t c = __sync_sub_and_fetch((uintptr_t*)addr, 1); if (c == 0) { munmapForLinker(addr, getPageSize()); } }}} Need to test on powerpc, x86_64 and arm at least. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11036#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8 ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1399 Wiki Page: | ----------------------------------------+---------------------------------- Changes (by erikd): * differential: => Phab:D1399 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11036#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8 ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1399 Wiki Page: | ----------------------------------------+---------------------------------- Comment (by Erik de Castro Lopo <erikd@…>): In [changeset:"8ddf41744ea8b0c1d034f9c5e062b0112d3d3aff/ghc" 8ddf4174/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="8ddf41744ea8b0c1d034f9c5e062b0112d3d3aff" Linker: Fix type in m32_free_internal The code: uint64_t c = __sync_sub_and_fetch((uint64_t*)addr, 1); was causing GCC to emit atomic instructions for 64 bit values which are not available on PowerPC. However, since PowerPC only has a 32 bit address space, use of a 64 bit value is superflous. Switching the type from `uint64_t` to `uintptr_t` should simply do the correct thing on all 32 and 64 bit architectures. Reviewers: austin, bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1399 GHC Trac Issues: #11036 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11036#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11036: powerpc/linux: undefined reference to `__sync_sub_and_fetch_8 ----------------------------------------+---------------------------------- Reporter: erikd | Owner: erikd Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1399 Wiki Page: | ----------------------------------------+---------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11036#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC