3 Copyright (C) 1989-1995 Alan R. Baldwin
4 721 Berkeley St., Kent, Ohio 44240
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 * - errdmp: show s_id as string rather than array [NCPS]
22 * - relr: add support for 11 bit 8051 addressing
23 * 02-Apr-98 JLH: don't output empty hex records
32 * The module lkrloc.c contains the functions which
33 * perform the relocation calculations.
35 * lkrloc.c contains the following functions:
54 * lkrloc.c the local variable errmsg[].
58 /* Global which holds the upper 16 bits of the last 32 bit area adress
59 * output. Useful only for iHex mode.
61 int lastExtendedAddress=-1;
63 /* Static variable which holds the index of last processed area.
64 * Useful only for iHex mode.
66 static int lastAreaIndex = -1;
68 /*)Function VOID reloc(c)
72 * The function reloc() calls a particular relocation
73 * function determined by the process code.
79 * int lkerr error flag
82 * int fprintf() c_library
83 * VOID rele() lkrloc.c
84 * VOID relp() lkrloc.c
85 * VOID relr() lkrloc.c
86 * VOId relt() lkrloc.c
89 * Refer to the called relocation functions.
114 fprintf(stderr, "Undefined Relocation Operation\n");
122 /*)Function VOID relt()
124 * The function relt() evaluates a T line read by
125 * the linker. Each byte value read is saved in the
126 * rtval[] array, rtflg[] is set, and the number of
127 * evaluations is maintained in rtcnt.
131 * T xx xx nn nn nn nn nn ...
134 * In: "T n0 n1 n2 n3 ... nn"
136 * Out: 0 1 2 .. rtcnt
137 * +----+----+----+----+----+
138 * rtval | n0 | n1 | n2 | .. | nn |
139 * +----+----+----+----+----+
140 * rtflag| 1 | 1 | 1 | 1 | 1 |
141 * +----+----+----+----+----+
143 * The T line contains the assembled code output by the assem-
144 * bler with xx xx being the offset address from the current area
145 * base address and nn being the assembled instructions and data in
152 * int rtcnt number of values evaluated
153 * int rtflg[] array of evaluation flags
154 * int rtval[] array of evaluation values
157 * int eval() lkeval.c
161 * Linker input T line evaluated.
170 rtval[rtcnt] = eval();
177 /*)Function VOID relr()
179 * The function relr() evaluates a R line read by
180 * the linker. The R line data is combined with the
181 * previous T line data to perform the relocation of
182 * code and data bytes. The S19 / IHX output and
183 * translation of the LST files to RST files may be
188 * R 0 0 nn nn n1 n2 xx xx ...
190 * The R line provides the relocation information to the linker.
191 * The nn nn value is the current area index, i.e. which area the
192 * current values were assembled. Relocation information is en-
193 * coded in groups of 4 bytes:
195 * 1. n1 is the relocation mode and object format
196 * 1. bit 0 word(0x00)/byte(0x01)
197 * 2. bit 1 relocatable area(0x00)/symbol(0x02)
198 * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
199 * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
201 * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
202 * 6. bit 5 normal(0x00)/page '0'(0x20) reference
203 * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
205 * 2. n2 is a byte index into the corresponding (i.e. pre-
206 * ceeding) T line data (i.e. a pointer to the data to be
207 * updated by the relocation). The T line data may be
208 * 1-byte or 2-byte byte data format or 2-byte word
211 * 3. xx xx is the area/symbol index for the area/symbol be-
212 * ing referenced. the corresponding area/symbol is found
213 * in the header area/symbol lists.
215 * The groups of 4 bytes are repeated for each item requiring relo-
216 * cation in the preceeding T line.
219 * areax **a pointer to array of area pointers
220 * int aindex area index
221 * char *errmsg[] array of pointers to error strings
222 * int error error code
223 * int lkerr error flag
224 * int mode relocation mode
225 * adrr_t paga paging base area address
226 * Addr_T pags paging symbol address
227 * Addr_T pc relocated base address
228 * Addr_T r PCR relocation value
229 * Addr_T reli relocation initial value
230 * Addr_T relv relocation final value
231 * int rindex symbol / area index
232 * Addr_T rtbase base code address
233 * Addr_T rtofst rtval[] index offset
234 * int rtp index into T data
235 * sym **s pointer to array of symbol pointers
238 * head *hp pointer to the head structure
239 * rerr rerr linker error structure
240 * FILE *stderr standard error device
243 * Addr_T adb_b() lkrloc.c
244 * Addr_T adb_lo() lkrloc.c
245 * Addr_T adb_hi() lkrloc.c
246 * Addr_T adw_w() lkrloc.c
248 * Addr_T evword() lkrloc.c
249 * int eval() lkeval.c
250 * int fprintf() c_library
252 * int lkulist lklist.c
254 * VOID relerr() lkrloc.c
256 * int symval() lksym.c
259 * The R and T lines are combined to produce
260 * relocated code and data. Output S19 / IHX
261 * and relocated listing files may be produced.
268 register Addr_T reli, relv;
269 int aindex, rindex, rtp, error;
270 Addr_T r, rtbase, rtofst, paga, pags, pc;
275 * Get area and symbol lists
283 if (eval() != (R_WORD | R_AREA) || eval()) {
284 fprintf(stderr, "R input error\n");
292 if (aindex >= hp->h_narea) {
293 fprintf(stderr, "R area error\n");
297 ap = a[aindex]->a_bap;
302 rtbase = adw_w(0, 0);
308 pc = adw_w(a[aindex]->a_addr, 0);
311 printf("area %d base address: 0x%x size: 0x%x rtbase: 0x%x\n", aindex,
312 a[aindex]->a_addr, a[aindex]->a_size, rtbase);
315 * Do remaining relocations
321 if ((mode & R_ESCAPE_MASK) == R_ESCAPE_MASK)
323 mode = ((mode & ~R_ESCAPE_MASK) << 8) | eval();
324 /* printf("unescaping rmode\n"); */
331 * R_SYM or R_AREA references
334 if (rindex >= hp->h_nglob) {
335 fprintf(stderr, "R symbol error\n");
339 reli = symval(s[rindex]);
341 if (rindex >= hp->h_narea) {
342 fprintf(stderr, "R area error\n");
346 reli = a[rindex]->a_addr;
354 reli -= (pc + (rtp-rtofst) + 1);
356 reli -= (pc + (rtp-rtofst) + 2);
361 * R_PAG0 or R_PAG addressing
363 if (mode & (R_PAG0 | R_PAG)) {
364 paga = sdp.s_area->a_addr;
370 * R_BYTE or R_WORD operation
375 /* This is a three byte address, of which
376 * we will select one byte.
380 /* printf("24 bit address selecting hi byte.\n"); */
381 relv = adb_24_hi(reli, rtp);
383 else if (mode & R_MSB)
385 /* Note that in 24 bit mode, R_MSB
386 * is really the middle byte, not
387 * the most significant byte.
389 * This is ugly and I can only apologize
392 /* printf("24 bit address selecting middle byte.\n"); */
393 relv = adb_24_mid(reli, rtp);
397 /* printf("24 bit address selecting lo byte.\n"); */
398 relv = adb_24_lo(reli, rtp);
401 else if (mode & R_BYT2) {
402 /* This is a two byte address, of
403 * which we will select one byte.
406 relv = adb_hi(reli, rtp);
408 relv = adb_lo(reli, rtp);
411 relv = adb_b(reli, rtp);
413 } else if (IS_R_J11(mode)) {
414 /* JLH: 11 bit jump destination for 8051. Forms
415 / two byte instruction with op-code bits
417 / rtp points at 3 byte locus: first two
418 / will get the instructiion. third one
422 /* Calculate absolute destination
423 / relv must be on same 2K page as pc
425 relv = adw_w(reli, rtp);
427 if ((relv & ~0x7ff) != ((pc + rtp - rtofst) & ~0x7ff)) {
431 /* Merge MSB (byte 0) with op-code, ignoring
432 / top 5 bits of address. Then hide the op-code
434 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+2];
438 else if (IS_R_J19(mode)) {
439 /* 19 bit jump destination for DS80C390. Forms
440 / three byte instruction with op-code bits
442 / rtp points at 4 byte locus: first three
443 / will get the instructiion. fourth one
447 /* Calculate absolute destination
448 / relv must be on same 512K page as pc
450 relv = adw_24(reli, rtp);
452 if ((relv & ~0x7ffff) != ((pc + rtp - rtofst) & ~0x7ffff)) {
456 /* Merge MSB (byte 0) with op-code, ignoring
457 / top 5 bits of address. Then hide the op-code
459 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+3];
463 else if (IS_C24(mode))
466 relv = adw_24(reli, rtp);
470 /* 16 bit address. */
471 relv = adw_w(reli, rtp);
475 * R_BYTE with R_BYT2 offset adjust
484 * Unsigned Byte Checking
486 if (mode & R_USGN && mode & R_BYTE && relv & ~0xFF)
490 * PCR Relocation Error Checking
492 if (mode & R_PCR && mode & R_BYTE) {
494 if (r != (Addr_T) ~0x7F && r != 0)
499 * Page Relocation Error Checking
501 /* if (mode & R_PAG0 && (relv & ~0xFF || paga || pags))
503 if (mode & R_PAG && (relv & ~0xFF))
510 rerr.aindex = aindex;
512 rerr.rtbase = rtbase + rtp - rtofst - 1;
513 rerr.rindex = rindex;
514 rerr.rval = relv - reli;
515 relerr(errmsg[error-1]);
522 /* JLH: output only if data (beyond two byte address) */
523 if ((oflag == 1) && (rtcnt > 2)) {
524 // int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff;
526 /* Boy, is this a hack: for ABS sections, the
527 * base address is stored as zero, and the T records
528 * indicate the offset from zero.
530 * Since T records can only indicate a 16 bit offset, this
531 * obviously creates a problem for ABS segments located
532 * above 64K (this is only meaningful in flat24 mode).
534 * However, the size of an ABS area is stored as
535 * base address + section size (I suspect this is a bug,
536 * but it's a handy one right now). So the upper 8 bits of
537 * the 24 bit address are stored in the size record.
540 * This is another reason why we can't have areas greater
541 * than 64K yet, even in flat24 mode.
543 // extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
544 // commented out by jr
546 if (lastAreaIndex != aindex) {
547 lastAreaIndex = aindex;
551 if (extendedAddress != lastExtendedAddress)
554 if (lastExtendedAddress!=-1) {
555 printf("output extended linear address record 0x%x 0x%x\n",
556 extendedAddress, lastExtendedAddress);
561 ihxExtendedLinearAddress(extendedAddress);
563 else if (extendedAddress)
565 /* Not allowed to generate extended address records,
566 * but one is called for here...
569 "warning: extended linear address encountered; "
570 "you probably want the -r flag.\n");
572 lastExtendedAddress = extendedAddress;
577 if ((oflag == 2) && (rtcnt > 2)) {
580 if ((oflag == 3) && (rtcnt > 2)) {
586 "Unsigned Byte error",
587 "Byte PCR relocation error",
588 "Page0 relocation error",
589 "Page Mode relocation error"
593 /*)Function VOID relp()
595 * The function relp() evaluates a P line read by
596 * the linker. The P line data is combined with the
597 * previous T line data to set the base page address
598 * and test the paging boundary and length.
602 * P 0 0 nn nn n1 n2 xx xx
604 * The P line provides the paging information to the linker as
605 * specified by a .setdp directive. The format of the relocation
606 * information is identical to that of the R line. The correspond-
607 * ing T line has the following information:
608 * T xx xx aa aa bb bb
610 * Where aa aa is the area reference number which specifies the
611 * selected page area and bb bb is the base address of the page.
612 * bb bb will require relocation processing if the 'n1 n2 xx xx' is
613 * specified in the P line. The linker will verify that the base
614 * address is on a 256 byte boundary and that the page length of an
615 * area defined with the PAG type is not larger than 256 bytes.
618 * areax **a pointer to array of area pointers
619 * int aindex area index
620 * int mode relocation mode
621 * Addr_T relv relocation value
622 * int rindex symbol / area index
623 * int rtp index into T data
624 * sym **s pointer to array of symbol pointers
627 * head *hp pointer to the head structure
628 * int lkerr error flag
629 * sdp sdp base page structure
630 * FILE *stderr standard error device
633 * Addr_T adw_w() lkrloc.c
634 * Addr_T evword() lkrloc.c
635 * int eval() lkeval.c
636 * int fprintf() c_library
638 * int symval() lksym.c
641 * The P and T lines are combined to set
642 * the base page address and report any
649 register int aindex, rindex;
656 * Get area and symbol lists
664 if (eval() != (R_WORD | R_AREA) || eval()) {
665 fprintf(stderr, "P input error\n");
673 if (aindex >= hp->h_narea) {
674 fprintf(stderr, "P area error\n");
680 * Do remaining relocations
688 * R_SYM or R_AREA references
691 if (rindex >= hp->h_nglob) {
692 fprintf(stderr, "P symbol error\n");
696 relv = symval(s[rindex]);
698 if (rindex >= hp->h_narea) {
699 fprintf(stderr, "P area error\n");
703 relv = a[rindex]->a_addr;
712 if (aindex >= hp->h_narea) {
713 fprintf(stderr, "P area error\n");
717 sdp.s_areax = a[aindex];
718 sdp.s_area = sdp.s_areax->a_bap;
719 sdp.s_addr = adw_w(0,4);
720 if (sdp.s_area->a_addr & 0xFF || sdp.s_addr & 0xFF)
721 relerp("Page Definition Boundary Error");
724 /*)Function VOID rele()
726 * The function rele() closes all open output files
727 * at the end of the linking process.
733 * int oflag output type flag
734 * int uflag relocation listing flag
739 * VOID lkulist() lklist.c
743 * All open output files are closed.
763 /*)Function Addr_T evword()
765 * The function evword() combines two byte values
766 * into a single word value.
769 * Addr_T v temporary evaluation variable
772 * hilo byte ordering parameter
775 * int eval() lkeval.c
778 * Relocation text line is scanned to combine
779 * two byte values into a single word value.
797 /*)Function Addr_T adb_b(v, i)
799 * int v value to add to byte
800 * int i rtval[] index
802 * The function adb_b() adds the value of v to
803 * the single byte value contained in rtval[i].
804 * The new value of rtval[i] is returned.
816 * The value of rtval[] is changed.
820 Addr_T adb_b(register Addr_T v, register int i)
822 return(rtval[i] += v);
825 /*)Function Addr_T adb_lo(v, i)
827 * int v value to add to byte
828 * int i rtval[] index
830 * The function adb_lo() adds the value of v to the
831 * double byte value contained in rtval[i] and rtval[i+1].
832 * The new value of rtval[i] / rtval[i+1] is returned.
833 * The MSB rtflg[] is cleared.
836 * Addr_T j temporary evaluation variable
839 * hilo byte ordering parameter
845 * The value of rtval[] is changed.
846 * The rtflg[] value corresponding to the
847 * MSB of the word value is cleared to reflect
848 * the fact that the LSB is the selected byte.
852 Addr_T adb_lo(Addr_T v, int i)
868 /*)Function Addr_T adb_hi(v, i)
870 * int v value to add to byte
871 * int i rtval[] index
873 * The function adb_hi() adds the value of v to the
874 * double byte value contained in rtval[i] and rtval[i+1].
875 * The new value of rtval[i] / rtval[i+1] is returned.
876 * The LSB rtflg[] is cleared.
879 * Addr_T j temporary evaluation variable
882 * hilo byte ordering parameter
888 * The value of rtval[] is changed.
889 * The rtflg[] value corresponding to the
890 * LSB of the word value is cleared to reflect
891 * the fact that the MSB is the selected byte.
895 Addr_T adb_hi(Addr_T v, int i)
911 /*)Function Addr_T adb_24_hi(v, i)
913 * int v value to add to byte
914 * int i rtval[] index
916 * The function adb_24_hi() adds the value of v to the
917 * 24 bit value contained in rtval[i] - rtval[i+2].
918 * The new value of rtval[i] / rtval[i+1] is returned.
919 * The LSB & middle byte rtflg[] is cleared.
922 * Addr_T j temporary evaluation variable
925 * hilo byte ordering parameter
931 * The value of rtval[] is changed.
932 * The rtflg[] value corresponding to the
933 * LSB & middle byte of the word value is cleared to
934 * reflect the fact that the MSB is the selected byte.
938 Addr_T adb_24_hi(Addr_T v, int i)
944 /* Remove the lower two bytes. */
958 /*)Function Addr_T adb_24_mid(v, i)
960 * int v value to add to byte
961 * int i rtval[] index
963 * The function adb_24_mid() adds the value of v to the
964 * 24 bit value contained in rtval[i] - rtval[i+2].
965 * The new value of rtval[i] / rtval[i+1] is returned.
966 * The LSB & MSB byte rtflg[] is cleared.
969 * Addr_T j temporary evaluation variable
972 * hilo byte ordering parameter
978 * The value of rtval[] is changed.
979 * The rtflg[] value corresponding to the
980 * LSB & MSB of the 24 bit value is cleared to reflect
981 * the fact that the middle byte is the selected byte.
985 Addr_T adb_24_mid(Addr_T v, int i)
991 /* remove the MSB & LSB. */
998 /*)Function Addr_T adb_24_lo(v, i)
1000 * int v value to add to byte
1001 * int i rtval[] index
1003 * The function adb_24_lo() adds the value of v to the
1004 * 24 bit value contained in rtval[i] - rtval[i+2].
1005 * The new value of rtval[i] / rtval[i+1] is returned.
1006 * The MSB & middle byte rtflg[] is cleared.
1009 * Addr_T j temporary evaluation variable
1012 * hilo byte ordering parameter
1018 * The value of rtval[] is changed.
1019 * The rtflg[] value corresponding to the
1020 * MSB & middle byte of the word value is cleared to
1021 * reflect the fact that the LSB is the selected byte.
1025 Addr_T adb_24_lo(Addr_T v, int i)
1031 /* Remove the upper two bytes. */
1045 /*)Function Addr_T adw_w(v, i)
1047 * int v value to add to word
1048 * int i rtval[] index
1050 * The function adw_w() adds the value of v to the
1051 * word value contained in rtval[i] and rtval[i+1].
1052 * The new value of rtval[i] / rtval[i+1] is returned.
1055 * Addr_T j temporary evaluation variable
1058 * hilo byte ordering parameter
1064 * The word value of rtval[] is changed.
1068 Addr_T adw_w(register Addr_T v, register int i)
1073 j = v + (rtval[i] << 8) + (rtval[i+1] & 0xff);
1074 rtval[i] = (j >> 8) & 0xff;
1075 rtval[i+1] = j & 0xff;
1077 j = v + (rtval[i] & 0xff) + (rtval[i+1] << 8);
1078 rtval[i] = j & 0xff;
1079 rtval[i+1] = (j >> 8) & 0xff;
1084 /*)Function Addr_T adw_24(v, i)
1086 * int v value to add to word
1087 * int i rtval[] index
1089 * The function adw_w() adds the value of v to the
1090 * 24 bit value contained in rtval[i] - rtval[i+2].
1091 * The new value of rtval[i] - rtval[i+2] is returned.
1094 * Addr_T j temporary evaluation variable
1097 * hilo byte ordering parameter
1103 * The word value of rtval[] is changed.
1106 Addr_T adw_24(Addr_T v, int i)
1111 j = v + ((rtval[i] & 0xff) << 16)
1112 + ((rtval[i+1] & 0xff) << 8)
1113 + (rtval[i+2] & 0xff);
1114 rtval[i] = (j >> 16) & 0xff;
1115 rtval[i+1] = (j >> 8) & 0xff;
1116 rtval[i+2] = j & 0xff;
1118 j = v + (rtval[i] & 0xff)
1119 + ((rtval[i+1] & 0xff) << 8)
1120 + ((rtval[i+2] & 0xff) << 16);
1121 rtval[i] = j & 0xff;
1122 rtval[i+1] = (j >> 8) & 0xff;
1123 rtval[i+2] = (j >> 16) & 0xff;
1128 /*)Function Addr_T adw_lo(v, i)
1130 * int v value to add to byte
1131 * int i rtval[] index
1133 * The function adw_lo() adds the value of v to the
1134 * double byte value contained in rtval[i] and rtval[i+1].
1135 * The new value of rtval[i] / rtval[i+1] is returned.
1136 * The MSB rtval[] is zeroed.
1139 * Addr_T j temporary evaluation variable
1142 * hilo byte ordering parameter
1148 * The value of rtval[] is changed.
1149 * The MSB of the word value is cleared to reflect
1150 * the fact that the LSB is the selected byte.
1154 Addr_T adw_lo(Addr_T v, int i)
1170 /*)Function Addr_T adw_hi(v, i)
1172 * int v value to add to byte
1173 * int i rtval[] index
1175 * The function adw_hi() adds the value of v to the
1176 * double byte value contained in rtval[i] and rtval[i+1].
1177 * The new value of rtval[i] / rtval[i+1] is returned.
1178 * The MSB and LSB values are interchanged.
1179 * The MSB rtval[] is zeroed.
1182 * Addr_T j temporary evaluation variable
1185 * hilo byte ordering parameter
1191 * The value of rtval[] is changed.
1192 * The MSB and LSB values are interchanged and
1193 * then the MSB cleared.
1197 Addr_T adw_hi(Addr_T v, int i)
1203 * LSB = MSB, Clear MSB
1206 rtval[i+1] = rtval[i];
1209 rtval[i] = rtval[i+1];
1215 /*)Function VOID relerr(str)
1217 * char *str error string
1219 * The function relerr() outputs the error string to
1220 * stderr and to the map file (if it is open).
1226 * FILE *mfp handle for the map file
1229 * VOID errdmp() lkrloc.c
1232 * Error message inserted into map file.
1236 VOID relerr(char *str)
1238 errdmp(stderr, str);
1243 /*)Function VOID errdmp(fptr, str)
1245 * FILE *fptr output file handle
1246 * char *str error string
1248 * The function errdmp() outputs the error string str
1249 * to the device specified by fptr. Additional information
1250 * is output about the definition and referencing of
1251 * the symbol / area error.
1254 * int mode error mode
1255 * int aindex area index
1256 * int lkerr error flag
1257 * int rindex error index
1258 * sym **s pointer to array of symbol pointers
1259 * areax **a pointer to array of area pointers
1260 * areax *raxp error area extension pointer
1263 * sdp sdp base page structure
1266 * int fprintf() c_library
1267 * VOID prntval() lkrloc.c
1274 VOID errdmp(FILE *fptr, char *str)
1276 int mode, aindex, rindex;
1285 aindex = rerr.aindex;
1286 rindex = rerr.rindex;
1291 fprintf(fptr, "\n?ASlink-Warning-%s", str);
1295 * Print symbol if symbol based
1298 fprintf(fptr, " for symbol %s\n",
1299 &s[rindex]->s_id[0]);
1301 fprintf(fptr, "\n");
1308 " file module area offset\n");
1310 " Refby %-8.8s %-8.8s %-8.8s ",
1313 &a[aindex]->a_bap->a_id[0]);
1314 prntval(fptr, rerr.rtbase);
1320 raxp = s[rindex]->s_axp;
1325 " Defin %-8.8s %-8.8s %-8.8s ",
1326 raxp->a_bhp->h_lfile->f_idp,
1327 &raxp->a_bhp->m_id[0],
1328 &raxp->a_bap->a_id[0]);
1330 prntval(fptr, s[rindex]->s_addr);
1332 prntval(fptr, rerr.rval);
1336 /*)Function VOID prntval(fptr, v)
1338 * FILE *fptr output file handle
1339 * Addr_T v value to output
1341 * The function prntval() outputs the value v, in the
1342 * currently selected radix, to the device specified
1349 * int xflag current radix
1352 * int fprintf() c_library
1359 VOID prntval(FILE *fptr, Addr_T v)
1362 fprintf(fptr, "%04X\n", v);
1365 fprintf(fptr, "%06o\n", v);
1368 fprintf(fptr, "%05u\n", v);
1372 /*)Function VOID relerp(str)
1374 * char *str error string
1376 * The function relerp() outputs the paging error string to
1377 * stderr and to the map file (if it is open).
1383 * FILE *mfp handle for the map file
1386 * VOID erpdmp() lkrloc.c
1389 * Error message inserted into map file.
1393 VOID relerp(char *str)
1395 erpdmp(stderr, str);
1400 /*)Function VOID erpdmp(fptr, str)
1402 * FILE *fptr output file handle
1403 * char *str error string
1405 * The function erpdmp() outputs the error string str
1406 * to the device specified by fptr.
1409 * head *thp pointer to head structure
1412 * int lkerr error flag
1413 * sdp sdp base page structure
1416 * int fprintf() c_library
1417 * VOID prntval() lkrloc.c
1424 VOID erpdmp(FILE *fptr, char *str)
1426 register struct head *thp;
1428 thp = sdp.s_areax->a_bhp;
1433 fprintf(fptr, "\n?ASlink-Warning-%s\n", str);
1440 " file module pgarea pgoffset\n");
1442 " PgDef %-8.8s %-8.8s %-8.8s ",
1443 thp->h_lfile->f_idp,
1445 &sdp.s_area->a_id[0]);
1446 prntval(fptr, sdp.s_area->a_addr + sdp.s_addr);