Hi all,
I was able to do this using msys2 but only with the resulting binaries linking to the msys-2.0.dll rather than msvcrt.dll. When trying to link to Microsoft runtime I got problems in libiberty, pex-win32.c can't find _open, _pipe etc. I also building in msys but the version of bison it has seemed too old. I needed to do a couple of patches. In sim/riscv/sim-main.c I changd CLOCK_BOOTTIME to CLOCK_MONOTONIC and I removed a use of __int128. (I think these issue may have since been fixed.) My goal in doing this was to get gcc that runs on windows to compile for a bare metal riscv core, this worked, and to get gdb running on windows for this core, I have only tested this runs. I would be interested in knowing about building this against the msvcrt.dll and if I have done anything odd.
I did this a little while ago so things may have changed.
bhorgan@UST19 MINGW64 /c/riscv/riscv-binutils-gdb (riscv-binutils-2.26)
$ git log
commit 7a54f96685d29b5d8713a07e10106131aa4650b0
Author: Tim Newsome <
t...@sifive.com>
Date: Thu Jul 28 14:43:53 2016 -0700
bhorgan@UST19 MINGW64 /c/riscv/riscv-newlib (master)
$ git log
commit 77f0072999addb5d5b5c551baec21565aaf3a9e0
Author: Palmer Dabbelt <
pal...@dabbelt.com>
Date: Fri Aug 12 11:13:18 2016 -0700
bhorgan@UST19 MINGW64 /c/riscv/riscv-gcc (riscv-gcc-6.1.0)
$ git log
commit e90d8dc6f429856510a51371d21dacd97ef68d41
Author: Andrew Waterman <
wate...@cs.berkeley.edu>
Date: Mon Sep 12 11:56:36 2016 -0700
My steps:
Env:
$ export TARGET=riscv32-unknown-elf
$ export PREFIX=/c/riscv/$TARGET
$ export PATH=$PATH:$PREFIX/bin
binutils:
$ ./configure --target=$TARGET --prefix=$PREFIX --disable-werror --build=x86_64-pc-msys2
$ make all
$ make install
gcc first pass:
$ ../riscv-gcc/configure --build=x86_64-pc-msys2 --target=$TARGET --enable-werror=no --disable-nls --prefix=$PREFIX --without-headers --with-newlib --with-gnu-as --with-gnu-ld --enable-languages=c
$ make all-gcc
$ make install-gcc
newlib:
$ touch ../riscv-newlib/libgloss/riscv/memory.h # Is this a good idea?
$ ../riscv-newlib/configure --disable-werror --build=x86_64-pc-msys2 --target=$TARGET --prefix=$PREFIX --disable-multilib
$ make all
$ make install
gcc again:
$ rm -rf *
$ ../riscv-gcc/configure --build=x86_64-pc-msys2 --target=$TARGET --enable-werror=no --disable-nls --prefix=$PREFIX --with-newlib --with-gnu-as --with-gnu-ld --disable-shared --disable-libssp --disable-multilib --enable-languages=c
$ make all
$ make install
Cheers
Ben
To view this discussion on the web visit
https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/222553867.194758.1478112702444%40webmail.strato.com.