diff options
author | Ted Pudlik <tpudlik@google.com> | 2023-10-06 21:16:55 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-10-06 21:16:55 +0000 |
commit | 6c8f0837d6607b51d441357b6738a5fbb12f296c (patch) | |
tree | 52212680f33c9d05c66bd5c3957118c8c2a22b3f /pw_build | |
parent | 9b452455f7a4ddae7933ecca09dac86b84fcba70 (diff) | |
download | pigweed-6c8f0837d6607b51d441357b6738a5fbb12f296c.tar.gz |
pw_build: Update pw_linker_script docs
Document the fact that you can simply add pw_linker_script to the deps
of a cc_binary.
Also, use cc_binary (the native Bazel rule) instead of pw_cc_binary (our
custom wrapper), to make it clear that this doesn't rely on any special
handling in the binary rule.
Change-Id: Ida95b5aff2f198238287064b4e9d3bd7a53685a3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/174848
Reviewed-by: Kayce Basques <kayce@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Diffstat (limited to 'pw_build')
-rw-r--r-- | pw_build/bazel.rst | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pw_build/bazel.rst b/pw_build/bazel.rst index 232f01ca6..bc3c0427a 100644 --- a/pw_build/bazel.rst +++ b/pw_build/bazel.rst @@ -34,9 +34,19 @@ rule for handling linker scripts with Bazel. e.g. ], ) - pw_cc_binary( + # You can include the linker script in the deps. + cc_binary( name = "some_binary", - srcs = ["some_source.c"], + srcs = ["some_source.cc"], + deps = [":some_linker_script"], + ) + + # Alternatively, you can use additional_linker_inputs and linkopts. This + # allows you to explicitly specify the command line order of linker scripts, + # and may be useful if your project defines more than one. + cc_binary( + name = "some_binary", + srcs = ["some_source.cc"], additional_linker_inputs = [":some_linker_script"], linkopts = ["-T $(location :some_linker_script)"], ) |