Skip to content

Commit

Permalink
Fix: Strip option doesn't work for linux .so files (#455)
Browse files Browse the repository at this point in the history
libflutter_engine.so and libflutter_linux_gtk.so are  not stripped
  • Loading branch information
Hidenori Matsubayashi committed May 27, 2021
1 parent ef50dec commit ff1975d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build/toolchain/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ declare_args() {

# Set this flag to cause bitcode to be marker only.
bitcode_marker = false

# Set this flag to strip .so files.
stripped_symbols = !is_debug
}

declare_args() {
Expand Down
16 changes: 16 additions & 0 deletions build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ template("gcc_toolchain") {
replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi"

command = "$link_command && $toc_command && $replace_command"
if (stripped_symbols) {
if (defined(invoker.strip) || defined(invoker.llvm_objcopy)) {
unstripped_outfile = "{{root_out_dir}}/lib.unstripped/$sofile"
pre_strip_command = "mkdir -p {{root_out_dir}}/lib.unstripped && cp $sofile {{root_out_dir}}/lib.unstripped/"
}
if (defined(invoker.strip)) {
strip = invoker.strip
strip_command =
"${strip} --strip-unneeded -o $sofile $unstripped_outfile"
command += " && " + pre_strip_command + " && " + strip_command
} else if (defined(invoker.llvm_objcopy)) {
strip = invoker.llvm_objcopy
strip_command = "${strip} --strip-all $unstripped_outfile $sofile"
command += " && " + pre_strip_command + " && " + strip_command
}
}
if (defined(invoker.postsolink)) {
command += " && " + invoker.postsolink
}
Expand Down

0 comments on commit ff1975d

Please sign in to comment.