Fix malloc handling in Bazel build
diff --git a/src/rp2_common/boot_stage2/BUILD.bazel b/src/rp2_common/boot_stage2/BUILD.bazel
index f34bc56..e6c175d 100644
--- a/src/rp2_common/boot_stage2/BUILD.bazel
+++ b/src/rp2_common/boot_stage2/BUILD.bazel
@@ -25,6 +25,12 @@
     visibility = ["//src/rp2_common/pico_standard_link:__pkg__"],
 )
 
+# Stub library to prevent custom malloc from getting linked in. boot2 will never
+# need malloc, so letting it link can only cause problems.
+cc_library(
+    name = "no_malloc",
+)
+
 cc_binary(
     name = "boot_stage2_elf",
     srcs = ["compile_time_choice.S"],
@@ -34,6 +40,7 @@
         "-nostartfiles",
         "-T$(location boot_stage2.ld)",
     ],
+    malloc = ":no_malloc",
     deps = [
         "boot_stage2.ld",
         ":config",
diff --git a/src/rp2_common/pico_malloc/BUILD.bazel b/src/rp2_common/pico_malloc/BUILD.bazel
index 5287b24..d3871ef 100644
--- a/src/rp2_common/pico_malloc/BUILD.bazel
+++ b/src/rp2_common/pico_malloc/BUILD.bazel
@@ -6,10 +6,10 @@
     hdrs = ["include/pico/malloc.h"],
     includes = ["include"],
     linkopts = [
-        "--linkopts=malloc",
-        "--linkopts=calloc",
-        "--linkopts=realloc",
-        "--linkopts=free",
+        "-Wl,--wrap=malloc",
+        "-Wl,--wrap=calloc",
+        "-Wl,--wrap=realloc",
+        "-Wl,--wrap=free",
     ],
     deps = [
         "//src/common/pico_base",