From b53262f0d50ff3004afdae254691a76a3acb4d1b Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Sun, 1 Oct 2006 21:17:07 +0000 Subject: [PATCH] * device/lib/gets.c: fixed bug 1568829,thanks Philipp Krause * device/lib/pic16/libc/string/memcpypgm2ram.c, * device/lib/pic16/libc/string/memcpyram2ram.c: fixed bug 1568836, thanks Philipp Krause * as/mcs51/asmain.c (asmbl, newdot): fixed problems with absolute areas * as/link/mcs51/lkmem.c (summary2): reverted, do do count abs segments git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4398 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 6 ++++++ as/link/mcs51/lkmem.c | 4 ++-- as/mcs51/asmain.c | 12 +++++++++--- device/lib/gets.c | 5 ++--- device/lib/pic16/libc/string/memcpypgm2ram.c | 17 ++++++++--------- device/lib/pic16/libc/string/memcpyram2ram.c | 17 ++++++++--------- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80e5d4cf..6fde20b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ * src/pic16/glue.c (pic16emitMaps), * src/pic/glue.c (pic14emitMaps): hopefully fixed bug 1568779 + * device/lib/gets.c: fixed bug 1568829,thanks Philipp Krause + * device/lib/pic16/libc/string/memcpypgm2ram.c, + * device/lib/pic16/libc/string/memcpyram2ram.c: fixed bug 1568836, thanks + Philipp Krause + * as/mcs51/asmain.c (asmbl, newdot): fixed problems with absolute areas + * as/link/mcs51/lkmem.c (summary2): reverted, do do count abs segments 2006-09-30 Jesus Calvino-Fraga diff --git a/as/link/mcs51/lkmem.c b/as/link/mcs51/lkmem.c index 140565f9..1769f8c9 100644 --- a/as/link/mcs51/lkmem.c +++ b/as/link/mcs51/lkmem.c @@ -435,7 +435,7 @@ int summary2(struct area * areap) xp=areap; while (xp) { - if((xp->a_flag & A_CODE) && !(xp->a_flag & A_ABS)) + if (xp->a_flag & A_CODE) { if(xp->a_size) { @@ -475,7 +475,7 @@ int summary2(struct area * areap) Paged.End = xp->a_addr + xp->a_size; } - else if((xp->a_flag & A_XDATA) && !(xp->a_flag & A_ABS)) + else if (xp->a_flag & A_XDATA) { if(xp->a_size) { diff --git a/as/mcs51/asmain.c b/as/mcs51/asmain.c index 0f40fe84..86d0da26 100644 --- a/as/mcs51/asmain.c +++ b/as/mcs51/asmain.c @@ -811,7 +811,7 @@ loop: lmode = SLIST; break; - case S_OPTSDCC: + case S_OPTSDCC: p = optsdcc; if ((c = getnb()) != 0) { do { @@ -836,7 +836,7 @@ loop: break; case S_DAREA: - getid(id, -1); + getid(id, -1); uaf = 0; uf = A_CON|A_REL; if ((c = getnb()) == '(') { @@ -875,6 +875,7 @@ loop: case S_ORG: if (dot.s_area->a_flag & A_ABS) { outall(); + dot.s_area->a_size += dot.s_addr - dot.s_org; laddr = dot.s_addr = dot.s_org = absexpr(); } else { err('o'); @@ -1135,7 +1136,8 @@ register struct area *nap; } } else if (oap->a_flag & A_ABS) { oap->a_addr = dot.s_org; - oap->a_size = dot.s_addr - dot.s_org; + oap->a_size += dot.s_addr - dot.s_org; + dot.s_addr = dot.s_org = 0; } else { oap->a_addr = 0; oap->a_size = dot.s_addr; @@ -1144,6 +1146,10 @@ register struct area *nap; // a new overlay starts at 0, no fuzz dot.s_addr = 0; fuzz = 0; + } else if (nap->a_flag & A_ABS) { + // a new absolute starts at org, no fuzz + dot.s_addr = dot.s_org; + fuzz = 0; } else { dot.s_addr = nap->a_size; fuzz = nap->a_fuzz; diff --git a/device/lib/gets.c b/device/lib/gets.c index 005a2a07..be5ee730 100755 --- a/device/lib/gets.c +++ b/device/lib/gets.c @@ -1,7 +1,6 @@ #include -char * gets(const char *str) { - char *s=str; +char * gets(char *s) { char c; unsigned int count=0; @@ -22,7 +21,7 @@ char * gets(const char *str) { putchar('\r'); putchar('\n'); *s=0; - return str; + return s; default: *s++=c; count++; diff --git a/device/lib/pic16/libc/string/memcpypgm2ram.c b/device/lib/pic16/libc/string/memcpypgm2ram.c index d4b0c49b..b27a881d 100644 --- a/device/lib/pic16/libc/string/memcpypgm2ram.c +++ b/device/lib/pic16/libc/string/memcpypgm2ram.c @@ -7,28 +7,27 @@ under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - + You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - + In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! + what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ #include -__data void *memcpypgm2ram (__data void *dst, void __code *src, size_t acount) +__data void *memcpypgm2ram (__data void *dst, __code void *src, size_t acount) { - void *ret = dst; /* perhaps ret should be removed, use dst instead */ char __data *d = dst; - char *s = src; - + char __code *s = src; + /* * copy from lower addresses to higher addresses */ @@ -36,5 +35,5 @@ __data void *memcpypgm2ram (__data void *dst, void __code *src, size_t acount) *d++ = *s++; } - return(ret); + return(dst); } diff --git a/device/lib/pic16/libc/string/memcpyram2ram.c b/device/lib/pic16/libc/string/memcpyram2ram.c index 1335a5c1..c237e438 100644 --- a/device/lib/pic16/libc/string/memcpyram2ram.c +++ b/device/lib/pic16/libc/string/memcpyram2ram.c @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------- - memcpypgm2ram.c - part of string library functions + memcpyram2ram.c - part of string library functions Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999) @@ -7,28 +7,27 @@ under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - + You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - + In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! + what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ #include -__data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount) +__data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount) { - void __data *ret = dst; /* perhaps ret should be removed, use dst instead */ char __data *d = dst; char __data *s = src; - + /* * copy from lower addresses to higher addresses */ @@ -36,5 +35,5 @@ __data void *memcpyram2ram (__data void *dst, __data void *src, size_t acount) *d++ = *s++; } - return(ret); + return(dst); } -- 2.30.2