Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit 8ff305b

Browse files
committed
do not KEEP the .stack_sizes section
this undoes PR #118 I found a problem with keeping this section. Turns out that the input `.stack_sizes` sections contain references to all functions compiled with `-Z emit-stack-sizes` (the section contains the addresses of all those functions after all) so keeping those section prevents the linker from removing *any* of those functions. This is not a problem today because `-Z emit-stack-sizes` is *opt-in* and only used to analyze a program. However, I am proposing a rust-lang/rust PR to build the `compiler-builtins` crate with `-Z emit-stack-sizes`. That change will cause *all* the functions in that crate to be kept in binaries that link to `cortex-m-rt`, regardless of whether the crate author uses `-Z emit-stack-sizes` or not, leading a increase in binary size of about 14 KB (`.text` section). To prevent issues with that rust-lang/rust PR I propose we undo PR #118. On the bright side, the tools that were depending on this (`cargo-stack-sizes` and `cargo-call-stack`) no longer do so in their latest releases so nothing is lost on the tooling front with this change.
1 parent 989922d commit 8ff305b

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

link.x.in

-6
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ SECTIONS
131131
/* Place the heap right after `.bss` */
132132
__sheap = ADDR(.bss) + SIZEOF(.bss);
133133

134-
/* Stack usage metadata emitted by LLVM */
135-
.stack_sizes (INFO) :
136-
{
137-
KEEP(*(.stack_sizes));
138-
}
139-
140134
/* ## .got */
141135
/* Dynamic relocations are unsupported. This section is only used to detect relocatable code in
142136
the input files and raise an error if relocatable code is found */

0 commit comments

Comments
 (0)