Build issue with macOS clang
I'm trying to build adtools on macOS Mojave, and this warning causes the compilation to fail:
/Users/bszili/Documents/adtools/binutils/repo/bfd/elflink.c:4975:45: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] return (struct elf_link_hash_entry *) 0 - 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /Users/bszili/Documents/adtools/binutils/repo/bfd/elflink.c:5087:46: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] if (h == (struct elf_link_hash_entry *) 0 - 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ 2 errors generated.
The compiler is: Apple LLVM version 10.0.0 (clang-1000.10.44.4)
I ran into the same thing. What's missing here is --disable-werror in the configure flags for binutils. With this, building binutils on macOS works fine.
The reason for this is that Clang has much more warnings than GCC, and binutils by default turns them into errors.