Re: Reduce function call costs on ELF platforms

From: Andres Freund <andres(at)anarazel(dot)de>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reduce function call costs on ELF platforms
Date: 2021-11-25 03:57:46
Message-ID: 20211125035746.kfpoi2j6uo6xbzms@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2021-11-24 17:55:03 -0500, Andrew Dunstan wrote:
> On 11/24/21 13:55, Andres Freund wrote:
> > On 2021-11-23 17:28:08 +0100, Peter Eisentraut wrote:
> >> On 22.11.21 23:32, Tom Lane wrote:
> >>>> The easier approach for this class of issues is to use the linker option
> >>>> -Bsymbolic.
> >>> I don't recall details, but we've previously rejected the idea of
> >>> trying to use -Bsymbolic widely; apparently it has undesirable
> >>> side-effects on some platforms. See commit message for e3d77ea6b
> >>> (hopefully there's some detail in the email thread [1]). It sounds
> >>> like you're not actually proposing that, but I thought it would be
> >>> a good idea to note the hazard here.
> >> Also, IIRC, -Bsymbolic was once frowned upon by packaging policies, since it
> >> prevents use of LD_PRELOAD. I'm not sure what the current thinking there
> >> is, however.
> > It doesn't break some (most?) of the uses of LD_PRELOAD. In particular, it
> > doesn't break things like replacing the malloc implementation. When do you
> > have a symbol that you want to override *inside* your library (executables
> > already bind to their own symbols at compile time)? I've seen that for
> > replacing buggy functions in closed source things, but that's about it?
> >
>
> Which things does it break exactly?

-Bsymbolic causes symbols that are defined and referenced within one shared
library to use that definition. E.g. if a shared lib has a function
"do_something()" and some of its code calls do_something(), you cannot use
LD_PRELOAD (or a definition in the main binary) to redirect the call to
do_something() inside the shared library to something else.

I.e. if a shared library calls a function that's *not* defined within that
shared library, -Bsymbolic doesn't have an effect for that symbol.

> I have a case where a library that
> is LD_PRELOADed calls PQsetSSLKeyPassHook_OpenSSL() in its constructor
> function. I'd be very unhappy if that stopped working (and so would our
> client).

Bsymbolic shouldn't affect that at all.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-11-25 04:21:22 Re: Non-superuser subscription owners
Previous Message Peter Smith 2021-11-25 03:56:22 Re: row filtering for logical replication