<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi,</div><div><br></div><div>I'm trying to use clang toolchain to compile a c program to a wasm file.</div><div>I could type the following command step by step to get a correct wasm file:</div><div><font face="Times New Roman" size="3">
</font></div><p style="margin: 0in 0in 0pt;"><font face="Calibri" size="3">1.clang-8 main.c -S -emit-llvm --target=wasm32 -o
main.ll</font></p><div><font face="Times New Roman" size="3">
</font></div><p style="margin: 0in 0in 0pt;"><font face="Calibri" size="3">2.llvm-link-8 -o main.bc main.ll</font><font face="Times New Roman" size="3">
</font></p><p style="margin: 0in 0in 0pt;"><font face="Calibri" size="3">3.opt-8 -O3 main.bc -o main.bc</font><font face="Times New Roman" size="3">
</font></p><div><font face="Calibri" size="3">4.llc-8 -mtriple=wasm32-unknown-unknown -O3 -filetype=obj
main.bc -o main.o</font><font face="Times New Roman" size="3">
</font></div><div><font face="Times New Roman" size="3">
</font><font face="Times New Roman" size="3">
</font><font face="Calibri" size="3">5.wasm-ld-8 main.o -o test.wasm</font><font face="Times New Roman" size="3">
</font><font face="Calibri"><font size="3">--no-entry
--export-dynamic -allow-undefined --strip-all --lto-O3 </font></font><font face="Calibri"><font size="3">--initial-memory=131072 </font></font><font face="Calibri"><font size="3"><span style="mso-spacerun: yes;"> </span>--export=main</font></font></div><div><font face="Calibri" size="3">My question is:</font></div><div><font face="Calibri" size="3">I don't want to compile any libc functions with my wasm app together, and I want to squeeze above command into</font></div><div><font face="Calibri" size="3">one clang-8 command line. Are there any parameter for me to avoid using a "--sysroot" parameter? If so, can someone</font></div><div><font face="Calibri" size="3">give me a sample command line?</font></div><div><font face="Calibri" size="3"><br></font></div><div><font face="Calibri" size="3">Thanks.</font></div><div><font face="Times New Roman" size="3">
</font></div></div><br><br><span title="neteasefooter"><p> </p></span>