Skip to content

xbuild ignores .cargo/config for sysroot crates. #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andre-richter opened this issue Jan 7, 2019 · 2 comments
Closed

xbuild ignores .cargo/config for sysroot crates. #27

andre-richter opened this issue Jan 7, 2019 · 2 comments

Comments

@andre-richter
Copy link
Member

Hi,

for the following description please refer to an example uploaded to https://github.com/rust-embedded/rust-raspi3-tutorial/tree/no_float/float_reg_emission

This example should be buildable with a recent nightly rust and just executing make.

The project uses the aarch64-unknown-none target, and has additional rustflags in .cargo/config. However, it seems that xbuild is ignoring the contents of .cargo/config when it builds the sysroot crates.

In the example uploaded, it is set that no hard-float code should be emitted (-fp-armv8). This is honored for the actual crate being compiled, but not for the sysroot.

Here's a dissasembly of the emitted code where you can see that with xbuild, an ARM floating point register (q0) is being emitted:

core::panicking::panic_fmt::h7472082024a4b065:
   80218:       20 00 c0 3d     ldr     q0, [x1]
   8021c:       28 08 40 f9     ldr     x8, [x1, #0x10]
   80220:       09 00 00 b0     adrp    x9, #0x1000
   80224:       0a 00 00 b0     adrp    x10, #0x1000
   80228:       29 a1 15 91     add     x9, x9, #0x568
   8022c:       4a a1 15 91     add     x10, x10, #0x568
   80230:       e9 2b bd a9     stp     x9, x10, [sp, #-0x30]!
   80234:       e0 0b 00 f9     str     x0, [sp, #0x10]
   80238:       e0 03 00 91     mov     x0, sp
   8023c:       e0 83 81 3c     stur    q0, [sp, #0x18]
   80240:       e8 17 00 f9     str     x8, [sp, #0x28]
   80244:       58 00 00 94     bl      #0x160 <rust_begin_unwind>
   80248:       20 00 20 d4     brk     #0x1

Using xargo within the same example, this doesn't happen:

xargo build --target=aarch64-unknown-none --release
cp target/aarch64-unknown-none/release/kernel8 .
make objdump

No float regs here:

core::panicking::panic_fmt::h4f28b4483e5ece01:
   80224:       08 00 00 b0     adrp    x8, #0x1000
   80228:       08 21 16 91     add     x8, x8, #0x588
   8022c:       e8 0f 1d f8     str     x8, [sp, #-0x30]!
   80230:       0a 00 00 b0     adrp    x10, #0x1000
   80234:       4a 21 16 91     add     x10, x10, #0x588
   80238:       28 24 40 a9     ldp     x8, x9, [x1]
   8023c:       ea 83 00 a9     stp     x10, x0, [sp, #0x8]
   80240:       e0 03 00 91     mov     x0, sp
   80244:       2a 2c 42 29     ldp     w10, w11, [x1, #0x10]
   80248:       e8 a7 01 a9     stp     x8, x9, [sp, #0x18]
   8024c:       ea 2f 05 29     stp     w10, w11, [sp, #0x28]
   80250:       59 00 00 94     bl      #0x164 <rust_begin_unwind>
   80254:       20 00 20 d4     brk     #0x1
@andre-richter andre-richter changed the title xbuild ignores .cargo/config xbuild ignores .cargo/config for sysroot crates. Jan 7, 2019
@andre-richter
Copy link
Member Author

I was on an older version of xbuild. The issue has already been detected and fixed via #25 👍

@phil-opp
Copy link
Member

phil-opp commented Jan 8, 2019

Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants