* Write out the (probably changed)
* relocation information.
*/
- if (flagword & RFLAG)
+ if (flagword & (RFLAG|CFLAG))
wr_relo(relo, 1);
}
}
* Write out the (probably changed)
* relocation information.
*/
- if (flagword & RFLAG)
+ if (flagword & (RFLAG|CFLAG))
wr_relo(relo, 1);
}
}
This flag suppresses the `Undefined:' diagnostic.
.TP
.B \-c
-Only effective in combination with
-.BR \-r .
-Indicates that relocatable output must be produced, but commons must
+Indicates that relocation information must be produced, but commons must
be resolved.
This may be useful for machines that need a last relocation step
-at load time.
+at load time. This flag disables the \fB\-r\fP flag.
.TP
.B \-s
`Strip' the output, that is, remove the name table
break;
case 'c':
/*
- * Might be used in combination with 'r', to produce
- * relocatable output, but handle commons now.
+ * Leave relocation information in the output, so that
+ * a next pass can see where relocation was done. The
+ * resulting output however is no longer relocatable.
*/
+ flagword &= ~RFLAG;
flagword |= CFLAG;
break;
#ifndef NDEBUG
* given to common symbols, and suppresses the
* `Undefined:' diagnostic.
*/
+ if (flagword & CFLAG) break;
if (flagword & SFLAG)
warning("-r contradicts -s: -s ignored");
flagword |= RFLAG;
{
norm_commons();
complete_sections();
- if (!(flagword & RFLAG))
+ if (!(flagword&RFLAG))
change_names();
}
}
name++;
}
- if ((flagword & RFLAG) && !(flagword & CFLAG)) return;
+ if (flagword & RFLAG) return;
/*
* RFLAG is off, so we need not produce relocatable output.
sc->os_foff = foff;
foff += sc->os_flen;
- if ((flagword & RFLAG) && !(flagword & CFLAG))
+ if (flagword & RFLAG)
continue;
sc->os_size += sect_comm[sectindex];
- if (flagword & RFLAG) continue;
sc->os_lign =
tstbit(sectindex, lignmap) ? sect_lign[sectindex] : 1;
if (tstbit(sectindex, basemap)) {
base = sect_base[sectindex];
- if (base % sc->os_lign)
+ if (sc->os_lign && base % sc->os_lign)
fatal("base not aligned");
- } else {
+ } else if (sc->os_lign) {
base += sc->os_lign - 1;
base -= base % sc->os_lign;
}
/*
* The rest depends on the flags.
*/
- if (flagword & RFLAG)
+ if (flagword & (RFLAG|CFLAG))
wr_relo((struct outrelo *) mems[ALLORELO].mem_base,
outhead.oh_nrelo);
if (!(flagword & SFLAG)) {
if (incore)
generate_section_names();
- if (!(flagword & RFLAG))
+ if (!(flagword & (CFLAG|RFLAG)))
outhead.oh_nrelo = (ushort)0;
if (flagword & SFLAG) {
outhead.oh_nname = (ushort)0;
extern int hash();
extern struct outname *searchname();
extern ushort indexof();
+ extern struct outhead outhead;
name = searchname(local->on_mptr, hash(local->on_mptr));
if (name == (struct outname *)0)
index += indexof(name);
} else {
valu += name->on_valu;
- index += NGlobals + (name->on_type & S_TYP) - S_MIN;
+ if ((name->on_type & S_TYP) == S_ABS) {
+ index += NGlobals + outhead.oh_nsect;
+ }
+ else index += NGlobals +
+ (name->on_type & S_TYP) - S_MIN;
}
}
*valu_out = valu;