mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
Bazel: disable link_extra_lib when building bootloader (#1854)
Fixes #1853
This commit is contained in:
parent
9b16c797b4
commit
7dc10d7aad
3 changed files with 17 additions and 0 deletions
|
|
@ -87,11 +87,18 @@ rp2040_bootloader_binary = declare_transtion(
|
||||||
"_allowlist_function_transition": attr.label(
|
"_allowlist_function_transition": attr.label(
|
||||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||||
),
|
),
|
||||||
|
"_link_extra_libs": attr.label(default = "//bazel:empty_cc_lib"),
|
||||||
},
|
},
|
||||||
flag_overrides = {
|
flag_overrides = {
|
||||||
# We don't want --custom_malloc to ever apply to the bootloader, so
|
# We don't want --custom_malloc to ever apply to the bootloader, so
|
||||||
# always explicitly override it here.
|
# always explicitly override it here.
|
||||||
"//command_line_option:custom_malloc": "_malloc",
|
"//command_line_option:custom_malloc": "_malloc",
|
||||||
|
|
||||||
|
# Platforms will commonly depend on bootloader components in every
|
||||||
|
# binary via `link_extra_libs`, so we must drop these deps when
|
||||||
|
# building the bootloader binaries themselves in order to avoid a
|
||||||
|
# circular dependency.
|
||||||
|
"@bazel_tools//tools/cpp:link_extra_libs": "_link_extra_libs",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,11 @@ cc_binary(
|
||||||
"-Wl,--entry=_stage2_boot",
|
"-Wl,--entry=_stage2_boot",
|
||||||
"-T$(location boot_stage2.ld)",
|
"-T$(location boot_stage2.ld)",
|
||||||
],
|
],
|
||||||
|
# Platforms will commonly depend on bootloader components in every
|
||||||
|
# binary via `link_extra_libs`, so we must drop these deps when
|
||||||
|
# building the bootloader binaries themselves in order to avoid a
|
||||||
|
# circular dependency.
|
||||||
|
link_extra_lib = "//bazel:empty_cc_lib",
|
||||||
# this does nothing if someone passes --custom_malloc, so the
|
# this does nothing if someone passes --custom_malloc, so the
|
||||||
# rp2040_bootloader_binary transition forcibly clobbers --custom_malloc.
|
# rp2040_bootloader_binary transition forcibly clobbers --custom_malloc.
|
||||||
malloc = "//bazel:empty_cc_lib",
|
malloc = "//bazel:empty_cc_lib",
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ cc_binary(
|
||||||
copts = ["-fPIC"],
|
copts = ["-fPIC"],
|
||||||
# Incompatible with section garbage collection.
|
# Incompatible with section garbage collection.
|
||||||
features = ["-gc_sections"],
|
features = ["-gc_sections"],
|
||||||
|
# Platforms will commonly depend on bootloader components in every
|
||||||
|
# binary via `link_extra_libs`, so we must drop these deps when
|
||||||
|
# building the bootloader binaries themselves in order to avoid a
|
||||||
|
# circular dependency.
|
||||||
|
link_extra_lib = "//bazel:empty_cc_lib",
|
||||||
linkopts = [
|
linkopts = [
|
||||||
"-Wl,--no-gc-sections",
|
"-Wl,--no-gc-sections",
|
||||||
"-nostartfiles",
|
"-nostartfiles",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue