Re: [rust-dev] How do I pass -march down to llvm from rustc?
You are right in that the __morestack function is a requirement from enabling segmented stacks in LLVM. While we no longer use truly segmented stacks, we still use the segmented stack prologue in order to detect stack overflow. This is a crucial piece of infrastructure for rust code used to ensure safety. It's difficult to provide a __morestack implementation for all platforms, however (as you've discovered), and we're thinking of possibly adding an option to disable split stacks globally (the function prologue), or moving to an alternative scheme which requires fewer runtime dependencies. On Sun, Mar 23, 2014 at 11:48 AM, Vladimir Pouzanov wrote: > Thanks for links to bugs. > > Is there anything to read on the whole morestack thing? I thought that it's > connected to segmented stacks that are (are they?) going away. > > It seems that I can use #[no_split_stack] before each and every function to > generate a valid freestanding binary. If I just could use that in header... > > > On Sun, Mar 23, 2014 at 6:24 PM, Corey Richardson wrote: >> >> 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 >> 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 >> > 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 >> >> >> >> 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_ >> >>> D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E >> >>> 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E >> >>> r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E >> >>> 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E >> >>> 0078 t _ZN4main10__rust_abiE >> >>> t _ZN4wait20h53ffb23463e08f19Maa4v0.0E >> >>> U __aeabi_unwind_cpp_pr0 >> >>> U __morestack >> >>> 004c T main >> >>> >> >>> vs. >> >>> >> >>> D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E >> >>> 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 >> >>> 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 >> >> 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,
Re: [rust-dev] How do I pass -march down to llvm from rustc?
Thanks for links to bugs. Is there anything to read on the whole morestack thing? I thought that it's connected to segmented stacks that are (are they?) going away. It seems that I can use #[no_split_stack] before each and every function to generate a valid freestanding binary. If I just could use that in header... On Sun, Mar 23, 2014 at 6:24 PM, Corey Richardson wrote: > 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 > 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 > > 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 > > >> 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_ > >>> D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E > >>> 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E > >>> r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E > >>> 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E > >>> 0078 t _ZN4main10__rust_abiE > >>> t _ZN4wait20h53ffb23463e08f19Maa4v0.0E > >>> U __aeabi_unwind_cpp_pr0 > >>> U __morestack > >>> 004c T main > >>> > >>> vs. > >>> > >>> D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E > >>> 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 > 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.ne
Re: [rust-dev] How do I pass -march down to llvm from rustc?
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 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 > 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 >> 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_ >>> D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E >>> 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E >>> r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E >>> 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E >>> 0078 t _ZN4main10__rust_abiE >>> t _ZN4wait20h53ffb23463e08f19Maa4v0.0E >>> U __aeabi_unwind_cpp_pr0 >>> U __morestack >>> 004c T main >>> >>> vs. >>> >>> D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E >>> 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 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 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
Re: [rust-dev] How do I pass -march down to llvm from rustc?
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 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 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_ >> D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E >> 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E >> r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E >> 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E >> 0078 t _ZN4main10__rust_abiE >> t _ZN4wait20h53ffb23463e08f19Maa4v0.0E >> U __aeabi_unwind_cpp_pr0 >> U __morestack >> 004c T main >> >> vs. >> >> D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E >> 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 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 >>> 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
Re: [rust-dev] How do I pass -march down to llvm from rustc?
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 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_ > D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E > 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E > r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E > 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E > 0078 t _ZN4main10__rust_abiE > t _ZN4wait20h53ffb23463e08f19Maa4v0.0E > U __aeabi_unwind_cpp_pr0 > U __morestack > 004c T main > > vs. > > D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E > 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 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 >> 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/ ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
Re: [rust-dev] How do I pass -march down to llvm from rustc?
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_ D _ZN20_rust_crate_map_main16ad67637f924a5c794v0.0E 0008 r _ZN2hw11GPIO_PIN_NO20hb0b70c1482b61788Gaa4v0.0E r _ZN2hw12GPIO_DIR_REG20hb0b70c1482b61788yaa4v0.0E 0004 r _ZN2hw12GPIO_REG_VAL20hb0b70c1482b61788Caa4v0.0E 0078 t _ZN4main10__rust_abiE t _ZN4wait20h53ffb23463e08f19Maa4v0.0E U __aeabi_unwind_cpp_pr0 U __morestack 004c T main vs. D _ZN23_rust_crate_map_main.c016ad67637f924a5c794v0.0E 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 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 > 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/ ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
Re: [rust-dev] How do I pass -march down to llvm from rustc?
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 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 > ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev