Is there a possibility to preserve debug symbols when generating a shared object from an object file?
For example, I'm generating my object file with debug symbols using cc using the implicit target and only adding -g to CFLAGS. Then, I generate the shared object (.so) file by defining a custom target where I'm using the -shared option for cc.
My observations so far are:
- when generating the shared object directly from source code files I do get debug symbols
- using -g option when generating the shared object from an object file with debug symbols included does not help
My assumption is:
- debug symbols are indeed not included since when creating the rpm, /usr/lib/rpm/find-debuginfo.sh is automatically run and I'm getting some warnings that my files have already been stripped
If the exact files are needed for examination, take for example how radius.so is generated: http://git.ozlabs.org/?p=ppp.git;a=blob;f=pppd/plugins/radius/Makefile.linux;h=24ed3e580c4db6aeca129dd22dbe6de5f2d1ff5f;hb=HEAD
I need to mention again that I've added -g option to CFLAGS.
Thank you!
The quick-and-dirty answer is to add exit 0 at the end of the %install script which disables various helpers that are appended to the end of the %install build scriptlet when run.
The more specific answer is to examine the helper scriptlets (which strip shared libraries of debugging symbols) using rpm --showrc on your system and modify what helpers are being run.
The two most important macros that need to be configured to diable debug symbol stripping are:
Which are usually re-defined in the redhat-rpm-config package.