The successfully building RTEMS for i386 using LLVM/Clang

yangwei weiyang wei.a.yang at gmail.com
Wed Feb 22 14:21:54 UTC 2012


Hi all:
Now i have build RTEMS source code successfully for i386 with Clang
compiler. But there are still some problems to be fixed. As follow:

1.clang does not find the newlib header files by default (now modify
the clang code to fix it)
2.clang has problem to handle the "-B" option (it does not seach the
header file under the directory specified by option "-B", now add
CPPFLAGS to rtems configure system)
3.clang can handle the "-specs" option but you must with the format
"-specs=specs_file" instand of "-specs specs_file" by default.
4.clang does not preprocess score/cpu/i386/cpu_asm.S the same as gcc.
Generates incorrect code. http://llvm.org/bugs/show_bug.cgi?id=10298
5.There are maybe some bugs in the rtems configure system. when attach
the CC_FOR_TARGET, CC_FOR_BUILD flags to the cofigure command,
it will generate some config.status inside which will add CC="cross compiler"
to every subdir, but some subdir do not expect this CC, like in dir
i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/tools. it contains some
host code compiled by host compiler which should be auto detected,
if you add CC="cross compiler" it will failed.

The attachments are my configure log, build log and build script
1.c.log is configure log
2.b.log is my failed build log
3.c.log is my successful build log(when build failed i manually change
the CC flags in the i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/config.status).
4.build.sh is my build script.

Now about test case i only build sample test and also test all sample
test successfully, but i found that the size of these test excutable
file build by
clang is larger those build by gcc about 40%.

----------------------Build by Clang--------------------------------------------
-rwxr-xr-x 1 root root 2463720 Feb 21 14:11 base_sp.exe
-rwxr-xr-x 1 root root 2808686 Feb 21 14:11 capture.exe
-rwxr-xr-x 1 root root 4554964 Feb 21 14:10 fileio.exe
-rwxr-xr-x 1 root root 2256130 Feb 21 14:10 hello.exe
-rwxr-xr-x 1 root root 3303244 Feb 21 14:10 loopback.exe
-rwxr-xr-x 1 root root 1846542 Feb 21 14:10 minimum.exe
-rwxr-xr-x 1 root root 2492752 Feb 21 14:10 nsecs.exe
-rwxr-xr-x 1 root root 2546250 Feb 21 14:09 paranoia.exe
-rwxr-xr-x 1 root root 3946616 Feb 21 14:09 pppd.exe
-rwxr-xr-x 1 root root 2491988 Feb 21 14:08 ticker.exe
-rwxr-xr-x 1 root root 2478225 Feb 21 14:09 unlimited.exe

---------------------Build by i386-rtems-gcc-------------------------------
-rwxr-xr-x 1 root root 1366763 Feb 21 15:42 base_sp.exe
-rwxr-xr-x 1 root root 1645500 Feb 21 15:42 capture.exe
-rwxr-xr-x 1 root root 2854663 Feb 21 15:42 fileio.exe
-rwxr-xr-x 1 root root 1286709 Feb 21 15:42 hello.exe
-rwxr-xr-x 1 root root 2025570 Feb 21 15:42 loopback.exe
-rwxr-xr-x 1 root root 1157628 Feb 21 15:42 minimum.exe
-rwxr-xr-x 1 root root 1395591 Feb 21 15:42 nsecs.exe
-rwxr-xr-x 1 root root 1455086 Feb 21 15:42 paranoia.exe
-rwxr-xr-x 1 root root 2632300 Feb 21 15:42 pppd.exe
-rwxr-xr-x 1 root root 1393107 Feb 21 15:42 ticker.exe
-rwxr-xr-x 1 root root 1379450 Feb 21 15:42 unlimited.exe

-- 
Wei Yang
Best Regards

wei.a.yang at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c.log
Type: application/octet-stream
Size: 10102 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20120222/1f8a977f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.sh
Type: application/x-sh
Size: 418 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20120222/1f8a977f/attachment.sh>


More information about the users mailing list