Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#8166 closed bug (fixed)

Undefined references in HEAD object files

Reported by: joelteon Owned by: jstolarek
Priority: high Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc: rwbarton@…, fuuzetsu@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

$ uname -a
Linux default-centos-64.vagrantup.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

When I try to bootstrap cabal-install using GHC HEAD:

Checking installed packages for ghc-7.7.20130823...
Cabal is already installed and the version is ok.
transformers is already installed and the version is ok.
mtl-2.1.2 will be downloaded and installed.
deepseq is already installed and the version is ok.
text-0.11.2.3 will be downloaded and installed.
parsec-3.1.3 will be downloaded and installed.
network-2.4.1.0 will be downloaded and installed.
time is already installed and the version is ok.
HTTP-4000.2.5 will be downloaded and installed.
zlib-0.5.4.0 will be downloaded and installed.
random-1.0.1.1 will be downloaded and installed.
stm-2.4.2 will be downloaded and installed.

Downloading mtl-2.1.2...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
100 13723  100 13723    0     0   2432      0  0:00:05  0:00:05 --:--:-- 40964
[1 of 1] Compiling Main             ( Setup.hs, Setup.o )
Linking Setup ...
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `cbw5_info':
(.text+0x83f): undefined reference to `r9F5_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `sapv_info':
(.text+0x1623): undefined reference to `r9F5_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `cbD6_info':
(.text+0x17a9): undefined reference to `r9F5_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `cbHC_info':
(.text+0x24ff): undefined reference to `r9F5_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `cbN4_info':
(.text+0x3257): undefined reference to `r9F5_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o):(.text+0x3faf): more undefined references to `r9F5_info' follow
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `ccEX_info':
(.text+0xb63c): undefined reference to `r9F3_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `ScJo_srt':
(.data+0x38): undefined reference to `r9F5_closure'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Simple__63.o): In function `ScJo_srt':
(.data+0x180): undefined reference to `r9F3_closure'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `s3WN_info':
(.text+0x8a): undefined reference to `r3Eg_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `c5NF_info':
(.text+0x118): undefined reference to `r3Eh_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `s3XR_info':
(.text+0xc35): undefined reference to `r3Ei_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `s3YA_info':
(.text+0xefe): undefined reference to `r3E8_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `s3Z6_info':
(.text+0x100e): undefined reference to `r3E8_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `s3Zb_info':
(.text+0x1095): undefined reference to `r3Ei_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `c5X3_info':
(.text+0x16d6): undefined reference to `r3E8_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `c5Xj_info':
(.text+0x19d3): undefined reference to `r3E8_info'
/usr/local/lib/ghc-7.7.20130823/Cabal-1.17.0/libHSCabal-1.17.0.a(Command__114.o): In function `S60p_srt':
(.data+0x18): undefined reference to `r3E8_closure'

(repeats ad nauseam)

collect2: ld returned 1 exit status

Error during cabal-install bootstrap:
Compiling the Setup script failed

The full output can be found at https://gist.github.com/anonymous/e30cda2ca16f1e90e13e/raw/eb9b2d10db44d0288ce79fd2c5955455c02926d9/cabal.txt

Change History (11)

comment:1 Changed 6 years ago by rwbarton

Cc: rwbarton@… added

comment:2 Changed 6 years ago by rwbarton

I get similar errors just trying to link anything with a recent HEAD. See http://lpaste.net/92183

comment:3 Changed 6 years ago by thoughtpolice

Milestone: 7.8.1
Owner: set to jstolarek
Priority: normalhigh

Reid confirmed this morning that reverting Jan's commits e5374a1b3ac11851576f8835e19d9fc92d7735c3 and 388e14e28c2ab70419dc3be610da9806a8e38325 fixed this problem:

commit 388e14e28c2ab70419dc3be610da9806a8e38325
Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
Date:   Tue Aug 20 15:03:26 2013 +0100

    Merge cgTailCall and cgLneJump into one function
    
    Previosly logic of these functions was sth like this:
    
      cgIdApp x = case x of
                    A -> cgLneJump x
                    _ -> cgTailCall x
    
      cgTailCall x = case x of
                       B -> ...
                       C -> ...
                       _ -> ...
    
    After merging there is no nesting of cases:
    
      cgIdApp x = case x of
                    A -> -- body of cgLneJump
                    B -> ...
                    C -> ...
                    _ -> ...

commit e5374a1b3ac11851576f8835e19d9fc92d7735c3
Author: Jan Stolarek <jan.stolarek@p.lodz.pl>
Date:   Tue Aug 20 11:53:05 2013 +0100

    Cleanup StgCmm pass
    
    This cleanup includes:
      * removing dead code. This includes forkStatics function,
        which was in fact one big noop, and global bindings in
        CgInfoDownwards,
      * converting functions that used FCode monad only to
        access DynFlags into functions that take DynFlags
        as a parameter and don't work in a monad,
      * addBindC function is now smarter. It extracts Id from
        CgIdInfo passed to it in the same way addBindsC does.
        Previously this was done at every call site, which was
        redundant.

Unfortunately I'm having a hard time reproducing this myself on my Ubuntu 13.04 machine. I believe this is also the problem Nicolas and Ben had on the list recently.

Jan - can you look at this please? It's definitely problematic for several people (I may revert in the mean time.)

comment:4 Changed 6 years ago by rwbarton

After further experimentation, reverting just 388e14e2 "Merge cgTailCall and cgLneJump into one function" is enough to solve my problems. And it looks wrong: the structure of the old code is not as described in the commit message: the fun_id that used to be passed to cgTailCall is not the same as the one in cgIdApp, as explained in a comment in the old code.

comment:5 Changed 6 years ago by Fuuzetsu

Cc: fuuzetsu@… added

comment:6 Changed 6 years ago by Fuuzetsu

Confirming on 32-bit install as well, trying to build ghc-paths.

Linux misaki 3.9.0-rc6 #1 SMP Tue Apr 9 10:51:07 BST 2013 i686 Intel(R) Core(TM)2 Duo CPU L7700 @ 1.80GHz GenuineIntel GNU/Linux

comment:7 Changed 6 years ago by Austin Seipp <aseipp@…>

In 776cfe28cf089c24a56a288f2f0c49494f7d9e47/ghc:

Properly externalise codegen identifiers (#8166)

388e14e2 unfortunately broke a subtle invariant in the code generator:
when generating code for an application, names may need to be
externalised, in case you're building against something external with
was built with -split-objs.

We were never externalising the ids of the applied functions. This means
if the libraries are split and we call into them, then the compiler
won't may not generate correct ids when making references to functions
in the library (causing linker failure).

I'm not entirely sure how this didn't break everything, but it certainly
caused several failures for a bunch of people. I had to fiddle with my
tree a little to make this occur.

This should fix #8166.

Signed-off-by: Austin Seipp <aseipp@pobox.com>

comment:8 Changed 6 years ago by jstolarek

Sorry about that guys - I don't know how this change validated in my tree. Austin, thanks for fix.

comment:9 Changed 6 years ago by thoughtpolice

Resolution: fixed
Status: newclosed

Right, no worries. I'm not sure how it took me so long to get it happening for me, either...

comment:10 Changed 6 years ago by simonpj

Also I've checked your fix and it's the Right Thing to do. Thanks

Simon

comment:11 Changed 6 years ago by Simon Peyton Jones <simonpj@…>

In ef017944600cf4e153aad686a6a78bfb48dea67a/ghc:

Comments only, relating to #8166 fix
Note: See TracTickets for help on using tickets.