Opened 7 years ago

Closed 6 years ago

#5128 closed bug (fixed)

Linker text reloc warning under Mac OS 10.7

Reported by: jah Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 7.0.3
Keywords: Cc: dstcruz@…
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Compiling any Haskell program under the Mac OS 10.7 developer preview causes a few thousand linker warnings of the form:

ld: warning: text reloc in _cZh_str to _stg_ap_pppppp_info

Compiled programs still appears to run correctly.

Change History (8)

comment:1 Changed 6 years ago by igloo

Component: Build SystemCompiler
Milestone: 7.4.1

Thanks for the report.

comment:2 Changed 6 years ago by judahj

I got rid of those warnings by passing -optl"-Wl,-read_only_relocs,suppress" to ghc --make.

(Using ghc-7.0.3 on the release of OS X 10.7.)

I still got the following warning on a simple "hello world" program:

ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog

But the program does appear to run correctly.

comment:3 Changed 6 years ago by batterseapower

This workaround can be used slightly more conveniently if you edit /usr/bin/ghc (it is a shell script) and put the extra command line argument in there (on the last line, after the -B"$topdir" option).

comment:4 Changed 6 years ago by beej175560

I confirm this bug with a fresh install of OS X Lion, Xcode 4.1, and ghc 7.0.3 from the Haskell Platform. Compiling "main = return ()" generates some 14,000 "text reloc" linker warnings, the first of which is:

ld: warning: text reloc in _Main_main_info to _base_GHCziBase_zdfMonadIO_closure

comment:5 in reply to:  4 ; Changed 6 years ago by chak

Replying to beej175560:

I confirm this bug with a fresh install of OS X Lion, Xcode 4.1, and ghc 7.0.3 from the Haskell Platform. Compiling "main = return ()" generates some 14,000 "text reloc" linker warnings, the first of which is:

ld: warning: text reloc in _Main_main_info to _base_GHCziBase_zdfMonadIO_closure

Which architecture are you using? i386 or x86_64?

And can you check whether you still have that problem with the just released 7.2.1? (You shouldn't.)

comment:6 in reply to:  5 Changed 6 years ago by beej175560

Replying to chak:

Replying to beej175560:

I confirm this bug with a fresh install of OS X Lion, Xcode 4.1, and ghc 7.0.3 from the Haskell Platform. Compiling "main = return ()" generates some 14,000 "text reloc" linker warnings, the first of which is:

ld: warning: text reloc in _Main_main_info to _base_GHCziBase_zdfMonadIO_closure

Which architecture are you using? i386 or x86_64?

i386.

And can you check whether you still have that problem with the just released 7.2.1? (You shouldn't.)

I apologize that I don't have the time or resources to try non-Haskell Platform versions of ghc. (I've had problems with my Haskell installation before -- primarily with cabal -- and lost many hours of time as a result, so I'm a little paranoid about screwing anything up.)

comment:7 Changed 6 years ago by dstcruz

Cc: dstcruz@… added

I can report that this seems to work:

  • OS: Mac OS 10.7.1
  • XCode 4.1
  • GHC 7.2.1 (ghc-7.2.1-x86_64-apple-darwin.tar.bz2)

Test:

> echo "main = return ()" > Main.hs
> ghc --make Main
1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...

I was seeing the ld issues with an install of i386, but the x86_64 seems to work without an issue.

comment:8 Changed 6 years ago by igloo

Resolution: fixed
Status: newclosed

I've silenced the warning:

commit 20705dff179ed09f37a7db474109cccef6f9afec
Author: Ian Lynagh <igloo@earth.li>
Date:   Thu Oct 6 19:40:51 2011 +0100

    Silence "text reloc" warnings on OS X / x86

    ld gives loads of warnings like:
        ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure
    when linking any program. We're not sure whether this is something we
    ought to fix, but for now we use the -Wl,-read_only_relocs,suppress flag
    to silence them.
Note: See TracTickets for help on using tickets.