X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=as%2Fmcs51%2Flkarea.c;h=3913ae83af8e168f7a0bb542a27d2080cf34e5d8;hb=195ee3f3ee25ce2c5f2a59fbd2779c4cb80527c3;hp=608e3e151a7d079b7512f2ea34e9c117501437a7;hpb=67012d40979fd3584f926cfd9c200ffa4a16d338;p=fw%2Fsdcc diff --git a/as/mcs51/lkarea.c b/as/mcs51/lkarea.c index 608e3e15..3913ae83 100644 --- a/as/mcs51/lkarea.c +++ b/as/mcs51/lkarea.c @@ -495,12 +495,29 @@ VOID lnkarea2 (void) char temp[NCPS]; struct sym *sp; int j; - struct area *dseg_ap=NULL; + struct area *dseg_ap = NULL; + struct area *abs_ap = NULL; struct sym *sp_dseg_s=NULL, *sp_dseg_l=NULL; for(j=0; j<256; j++) idatamap[j]=' '; memset(codemap, 0, sizeof(codemap)); + /* first sort all absolute areas to the front */ + ap = areap; + /* no need to check first area, it's in front anyway */ + while (ap && ap->a_ap) + { + if (ap->a_ap->a_flag & A_ABS) + {/* next area is absolute, move it to front, + reversed sequence is no problem for absolutes */ + abs_ap = ap->a_ap; + ap->a_ap = abs_ap->a_ap; + abs_ap->a_ap = areap; + areap = abs_ap; + } + ap = ap->a_ap; + } + ap = areap; while (ap) { @@ -555,7 +572,7 @@ VOID lnkarea2 (void) to compute the byte size of BSEG_BYTES: */ if (!strcmp(ap->a_id, "BSEG")) { - ap->a_ap->a_axp->a_size = ((ap->a_addr + ap->a_size + 7)/8); /*Bits to bytes*/ + ap->a_ap->a_axp->a_size = ((ap->a_addr + ap->a_size + 7)/8); /*Bits to bytes*/ } else if (!strcmp(ap->a_id, "DSEG")) { @@ -736,7 +753,7 @@ void lnksect2 (struct area *tap, int rloc) fprintf(stderr, ErrMsg, taxp->a_size, taxp->a_size>1?"s":"", tap->a_id); lkerr++; } - } + } for(j=0; j