blob: 0737c85c1429767495ec58e45534cb002973c674 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Adds an ELF binary to the .build-id directory by hard-linking.
#
# Parameters
#
# debug
# Type: file
# Required: This file will be linked into the .build-id directory
# with the ".debug" extension
#
# stripped
# Type: file
# Optional: If set this file will be linked into the .build-id directory
# with no extension
template("build_id_entry") {
action(target_name) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
"data_deps",
])
assert(defined(invoker.debug), "Must define debug")
sources = [ invoker.debug ]
stamp = "${invoker.debug}.build-id.stamp"
outputs = [ stamp ]
# TODO(https://fxbug.dev/42060773): Re-enable when fsatrace is fixed to not hang when running this tool.
hermetic_deps = false
script = "//prebuilt/tools/buildidtool/${host_platform}/buildidtool"
args = [
"-entry",
".debug=" + rebase_path(invoker.debug, root_build_dir),
"-build-id-dir",
".build-id",
"-stamp",
rebase_path(stamp, root_build_dir),
]
if (defined(invoker.stripped)) {
sources += [ invoker.stripped ]
args += [
"-entry",
"=" + rebase_path(invoker.stripped, root_build_dir),
]
}
}
}