Re: LLVM strip -x fails - Mailing list pgsql-hackers

From Andres Freund
Subject Re: LLVM strip -x fails
Date
Msg-id 20230420193542.6pyucpzniiibtp23@awork3.anarazel.de
Whole thread Raw
In response to Re: LLVM strip -x fails  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LLVM strip -x fails  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

On 2023-04-20 12:43:48 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: New committers: Nathan Bossart, Amit Langote, Masahiko Sawada
Next
From: Dave Cramer
Date:
Subject: Re: Request for comment on setting binary format output per session