Discussion:
[patch] add stpcpy, mempcpy and fix strcpy
LHB Jr
2011-10-23 19:11:13 UTC
Permalink
I was trying to build binutils and it couldn't find stpcpy or mempcpy
so I added them.

I also noticed that the entry for __builtin_strcpy referenced strcmpt
, which seemed wrong,
so I fixed that.

binutils will compile with this patch as long as Werror is disabled.

LHB

Index: cc/ccom/builtins.c
===================================================================
RCS file: /cvsroot/pcc/cc/ccom/builtins.c,v
retrieving revision 1.33
diff -r1.33 builtins.c
649a650
static TWORD mempcpyt[] = { VOID|PTR, VOID|PTR, SIZET, INT };
654a656
static TWORD stpcpyt[] = { CHAR|PTR, CHAR|PTR, INT };
672a675
{ "__builtin___mempcpy_chk", builtin_unimp, 4, mempcpyt, VOID|PTR },
708a712
{ "__builtin_mempcpy", builtin_unimp, 3, mempcpyt, VOID|PTR },
728c732,733
< { "__builtin_strcpy", builtin_unimp, 2, strcmpt, CHAR|PTR },
---
{ "__builtin_strcpy", builtin_unimp, 2, strcpyt, CHAR|PTR },
{ "__builtin_stpcpy", builtin_unimp, 2, stpcpyt, CHAR|PTR },
Iain Hibbert
2011-10-24 08:54:49 UTC
Permalink
I was trying to build binutils and it couldn't find stpcpy or mempcpy so I
added them.
I also noticed that the entry for __builtin_strcpy referenced strcmpt , which
seemed wrong,
so I fixed that.
binutils will compile with this patch as long as Werror is disabled.
Thanks - I added the changes, but slightly differently
Index: cc/ccom/builtins.c
===================================================================
RCS file: /cvsroot/pcc/cc/ccom/builtins.c,v
retrieving revision 1.33
diff -r1.33 builtins.c
649a650
static TWORD mempcpyt[] = { VOID|PTR, VOID|PTR, SIZET, INT };
did not add this (same as memcpyt)
654a656
static TWORD stpcpyt[] = { CHAR|PTR, CHAR|PTR, INT };
nor this (same as strcpyt)
672a675
{ "__builtin___mempcpy_chk", builtin_unimp, 4, mempcpyt, VOID|PTR },
708a712
{ "__builtin_mempcpy", builtin_unimp, 3, mempcpyt, VOID|PTR },
added these (using memcpyt)
728c732,733
< { "__builtin_strcpy", builtin_unimp, 2, strcmpt, CHAR|PTR },
---
{ "__builtin_strcpy", builtin_unimp, 2, strcpyt, CHAR|PTR },
fixed that (it would have worked fine, but as you say.. bit strange :)
{ "__builtin_stpcpy", builtin_unimp, 2, stpcpyt, CHAR|PTR },
and added (using strcpyt)

regards,
iain

Loading...