+/*)Function VOID write_rmode(r)
+ *
+ * int r relocation mode
+ *
+ * write_rmode puts the passed relocation mode into the
+ * output relp buffer, escaping it if necessary.
+ *
+ * global variables:
+ * int * relp pointer to rel array
+ *
+ * functions called:
+ * VOID rerr() assubr.c
+ *
+ * side effects:
+ * relp is incremented appropriately.
+ */
+VOID
+write_rmode(int r)
+{
+ /* We need to escape the relocation mode if it is greater
+ * than a byte, or if it happens to look like an escape.
+ * (I don't think that the latter case is legal, but
+ * better safe than sorry).
+ */
+ if ((r > 0xff) || ((r & R_ESCAPE_MASK) == R_ESCAPE_MASK))
+ {
+ /* Hack in up to an extra 4 bits of flags with escape. */
+ if (r > 0xfff)
+ {
+ /* uh-oh.. we have more than 4 extra bits. */
+ fprintf(stderr,
+ "Internal error: relocation mode 0x%X too big.\n",
+ r);
+ rerr();
+ }
+ /* printf("escaping relocation mode\n"); */
+ *relp++ = R_ESCAPE_MASK | (r >> 8);
+ *relp++ = r & 0xff;
+ }
+ else
+ {
+ *relp++ = r;
+ }
+}
+