* as/link/aslink.h,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 14 Jul 2007 08:47:32 +0000 (08:47 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 14 Jul 2007 08:47:32 +0000 (08:47 +0000)
* as/link/hc08/lkihx.c,
* as/link/hc08/lkrloc.c,
* as/link/mcs51/lkihx.c,
* as/link/mcs51/lkrloc.c: renamed ihxEntendedLinearAddress to
  ihxExtendedLinearAddress
* as/link/mcs51/lkrloc.c (relr),
* as/mcs51/asout.c (outr11, outr19): handle absolute destination for
  acall/ajmp, see bug 830513

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4884 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
as/link/aslink.h
as/link/hc08/lkihx.c
as/link/hc08/lkrloc.c
as/link/mcs51/lkihx.c
as/link/mcs51/lkrloc.c
as/mcs51/asout.c

index 7b4a91e46d45c03ca6d0e3ba7677c957ccabbb7f..4f3f450588b0e51c22b39d9667a347b833758922 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-07-14 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * as/link/aslink.h,
+       * as/link/hc08/lkihx.c,
+       * as/link/hc08/lkrloc.c,
+       * as/link/mcs51/lkihx.c,
+       * as/link/mcs51/lkrloc.c: renamed ihxEntendedLinearAddress to
+         ihxExtendedLinearAddress
+       * as/link/mcs51/lkrloc.c (relr),
+       * as/mcs51/asout.c (outr11, outr19): handle absolute destination for
+         acall/ajmp, see bug 830513
+
 2007-07-13 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/SDCCcse.c (replaceAllSymBySym): renamed siaddr to isaddr,
index 086a7e11db91fadc9997e1eb22d8d62c04391322..15d6e0f9b5f10cc93e01f1e32d1afff3a3d5fa0c 100644 (file)
@@ -808,7 +808,7 @@ extern  VOID            s19();
 
 /* lkihx.c */
 extern  VOID            ihx();
-extern  VOID            ihxEntendedLinearAddress(Addr_T);
+extern  VOID            ihxExtendedLinearAddress(Addr_T);
 extern  VOID            ihxNewArea();
 
 /* lkstore.c */
index ff75e93174e2e4718aea1dec92856c34d513318f..824e41529ea5b8f2f31724b9e0e3e68ebce9d1a6 100644 (file)
@@ -22,7 +22,7 @@
  *     lkihx.c contains the following functions:
  *             VOID    hexRecord(addr, rtvalIndex)
  *             VOID    ihx(i)
- *             VOID    ihxEntendedLinearAddress(a)
+ *             VOID    ihxExtendedLinearAddress(a)
  *
  *     local variables: hexPageOverrun, lastHexAddr
  */
@@ -113,7 +113,7 @@ unsigned int lastHexAddr = 0;
  *
  *     functions called:
  *             int     fprintf()       c_library
- *             ihxEntendedLinearAddress()      lkihx.c
+ *             ihxExtendedLinearAddress()      lkihx.c
  *             hexRecord()             lkihx.c         (recursion)
  *
  *     side effects:
@@ -138,7 +138,7 @@ hexRecord(unsigned addr, int rtvalIndex)
 
        if (lastHexAddr > addr) {
                overrun = hexPageOverrun + 1;
-               ihxEntendedLinearAddress(lastExtendedAddress + overrun);
+               ihxExtendedLinearAddress(lastExtendedAddress + overrun);
                hexPageOverrun = overrun;
                hexRecord(addr, rtvalIndex);
                return;
@@ -156,7 +156,7 @@ hexRecord(unsigned addr, int rtvalIndex)
                                if (rflag) {
                                        fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
                                        overrun = hexPageOverrun + 1;
-                                       ihxEntendedLinearAddress(lastExtendedAddress + overrun);
+                                       ihxExtendedLinearAddress(lastExtendedAddress + overrun);
                                        hexPageOverrun = overrun;
                                        hexRecord(0, i + 1);
                                        return;
@@ -225,11 +225,11 @@ ihxNewArea()
        lastHexAddr = 0;
 }
 
-/*)Function    ihxEntendedLinearAddress(i)
+/*)Function    ihxExtendedLinearAddress(i)
  *
  *             Addr_T  i               16 bit extended linear address.
  *
- *     The function ihxEntendedLinearAddress() writes an extended
+ *     The function ihxExtendedLinearAddress() writes an extended
  *     linear address record (type 04) to the output file.
  *
  *     local variables:
@@ -246,7 +246,7 @@ ihxNewArea()
  *             hexPageOverrun and lastHexAddr is cleared
  */
 VOID
-ihxEntendedLinearAddress(Addr_T a)
+ihxExtendedLinearAddress(Addr_T a)
 {
     Addr_T     chksum;
   
index acd9ee992f5a313b0d684d567c9678a11e0c44d1..cfa15d1e74106273dc6452a922b29e80ae1c77ca 100644 (file)
@@ -549,7 +549,7 @@ VOID relr(VOID)
                    
                    if (rflag)
                    {
-                       ihxEntendedLinearAddress(extendedAddress);
+                       ihxExtendedLinearAddress(extendedAddress);
                    }
                    else if (extendedAddress)
                    {
index cc9c421896850d8f562086fe4854dd7cee6de053..415408fc47f964940c7a2074c6e724198ed7ddb5 100644 (file)
@@ -22,7 +22,7 @@
  *  lkihx.c contains the following functions:
  *      VOID    hexRecord(addr, rtvalIndex)
  *      VOID    ihx(i)
- *      VOID    ihxEntendedLinearAddress(a)
+ *      VOID    ihxExtendedLinearAddress(a)
  *
  *  local variables: hexPageOverrun, lastHexAddr
  */
@@ -113,7 +113,7 @@ unsigned int lastHexAddr = 0;
  *
  *  functions called:
  *      int     fprintf()           c_library
- *      ihxEntendedLinearAddress()  lkihx.c
+ *      ihxExtendedLinearAddress()  lkihx.c
  *      hexRecord()                 lkihx.c     (recursion)
  *
  *  side effects:
@@ -138,7 +138,7 @@ hexRecord(unsigned addr, int rtvalIndex)
 
     if ( (lastHexAddr > addr) && (rflag) ) {
         overrun = hexPageOverrun + 1;
-        ihxEntendedLinearAddress(lastExtendedAddress + overrun);
+        ihxExtendedLinearAddress(lastExtendedAddress + overrun);
         hexPageOverrun = overrun;
         hexRecord(addr, rtvalIndex);
         return;
@@ -155,7 +155,7 @@ hexRecord(unsigned addr, int rtvalIndex)
                 if (rflag) {
                     fprintf(ofp, "%02X\n", (0-chksum) & 0xff);
                     overrun = hexPageOverrun + 1;
-                    ihxEntendedLinearAddress(lastExtendedAddress + overrun);
+                    ihxExtendedLinearAddress(lastExtendedAddress + overrun);
                     hexPageOverrun = overrun;
                     hexRecord(0, i + 1);
                     return;
@@ -223,11 +223,11 @@ ihxNewArea()
     lastHexAddr = 0;
 }
 
-/*)Function ihxEntendedLinearAddress(i)
+/*)Function ihxExtendedLinearAddress(i)
  *
  *      Addr_T  i           16 bit extended linear address.
  *
- *  The function ihxEntendedLinearAddress() writes an extended
+ *  The function ihxExtendedLinearAddress() writes an extended
  *  linear address record (type 04) to the output file.
  *
  *  local variables:
@@ -244,7 +244,7 @@ ihxNewArea()
  *      hexPageOverrun and lastHexAddr is cleared
  */
 VOID
-ihxEntendedLinearAddress(Addr_T a)
+ihxExtendedLinearAddress(Addr_T a)
 {
     Addr_T  chksum;
 
index a7721baff08060e434891a094b913f5bfb76ca4e..fc50964af1791ec18988120456b7d0ee8bcdf47a 100644 (file)
@@ -326,6 +326,9 @@ VOID relr(VOID)
                 return;
             }
             reli = symval(s[rindex]);
+        } else if ((IS_R_J11(mode) || IS_R_J19(mode)) && (rindex == 0xFFFF)) {
+            /* absolute acall/ajmp address */
+            reli = 0;
         } else {
             if (rindex >= hp->h_narea) {
                 fprintf(stderr, "R area error\n");
@@ -555,7 +558,7 @@ VOID relr(VOID)
 
             if (rflag)
             {
-                ihxEntendedLinearAddress(extendedAddress);
+                ihxExtendedLinearAddress(extendedAddress);
             }
             else if (extendedAddress)
             {
index c2ef5bfcca6ea21e32ed28bd106e4734d3ffaff7..c5fa425f064fe61f0412c048c24a9542e9dafdc4 100644 (file)
@@ -1363,41 +1363,48 @@ byte3(int n)
  * 11 bit address.  This form of address is used only on the 8051 and 8048.
  */
 VOID
-outr11(esp, op, r)
-register struct expr *esp;
-int op;
-int r;
+outr11(register struct expr *esp, int op, int r)
 {
         register int n;
 
         if (pass == 2) {
                 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
-                        /* equated absolute destination.  Assume value
-                         * relative to current area */
-                        esp->e_base.e_ap = dot.s_area;
-                }
+                        /* Absolute destination.
+                         * Listing shows only the address.
+                         */
+                        out_lw(esp->e_addr,0);
+                        if (oflag) {
+                                outchk(3, 0);
+                                out_tw(esp->e_addr);
+                                *txtp++ = op;
 
-                /* Relocatable destination.  Build THREE
-                 * byte output: relocatable word, followed
-                 * by op-code.  Linker will combine them.
-                 * Listing shows only the address.
-                 */
-                r |= R_WORD | esp->e_rlcf;
-                out_lw(esp->e_addr,r|R_RELOC);
-                if (oflag) {
-                        outchk(3, 5);
-                        out_tw(esp->e_addr);
-                        *txtp++ = op;
+                                write_rmode(r);
+                                *relp++ = txtp - txt - 3;
+                                out_rw(0xFFFF);
+                        }
+                } else {
+                        /* Relocatable destination.  Build THREE
+                         * byte output: relocatable word, followed
+                         * by op-code.  Linker will combine them.
+                         * Listing shows only the address.
+                         */
+                        r |= R_WORD | esp->e_rlcf;
+                        out_lw(esp->e_addr,r|R_RELOC);
+                        if (oflag) {
+                                outchk(3, 5);
+                                out_tw(esp->e_addr);
+                                *txtp++ = op;
 
-                        if (esp->e_flag) {
-                                n = esp->e_base.e_sp->s_ref;
-                                r |= R_SYM;
-                        } else {
-                                n = esp->e_base.e_ap->a_ref;
+                                if (esp->e_flag) {
+                                        n = esp->e_base.e_sp->s_ref;
+                                        r |= R_SYM;
+                                } else {
+                                        n = esp->e_base.e_ap->a_ref;
+                                }
+                                write_rmode(r);
+                                *relp++ = txtp - txt - 3;
+                                out_rw(n);
                         }
-                        write_rmode(r);
-                        *relp++ = txtp - txt - 3;
-                        out_rw(n);
                 }
         }
         dot.s_addr += 2;
@@ -1417,32 +1424,42 @@ outr19(struct expr * esp, int op, int r)
 
         if (pass == 2) {
                 if (esp->e_flag==0 && esp->e_base.e_ap==NULL) {
-                        /* equated absolute destination.  Assume value
-                         * relative to current area */
-                        esp->e_base.e_ap = dot.s_area;
-                }
+                        /* Absolute destination.
+                         * Listing shows only the address.
+                         */
+                        out_lw(esp->e_addr,0);
+                        if (oflag) {
+                                outchk(4, 0);
+                                out_t24(esp->e_addr);
+                                *txtp++ = op;
 
-                /* Relocatable destination.  Build FOUR
-                 * byte output: relocatable 24-bit entity, followed
-                 * by op-code.  Linker will combine them.
-                 * Listing shows only the address.
-                 */
-                r |= R_WORD | esp->e_rlcf;
-                out_l24(esp->e_addr,r|R_RELOC);
-                if (oflag) {
-                        outchk(4, 5);
-                        out_t24(esp->e_addr);
-                        *txtp++ = op;
+                                write_rmode(r);
+                                *relp++ = txtp - txt - 4;
+                                out_rw(0xFFFF);
+                        }
+                } else {
+                        /* Relocatable destination.  Build FOUR
+                         * byte output: relocatable 24-bit entity, followed
+                         * by op-code.  Linker will combine them.
+                         * Listing shows only the address.
+                         */
+                        r |= R_WORD | esp->e_rlcf;
+                        out_l24(esp->e_addr,r|R_RELOC);
+                        if (oflag) {
+                                outchk(4, 5);
+                                out_t24(esp->e_addr);
+                                *txtp++ = op;
 
-                        if (esp->e_flag) {
-                                n = esp->e_base.e_sp->s_ref;
-                                r |= R_SYM;
-                        } else {
-                                n = esp->e_base.e_ap->a_ref;
+                                if (esp->e_flag) {
+                                        n = esp->e_base.e_sp->s_ref;
+                                        r |= R_SYM;
+                                } else {
+                                        n = esp->e_base.e_ap->a_ref;
+                                }
+                                write_rmode(r);
+                                *relp++ = txtp - txt - 4;
+                                out_rw(n);
                         }
-                        write_rmode(r);
-                        *relp++ = txtp - txt - 4;
-                        out_rw(n);
                 }
         }
         dot.s_addr += 3;