Commit 13174b0
committed
Add link_section = ".HardFault.user" to _HardFault
Without that link_section, I get the following error when using a
HardFault handler with trampoline enabled:
```
error: linking with `rust-lld` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/jan/bin:/home/jan/.local/bin:/home/jan/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" VSLANG="1033" "rust-lld" "-flavor" "gnu" "/tmp/rustco5o3sY/symbols.o" "/tmp/hf/target/thumbv6m-none-eabi/release/deps/hf-60e327b1df262da6.hf.b796e35f6a1db46-cgu.0.rcgu.o" "--as-needed" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/deps" "-L" "/tmp/hf/target/release/deps" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/build/hf-ff0c4c84ae595cf3/out" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/build/cortex-m-a49cc6d3fe1b56bb/out" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/build/cortex-m-rt-92c9f0977947feec/out" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/build/defmt-f49fb1c33a63ef3f/out" "-L" "/tmp/hf/target/thumbv6m-none-eabi/release/build/rp2040-pac-b75ed87cecd188ac/out" "-L" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv6m-none-eabi/lib" "-Bstatic" "/tmp/rustco5o3sY/libcortex_m-e77ad2852f31030c.rlib" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv6m-none-eabi/lib/libcompiler_builtins-94a92625991d7a16.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "/home/jan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv6m-none-eabi/lib" "-o" "/tmp/hf/target/thumbv6m-none-eabi/release/deps/hf-60e327b1df262da6" "--gc-sections" "-O1" "--nmagic" "-Tlink.x" "-Tdefmt.x"
= note: rust-lld: error: /tmp/hf/target/thumbv6m-none-eabi/release/deps/hf-60e327b1df262da6.hf.b796e35f6a1db46-cgu.0.rcgu.o:(function HardFault: .HardFault.user+0xc): relocation R_ARM_THM_JUMP11 out of range: -7055 is not in [-2048, 2047]; references '_HardFault'
>>> referenced by hf.b796e35f6a1db46-cgu.0
>>> defined in /tmp/hf/target/thumbv6m-none-eabi/release/deps/hf-60e327b1df262da6.hf.b796e35f6a1db46-cgu.0.rcgu.o
```
This commit also moves the trampoline from .HardFault.user to
.HardFaultTrampoline. This is not strictly necessary, but is consistent
with previous (cortex-m-rt <= 0.7.3) usage. Alternatively,
`*(.HardFaultTrampoline)` could be removed from link.x.1 parent 5473462 commit 13174b0
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
| |||
379 | 383 | | |
380 | 384 | | |
381 | 385 | | |
382 | | - | |
| 386 | + | |
383 | 387 | | |
384 | 388 | | |
385 | 389 | | |
| |||
0 commit comments