Ticket #1845 (closed bug: fixed)

Opened 4 years ago

Last modified 15 months ago

unconditional relative branch out of range (GHC version 6.8.1-6.10.4 for powerpc_apple_darwin)

Reported by: guest Owned by: igloo
Priority: high Milestone: 7.0.2
Component: Compiler Version: 7.1
Keywords: Cc: Christian.Maeder@…, alfonso.acosta@…, pho@…
Operating System: MacOS X Architecture: powerpc
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Having build ghc-6.8.1 from sources revealed the following problem after installation:

> ghci -package ghc
GHCi, version 6.8.1: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Loading package old-locale-1.0.0.0 ... linking ... done.
Loading package old-time-1.0.0.0 ... linking ... done.
Loading package filepath-1.1.0.0 ... linking ... done.
Loading package directory-1.0.0.0 ... linking ... done.
Loading package array-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.0 ... linking ... done.
Loading package hpc-0.5.0.0 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
Loading package pretty-1.0.0.0 ... linking ... done.
Loading package packedstring-0.1.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package unix-2.2.0.0 ... linking ... done.
Loading package process-1.0.0.0 ... linking ... done.
Loading package readline-1.0.1.0 ... linking ... done.
Loading package Cabal-1.2.2.0 ... linking ... done.
Loading package random-1.0.0.0 ... linking ... done.
Loading package haskell98 ... linking ... done.
ghc-6.8.1: internal error: unconditional relative branch out of range: jump island out of range
    (GHC version 6.8.1 for powerpc_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Abort trap

Attachments

avoid-mmap-on-powerpc-apple-darwin.patch Download (162.5 KB) - added by PHO 17 months ago.
suppress-warnings-on-x64_64.patch Download (173.0 KB) - added by PHO 16 months ago.
series-of-patches-to-fix-1845.patch Download (215.5 KB) - added by PHO 15 months ago.

Change History

  Changed 4 years ago by guest

  • cc Christian.Maeder@… added

  Changed 4 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.8.2

Thanks for the report!

  Changed 4 years ago by ChrisKuklewicz

This *might* be related to bug  #1843 on OS X 10.5 (Leopard) on ppc.

  Changed 4 years ago by thorkilnaur

I can reproduce this using the binary package  http://haskell.org/ghc/dist/6.8.1/maeder/ghc-6.8.1-powerpc-apple-darwin.tar.bz2 by Christian Maeder, both on PPC Mac OS X 10.4 Tiger and PPC Mac OS X 10.5 Leopard.

Best regards Thorkil

  Changed 4 years ago by igloo

  • milestone changed from 6.8.2 to 6.8.3

  Changed 4 years ago by thorkilnaur

  • owner set to thorkilnaur

I will see if I can dig out some additional details here.

Best regards Thorkil

  Changed 4 years ago by maeder

  Changed 4 years ago by maeder

Just adding -mlongcall to extra-gcc-opts did not help. When trying to compile with

SRC_HC_OPTS += -fvia-C

in mk/build.mk I got the following error:

 ../compiler/ghc-inplace -H16m -O -fvia-C -optc-O2 -package-name rts -static -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint     -c Apply.cmm -o Apply.o
/tmp/ghc24169_0/ghc24169_0.s:unknown:Undefined local symbol L___DISCARD__$stub
make[1]: *** [Apply.o] Error 1
make: *** [stage1] Error 1

follow-up: ↓ 1   Changed 4 years ago by fons

  • cc alfonso.acosta@… added
  • version changed from 6.8.1 to 6.8.2
  • component changed from GHCi to Compiler
  • severity changed from normal to major
  • summary changed from unconditional relative branch out of range (GHC version 6.8.1 for powerpc_apple_darwin) to unconditional relative branch out of range (GHC version 6.8.1/6.8.2 for powerpc_apple_darwin)

I'm suffering exactly the same problem with ghc 6.8.2 in Leopard/ppcG4.

I can reproduce the bug both with macports ghc and  http://www.informatik.uni-bremen.de/agbkb/forschung/formal_methods/CoFI/hets/mac/ghcs/ghc-6.8.2-powerpc-apple-darwin-static-libs.tar.bz2

Furthermore, the problem is not limited to interactive mode. Compilation fails for this cabal package  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/type-level-0.1

Removing the genAliases splice from Data.TypeLevel?.Num.Aliases fixes the problem.

in reply to: ↑ 9   Changed 4 years ago by fons

Replying to fons:

Removing the genAliases splice from Data.TypeLevel?.Num.Aliases fixes the problem.

The problem can also be fixed by removing the unnnecesary ghc package dependency from the cabal description (its intention is to make clear to other compilers that the code was ghc-dependent)

This makes more sense.

However, other cabal packages with the ghc dependency can be compiled without problems (e.g.  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/parameterized-data-0.1 )

  Changed 4 years ago by thorkilnaur

Thanks a lot for this information. In addition, the problem occurs for test case ghci024(ghci) as well, both HEAD and STABLE, for the tnaur PPC OSX builders which are Mac OS X 10.4 (Tiger).

Best regards Thorkil

  Changed 4 years ago by igloo

  • milestone changed from 6.8.3 to 6.10.1

  Changed 3 years ago by igloo

  • milestone changed from 6.10.1 to 6.10.2

  Changed 3 years ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.10.2 to 6.12.1

Dropping priority as this is not a tier 1 platform.

  Changed 2 years ago by igloo

  • priority changed from low to normal
  • milestone changed from 6.12.1 to _|_

  Changed 2 years ago by weakish

  • failure set to None/Unknown
  • version changed from 6.8.2 to 6.10.4

This bug still exist on 6.10.4

  Changed 2 years ago by PHO

  • cc pho@… added

  Changed 2 years ago by verti

  • failure changed from None/Unknown to Compile-time crash
  • summary changed from unconditional relative branch out of range (GHC version 6.8.1/6.8.2 for powerpc_apple_darwin) to unconditional relative branch out of range (GHC version 6.8.1-6.10.4 for powerpc_apple_darwin)

I also recieved this error when attempting to resolve an issue with a Yi installation by applying some suggested constraints.
A "hello" example had been compiled before this, and cabal install of all items listed in the Haskell Platform was successful.
Using OS X Leopard, PPC G5, GHC 6.10.4

$ cabal install yi --constraint="data-accessor < 0.2.1" --constraint="template-haskell < 2.4"

Resolving dependencies...
Configuring data-accessor-monads-fd-0.2...
Preprocessing library data-accessor-monads-fd-0.2...
Building data-accessor-monads-fd-0.2...
[1 of 1] Compiling Data.Accessor.Monad.FD.State ( src/Data/Accessor/Monad/FD/State.hs, dist/build/Data/Accessor/Monad/FD/State.o )
ar: creating archive dist/build/libHSdata-accessor-monads-fd-0.2.a
Installing library in
/Users/administrator/.cabal/lib/data-accessor-monads-fd-0.2/ghc-6.10.4
Registering data-accessor-monads-fd-0.2...
Reading package info from "dist/installed-pkg-config" ... done.
Writing new package config file... done.
Configuring data-accessor-template-0.2.1.3...
Preprocessing library data-accessor-template-0.2.1.3...
Building data-accessor-template-0.2.1.3...
[1 of 2] Compiling Data.Accessor.Template ( src-3/Data/Accessor/Template.hs, dist/build/Data/Accessor/Template.o )
[2 of 2] Compiling Data.Accessor.Template.Example ( src/Data/Accessor/Template/Example.hs, dist/build/Data/Accessor/Template/Example.o )
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package syb ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package utility-ht-0.0.5.1 ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package packedstring-0.1.0.1 ... linking ... done.
Loading package pretty-1.0.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package transformers-0.1.4.0 ... linking ... done.
Loading package data-accessor-0.2.0.2 ... linking ... done.
ar: creating archive dist/build/libHSdata-accessor-template-0.2.1.3.a
Installing library in
/Users/administrator/.cabal/lib/data-accessor-template-0.2.1.3/ghc-6.10.4
Registering data-accessor-template-0.2.1.3...
Reading package info from "dist/installed-pkg-config" ... done.
Writing new package config file... done.
[1 of 1] Compiling Main             ( /var/folders/nC/nCwTbMclGKiVINNMLpEVRE+++TI/-Tmp-/pointedlist-0.3.548338/pointedlist-0.3.5/Setup.hs, /var/folders/nC/nCwTbMclGKiVINNMLpEVRE+++TI/-Tmp-/pointedlist-0.3.548338/pointedlist-0.3.5/dist/setup/Main.o )
Linking /var/folders/nC/nCwTbMclGKiVINNMLpEVRE+++TI/-Tmp-/pointedlist-0.3.548338/pointedlist-0.3.5/dist/setup/setup ...
Configuring pointedlist-0.3.5...
Preprocessing library pointedlist-0.3.5...
Building pointedlist-0.3.5...
[1 of 2] Compiling Data.List.PointedList ( Data/List/PointedList.hs, dist/build/Data/List/PointedList.o )
[2 of 2] Compiling Data.List.PointedList.Circular ( Data/List/PointedList/Circular.hs, dist/build/Data/List/PointedList/Circular.o )
ar: creating archive dist/build/libHSpointedlist-0.3.5.a
Installing library in
/Users/administrator/.cabal/lib/pointedlist-0.3.5/ghc-6.10.4
Registering pointedlist-0.3.5...
Reading package info from "dist/installed-pkg-config" ... done.
Writing new package config file... done.
Configuring yi-0.6.1...
Preprocessing library yi-0.6.1...
Preprocessing executables for yi-0.6.1...
Building yi-0.6.1...
[  1 of 120] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o )
[  2 of 120] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o )
[  3 of 120] Compiling Parser.Incremental ( Parser/Incremental.hs, dist/build/Parser/Incremental.o )
[  4 of 120] Compiling Data.Trie        ( Data/Trie.hs, dist/build/Data/Trie.o )
[  5 of 120] Compiling Data.DelayList   ( Data/DelayList.hs, dist/build/Data/DelayList.o )
[  6 of 120] Compiling Data.Rope        ( Data/Rope.hs, dist/build/Data/Rope.o )
[  7 of 120] Compiling Data.Prototype   ( Data/Prototype.hs, dist/build/Data/Prototype.o )
[  8 of 120] Compiling HConf.Utils      ( HConf/Utils.hs, dist/build/HConf/Utils.o )
[  9 of 120] Compiling HConf.Paths      ( HConf/Paths.hs, dist/build/HConf/Paths.o )
[ 10 of 120] Compiling Paths_yi         ( dist/build/autogen/Paths_yi.hs, dist/build/Paths_yi.o )
[ 11 of 120] Compiling HConf            ( HConf.hs, dist/build/HConf.o )
[ 12 of 120] Compiling Yi.Char.Unicode  ( Yi/Char/Unicode.hs, dist/build/Yi/Char/Unicode.o )
[ 13 of 120] Compiling Yi.UI.Common[boot] ( Yi/UI/Common.hs-boot, dist/build/Yi/UI/Common.o-boot )
[ 14 of 120] Compiling Yi.String        ( Yi/String.hs, dist/build/Yi/String.o )
[ 15 of 120] Compiling Yi.Monad         ( Yi/Monad.hs, dist/build/Yi/Monad.o )
[ 16 of 120] Compiling Yi.Keymap.Completion ( Yi/Keymap/Completion.hs, dist/build/Yi/Keymap/Completion.o )
[ 17 of 120] Compiling Yi.Editor[boot]  ( Yi/Editor.hs-boot, dist/build/Yi/Editor.o-boot )
[ 18 of 120] Compiling Yi.Debug         ( Yi/Debug.hs, dist/build/Yi/Debug.o )
[ 19 of 120] Compiling Yi.Prelude       ( Yi/Prelude.hs, dist/build/Yi/Prelude.o )
[ 20 of 120] Compiling Yi.Dynamic       ( Yi/Dynamic.hs, dist/build/Yi/Dynamic.o )
[ 21 of 120] Compiling Yi.Event         ( Yi/Event.hs, dist/build/Yi/Event.o )
[ 22 of 120] Compiling Yi.Interact      ( Yi/Interact.hs, dist/build/Yi/Interact.o )
[ 23 of 120] Compiling Yi.Keymap[boot]  ( Yi/Keymap.hs-boot, dist/build/Yi/Keymap.o-boot )
[ 24 of 120] Compiling Yi.Style         ( Yi/Style.hs, dist/build/Yi/Style.o )
[ 25 of 120] Compiling Yi.Style.Library ( Yi/Style/Library.hs, dist/build/Yi/Style/Library.o )
[ 26 of 120] Compiling Yi.Interpreter   ( Yi/Interpreter.hs, dist/build/Yi/Interpreter.o )
[ 27 of 120] Compiling Shim.Utils       ( Shim/Utils.hs, dist/build/Shim/Utils.o )
[ 28 of 120] Compiling Shim.CabalInfo   ( Shim/CabalInfo.hs, dist/build/Shim/CabalInfo.o )
[ 29 of 120] Compiling Yi.Buffer.Misc[boot] ( Yi/Buffer/Misc.hs-boot, dist/build/Yi/Buffer/Misc.o-boot )
[ 30 of 120] Compiling Yi.Buffer.Basic  ( Yi/Buffer/Basic.hs, dist/build/Yi/Buffer/Basic.o )
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Loading package bytestring-0.9.1.4 ... linking ... done.
Loading package syb ... linking ... done.
Loading package array-0.2.0.0 ... linking ... done.
Loading package containers-0.2.0.1 ... linking ... done.
Loading package extensible-exceptions-0.1.1.1 ... linking ... done.
Loading package terminfo-0.3.1.1 ... linking ... done.
Loading package unix-2.3.2.0 ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package utf8-string-0.3.6 ... linking ... done.
Loading package vty-3.1.8.4 ... linking ... done.
Loading package unix-compat-0.1.2.1 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package uniplate-1.5.1 ... linking ... done.
Loading package old-locale-1.0.0.1 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package split-0.1.2 ... linking ... done.
Loading package rosezipper-0.1 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package regex-base-0.93.1 ... linking ... done.
Loading package regex-tdfa-1.1.2 ... linking ... done.
Loading package binary-0.5.0.2 ... linking ... done.
Loading package pureMD5-1.0.0.3 ... linking ... done.
Loading package transformers-0.1.4.0 ... linking ... done.
Loading package data-accessor-0.2.0.2 ... linking ... done.
Loading package pointedlist-0.3.5 ... linking ... done.
Loading package ghc-paths-0.1.0.6 ... linking ... done.
Loading package fingertree-0.0.1.0 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package filepath-1.1.0.2 ... linking ... done.
Loading package old-time-1.0.0.2 ... linking ... done.
Loading package directory-1.0.0.3 ... linking ... done.
Loading package packedstring-0.1.0.1 ... linking ... done.
Loading package pretty-1.0.1.0 ... linking ... done.
Loading package process-1.0.1.1 ... linking ... done.
Loading package random-1.0.0.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package derive-0.1.4 ... linking ... done.
Loading package utility-ht-0.0.5.1 ... linking ... done.
Loading package data-accessor-template-0.2.1.3 ... linking ... done.
Loading package monads-fd-0.0.0.1 ... linking ... done.
Loading package data-accessor-monads-fd-0.2 ... linking ... done.
Loading package Cabal-1.6.0.3 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package hpc-0.5.0.3 ... linking ... done.
ghc: internal error: unconditional relative branch out of range: jump island out of range
    (GHC version 6.10.4 for powerpc_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
cabal: Error: some packages failed to install:
yi-0.6.1 failed during the building phase. The exception was:
exit: ExitFailure 6

Changed 17 months ago by PHO

  Changed 17 months ago by PHO

  • status changed from new to patch
  • version changed from 6.10.4 to 7.1

I can reproduce this bug on the darcs HEAD. Applying the attached patch could solve this.

2 patches for repository http://darcs.haskell.org/ghc:

Tue Sep 28 07:41:45 JST 2010  pho@cielonegro.org
  * New member "archiveMemberName" for struct _ObjectCode
  
  struct _ObjectCode should be able to retain the name of archive members.
  Though currently the only use of those names are for debugging outputs.

Tue Sep 28 22:25:59 JST 2010  pho@cielonegro.org
  * FIX #1845 (unconditional relative branch out of range)
  
  Don't use mmap on powerpc-apple-darwin as mmap doesn't support
  reallocating but we need to allocate jump islands just after each
  object images. Otherwise relative branches to jump islands can fail
  due to 24-bits displacement overflow.

  Changed 17 months ago by igloo

  • priority changed from normal to high
  • milestone changed from _|_ to 7.0.1

Thanks for the patch! We'll take a look.

  Changed 17 months ago by igloo

  • owner thorkilnaur deleted

  Changed 16 months ago by igloo

  • owner set to igloo

I've applied the first patch to HEAD. The second one gives me:

$ ghci
GHCi, version 7.1.20101015: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... ghc-stage2: /home/ian/ghc/darcs/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim-0.2.0.0.o: WARNING: Allocating jump islands separately from the object image itself. This may interfere with relative branches to them.
linking ... done.
Loading package integer-gmp ... ghc-stage2: /home/ian/ghc/darcs/ghc/libraries/integer-gmp/dist-install/build/HSinteger-gmp-0.2.0.2.o: WARNING: Allocating jump islands separately from the object image itself. This may interfere with relative branches to them.
linking ... done.
Loading package base ... ghc-stage2: /home/ian/ghc/darcs/ghc/libraries/base/dist-install/build/HSbase-4.3.0.0.o: WARNING: Allocating jump islands separately from the object image itself. This may interfere with relative branches to them.
linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> 

on amd64/Linux. I'll take a closer look.

  Changed 16 months ago by PHO

Ah, sorry. That is a false warning for X86_64. I'll soon post a new patch here.

Changed 16 months ago by PHO

  Changed 15 months ago by PHO

  • status changed from patch to closed
  • resolution set to worksforme

Ah... I must say that... the darcs HEAD works well without my last 2 (unmerged) patches. I can't explain why, but anyway it works, so I withdraw them.

  Changed 15 months ago by PHO

  • owner igloo deleted
  • status changed from closed to new
  • resolution worksforme deleted

Sorry, looks like I spoke too soon. GHCi still crashes on loading GHCi libraries. It only works if we don't build GHCi libraries (not archives) at all. I'll investigate this further.

% ./inplace/bin/ghc-stage2 --interactive -package ghc
GHCi, version 7.1.20101127: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... zsh: segmentation fault  ./inplace/bin/ghc-stage2 --interactive -package ghc

  Changed 15 months ago by PHO

  • owner set to igloo

Changed 15 months ago by PHO

  Changed 15 months ago by PHO

  • status changed from new to patch

Attached a series of patches to make the current darcs HEAD fully working. Both SEGV and "jump island out of range" have gone away.

Please forget about my previous unmerged patches. They are now obsolete.

  Changed 15 months ago by simonmar

  • milestone changed from 7.0.1 to 7.0.2

Patches look good to me - nice job.

  Changed 15 months ago by igloo

  • status changed from patch to merge

These four now also applied to HEAD:

Tue Nov 30 12:14:25 GMT 2010  pho@cielonegro.org
  * rts/Linker.c (ocFlushInstructionCache):

Tue Nov 30 12:33:55 GMT 2010  pho@cielonegro.org
  * rts/Linker.c (machoGetMisalignment):

Tue Nov 30 14:27:00 GMT 2010  pho@cielonegro.org
  * rts/Linker.c (loadArchive):

Tue Nov 30 14:30:14 GMT 2010  pho@cielonegro.org
  * FIX #1845 (unconditional relative branch out of range)

  Changed 15 months ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Merged.

Note: See TracTickets for help on using tickets.