Commit 996560191ac6bd603901dcd6c0de5d239e019ef4 causes strange regression

Andrew Bartlett abartlet at
Mon Mar 8 02:42:06 UTC 2021

On Mon, 2021-03-08 at 14:59 +1300, Andrew Bartlett via samba-technical
> On Mon, 2021-03-08 at 12:39 +1100, Martin Schwenke via samba-
> technical
> wrote:
> > I want to flag this regression as soon as possible (before I really
> > understand it) because 4.12.12 is due for release on Thursday and
> > this
> > may be the last 4.12.x release, due to the imminent release of
> > 4.14.0.
> Thanks for looking at this.  Bother.
> Can you see if --as-needed is being detected on your
> host?  Previously
> it was being used only if we were compiling with GCC, now we test,
> but
> it is possible the test is wrong.
> In short, can you look into the config.log and such?
> Andrew Bartlett

Lot of bugs here.  To aid those trying to chase them along, the
regression is in the fix for

Interestingly, 996560191ac6bd603901dcd6c0de5d239e019ef4 is essentially
a revert of:

commit ab232ca77f8f08879d99f88cfcd554500717075e
Author: Andreas Schneider <asn at>
Date:   Mon Sep 23 17:21:51 2019 +0200

    waf: Use waf function to add for -Wl,--as-needed
    Signed-off-by: Andreas Schneider <asn at>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at>
    Reviewed-by: Alexander Bokovoy <ab at>
    Autobuild-User(master): Andreas Schneider <asn at>
    Autobuild-Date(master): Wed Sep 25 16:56:40 UTC 2019 on sn-devel-

Sorry for the bung review here.  The patch is wrong, it changes
behaviour on Linux, see the diff attached.  

It was likely tested most carefully by the person not wanting --as-
needed on the Solaris derivative and not for the normal case on Linux. 

I looked into if should we go back to before that commit, but reverting
it doesn't help.

As to why, this commit is revealing:

commit b0f41c07ffe8600433c20a038b1612c04ed29e89
Author: Björn Jacke <bj at>
Date:   Thu Sep 10 21:31:03 2015 +0200

    build: use as-needed linker flag also on OpenBSD
    OpenBSD is unusable with binaries with many superfluous libs linked
    samba-tool start times of 250 seconds without as-needed vs. 1.4
seconds with
    Signed-off-by: Bjoern Jacke <bj at>
    Reviewed-by: Ralph Böhme <rb at>
    Autobuild-User(master): Björn Jacke <bj at>
    Autobuild-Date(master): Fri Sep 11 03:37:17 CEST 2015 on sn-devel-

I wonder if we should do the opposite, just decide this is a required
feature, at least until someone works out how to pare down the library

Finally, the issue here is that ADD_LDFLAGS modified EXTRA_LDFLAGS
while conf.add_as_needed() changes LINKFLAGS.

I'll update the bug with this last summery.

Andrew Bartlett
Andrew Bartlett (he/him)
Samba Team Member (since 2001)
Samba Team Lead, Catalyst IT

Samba Development and Support, Catalyst IT - Expert Open Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log.diff
Type: text/x-patch
Size: 49004 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list