Closed xumia closed 2 years ago
@mlindgren , could you please take a look the issue? Thanks.
Hi @xumia, in order to preserve debugging symbols for later reference, we build with the -g
flag and then have a separate step in the Linux module CMake file which copies the debug symbols to a separate file using objcopy
and then strips them. See here: https://github.com/microsoft/SymCrypt/blob/31e06ae046dd54120ba1463f2e404a02db44f919/modules_linux/common/ModuleCommon.cmake#L62
Does this not work for your use case? We could consider adding another flag to make this step optional. Also open to other suggestions.
@mlindgren , thanks for you reply. The generic_linux contains debug info, but generic (libsymcrypt.so.101.3.0) does not contain debug info. Can I build debug version and remove the debug info after build? Any issue?
$ file ./module/AMD64/LinuxUserMode/generic_linux/libsymcrypt.so ./module/AMD64/LinuxUserMode/generic_linux/libsymcrypt.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=52fe5080f71d74fc9377349995b328720e32028e, with debug_info, not stripped
$ ls ./module/AMD64/LinuxUserMode/generic_linux/
libsymcrypt.so
$ ls ./module/AMD64/LinuxUserMode/generic -l
total 448
lrwxrwxrwx 1 xumia xumia 18 Apr 29 23:03 libsymcrypt.so -> libsymcrypt.so.101
lrwxrwxrwx 1 xumia xumia 22 Apr 29 23:03 libsymcrypt.so.101 -> libsymcrypt.so.101.3.0
-rwxr-x--x 1 xumia xumia 457608 Apr 29 23:03 libsymcrypt.so.101.3.0
drwxr-xr-x 2 xumia xumia 119 Apr 29 23:03 processing
Did you clean your build outputs? I believe generic_linux is an old directory name that we no longer use. From a clean build, this is what I get:
$ ls module/AMD64/LinuxUserMode/
generic oe_full
$ ls module/AMD64/LinuxUserMode/generic/ -l
total 456
lrwxrwxrwx 1 mitch mitch 18 Apr 29 16:34 libsymcrypt.so -> libsymcrypt.so.101
lrwxrwxrwx 1 mitch mitch 22 Apr 29 16:34 libsymcrypt.so.101 -> libsymcrypt.so.101.3.0
-rwxr-x--x 1 mitch mitch 461712 Apr 29 16:34 libsymcrypt.so.101.3.0
drwxr-xr-x 2 mitch mitch 4096 Apr 29 16:34 processing
$ file module/AMD64/LinuxUserMode/generic/libsymcrypt.so.101.3.0
module/AMD64/LinuxUserMode/generic/libsymcrypt.so.101.3.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5c64c9efdb7efa6551bd65e646b16d216b25bad7, not stripped
I'm not sure why it says "not stripped" since we do explicitly strip it in ModuleCommon.cmake
, but as expected it shows that there is no debug info (also confirmed with readelf).
@mlindgren , yes, it is an old directory, the new generic folder looks good, thanks.
For Linux, if the CMAKE_BUILD_TYPE=Release, we should not add the -g flag.
https://github.com/microsoft/SymCrypt/blob/31e06ae046dd54120ba1463f2e404a02db44f919/CMakeLists.txt#L88