Re: LLVM strip -x fails
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Palle Girgensohn <girgen@pingpong.net>, pgsql-hackers@postgresql.org, Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2023-04-20T19:35:42Z
Lists: 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
Commits
-
Use --strip-unneeded when stripping static libraries with GNU strip.
- a14afd3bdc21 15.3 landed
- eab2d3147e3c 16.0 landed
- e2e34dfff5e7 12.15 landed
- c976ccc9e557 11.20 landed
- 6dce37203410 13.11 landed
- 6d60b718ceb0 14.8 landed
-
Add make install-strip target.
- 563673e15db9 7.3.1 cited