Opened 11 years ago

Closed 11 years ago

Last modified 44 years ago

#96 closed bug (Fixed)

Still fails to build with GCC 3.2 on Mandrake

Reported by: jenglish Owned by: simonmar
Priority: normal Milestone:
Component: Driver Version: 5.04.1
Keywords: Cc:
Operating System: Architecture:
Type of failure: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Following the instructions listed in other bug reports,
I bootstrapped GHC 5.04.1 on a machine with an older
GCC, then installed that on the target machine
(Mandrake 9.0, GCC 3.2).

But the mangler is still busted: compiling anything
with -O gives errors like:

| Prologue junk?: .globl __stginit_PrimPacked
| 	.type	__stginit_PrimPacked,@function
| __stginit_PrimPacked:
| 	pushl	%ebp
| 	movl	%esp, %ebp


Compiling with '-O -fasm' works, but GHC 5.04.1 still
can't recompile itself since parts of it require '-O
-fvia-C'.

I also tried downloading the current version of
ghc-asm.lprl from the CVS repository and using that;
still get the same errors.

Attachments (1)

ghc-no-omit-lfp.2.patch (1.8 KB) - added by jenglish 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by simonmar

Logged In: YES 
user_id=48280

Mandrake shipped a broken GCC, it seems.

comment:2 Changed 11 years ago by jenglish

  • Summary changed from Still fails to build with GCC 3.2 to Still fails to build with GCC 3.2 on Mandrake
Logged In: YES 
user_id=68433

Aha:  Mandrake's GCC is configured to compile for i586,
while Redhat's is configured for i386.

I'll bet this is the source of the problem.  Will
investigate further...

comment:3 Changed 11 years ago by jenglish

Logged In: YES 
user_id=68433

Nope, that's not it either.  Using ghc -O -v -pgmc "gcc-3.2
-march=i386 -mcpu=i386" gives the same result.

Back to the drawing board...

comment:4 Changed 11 years ago by jenglish

Logged In: YES 
user_id=68433

I think I've found the problem:  the mangler relies on
-fomit-frame-pointer, but gcc-3.2mdk turns
-momit-leaf-frame-pointer on by default.  The latter flag
(apparently) overrides the former, so non-leaf functions end
up with unexpected junk in the prologue.

I'll try -mno-omit-leaf-frame-pointer and see if that
works.  (I don't have access to my Mandrake box at the
moment; but I can get ghc to *break* in the same way on a
Red Hat 8.0 system with `ghc -c -O -optc
-momit-leaf-frame-pointer`, so that's a promising sign :-)

comment:5 Changed 11 years ago by jenglish

Logged In: YES 
user_id=68433

Yep, adding -mno-omit-leaf-frame-pointer did the trick. 
Problem solved!

comment:6 Changed 11 years ago by simonmar

Logged In: YES 
user_id=48280

Re-opened; we really need a workaround for this one.

Changed 11 years ago by jenglish

comment:7 Changed 11 years ago by jenglish

Logged In: YES 
user_id=68433

Simon wrote:
> Re-opened; we really need a workaround for this one.

I've attached the patch I used to build a Mandrake RPM; this
just adds -mno-omit-leaf-frame-pointer at the relevant spot
in DriverFlags.hs.

Unfortunately, applying this patch as it stands *breaks* the
compiler if an older gcc is used, since
-mno-omit-leaf-frame-pointer was introduced in GCC 3.X.

comment:8 Changed 11 years ago by simonmar

  • Status changed from assigned to closed
Logged In: YES 
user_id=48280

Fixed; -mno-omit-leaf-frame-pointer is now added if gcc >= 
3.2.
Note: See TracTickets for help on using tickets.