I use the cygwin to build the binutils for my platform. I followed the GCC-Cross-Compiler article and stack on 'make' command. The command i used:
export PREFIX="$HOME/opt/cross"
../binutils-2.42/configure --target=amd64 --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make CFLAGS="-march=x86-64-v2" && make install
on the 'make' command it thrown me following errors:
../../binutils-2.42/libiberty/pex-unix.c:259:14: warning: implicit declaration of function ‘wait’; did you mean ‘cwait’? [-Wimplicit-function-declaration]
259 | cpid = wait (status);
| ^~~~
| cwait
../../binutils-2.42/libiberty/pex-unix.c: In function ‘save_and_install_fd’:
../../binutils-2.42/libiberty/pex-unix.c:385:11: warning: implicit declaration of function ‘fcntl’ [-Wimplicit-function-declaration]
385 | flags = fcntl (old_fd, F_GETFD);
| ^~~~~
../../binutils-2.42/libiberty/pex-unix.c:385:26: error: ‘F_GETFD’ undeclared (first use in this function)
385 | flags = fcntl (old_fd, F_GETFD);
| ^~~~~~~
../../binutils-2.42/libiberty/pex-unix.c:385:26: note: each undeclared identifier is reported only once for each function it appears in
../../binutils-2.42/libiberty/pex-unix.c:398:20: error: ‘FD_CLOEXEC’ undeclared (first use in this function)
398 | if ((flags & FD_CLOEXEC) == 0 && fcntl (old_fd, F_SETFD, FD_CLOEXEC) < 0)
| ^~~~~~~~~~
../../binutils-2.42/libiberty/pex-unix.c:398:55: error: ‘F_SETFD’ undeclared (first use in this function)
398 | if ((flags & FD_CLOEXEC) == 0 && fcntl (old_fd, F_SETFD, FD_CLOEXEC) < 0)
| ^~~~~~~
../../binutils-2.42/libiberty/pex-unix.c:411:31: error: ‘F_DUPFD’ undeclared (first use in this function)
411 | new_fd = fcntl (old_fd, F_DUPFD, 3);
| ^~~~~~~
../../binutils-2.42/libiberty/pex-unix.c: In function ‘restore_fd’:
../../binutils-2.42/libiberty/pex-unix.c:445:19: error: ‘FD_CLOEXEC’ undeclared (first use in this function)
445 | if (flags & FD_CLOEXEC)
| ^~~~~~~~~~
../../binutils-2.42/libiberty/pex-unix.c:447:29: error: ‘F_SETFD’ undeclared (first use in this function)
447 | return fcntl (old_fd, F_SETFD, flags);
(There is much more but i think no sense to put all)
Tryed to some adjust compilation flags, tryed without removed -march=x86_64-v2 specification.