Commit 916aafa6 authored by mcgrathr's avatar mcgrathr Committed by Commit bot

Refactor NaCl IRT toolchains, use arm-nacl-clang

This factors the irt_* toolchain definitions using a template to reduce
copied boilerplate.  It also switches the ARM build to use arm-nacl-clang
rather than arm-nacl-gcc, which matches what the GYP build does now.  Many
of the compilation flags are still not at all right, but this is enough
for the build of the IRT to complete successfully.

BUG=531702
R=dpranke@chromium.org

Review URL: https://codereview.chromium.org/1341143002

Cr-Commit-Position: refs/heads/master@{#348781}
parent 315d1a31
......@@ -630,7 +630,6 @@ group("gn_only") {
"//components/sessions:unit_tests",
"//media/blink:media_blink_unittests",
"//media/cast:udp_proxy",
"//native_client/src/trusted/platform_qualify:vcpuid",
"//native_client/src/trusted/debug_stub:gdb_rsp_unittest",
"//storage/browser:dump_file_system",
"//third_party/angle:libANGLE",
......@@ -683,7 +682,10 @@ group("gn_only") {
]
if (target_cpu == "x86" || target_cpu == "x64") {
deps += [ "//third_party/libjpeg_turbo:simd_asm" ]
deps += [
"//third_party/libjpeg_turbo:simd_asm",
"//native_client/src/trusted/platform_qualify:vcpuid",
]
}
if (enable_nacl) {
deps += [ "//native_client/src/trusted/service_runtime:sel_ldr" ]
......
......@@ -398,19 +398,22 @@ config("compiler") {
]
}
} else if (current_cpu == "arm") {
cflags += [
"-march=$arm_arch",
"-mfloat-abi=$arm_float_abi",
]
if (!is_nacl) {
cflags += [
"-march=$arm_arch",
"-mfloat-abi=$arm_float_abi",
]
if (arm_use_thumb) {
cflags += [ "-mthumb" ]
if (is_android && !is_clang) {
# Clang doesn't support this option.
cflags += [ "-mthumb-interwork" ]
}
}
}
if (arm_tune != "") {
cflags += [ "-mtune=$arm_tune" ]
}
if (arm_use_thumb) {
cflags += [ "-mthumb" ]
if (is_android && !is_clang) { # Clang doesn't support this option.
cflags += [ "-mthumb-interwork" ]
}
}
if (!is_clang) {
# Clang doesn't support these flags.
cflags += [
......@@ -692,7 +695,7 @@ config("compiler") {
}
config("compiler_arm_fpu") {
if (current_cpu == "arm" && !is_ios) {
if (current_cpu == "arm" && !is_ios && !is_nacl) {
cflags = [ "-mfpu=$arm_fpu" ]
}
}
......
......@@ -139,77 +139,50 @@ nacl_toolchain("clang_newlib_x64") {
ld = cxx
}
link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
template("nacl_irt_toolchain") {
toolchain_cpu = target_name
assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple")
nacl_toolchain("irt_x86") {
toolchain_package = "pnacl_newlib"
toolchain_revision = pnacl_newlib_rev
toolchain_cpu = "x86"
toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-"
is_clang = true
toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/" +
invoker.toolchain_tuple + "-"
cc = toolprefix + "clang"
cxx = toolprefix + "clang++"
ar = toolprefix + "ar"
readelf = toolprefix + "readelf"
link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir)
tls_edit_label =
"//native_client/src/tools/tls_edit:tls_edit($host_toolchain)"
host_toolchain_out_dir =
rebase_path(get_label_info(tls_edit_label, "root_out_dir"),
root_build_dir)
# Some IRT implementations (notably, Chromium's) contain C++ code,
# so we need to link w/ the C++ linker.
ld = "${python_path} ${link_irt} --tls-edit=${host_toolchain_out_dir}/tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
# TODO(ncbray): depend on link script
deps = [
tls_edit_label,
]
tls_edit = "${host_toolchain_out_dir}/tls_edit"
nacl_toolchain("irt_" + toolchain_cpu) {
is_clang = true
cc = toolprefix + "clang"
cxx = toolprefix + "clang++"
ar = toolprefix + "ar"
readelf = toolprefix + "readelf"
# Some IRT implementations (notably, Chromium's) contain C++ code,
# so we need to link w/ the C++ linker.
ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} --readelf-cmd=${readelf}"
# TODO(ncbray): depend on link script
deps = [
tls_edit_label,
]
}
}
nacl_toolchain("irt_x64") {
toolchain_package = "pnacl_newlib"
toolchain_revision = pnacl_newlib_rev
toolchain_cpu = "x64"
toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-"
is_clang = true
cc = toolprefix + "clang"
cxx = toolprefix + "clang++"
ar = toolprefix + "ar"
readelf = toolprefix + "readelf"
# Some IRT implementations (notably, Chromium's) contain C++ code,
# so we need to link w/ the C++ linker.
ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
# TODO(ncbray): depend on link script
deps = [
"//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
]
nacl_irt_toolchain("x86") {
toolchain_tuple = "i686-nacl"
}
# Uses newlib to match the Chrome build.
nacl_toolchain("irt_arm") {
toolchain_package = "nacl_arm_newlib"
toolchain_revision = nacl_arm_newlib_rev
toolchain_cpu = "arm"
toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-"
is_clang = false
cc = toolprefix + "gcc"
cxx = toolprefix + "g++"
ar = toolprefix + "ar"
readelf = toolprefix + "readelf"
# Some IRT implementations (notably, Chromium's) contain C++ code,
# so we need to link w/ the C++ linker.
ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}"
nacl_irt_toolchain("x64") {
toolchain_tuple = "x86_64-nacl"
}
# TODO(ncbray): depend on link script
deps = [
"//native_client/src/tools/tls_edit:tls_edit($host_toolchain)",
]
nacl_irt_toolchain("arm") {
toolchain_tuple = "arm-nacl"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment