Ensure Clang produces Build IDs so that matching matching dylibs with symbols is easier. (#134)

This is already the default in GCC.
This commit is contained in:
Chinmay Garde 2018-04-30 21:01:10 -07:00 committed by GitHub
parent 66676c9960
commit a69ebc4e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,8 +147,7 @@ template("gcc_toolchain") {
# existing .TOC file, overwrite it, otherwise, don't change it. # existing .TOC file, overwrite it, otherwise, don't change it.
tocfile = sofile + ".TOC" tocfile = sofile + ".TOC"
temporary_tocname = sofile + ".tmp" temporary_tocname = sofile + ".tmp"
link_command = link_command = "$ld -shared {{ldflags}} -o $sofile -Wl,--build-id -Wl,-soname=$soname @$rspfile"
"$ld -shared {{ldflags}} -o $sofile -Wl,-soname=$soname @$rspfile"
toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname" toc_command = "{ $readelf -d $sofile | grep SONAME ; $nm -gD -f p $sofile | cut -f1-2 -d' '; } > $temporary_tocname"
replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi" replace_command = "if ! cmp -s $temporary_tocname $tocfile; then mv $temporary_tocname $tocfile; fi"
@ -198,10 +197,11 @@ template("gcc_toolchain") {
unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename"
} }
command = "$ld {{ldflags}} -o $unstripped_outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" command = "$ld {{ldflags}} -o $unstripped_outfile -Wl,--build-id -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix"
if (defined(invoker.strip)) { if (defined(invoker.strip)) {
strip = invoker.strip strip = invoker.strip
strip_command = "${strip} --strip-unneeded -o $outfile $unstripped_outfile" strip_command =
"${strip} --strip-unneeded -o $outfile $unstripped_outfile"
command += " && " + strip_command command += " && " + strip_command
} }
if (defined(invoker.postlink)) { if (defined(invoker.postlink)) {