Skip to content

Commit

Permalink
Modify gcc , cobalt toolchains (youtube#2072)
Browse files Browse the repository at this point in the history
1) Ingest shlib extension from the toolchain variables : fixes error
b/246412559#comment79
2) Windows based modular builds can't link with the shared library
   directly - link command is modified accordingly.

b/246412559

Change-Id: I87e2dc56ed4bbf60e296199d02aacfa34d4f1d72
  • Loading branch information
niranjanyardi authored and Rongo-JL committed Dec 19, 2023
1 parent 672b7f8 commit b6551e1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
11 changes: 10 additions & 1 deletion build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")

if (use_cobalt_customizations) {
import("//starboard/build/config/os_definitions.gni")
}

if (is_nacl) {
# To keep NaCl variables out of builds that don't include NaCl, all
# variables defined in nacl/config.gni referenced here should be protected by
Expand Down Expand Up @@ -610,7 +614,12 @@ template("gcc_toolchain") {
if (using_old_compiler) {
link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag {{libs}} $tail_lib_dependencies"
} else {
link_command = "$ld {{ldflags}}${extra_ldflags} {{libs}} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag$tail_lib_dependencies"
# Windows based platform modular builds dont link directly with the shared library.
if (is_host_win && sb_is_modular) {
link_command = "$ld {{ldflags}}${extra_ldflags} {{libs}} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" $end_group_flag$tail_lib_dependencies"
} else {
link_command = "$ld {{ldflags}}${extra_ldflags} {{libs}} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag$tail_lib_dependencies"
}
}

# Generate a map file to be used for binary size analysis.
Expand Down
6 changes: 4 additions & 2 deletions starboard/build/toolchain/cobalt_toolchains.gni
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import("//build/toolchain/gcc_toolchain.gni")

template("cobalt_clang_toolchain") {
gcc_toolchain(target_name) {
forward_variables_from(invoker.variables,
forward_variables_from(invoker,
[
"native_linker_path",
"executable_extension",
"tail_lib_dependencies",
"shlib_extension",
])
if (defined(invoker.shlib_extension)) {
shlib_extension = invoker.shlib_extension
}
assert(defined(native_linker_path),
"native_linker_path has to be defined by the platform")
if (!is_host_win) {
Expand Down
4 changes: 1 addition & 3 deletions starboard/linux/x64x11/clang/3.9/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import("//starboard/shared/toolchain/overridable_gcc_toolchain.gni")
_target_llvm_3_9_bin_dir = "/usr/lib/llvm-3.9/bin"

cobalt_clang_toolchain("cobalt") {
variables = {
native_linker_path = "${_target_llvm_3_9_bin_dir}/clang++"
}
native_linker_path = "${_target_llvm_3_9_bin_dir}/clang++"
}

overridable_gcc_toolchain("starboard") {
Expand Down
4 changes: 1 addition & 3 deletions starboard/linux/x64x11/gcc/6.3/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import("//starboard/shared/toolchain/overridable_gcc_toolchain.gni")
_default_gcc_6_3_bin_dir = "/usr/bin"

cobalt_clang_toolchain("cobalt") {
variables = {
native_linker_path = "${_default_gcc_6_3_bin_dir}/clang++"
}
native_linker_path = "${_default_gcc_6_3_bin_dir}/clang++"
}

overridable_gcc_toolchain("starboard") {
Expand Down
4 changes: 1 addition & 3 deletions starboard/linux/x64x11/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ overridable_clang_toolchain("starboard") {
}

cobalt_clang_toolchain("cobalt") {
variables = {
native_linker_path = "$clang_base_path/bin/clang++"
}
native_linker_path = "$clang_base_path/bin/clang++"
}

overridable_clang_toolchain("target") {
Expand Down
4 changes: 1 addition & 3 deletions starboard/raspi/2/skia/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ gcc_toolchain("target") {
}

cobalt_clang_toolchain("cobalt") {
variables = {
native_linker_path = gcc_toolchain_cxx
}
native_linker_path = gcc_toolchain_cxx
}

gcc_toolchain("starboard") {
Expand Down
4 changes: 1 addition & 3 deletions starboard/raspi/2/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import("//starboard/build/toolchain/cobalt_toolchains.gni")
import("//starboard/raspi/shared/toolchain/raspi_shared_toolchain.gni")

cobalt_clang_toolchain("cobalt") {
variables = {
native_linker_path = gcc_toolchain_cxx
}
native_linker_path = gcc_toolchain_cxx
}

gcc_toolchain("starboard") {
Expand Down

0 comments on commit b6551e1

Please sign in to comment.