diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2020-09-02 12:21:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 12:21:09 +0300 |
commit | e510e767e4861be955cefdc7187ddd875d1e6a9e (patch) | |
tree | 7c51325ce2789e2e537ddba5b4064fb699b5c3d8 /eng/native/functions.cmake | |
parent | a664bbc7b6b42a88bf3597834f620a41be8fcee5 (diff) |
Strip binaries more aggressively (#41039)
* Strip binaries more aggressively
We are currently stripping only debug symbols, but there are also other
symbols that can be stripped without affecting debuggability or anything
else. We were stripping the binaries in corefx that way in the past,
but some time ago we have unified the stripping between the former
three repos and started to strip just the debugging symbols.
This change strips all unneeded symbols, which results in significant
reduction of the binaries sizes. For example, libcoreclr.so went down
from 8732272 to 7027024 or libSystem.Security.Cryptography.Native.OpenSsl.so
went down from 163376 to 120952.
* Fix FreeBSD
* Fix FreeBSD and OSX
We use nm command to extract g_dacTable symbol value from libcoreclr
for the DAC purposes. On OSX, there are no dynamic symbols, on
FreeBSD, the stripping strips all regular symbols and leaves
dynamic ones only. So the nm needs to get a -D argument for
non OSX.
Diffstat (limited to 'eng/native/functions.cmake')
-rw-r--r-- | eng/native/functions.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 1bdcf1ddd38..420b7d1a88f 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -323,7 +323,7 @@ function(strip_symbols targetName outputFilename) POST_BUILD VERBATIM COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} - COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file} + COMMAND ${CMAKE_OBJCOPY} --strip-unneeded ${strip_source_file} COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}" ) |