[PATCH] 'add symbol' feature in objcopy

Ronald Hoogenboom hoogenboom30@zonnet.nl
Tue Nov 3 22:08:00 GMT 2015


On 11/03/2015 02:03 PM, Qian Hong wrote:
> Hi Ronald,
>
> Thanks a lot for your work, it is a nice feature.
>
> I tried latest cross compile binutils using mingw-w64-i686-gcc, and
> found these warnings (-Werror):
>
> objcopy.c: In function ‘parse_symflags’:
> objcopy.c:792:7: error: implicit declaration of function ‘strndup’
> [-Werror=implicit-function-declaration]
>         PARSE_OTHER ("before=", *other);
>         ^
> objcopy.c:774:9: error: incompatible implicit declaration of built-in
> function ‘strndup’ [-Werror]
>    fval = strndup (s + sizeof fname - 1, len - sizeof fname + 1)
>           ^
> objcopy.c:792:7: note: in expansion of macro ‘PARSE_OTHER’
>         PARSE_OTHER ("before=", *other);
>         ^
> objcopy.c: In function ‘copy_main’:
> objcopy.c:4085:23: error: incompatible implicit declaration of
> built-in function ‘strndup’ [-Werror]
>        newsym->symdef = strndup (optarg, s - optarg);
>                         ^
> cc1: all warnings being treated as errors
> Makefile:939: recipe for target 'objcopy.o' failed
> make[4]: *** [objcopy.o] Error 1
>
> Would you mind have a look? Thanks!
Apparently, the strndup function is not 'portable' enough for mingw-w64. 
There seems to be a xstrndup function in libiberty that could be used 
instead. I'm sorry I don't have all the possible compilers handy to 
verify all possible targets, but this should do.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objcopy.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20151103/dd1f24e1/attachment.bin>


More information about the Binutils mailing list