diff options
author | 2021-01-27 11:14:20 +0000 | |
---|---|---|
committer | 2021-01-27 12:51:26 +0000 | |
commit | f0e2218330adcffe7dc8a05869dac0e5399058c3 (patch) | |
tree | 8aa463a93a2f9a2a8e07cd97278ed6df85f5fb96 /cortex-m-rt/macros/src/lib.rs | |
parent | 8a64815108bf266e97a82c9be89bbc2ccbf0a5c3 (diff) | |
download | cortex-m-f0e2218330adcffe7dc8a05869dac0e5399058c3.tar.gz cortex-m-f0e2218330adcffe7dc8a05869dac0e5399058c3.tar.zst cortex-m-f0e2218330adcffe7dc8a05869dac0e5399058c3.zip |
Only emit link_section for cortex-m.
Previously we always emitted link_section, even though it only had an
effect when our linker script was being used (and only made sense on
cortex-m targets). This breaks building the code for a MacOS target,
which is occasionally useful for running `cargo check` etc.
In the macros crate we don't have the target information available, so
instead we continue to emit link_section except specifically on MacOS.
Diffstat (limited to 'cortex-m-rt/macros/src/lib.rs')
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index 74041ef..fe0264f 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -278,8 +278,10 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream { #(#attrs)* #[doc(hidden)] #[export_name = "HardFault"] - #[cfg_attr(target_os = "macos", link_section = ".HardFault,user")] - #[cfg_attr(not(target_os = "macos"), link_section = ".HardFault.user")] + // Only emit link_section when building for embedded targets, + // because some hosted platforms (used to check the build) + // cannot handle the long link section names. + #[cfg_attr(target_os = "none", link_section = ".HardFault.user")] pub unsafe extern "C" fn #tramp_ident(frame: &::cortex_m_rt::ExceptionFrame) { #ident(frame) } |