You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/fix-rust-linking.patch

50 lines
2.8 KiB

Index: chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni
===================================================================
--- chromium-121.0.6167.75.orig/build/toolchain/gcc_toolchain.gni
+++ chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni
@@ -464,7 +464,13 @@ template("single_gcc_toolchain") {
# -soname flag is not available on aix ld
soname_flag = "-Wl,-soname=\"$soname\""
}
- link_command = "$ld -shared $soname_flag {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\" {{rlibs}}"
+ if (target_cpu == "ppc64") {
+ # Work around linker failures due to Rust libraries and the use of whole-archive
+ link_command = "$ld -shared $soname_flag -Wl,--start-group {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\" {{rlibs}} -Wl,--end-group"
+ }
+ else {
+ link_command = "$ld -shared $soname_flag {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" @\"$rspfile\" {{rlibs}}"
+ }
# Generate a map file to be used for binary size analysis.
# Map file adds ~10% to the link time on a z620.
@@ -576,7 +582,13 @@ template("single_gcc_toolchain") {
whole_archive_flag = "-Wl,--whole-archive"
no_whole_archive_flag = "-Wl,--no-whole-archive"
}
- command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" $soname_flag @\"$rspfile\""
+ if (target_cpu == "ppc64") {
+ # Work around linker failures due to Rust libraries and the use of whole-archive
+ command = "$ld -shared -Wl,--start-group {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" $soname_flag @\"$rspfile\" -Wl,--end-group"
+ }
+ else {
+ command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile\" $soname_flag @\"$rspfile\""
+ }
if (defined(invoker.strip)) {
strip_command = "${invoker.strip} -o \"$sofile\" \"$unstripped_sofile\""
@@ -636,7 +648,13 @@ template("single_gcc_toolchain") {
start_group_flag = "-Wl,--start-group"
end_group_flag = "-Wl,--end-group "
}
- link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag {{libs}} {{rlibs}}"
+ if (target_cpu == "ppc64") {
+ # Work around linker failures due to Rust libraries and the use of whole-archive
+ link_command = "$ld -Wl,--start-group {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" @\"$rspfile\" {{solibs}} {{libs}} {{rlibs}} -Wl,--end-group"
+ }
+ else {
+ link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag {{libs}} {{rlibs}}"
+ }
# Generate a map file to be used for binary size analysis.
# Map file adds ~10% to the link time on a z620.