Re: LLVM strip -x fails

From: Andres Freund <andres(at)anarazel(dot)de>
To: Palle Girgensohn <girgen(at)pingpong(dot)net>, pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: LLVM strip -x fails
Date: 2023-04-20 15:33:38
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


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 is stricter and emits an error upon request to strip a non-removable local symbol.
> There is an LLVM ticket open for this at, and it may make sense for LLVM strip to behave the same as GNU and ELF Tool Chain strip. That said, pgsql should just not use strip -x when there are symbols that cannot be stripped.

Personally I'd say stripping symbols is something that should just not be done
anymore, but ...

> 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

commit 563673e15db995b6f531b44be7bb162330ac157a
Author: Peter Eisentraut <peter_e(at)gmx(dot)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


Andres Freund


Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2023-04-20 15:49:49 Re: Wrong results from Parallel Hash Full Join
Previous Message Jeff Davis 2023-04-20 15:10:54 Re: check_strxfrm_bug()