Using gnu_debuglink Files
Some versions of Linux allow you to place debugging information in a separate file. These files, which can have any name, are called gnu_debuglink files. Because this information is stripped from the program’s file, it almost always greatly reduces the size of your program. In most cases, you would create gnu_debuglink files for system libraries or other programs for which it is inappropriate to ship versions have debugging information.
After you create an unstripped executable or shared library, you can prepare the gnu_debuglink file as follows:
1. Create a.debug copy of the file. This second file will only contain debugging symbol table information. That is, it differs from the original in that it does not contain code or data.
Create this file on Linux systems that support the - -add-gnu-debuglink and - -only-keep-debug command-line options. If objcopy -- -help mentions - -add-gnu-debuglink, you should be able to create this file. See man objcopy for more details.
1. Create a stripped copy of the image file, and add a .gnu_debuglink section to the stripped file that contains the name of the .debug file and the checksum of the .debug file.
2. Distribute the stripped image and .debug files separately. The idea is that the stripped image file will normally take up less space on the disk, and if you want the debug information, you can also install the corresponding .debug file.
The following example creates the gnu_debuglink file for a program named hello. It also strips the debugging information from hello:
objcopy --only-keep-debug hello hello.gnu_debuglink.debug
objcopy --strip-all hello hello.gnu_debuglink
objcopy --add-gnu-debuglink=hello.gnu_debuglink.debug \
hello.gnu_debuglink