Skip to content

Commit 9a8885f

Browse files
bors[bot]Anatol Ulrich
and
Anatol Ulrich
authored
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 <[email protected]>
2 parents 272ee3d + b45a5b6 commit 9a8885f

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

cortex-m-rt/.github/workflows/ci.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,19 @@ jobs:
6464
override: true
6565
- name: Install all Rust targets
6666
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
67-
- name: Build crate for thumbv6m-none-eabi
67+
- name: Build examples for thumbv6m-none-eabi
6868
run: cargo build --target=thumbv6m-none-eabi --examples
69-
- name: Build crate for thumbv7m-none-eabi
69+
- name: Build examples for thumbv7m-none-eabi
7070
run: cargo build --target=thumbv7m-none-eabi --examples
71-
- name: Build crate for thumbv7em-none-eabi
71+
- name: Build examples for thumbv7em-none-eabi
7272
run: cargo build --target=thumbv7em-none-eabi --examples
73-
- name: Build crate for thumbv7em-none-eabihf
73+
- name: Build examples for thumbv7em-none-eabihf
7474
run: cargo build --target=thumbv7em-none-eabihf --examples
75-
- name: Build crate for thumbv8m.base-none-eabi
75+
- name: Build examples for thumbv8m.base-none-eabi
7676
run: cargo build --target=thumbv8m.base-none-eabi --examples
77-
- name: Build crate for thumbv8m.main-none-eabi
77+
- name: Build examples for thumbv8m.main-none-eabi
7878
run: cargo build --target=thumbv8m.main-none-eabi --examples
79-
- name: Build crate for thumbv8m.main-none-eabihf
79+
- name: Build examples for thumbv8m.main-none-eabihf
8080
run: cargo build --target=thumbv8m.main-none-eabihf --examples
81+
- name: Build crate for host OS
82+
run: cargo build

cortex-m-rt/macros/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
266266
#(#attrs)*
267267
#[doc(hidden)]
268268
#[export_name = "HardFault"]
269-
#[link_section = ".HardFault.user"]
269+
#[cfg_attr(target_os = "macos", link_section = ".HardFault,user")]
270+
#[cfg_attr(not(target_os = "macos"), link_section = ".HardFault.user")]
270271
pub unsafe extern "C" fn #tramp_ident(frame: &::cortex_m_rt::ExceptionFrame) {
271272
#ident(frame)
272273
}

cortex-m-rt/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,13 +910,15 @@ pub fn heap_start() -> *mut u32 {
910910

911911
// Entry point is Reset.
912912
#[doc(hidden)]
913-
#[link_section = ".vector_table.reset_vector"]
913+
#[cfg_attr(target_os = "macos", link_section = ".vector_table,reset_vector")]
914+
#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.reset_vector")]
914915
#[no_mangle]
915916
pub static __RESET_VECTOR: unsafe extern "C" fn() -> ! = Reset;
916917

917918
#[allow(unused_variables)]
918919
#[doc(hidden)]
919-
#[link_section = ".HardFault.default"]
920+
#[cfg_attr(target_os = "macos", link_section = ".HardFault,default")]
921+
#[cfg_attr(not(target_os = "macos"), link_section = ".HardFault.default")]
920922
#[no_mangle]
921923
pub unsafe extern "C" fn HardFault_(ef: &ExceptionFrame) -> ! {
922924
loop {
@@ -1008,7 +1010,8 @@ pub union Vector {
10081010
}
10091011

10101012
#[doc(hidden)]
1011-
#[link_section = ".vector_table.exceptions"]
1013+
#[cfg_attr(target_os = "macos", link_section = ".vector_table,exceptions")]
1014+
#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.exceptions")]
10121015
#[no_mangle]
10131016
pub static __EXCEPTIONS: [Vector; 14] = [
10141017
// Exception 2: Non Maskable Interrupt.
@@ -1070,7 +1073,8 @@ pub static __EXCEPTIONS: [Vector; 14] = [
10701073
// to the default handler
10711074
#[cfg(all(any(not(feature = "device"), test), not(armv6m)))]
10721075
#[doc(hidden)]
1073-
#[link_section = ".vector_table.interrupts"]
1076+
#[cfg_attr(target_os = "macos", link_section = ".vector_table,interrupts")]
1077+
#[cfg_attr(not(target_os = "macos"), link_section = ".vector_table.interrupts")]
10741078
#[no_mangle]
10751079
pub static __INTERRUPTS: [unsafe extern "C" fn(); 240] = [{
10761080
extern "C" {

0 commit comments

Comments
 (0)