How to generate gcc debug symbol outside the build target?

You need to use objcopy to separate the debug information: objcopy –only-keep-debug “${tostripfile}” “${debugdir}/${debugfile}” strip –strip-debug –strip-unneeded “${tostripfile}” objcopy –add-gnu-debuglink=”${debugdir}/${debugfile}” “${tostripfile}” I use the bash script below to separate the debug information into files with a .debug extension in a .debug directory. This way I can tar the libraries and executables in one tar file … Read more