Skip to content

Commit d86829a

Browse files
authored
Mark .debug_gdb_scripts as non-allocatable.
See the discussion in rust-lang/rust#41627 for an explanation of why this is necessary.
1 parent 4d1cf60 commit d86829a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cortex-m-rt/link.x

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ SECTIONS
3535

3636
_sidata = LOADADDR(.data);
3737

38+
/* Due to an unfortunate combination of legacy concerns,
39+
toolchain drawbacks, and insufficient attention to detail,
40+
rustc has no choice but to mark .debug_gdb_scripts as allocatable.
41+
We really do not want to upload it to our target, so we
42+
remove the allocatable bit. Unfortunately, it appears
43+
that the only way to do this in a linker script is
44+
the extremely obscure "INFO" output section type specifier. */
45+
.debug_gdb_scripts 0 (INFO) : {
46+
KEEP(*(.debug_gdb_scripts))
47+
}
48+
3849
/DISCARD/ :
3950
{
4051
/* Unused unwinding stuff */

0 commit comments

Comments
 (0)