Hi,
Moving this to -hackers.
On 2023-04-20 11:49:23 +0200, Palle Girgensohn wrote:
> I was recently made aware of a problem building postgresql using LLVM binutils.
>
> A summary:
>
> --
>
> pgsql's build has requested to strip all non-global symbols (strip -x), but
> there is at least one non-global symbol that in fact cannot be stripped
> because it is referenced by a relocation.
An important detail here is that this happens when stripping static
libraries. It's not too surprising that one needs the symbols referenced by
relocations until after linking with the static lib, even if they're not
globally visible symbols.
> Both GNU strip and ELF Tool Chain strip silently handle this case (and just retain the local symbol), but LLVM strip
isstricter and emits an error upon request to strip a non-removable local symbol.
>
> There is an LLVM ticket open for this at https://github.com/llvm/llvm-project/issues/47468, and it may make sense for
LLVMstrip to behave the same as GNU and ELF Tool Chain strip. That said, pgsql should just not use strip -x when there
aresymbols that cannot be stripped.
Personally I'd say stripping symbols is something that should just not be done
anymore, but ...
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270769
>
> https://reviews.freebsd.org/D39590
>
>
> Any toughts about this? Should send the suggested patch upstreams? Or do we just consider LLVM to behave badly?
Peter, it's unlikely given the timeframe, but do you happen to remember why
you specified -x when stripping static libs? This seems to be all the way back
from
commit 563673e15db995b6f531b44be7bb162330ac157a
Author: Peter Eisentraut <peter_e@gmx.net>
Date: 2002-04-10 16:45:25 +0000
Add make install-strip target.
Afaict the only safe thing to use when stripping static libs is
-g/--strip-debug.
Greetings,
Andres Freund