Hello.
What's the proper way to remove *all symbols* from ELF binaries when building packages with rpmbuild on CentOS? Seems that an out of the box rpmbuild install only discards debugging symbols (strip -g).
That's the default configuration for %__os_install_post on CentOS, the step in charge on stripping binaries:
$ rpmbuild --showrc (..) -14: __os_install_post %{_rpmconfigdir}/brp-compress %{_rpmconfigdir}/brp-strip %{_rpmconfigdir}/brp-strip-static-archive %{_rpmconfigdir}/brp-strip-comment-note
ELF binaries are stripped with /usr/lib/rpm/brp-strip, this script explicitly calls to /usr/bin/strip with "-g" flag and discards only debugging symbols.
Seems that the people usually installs "redhat-rpm-config" package to achieve this. Indeed it builds RPMs with all symbols removed, but it also installs some helper scripts and macros that change other behaviors, for example SRPMs are signed with SHA-256.
When "redhat-rpm-config" package is installed, %__os_install_post variable is modified and find-debuginfo.sh is executed, this script will remove all symbols, but it will *also* build "-debug" packages, and that's not what I'm looking for.
For the moment, I have have added another script to %__os_install_post step that removes all symbols using "strip --strip-all", but I wonder if this is the most straightforward method, thanks.
Santi Saez
On Sun, 09 Jun 2013 22:03:40 +0200 Santi Saez santi@woop.es wrote: ...
When "redhat-rpm-config" package is installed, %__os_install_post variable is modified and find-debuginfo.sh is executed, this script will remove all symbols, but it will *also* build "-debug" packages, and that's not what I'm looking for.
... You can avoid generating "-debug" packages with: %define debug_package %{nil}
BR, Bob
On 09/06/13 23:47, Bob Marcan wrote:
You can avoid generating "-debug" packages with: %define debug_package %{nil}
If %__debug_packageis not defined %__debug_install_post step will be skipped and "find-debuginfo.sh" script will not be executed: that's the script in charge of executing "strip -s" to remove all symbols, thanks anyway for the advice.
Santi Saez