aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2021-01-26 16:22:25 +0000
committerGravatar GitHub <noreply@github.com> 2021-01-26 16:22:25 +0000
commit9a8885f4f75d10d18506d13041c80952b9a5a4a2 (patch)
tree20e0953710876ae0d705c2161aac917fc55d5962
parent272ee3d30a3227ee45ff11c5c7c0134916a40525 (diff)
parentb45a5b6bcada5a1e22efbbecaa5ea23e244b56f6 (diff)
downloadcortex-m-9a8885f4f75d10d18506d13041c80952b9a5a4a2.tar.gz
cortex-m-9a8885f4f75d10d18506d13041c80952b9a5a4a2.tar.zst
cortex-m-9a8885f4f75d10d18506d13041c80952b9a5a4a2.zip
Merge #306
306: fix #74 r=jonas-schievink a=spookyvision special-cased linker section names to satisfy macos linker constraints Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
-rw-r--r--cortex-m-rt/.github/workflows/ci.yml16
-rw-r--r--cortex-m-rt/macros/src/lib.rs3
-rw-r--r--cortex-m-rt/src/lib.rs12
3 files changed, 19 insertions, 12 deletions
diff --git a/cortex-m-rt/.github/workflows/ci.yml b/cortex-m-rt/.github/workflows/ci.yml
index 35abd15..8ab6ebb 100644
--- a/cortex-m-rt/.github/workflows/ci.yml
+++ b/cortex-m-rt/.github/workflows/ci.yml
@@ -64,17 +64,19 @@ jobs:
override: true
- name: Install all Rust targets
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv8m.base-none-eabi thumbv8m.main-none-eabi thumbv8m.main-none-eabihf
- - name: Build crate for thumbv6m-none-eabi
+ - name: Build examples for thumbv6m-none-eabi
run: cargo build --target=thumbv6m-none-eabi --examples
- - name: Build crate for thumbv7m-none-eabi
+ - name: Build examples for thumbv7m-none-eabi
run: cargo build --target=thumbv7m-none-eabi --examples
- - name: Build crate for thumbv7em-none-eabi
+ - name: Build examples for thumbv7em-none-eabi
run: cargo build --target=thumbv7em-none-eabi --examples
- - name: Build crate for thumbv7em-none-eabihf
+ - name: Build examples for thumbv7em-none-eabihf
run: cargo build --target=thumbv7em-none-eabihf --examples
- - name: Build crate for thumbv8m.base-none-eabi
+ - name: Build examples for thumbv8m.base-none-eabi
run: cargo build --target=thumbv8m.base-none-eabi --examples
- - name: Build crate for thumbv8m.main-none-eabi
+ - name: Build examples for thumbv8m.main-none-eabi
run: cargo build --target=thumbv8m.main-none-eabi --examples
- - name: Build crate for thumbv8m.main-none-eabihf
+ - name: Build examples for thumbv8m.main-none-eabihf
run: cargo build --target=thumbv8m.main-none-eabihf --examples
+ - name: Build crate for host OS
+ run: cargo build
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs
index 7e54a5c..a486558 100644
--- a/cortex-m-rt/macros/src/lib.rs
+++ b/cortex-m-rt/macros/src/lib.rs
@@ -266,7 +266,8 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
#(#attrs)*
#[doc(hidden)]
#[export_name = "HardFault"]
- #[link_section = ".HardFault.user"]
+ #[cfg_attr(target_os = "macos", link_section = ".HardFault,user")]
+ #[cfg_attr(not(target_os = "macos"), link_section = ".HardFault.user")]
pub unsafe extern "C" fn #tramp_ident(frame: &::cortex_m_rt::ExceptionFrame) {
#ident(frame)
}
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index e5e290d..93125b7 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -910,13 +910,15 @@ pub fn heap_start() -> *mut u32 {
// Entry point is Reset.
#[doc(hidden)]
-#[link_section = ".vector_table.reset_vector"]
+#[cfg_attr(target_os = "macos", link_section = ".vector_table,reset_vector")]
+#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.reset_vector")]
#[no_mangle]
pub static __RESET_VECTOR: unsafe extern "C" fn() -> ! = Reset;
#[allow(unused_variables)]
#[doc(hidden)]
-#[link_section = ".HardFault.default"]
+#[cfg_attr(target_os = "macos", link_section = ".HardFault,default")]
+#[cfg_attr(not(target_os = "macos"), link_section = ".HardFault.default")]
#[no_mangle]
pub unsafe extern "C" fn HardFault_(ef: &ExceptionFrame) -> ! {
loop {
@@ -1008,7 +1010,8 @@ pub union Vector {
}
#[doc(hidden)]
-#[link_section = ".vector_table.exceptions"]
+#[cfg_attr(target_os = "macos", link_section = ".vector_table,exceptions")]
+#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.exceptions")]
#[no_mangle]
pub static __EXCEPTIONS: [Vector; 14] = [
// Exception 2: Non Maskable Interrupt.
@@ -1070,7 +1073,8 @@ pub static __EXCEPTIONS: [Vector; 14] = [
// to the default handler
#[cfg(all(any(not(feature = "device"), test), not(armv6m)))]
#[doc(hidden)]
-#[link_section = ".vector_table.interrupts"]
+#[cfg_attr(target_os = "macos", link_section = ".vector_table,interrupts")]
+#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.interrupts")]
#[no_mangle]
pub static __INTERRUPTS: [unsafe extern "C" fn(); 240] = [{
extern "C" {