On Windows objcopy fails to split debug info with --only-keep-debug when this debug information is bigger than 2 GB.
This is because of the following code in bfd_malloc():
if (size != sz
/* This is to pacify memory checkers like valgrind. */
|| ((signed long) sz) < 0)
On mingw32 target sizeof(long) is 4 bytes which makes < 0 condition invalid.
The master branch has been updated by Alan Modra <email@example.com>:
Author: Alan Modra <firstname.lastname@example.org>
Date: Fri Dec 28 09:34:28 2018 +1030
PR23966, mingw failure due to 32-bit long
* libbfd.c (SSIZE_MAX): Define.
(bfd_malloc, bfd_realloc): Don't cast size to long to check for
"negative" values, compare against SSIZE_MAX instead.
The bfd_malloc bug is now fixed.