@@ -45,6 +45,9 @@ analyzer_wrapper =
4545# Location of the strip executable. When specified, strip will be run on
4646# all shared libraries and executables as they are built. The pre-stripped
4747# artifacts will be put in lib.stripped/ and exe.stripped/.
48+ # - llvm_objcopy
49+ # Location of the llvm-objcopy executable. Used as strip instead of strip
50+ # when specified.
4851template (" gcc_toolchain" ) {
4952 toolchain (target_name ) {
5053 assert (defined (invoker .cc ), " gcc_toolchain() must specify a \" cc\" value" )
@@ -169,7 +172,7 @@ template("gcc_toolchain") {
169172 tocfile = sofile + " .TOC"
170173 temporary_tocname = sofile + " .tmp"
171174 link_command = " $ld -shared {{ldflags}} $coverage_flags -o $sofile -Wl,--build-id=sha1 -Wl,-soname=$soname @$rspfile "
172- toc_command = " { $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname "
175+ toc_command = " { $readelf -d $sofile | grep SONAME ; $nm -gD -f posix $sofile | cut -f1-2 -d' '; } > $temporary_tocname "
173176 replace_command = " if ! cmp -s $temporary_tocname $tocfile ; then mv $temporary_tocname $tocfile ; fi"
174177
175178 command = " $link_command && $toc_command && $replace_command "
@@ -214,7 +217,7 @@ template("gcc_toolchain") {
214217 rspfile = " $outfile .rsp"
215218 unstripped_outfile = outfile
216219
217- if (defined (invoker .strip )) {
220+ if (defined (invoker .strip ) || defined ( invoker . llvm_objcopy ) ) {
218221 unstripped_outfile = " {{root_out_dir}}/exe.unstripped/$exename "
219222 }
220223
@@ -224,6 +227,10 @@ template("gcc_toolchain") {
224227 strip_command =
225228 " ${ strip } --strip-unneeded -o $outfile $unstripped_outfile "
226229 command += " && " + strip_command
230+ } else if (defined (invoker .llvm_objcopy )) {
231+ strip = invoker .llvm_objcopy
232+ strip_command = " ${ strip } --strip-all $unstripped_outfile $outfile "
233+ command += " && " + strip_command
227234 }
228235 if (defined (invoker .postlink )) {
229236 command += " && " + invoker .postlink
0 commit comments