diff options
author | 2019-03-24 17:46:26 +0100 | |
---|---|---|
committer | 2019-03-24 17:46:26 +0100 | |
commit | 142b48b0ce73e3ed0483414168b97bea8fc5b660 (patch) | |
tree | 4644b7297f8e41a66adc1e31f24d8b4122463157 | |
parent | f1c317d028fdd2e7b407bb9d22f2d3b3d284e721 (diff) | |
download | cortex-m-142b48b0ce73e3ed0483414168b97bea8fc5b660.tar.gz cortex-m-142b48b0ce73e3ed0483414168b97bea8fc5b660.tar.zst cortex-m-142b48b0ce73e3ed0483414168b97bea8fc5b660.zip |
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.
-rw-r--r-- | cortex-m-rt/link.x.in | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in index f895e21..e1ec00e 100644 --- a/cortex-m-rt/link.x.in +++ b/cortex-m-rt/link.x.in @@ -131,12 +131,6 @@ SECTIONS /* Place the heap right after `.bss` */ __sheap = ADDR(.bss) + SIZEOF(.bss); - /* Stack usage metadata emitted by LLVM */ - .stack_sizes (INFO) : - { - KEEP(*(.stack_sizes)); - } - /* ## .got */ /* Dynamic relocations are unsupported. This section is only used to detect relocatable code in the input files and raise an error if relocatable code is found */ |