Re: LLVM strip -x fails

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 19:35:42
Message-ID: 20230420193542.6pyucpzniiibtp23@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-04-20 12:43:48 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > Afaict the only safe thing to use when stripping static libs is
> > -g/--strip-debug.
>
> The previous complaint about this [1] suggested we use --strip-unneeded
> for all cases with GNU strip, same as we've long done for shared libs.
> It's an easy enough change, but I wonder if anyone will complain.

--strip-unneeded output is smaller than -x output:

19M src/interfaces/libpq/libpq.a
364K src/interfaces/libpq/libpq.a.strip.gnu.g
352K src/interfaces/libpq/libpq.a.strip.gnu.unneeded
356K src/interfaces/libpq/libpq.a.strip.gnu.x
352K src/interfaces/libpq/libpq.a.strip.gnu.x.g

strip --version
GNU strip (GNU Binutils for Debian) 2.40

Partially that's because --strip-unneeded implies -g. Interestingly -x -g
output isn't quite the same as --strip-unneeded. The latter also removes the
_GLOBAL_OFFSET_TABLE_ symbol.

I doubt anybody wants to strip symbols and keep debug information, so I doubt
there's much ground for complaints?

Oddly the output of llvm-strip confuses binutils objdump enough that it claims
that "file format not recognized". Not sure which side is broken there.

llvm-strip's output is a lot larger than gnu strip's:
19M src/interfaces/libpq/libpq.a
19M src/interfaces/libpq/libpq.a.strip.llvm.X
908K src/interfaces/libpq/libpq.a.strip.llvm.g
892K src/interfaces/libpq/libpq.a.strip.llvm.unneeded
892K src/interfaces/libpq/libpq.a.strip.llvm.unneeded.g
364K src/interfaces/libpq/libpq.a.strip.gnu.g
356K src/interfaces/libpq/libpq.a.strip.gnu.x
352K src/interfaces/libpq/libpq.a.strip.gnu.x.g
352K src/interfaces/libpq/libpq.a.strip.gnu.unneeded

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-04-20 19:37:43 Re: pgsql: Further cleanup of autoconf output files for GSSAPI changes.
Previous Message Andrew Dunstan 2023-04-20 19:32:14 Re: New committers: Nathan Bossart, Amit Langote, Masahiko Sawada