[Pacemaker] Proposing patch for ld --as-needed

Ultrabug ultrabug at ultrabug.net
Thu Jul 22 03:56:06 EDT 2010

On 22/07/2010 01:56, Simon Horman wrote:
> On Wed, Jul 21, 2010 at 09:40:10PM +0200, Ultrabug wrote:
>> On Wednesday 21 July 2010 03:49:42 Simon Horman wrote:
>>> On Tue, Jul 20, 2010 at 05:35:01PM +0200, Ultrabug wrote:
>>>> ----- Original Message -----
>>>> From: Simon Horman<horms at verge.net.au>
>>>> To: The Pacemaker cluster resource manager
>>>> <pacemaker at oss.clusterlabs.org>  Sent: Tue, 20 Jul 2010 05:10:32 +0200
>>>> (CEST)
>>>> Subject: Re: [Pacemaker] Proposing patch for ld --as-needed
>>>> On Sat, Jul 17, 2010 at 01:12:20PM +0200, Ultrabug wrote:
>>>>> Dear list,
>>>>> I would like to ask you about a possible upstream modification regarding
>>>>> the -- as-needed ld flag for which we Gentoo users need to patch the
>>>>> pacemaker sources to get it compile.
>>>>> I'm attaching the patch which, as you can see, is relatively small and
>>>>> simple (looks to me at least). The question is whether or not you think
>>>>> this could be done upstream ?
>>>>> Thank you for your interest in this and all you work,
>>>> Out of interest, could you explain why this is needed?
>>>> Is it because gold is being used as the linker?
>>> [ please don't top-post ]
>> [ noticed after sending, sorry ]
>>> Thanks for the link.
>>> I guess what is happening without --as-needed is that the curses
>>> library is being dragged in somewhere, somehow - without your proposed
>>> change CURSESLIBS is used exactly nowhere.
>> Actually the two chunks of the patch have different purposes.
>> The first one is needed because the linking order has a meaning on a as-needed
>> system and libpengine uses functions that are defined in libpe_status.
>> Here is an example of failing build : http://paste.pocoo.org/show/239905/
>> If you try to compile a program that uses libpengine that doesn't need
>> libpe_status, e.g. gcc -Wl,--as-needed ptest.c -o ptest -lpe_status -lpengine
>> (shortened version of actual linking from pacemaker build.log) linking will
>> fail. Linker evaluates that statement sequentially starting from the inner
>> most lib:
>>    1) do I need libpe_status? No, forget about it.
>>    2) do I need libpengine? Yes, please.
>>    3) is everything all right? Ups, I don't know what `was_processing_warning'
>> is, die...
>> The second one explicitly adds CURSESLIBS dependency to libpe_status.
>> If pacemaker detects ncurses, you get HAVE_NCURSES_H and e.g.
>> status_print (used in  lib/pengine/native.c etc.) becomes wrapper
>> around "printw" (see configure.ac). You need to provide `printw' or any linking
>> with libpe_status will fail.
>> Fail build example : http://paste.pocoo.org/show/239916/
>>> So I think that your change is a step in the right direction,
>>> though for completeness I think that you also need to give the same
>>> treatment to libpe_rule as common.c seems to make curses calls.
>>> Could you considering updating your patch to include my proposed
>>> additions below? And could you please include a description that describes
>>> what the patch does? Perhaps something like this:
>> Sure, if you agree with the explanations above, I'll summarize them and add
>> them in the patch which I'll resubmit to you for integration.
> I think tat you have a better handle on this problem than me.
> So yes, please summarise your explanation above and use
> it as a preamble to the patch.
> [snip]

Sure mate, here it is attached. I hope it's explained well enough.
Thanks for your help and interest.

Kind regards

> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pacemaker-
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20100722/c102d616/attachment-0001.ksh>

More information about the Pacemaker mailing list