1) enter the musl's source code cd /home/jjj/test/musl/ 2) pull the newest codes git pull origin master 3) export some toolchains export PATH=$PATH:/home/jjj/9tripod/android_exynos4412_ics_rtm_v10/prebuilt/linux-x86/toolchain/arm-2009q3/bin/ 4) configure musl to arm target CC=arm-none-linux-gnueabi-gcc ./configure --target=arm --prefix=/home/jjj/test/musl/usr/local/musl/ 5) compiler musl and install make make install 6) export REALGCC to arm linux toolchains export REALGCC=arm-none-linux-gnueabi-gcc 7) write test cases and save to test.c #include #include int main(int argc, char ** argv) { double n = 0.0; int i; for(i = 0; i < 20; i++) { n = n - 0.125; printf("ceil(%f) = %f, floor(%f) = %f, round(%f) = %f\n", n, ceil(n), n, floor(n), n, round(n)); } return 0; } 8) compile test cases ./tools/musl-gcc test.c -o test -static 9) file test, will showing: test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped file test 10) running test case using qemu-arm qemu-arm test 11) result... ceil(-0.125000) = -0.000000, floor(-0.125000) = -1.000000, round(-0.125000) = -0.000000 ceil(-0.250000) = -0.000000, floor(-0.250000) = -1.000000, round(-0.250000) = -0.000000 ceil(-0.375000) = -0.000000, floor(-0.375000) = -1.000000, round(-0.375000) = -0.000000 ceil(-0.500000) = -0.000000, floor(-0.500000) = -1.000000, round(-0.500000) = -1.000000 ceil(-0.625000) = -0.000000, floor(-0.625000) = -1.000000, round(-0.625000) = -1.000000 ceil(-0.750000) = -0.000000, floor(-0.750000) = -1.000000, round(-0.750000) = -1.000000 ceil(-0.875000) = -0.000000, floor(-0.875000) = -1.000000, round(-0.875000) = -1.000000 ceil(-1.000000) = -1.000000, floor(-1.000000) = -1.000000, round(-1.000000) = -1.000000 ceil(-1.125000) = -1.000000, floor(-1.125000) = -2.000000, round(-1.125000) = -1.000000 ceil(-1.250000) = -1.000000, floor(-1.250000) = -2.000000, round(-1.250000) = -1.000000 ceil(-1.375000) = -1.000000, floor(-1.375000) = -2.000000, round(-1.375000) = -1.000000 ceil(-1.500000) = -1.000000, floor(-1.500000) = -2.000000, round(-1.500000) = -2.000000 ceil(-1.625000) = -1.000000, floor(-1.625000) = -2.000000, round(-1.625000) = -2.000000 ceil(-1.750000) = -1.000000, floor(-1.750000) = -2.000000, round(-1.750000) = -2.000000 ceil(-1.875000) = -1.000000, floor(-1.875000) = -2.000000, round(-1.875000) = -2.000000 ceil(-2.000000) = -2.000000, floor(-2.000000) = -2.000000, round(-2.000000) = -2.000000 ceil(-2.125000) = -2.000000, floor(-2.125000) = -3.000000, round(-2.125000) = -2.000000 ceil(-2.250000) = -2.000000, floor(-2.250000) = -3.000000, round(-2.250000) = -2.000000 ceil(-2.375000) = -2.000000, floor(-2.375000) = -3.000000, round(-2.375000) = -2.000000 ceil(-2.500000) = -2.000000, floor(-2.500000) = -3.000000, round(-2.500000) = -3.000000 Using qemu-arm, the result is correct. we will test in real hardware and review result, and find bug somewhere ‍ ------------------ ____________________________ 蒋建军 深圳市九鼎创展科技有限公司 地址:深圳市宝安区西乡街道宝源路宝安互联网产业基地A区7栋301 邮编:518101 手机:18665386306 电邮:8192542@qq.com 网站:http://www.9tripod.com 论坛:http://xboot.org ------------------ 原始邮件 ------------------ 发件人: "Rich Felker";; 发送时间: 2014年10月14日(星期二) 中午11:03 收件人: "bobodog"<8192542@qq.com>; 抄送: "musl"; 主题: Re: [musl] 回复: [musl ] [math] The math library have some bugforceil,floor,round functioin, in arm mode On Tue, Oct 14, 2014 at 10:51:58AM +0800, bobodog wrote: > Test it in qemu-system-arm, with soft fp, realview-pb-a8 platform‍ > > we porting musl to our project, and just write test functions to > test cases, i don't kown, how to test musl in origin test cases. Can you show a complete test program with correct prototypes for printf, ceil, floor, and round that exhibits the problem for you? Rich