Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 172299 - librep-0.17 fails to build on PPC64 [PATCH available]
Summary: librep-0.17 fails to build on PPC64 [PATCH available]
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: PPC64 Linux
: High normal (vote)
Assignee: Harald van Dijk (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-26 13:54 UTC by Marcus Comstedt
Modified: 2007-03-28 21:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to declare check_configuration() as not inlineabale. (rep_noinline.patch,237 bytes, patch)
2007-03-26 14:01 UTC, Marcus Comstedt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Comstedt 2007-03-26 13:54:11 UTC
When building librep with gcc4.1 on PPC64, the rep program fails with
the following message:

** error: --with-stack-direction is incorrect; it should be 1

This is however not true (the stack does grow downwards on PPC, as the
configure script correctly determined), it is in fact the sanity
check in check_configuration() which is incorrect.  The reason for the
erroneous conclusion is that check_configuration() gets inlined, which
places stack_high and the variable pointed to by stack_low (dummy) in
the same stack frame, making address comparisons between them moot.

To fix this, check_configuration() should be made non inlinable.  The
gcc attribute "noinline" can be used for this purpose, as in this
patch:

--- librep-0.17.orig/src/main.c
+++ librep-0.17/src/main.c
@@ -157,6 +157,7 @@
     return rep_TRUE;
 }
 
+static void check_configuration (int *stack_low) __attribute__((noinline));
 static void
 check_configuration (int *stack_low)
 {

Applying this patch makes librep build fine for me.  Note however that the
noinline attribute is new to gcc 4, so if older compilers should be supported
some kind of #if would be in order.

I also found this in the ebuild file:

        use ppc && myconf="${myconf} --with-stack-direction=1"

which I believe to be an (incorrect) workaround for the same problem
on ppc.  Afterwards there is also a similar one for IA64.  Since the
comment for the IA64 one claims that the problem does not occur with
gcc 3, maybe the best solution would be to apply my patch iff
(gcc-major-version) -ge 4 .  The bogus --with-stack-direction arguments
should be removed.
Comment 1 Marcus Comstedt 2007-03-26 14:01:05 UTC
Created attachment 114483 [details, diff]
Patch to declare check_configuration() as not inlineabale.

This patch requires GCC 4.
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2007-03-26 17:38:00 UTC
Thanks. This has been in librep CVS for a long time, but it's never had a release after 0.17. I'll update to a current snapshot.
Comment 3 Harald van Dijk (RETIRED) gentoo-dev 2007-03-26 18:33:22 UTC
Fixed, thanks again for the report.
Comment 4 Marcus Comstedt 2007-03-28 16:29:43 UTC
Thanks.  0.17_p20070101 works fine on my system.
Any chance of this package (and x11-libs/rep-gtk and x11-wm/sawfish)
getting unmasked for ppc64 now?
Comment 5 Harald van Dijk (RETIRED) gentoo-dev 2007-03-28 18:35:01 UTC
I don't have access to any ppc64 system, so I cannot add the keyword myself. Could you open a new bug for that, so that the ppc64 team will get a look at it, please?
Comment 6 Marcus Comstedt 2007-03-28 20:18:05 UTC
Sure.  Should I open one bug per package, or a single one for all three?
Comment 7 Harald van Dijk (RETIRED) gentoo-dev 2007-03-28 21:50:25 UTC
In this case, a single bug would be fine.