No. See https://github.com/mozilla/rust/pull/8955 and
https://github.com/mozilla/rust/issues/11871 for discussion. You can
stub out
morestack but that won't remove the stack size checks. It's sanest to
just compile the IR yourself (the stack checking is a target-specific
machine pass, which is why it shows up with --emit asm but not --emit
bc)

On Sun, Mar 23, 2014 at 2:09 PM, Vladimir Pouzanov <farcal...@gmail.com> wrote:
> So it doesn't work in the end.
>
> rustc --emit bc with flags set for cortex-m0 provides exact same bc with
> only difference in target triple (which makes perfect sense)
>
> However, replacing llc step with rustc --emit asm provides a different
> assembler file, which requires __morestack.
>
> Should I expect rustc to generate freestanding code given some additional
> options?
>
>
> On Sun, Mar 23, 2014 at 5:55 PM, Vladimir Pouzanov <farcal...@gmail.com>
> wrote:
>>
>> Nevermind, I lost -O somewhere in between copying and pasting command line
>> flags. Optimised version doesn't have any morestack references (which is
>> strange concept though).
>>
>>
>> On Sun, Mar 23, 2014 at 5:44 PM, Vladimir Pouzanov <farcal...@gmail.com>
>> wrote:
>>>
>>> Figured out I can use --target thumbv6m-linux-eabi, which implies
>>> -mthumb. Now the problem is that if I use
>>>
>>> rustc --target thumbv6m-linux-eabi -O --emit obj main.rs -o main.o
>>>
>>> instead of three-step process I mentioned before, I get a valid object
>>> file for cortex-m0, but functions have big prologues and symbol table is
>>> much bigger:
>>>
>>>          U STACK_LIMIT
>>>          U _GLOBAL_OFFSET_TABLE_
>>> 00000000 D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E
>>> 00000008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E
>>> 00000000 r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E
>>> 00000004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E
>>> 00000078 t _ZN4main10__rust_abiE
>>> 00000000 t _ZN4wait20h53ffb23463e08f19Maa4v0.0E
>>>          U __aeabi_unwind_cpp_pr0
>>>          U __morestack
>>> 0000004c T main
>>>
>>> vs.
>>>
>>> 00000000 D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E
>>> 00000000 T main
>>>
>>> in the initial version. Also, I now need to provide __morestack (no idea
>>> what's that about).
>>>
>>>
>>> On Sun, Mar 23, 2014 at 5:17 PM, Alex Crichton <a...@crichton.co> wrote:
>>>>
>>>> You should be able to assemble standalone objects for any triple
>>>> through rustc itself, you'll likely have to specify a different linker
>>>> or assembler though:
>>>>
>>>>     rustc foo.rs --target arm-non-linux-gnueabi \
>>>>         -C linker=arm-non-linux-gnueabi-ld \
>>>>         -C ar=arm-non-linux-gnueabi-ar
>>>>
>>>> As you discovered, you can pass through arguments to LLVM via the "-C
>>>> llvm-args=foo" command line option to rustc. If you get complaints
>>>> that it's an unknown command line argument, it's LLVM telling you
>>>> those complaints, not rustc.
>>>>
>>>> On Sun, Mar 23, 2014 at 8:54 AM, Vladimir Pouzanov <farcal...@gmail.com>
>>>> wrote:
>>>> > I'm trying to experiment with rust and some embedded code. Currently I
>>>> > have
>>>> > to do a three-pass compilation:
>>>> >
>>>> > rustc --target arm-linux-eabi -O --emit bc main.rs -o main.bc
>>>> > llc -mtriple arm-none-eabi -march=thumb -mcpu=cortex-m0 main.bc -o
>>>> > main.s
>>>> > arm-none-linux-gnueabi-as main.s -o main.o
>>>> >
>>>> > First, I'm not sure how relevant is --target flag for rustc. I seems
>>>> > to
>>>> > change target datalayout/triple in generated bc, but that should be
>>>> > overriden by llc -mtriple anyway, right?
>>>> >
>>>> > Second, I can pass -Ctarget-cpu=cortex-m0, but I cannot pass down
>>>> > -march=thumb, tried this way: -Cllvm-args='--march=thumb', failed with
>>>> > "rustc: Unknown command line argument '--march=thumb'".
>>>> >
>>>> > Any hints on how can I drop explicit llc and as steps here?
>>>> >
>>>> > --
>>>> > Sincerely,
>>>> > Vladimir "Farcaller" Pouzanov
>>>> > http://farcaller.net/
>>>> >
>>>> > _______________________________________________
>>>> > Rust-dev mailing list
>>>> > Rust-dev@mozilla.org
>>>> > https://mail.mozilla.org/listinfo/rust-dev
>>>> >
>>>
>>>
>>>
>>>
>>> --
>>> Sincerely,
>>> Vladimir "Farcaller" Pouzanov
>>> http://farcaller.net/
>>
>>
>>
>>
>> --
>> Sincerely,
>> Vladimir "Farcaller" Pouzanov
>> http://farcaller.net/
>
>
>
>
> --
> Sincerely,
> Vladimir "Farcaller" Pouzanov
> http://farcaller.net/
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>



-- 
http://octayn.net/
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to