- register struct area *ap;
- register struct sym *sp;
- register int i, j;
- char *ptr;
- int c, narea, nglob, rn;
-
- /*
- * Number of areas
- */
- narea = areap->a_ref + 1;
-
- /*
- * Number of global references/absolutes
- */
- nglob = 0;
- for (i = 0; i < NHASH; ++i) {
- sp = symhash[i];
- while (sp) {
- if (sp->s_flag&S_GBL)
- ++nglob;
- sp = sp->s_sp;
- }
- }
-
- /*
- * Output Radix and number of areas and symbols
- */
- if (xflag == 0) {
- fprintf(ofp, "X%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %X areas %X global symbols\n", narea, nglob);
- } else
- if (xflag == 1) {
- fprintf(ofp, "Q%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %o areas %o global symbols\n", narea, nglob);
- } else
- if (xflag == 2) {
- fprintf(ofp, "D%c\n", hilo ? 'H' : 'L');
- fprintf(ofp, "H %u areas %u global symbols\n", narea, nglob);
- }
-
- /*
- * Module name
- */
- if (module[0]) {
- fprintf(ofp, "M ");
- ptr = &module[0];
- while (ptr < &module[NCPS]) {
- if ((c = *ptr++) != 0)
- putc(c, ofp);
- }
- putc('\n', ofp);
- }
-
- /*
- * Global references and absolutes.
- */
- rn = 0;
- for (i=0; i<NHASH; ++i) {
- sp = symhash[i];
- while (sp) {
- if (sp->s_area==NULL && sp->s_flag&S_GBL) {
- sp->s_ref = rn++;
- outsym(sp);
- }
- sp = sp->s_sp;
- }
- }
-
- /*
- * Global relocatables.
- */
- for (i=0; i<narea; ++i) {
- ap = areap;
- while (ap->a_ref != i)
- ap = ap->a_ap;
- outarea(ap);
- for (j=0; j<NHASH; ++j) {
- sp = symhash[j];
- while (sp) {
- if (sp->s_area==ap && sp->s_flag&S_GBL) {
- sp->s_ref = rn++;
- outsym(sp);
- }
- sp = sp->s_sp;
- }
- }
- }
+ register struct area *ap;
+ register struct sym *sp;
+ register int i, j;
+ char *ptr;
+ int c, narea, nglob, rn;
+
+ /*
+ * Number of areas
+ */
+ narea = areap->a_ref + 1;
+
+ /*
+ * Number of global references/absolutes
+ */
+ nglob = 0;
+ for (i = 0; i < NHASH; ++i) {
+ sp = symhash[i];
+ while (sp) {
+ if (sp->s_flag&S_GBL)
+ ++nglob;
+ sp = sp->s_sp;
+ }
+ }
+
+ /*
+ * Output Radix and number of areas and symbols
+ */
+ if (xflag == 0) {
+ fprintf(ofp, "X%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %X areas %X global symbols\n", narea, nglob);
+ } else
+ if (xflag == 1) {
+ fprintf(ofp, "Q%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %o areas %o global symbols\n", narea, nglob);
+ } else
+ if (xflag == 2) {
+ fprintf(ofp, "D%c\n", hilo ? 'H' : 'L');
+ fprintf(ofp, "H %u areas %u global symbols\n", narea, nglob);
+ }
+
+ /*
+ * Module name
+ */
+ if (module[0]) {
+ fprintf(ofp, "M ");
+ ptr = &module[0];
+ while (ptr < &module[NCPS]) {
+ if ((c = *ptr++) != 0)
+ putc(c, ofp);
+ }
+ putc('\n', ofp);
+ }
+
+ /*
+ * Sdcc compile options
+ */
+ if (strlen(optsdcc)) fprintf(ofp, "O %s\n", optsdcc);
+
+ /*
+ * Global references and absolutes.
+ */
+ rn = 0;
+ for (i=0; i<NHASH; ++i) {
+ sp = symhash[i];
+ while (sp) {
+ if (sp->s_area==NULL && sp->s_flag&S_GBL) {
+ sp->s_ref = rn++;
+ outsym(sp);
+ }
+ sp = sp->s_sp;
+ }
+ }
+
+ /*
+ * Global relocatables.
+ */
+ for (i=0; i<narea; ++i) {
+ ap = areap;
+ while (ap->a_ref != i)
+ ap = ap->a_ap;
+ outarea(ap);
+ for (j=0; j<NHASH; ++j) {
+ sp = symhash[j];
+ while (sp) {
+ if (sp->s_area==ap && sp->s_flag&S_GBL) {
+ sp->s_ref = rn++;
+ outsym(sp);
+ }
+ sp = sp->s_sp;
+ }
+ }
+ }