Hi all:<br>Now i have build RTEMS source code successfully for i386 with Clang compiler. But there are still<br>some problems to be fixed. As follow:<br><br>1.clang does not find the newlib header files by default (now modify the clang code to fix it)<br>
2.clang has problem to handle the "-B" option (it does not seach the header file under the directory <br>   specified by option "-B", now add CPPFLAGS to rtems configure system)<br>3.clang can handle the "-specs" option but you must with the <br>
  format "-specs=specs_file" instand of "-specs specs_file" by default.<br>4.clang does not preprocess score/cpu/i386/cpu_asm.S the same as gcc. Generates incorrect code. <br>  <a href="http://llvm.org/bugs/show_bug.cgi?id=10298">http://llvm.org/bugs/show_bug.cgi?id=10298</a><br>
5.There are maybe some bugs in the rtems configure system. when attach the <br>  CC_FOR_TARGET,CC_FOR_BUILD flags to the cofigure command, it will generate <br>  some config.status inside which will add CC="cross compiler" to every subdir,<br>
  but some subdir do not expect this CC, like in dir i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/tools<br>  it contains some host code compiled by host compiler which should be auto detected, if <br>  you add CC="cross compiler" it will failed.<br>
  <br>The attachments are my configure log, build log and build script<br>1.c.log is configure log <br>2.b.log is my failed build log<br>3.c.log is my successful build log(when build failed i manually change the CC flags in the <br>
  i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/config.status).<br><a href="http://4.build.sh">4.build.sh</a> is my build script.<br><br>Now about test case i only build sample test and also test all sample test successfully, <br>
but i found that the size of these test excutable file build by clang is larger those build by gcc about 40%. <br><br>----------------------Build by Clang--------------------------------------------<br>-rwxr-xr-x 1 root root 2463720 Feb 21 14:11 base_sp.exe<br>
-rwxr-xr-x 1 root root 2808686 Feb 21 14:11 capture.exe<br>-rwxr-xr-x 1 root root 4554964 Feb 21 14:10 fileio.exe<br>-rwxr-xr-x 1 root root 2256130 Feb 21 14:10 hello.exe<br>-rwxr-xr-x 1 root root 3303244 Feb 21 14:10 loopback.exe<br>
-rwxr-xr-x 1 root root 1846542 Feb 21 14:10 minimum.exe<br>-rwxr-xr-x 1 root root 2492752 Feb 21 14:10 nsecs.exe<br>-rwxr-xr-x 1 root root 2546250 Feb 21 14:09 paranoia.exe<br>-rwxr-xr-x 1 root root 3946616 Feb 21 14:09 pppd.exe<br>
-rwxr-xr-x 1 root root 2491988 Feb 21 14:08 ticker.exe<br>-rwxr-xr-x 1 root root 2478225 Feb 21 14:09 unlimited.exe<br><br>---------------------Build by i386-rtems-gcc-------------------------------<br>-rwxr-xr-x 1 root root 1366763 Feb 21 15:42 base_sp.exe<br>
-rwxr-xr-x 1 root root 1645500 Feb 21 15:42 capture.exe<br>-rwxr-xr-x 1 root root 2854663 Feb 21 15:42 fileio.exe<br>-rwxr-xr-x 1 root root 1286709 Feb 21 15:42 hello.exe<br>-rwxr-xr-x 1 root root 2025570 Feb 21 15:42 loopback.exe<br>
-rwxr-xr-x 1 root root 1157628 Feb 21 15:42 minimum.exe<br>-rwxr-xr-x 1 root root 1395591 Feb 21 15:42 nsecs.exe<br>-rwxr-xr-x 1 root root 1455086 Feb 21 15:42 paranoia.exe<br>-rwxr-xr-x 1 root root 2632300 Feb 21 15:42 pppd.exe<br>
-rwxr-xr-x 1 root root 1393107 Feb 21 15:42 ticker.exe<br>-rwxr-xr-x 1 root root 1379450 Feb 21 15:42 unlimited.exe<br><br>WeiY<br>Best Regards<br><br><div class="gmail_quote">2012/2/19 yangwei weiyang <span dir="ltr"><<a href="mailto:wei.a.yang@gmail.com">wei.a.yang@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all: <br>     When i build Rtems using Clang there is a problem i encounter. It seems that it is related with configuration which can not probe the right CC.<br>
My configure command is :<br>----------------------------------------------------------------------------------------------------------------------------------------------------<br>
CPU=i386<br>../rtems/configure --target=${CPU}-rtems4.11 --with-newlib \<br>  --prefix=/sdb1/rtems-llvm/rtems-install \<br>  CC_FOR_BUILD="clang " \<br>  CC_FOR_TARGET="clang -ccc-host-triple ${CPU}-rtems4.11 -ccc-gcc-name ${CPU}-rtems4.11-gcc "<br>

-----------------------------------------------------------------------------------------------------------------------------------------------------<br>And it is OK, configure log is attached (named c.log)<br>Then i make RTEMS_BSP="pc386", it will failed when execut c/src/lib/libbsp/i386/pc386/tools/configure. I see the c/src/lib/libbsp/i386/pc386/tools/config.log<br>

, when it check the build i686-pc-linux-gnu-gcc it using CC_FOR_TARGET. So this is absolutely wrong.<br>I also attached make log (named b.log) and c/src/lib/libbsp/i386/pc386/tools/config.log.<br><br>Wenjie<br>Best Regards<br>

<br><br><span><span></span> </span><div><img src="http://images/cleardot.gif" alt=""></div>
</blockquote></div><br>