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

fix #74 #306

Merged
merged 4 commits into from
Jan 26, 2021
Merged

fix #74 #306

merged 4 commits into from
Jan 26, 2021

Conversation

spookyvision
Copy link
Contributor

special-cased linker section names to satisfy macos linker constraints

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jonas-schievink (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@jonas-schievink
Copy link
Contributor

If you rebase this on current master CI should pass. We should also add a new job here that just build without --target, since that should work after this PR:

run: cargo build --target=thumbv8m.main-none-eabihf --examples

@spookyvision
Copy link
Contributor Author

spookyvision commented Jan 26, 2021

If you rebase this on current master CI should pass.

unfortunately not, still getting language item required, but not found: 'eh_personality' for cargo build --examples. Adding panic = "abort" to [profile.dev] made this go away (and unearthed another broken link section name, which I've fixed with another commit in the meantime), but this is probably not the right way to go ahead?

with the temporary fix for eh_personality, remaining errors are:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/pre_init.41pb4842pbk6h8fj.rcgu.o" "-o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/pre_init" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps" "-L" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/build/cortex-m-rt-16e34855d1ab5756/out" "-L" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libpanic_halt-fa926b5489e34768.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libcortex_m_rt-9ecd0db86bd21c1b.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-99bca6ace58141c5.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-72a66f4c97a4c0c8.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-e7cd9f0beed2fc0f.rlib"
  = note: ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

(several occurrences)

and

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.131k0j0eiyyppm1j.rcgu.o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.1856riucyqnr98i3.rcgu.o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.1kfksmat7ftapeni.rcgu.o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.2665blsxk9zbeyyd.rcgu.o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.2jskah2k0tfezcd0.rcgu.o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu.3kpzafbr7npkpxbu.rcgu.o" "-o" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/examples/qemu" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps" "-L" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/build/cortex-m-rt-16e34855d1ab5756/out" "-L" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libpanic_halt-fa926b5489e34768.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libcortex_m_semihosting-3fdbe42e3865b53f.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libcortex_m_rt-9ecd0db86bd21c1b.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libcortex_m-31c5941f301e80db.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libembedded_hal-c1582eeb3909021d.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libvoid-da898260d610f50d.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libnb-8d47a613bc85f978.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libnb-4367aac38fcdfd15.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libvolatile_register-a6bee15977cbed10.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libvcell-d9c3ff73f19dce6e.rlib" "/Users/anatol.ulrich/work/cortex-m-rt/target/debug/deps/libbare_metal-130812a6caf1a5da.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-99bca6ace58141c5.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-72a66f4c97a4c0c8.rlib" "/Users/anatol.ulrich/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-e7cd9f0beed2fc0f.rlib"
  = note: Undefined symbols for architecture x86_64:
            "_memcpy", referenced from:
                core::fmt::Write::write_fmt::h2ba7f7f38cfa5045 in libcortex_m_semihosting-3fdbe42e3865b53f.rlib(cortex_m_semihosting-3fdbe42e3865b53f.cortex_m_semihosting.2d5joapa-cgu.0.rcgu.o)
                _$LT$$RF$mut$u20$W$u20$as$u20$core..fmt..Write$GT$::write_fmt::h5c55410df270d15d in libcortex_m_semihosting-3fdbe42e3865b53f.rlib(cortex_m_semihosting-3fdbe42e3865b53f.cortex_m_semihosting.2d5joapa-cgu.0.rcgu.o)
            "_memset", referenced from:
                core::fmt::Write::write_char::hc0a51b72bc1ae45b in libcortex_m_semihosting-3fdbe42e3865b53f.rlib(cortex_m_semihosting-3fdbe42e3865b53f.cortex_m_semihosting.2d5joapa-cgu.0.rcgu.o)
            "___nop", referenced from:
                cortex_m::asm::nop::h74dc3ed233ca0d95 in qemu.2665blsxk9zbeyyd.rcgu.o
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

@jonas-schievink
Copy link
Contributor

Oh, the examples won't build even on Linux. We should only test that the main cortex-m-rt crate builds (not links).

Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 26, 2021

@bors bors bot merged commit 4aee094 into rust-embedded:master Jan 26, 2021
bors bot added a commit that referenced this pull request Jan 27, 2021
310: Only emit link_section for cortex-m r=jonas-schievink a=adamgreig

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.

This keeps the fix from #306 but hopefully resolves the confusion in #74 (comment).

Co-authored-by: Adam Greig <adam@adamgreig.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants