On Sun, 2015-04-19 at 06:47 +1000, Alex Brown wrote: > Hi > > On Sun, Apr 19, 2015 at 4:01 AM, Oleg Endo <oleg.endo@xxxxxxxxxxx> wrote: > > Hi, > > > > How did you configure/build the toolchain that runs natively on SH? > > So excluding the bintutils and newlib builds, I built the toolchain as > follows (on OSX Yosemite): Somehow, my initial guess was that your host system is 64 bit ... > > (1) Build GCC 5 (rev 222001) on OSX > ../src/gcc-trunk/configure --prefix=/usr/local > > (2) Build cross compiler > ../src/gcc-trunk/configure -target=sh-elf --prefix=/usr/local/sh-elf/ > --with-gnu-as --with-gnu-ld --with-newlib --without-headers > --enable-languages=c,c++ --disable-nls --disable-libssp > --disable-libada --disable-libquadmath --disable-libgomp > > (3) Build native compiler > export PATH=/usr/local/sh-elf/bin:$PATH > ../src/gcc-trunk/configure --host=sh-elf --target=sh-elf > --prefix=/usr/local/sh-elf/ --with-gnu-as --with-gnu-ld --with-newlib > --without-headers --enable-languages=c --disable-nls --disable-libssp > --disable-libada --disable-libquadmath --disable-libgomp CFLAGS="-g > -m2e -pie" CXXFLAGS="-m2e -pie -fpermissive -g" --disable-libstdcxx > > There is a small step where the build seems to build some stuff using > the build machine's compiler and uses my passed in CXXFLAGS, so I > edited the Makefile post configure to resolve that: > > build-x86_64-apple-darwin14.3.0/libcpp/Makefile Probably this is the problem. When something picks up the wrong env settings during some sub-configure step, it's probably not sufficient to fix it up in the generated Makefile only. There have been some issues w.r.t. CFLAGS / CXXFLAGS and *FLAGS_FOR_TARGET etc usage in the configury stuff, maybe this is yet another one. In this case you might want to open a PR for that. Maybe the problem is also because your native SH compiler is built for SH2E, which always truncates doubles to floats. However, this is just a wild guess. You could confirm or refute this by building the native SH compiler for SH2 (-m2), which will use software FP for float and double. Note though that SH2 (-m2) and SH2E (-m2e) is not binary compatible due to FPU presence/absence. Cheers, Oleg