4 * (C) Copyright 1989-1995
12 * - errdmp: show s_id as string rather than array [NCPS]
13 * - relr: add support for 11 bit 8051 addressing
14 * 02-Apr-98 JLH: don't output empty hex records
23 * The module lkrloc.c contains the functions which
24 * perform the relocation calculations.
26 * lkrloc.c contains the following functions:
45 * lkrloc.c the local variable errmsg[].
49 /* Global which holds the upper 16 bits of the last 32 bit area adress
50 * output. Useful only for iHex mode.
52 int lastExtendedAddress=-1;
54 /* Static variable which holds the index of last processed area.
55 * Useful only for iHex mode.
57 static int lastAreaIndex = -1;
59 /*)Function VOID reloc(c)
63 * The function reloc() calls a particular relocation
64 * function determined by the process code.
70 * int lkerr error flag
73 * int fprintf() c_library
74 * VOID rele() lkrloc.c
75 * VOID relp() lkrloc.c
76 * VOID relr() lkrloc.c
77 * VOId relt() lkrloc.c
80 * Refer to the called relocation functions.
105 fprintf(stderr, "Undefined Relocation Operation\n");
113 /*)Function VOID relt()
115 * The function relt() evaluates a T line read by
116 * the linker. Each byte value read is saved in the
117 * rtval[] array, rtflg[] is set, and the number of
118 * evaluations is maintained in rtcnt.
122 * T xx xx nn nn nn nn nn ...
125 * In: "T n0 n1 n2 n3 ... nn"
127 * Out: 0 1 2 .. rtcnt
128 * +----+----+----+----+----+
129 * rtval | n0 | n1 | n2 | .. | nn |
130 * +----+----+----+----+----+
131 * rtflag| 1 | 1 | 1 | 1 | 1 |
132 * +----+----+----+----+----+
134 * The T line contains the assembled code output by the assem-
135 * bler with xx xx being the offset address from the current area
136 * base address and nn being the assembled instructions and data in
143 * int rtcnt number of values evaluated
144 * int rtflg[] array of evaluation flags
145 * int rtval[] array of evaluation values
148 * int eval() lkeval.c
152 * Linker input T line evaluated.
161 rtval[rtcnt] = eval();
168 /*)Function VOID relr()
170 * The function relr() evaluates a R line read by
171 * the linker. The R line data is combined with the
172 * previous T line data to perform the relocation of
173 * code and data bytes. The S19 / IHX output and
174 * translation of the LST files to RST files may be
179 * R 0 0 nn nn n1 n2 xx xx ...
181 * The R line provides the relocation information to the linker.
182 * The nn nn value is the current area index, i.e. which area the
183 * current values were assembled. Relocation information is en-
184 * coded in groups of 4 bytes:
186 * 1. n1 is the relocation mode and object format
187 * 1. bit 0 word(0x00)/byte(0x01)
188 * 2. bit 1 relocatable area(0x00)/symbol(0x02)
189 * 3. bit 2 normal(0x00)/PC relative(0x04) relocation
190 * 4. bit 3 1-byte(0x00)/2-byte(0x08) object format for
192 * 5. bit 4 signed(0x00)/unsigned(0x10) byte data
193 * 6. bit 5 normal(0x00)/page '0'(0x20) reference
194 * 7. bit 6 normal(0x00)/page 'nnn'(0x40) reference
196 * 2. n2 is a byte index into the corresponding (i.e. pre-
197 * ceeding) T line data (i.e. a pointer to the data to be
198 * updated by the relocation). The T line data may be
199 * 1-byte or 2-byte byte data format or 2-byte word
202 * 3. xx xx is the area/symbol index for the area/symbol be-
203 * ing referenced. the corresponding area/symbol is found
204 * in the header area/symbol lists.
206 * The groups of 4 bytes are repeated for each item requiring relo-
207 * cation in the preceeding T line.
210 * areax **a pointer to array of area pointers
211 * int aindex area index
212 * char *errmsg[] array of pointers to error strings
213 * int error error code
214 * int lkerr error flag
215 * int mode relocation mode
216 * adrr_t paga paging base area address
217 * Addr_T pags paging symbol address
218 * Addr_T pc relocated base address
219 * Addr_T r PCR relocation value
220 * Addr_T reli relocation initial value
221 * Addr_T relv relocation final value
222 * int rindex symbol / area index
223 * Addr_T rtbase base code address
224 * Addr_T rtofst rtval[] index offset
225 * int rtp index into T data
226 * sym **s pointer to array of symbol pointers
229 * head *hp pointer to the head structure
230 * rerr rerr linker error structure
231 * FILE *stderr standard error device
234 * Addr_T adb_b() lkrloc.c
235 * Addr_T adb_lo() lkrloc.c
236 * Addr_T adb_hi() lkrloc.c
237 * Addr_T adw_w() lkrloc.c
239 * Addr_T evword() lkrloc.c
240 * int eval() lkeval.c
241 * int fprintf() c_library
243 * int lkulist lklist.c
245 * VOID relerr() lkrloc.c
247 * int symval() lksym.c
250 * The R and T lines are combined to produce
251 * relocated code and data. Output S19 / IHX
252 * and relocated listing files may be produced.
259 register Addr_T reli, relv;
260 int aindex, rindex, rtp, error;
261 Addr_T r, rtbase, rtofst, paga, pags, pc;
266 * Get area and symbol lists
274 if (eval() != (R_WORD | R_AREA) || eval()) {
275 fprintf(stderr, "R input error\n");
283 if (aindex >= hp->h_narea) {
284 fprintf(stderr, "R area error\n");
288 ap = a[aindex]->a_bap;
293 rtbase = adw_w(0, 0);
299 pc = adw_w(a[aindex]->a_addr, 0);
302 printf("area %d base address: 0x%x size: 0x%x rtbase: 0x%x\n", aindex,
303 a[aindex]->a_addr, a[aindex]->a_size, rtbase);
306 * Do remaining relocations
312 if ((mode & R_ESCAPE_MASK) == R_ESCAPE_MASK)
314 mode = ((mode & ~R_ESCAPE_MASK) << 8) | eval();
315 /* printf("unescaping rmode\n"); */
322 * R_SYM or R_AREA references
325 if (rindex >= hp->h_nglob) {
326 fprintf(stderr, "R symbol error\n");
330 reli = symval(s[rindex]);
332 if (rindex >= hp->h_narea) {
333 fprintf(stderr, "R area error\n");
337 reli = a[rindex]->a_addr;
345 reli -= (pc + (rtp-rtofst) + 1);
347 reli -= (pc + (rtp-rtofst) + 2);
352 * R_PAG0 or R_PAG addressing
354 if (mode & (R_PAG0 | R_PAG)) {
355 paga = sdp.s_area->a_addr;
361 * R_BYTE or R_WORD operation
366 /* This is a three byte address, of which
367 * we will select one byte.
371 /* printf("24 bit address selecting hi byte.\n"); */
372 relv = adb_24_hi(reli, rtp);
374 else if (mode & R_MSB)
376 /* Note that in 24 bit mode, R_MSB
377 * is really the middle byte, not
378 * the most significant byte.
380 * This is ugly and I can only apologize
383 /* printf("24 bit address selecting middle byte.\n"); */
384 relv = adb_24_mid(reli, rtp);
388 /* printf("24 bit address selecting lo byte.\n"); */
389 relv = adb_24_lo(reli, rtp);
392 else if (mode & R_BYT2) {
393 /* This is a two byte address, of
394 * which we will select one byte.
397 relv = adb_hi(reli, rtp);
399 relv = adb_lo(reli, rtp);
402 relv = adb_b(reli, rtp);
404 } else if (IS_R_J11(mode)) {
405 /* JLH: 11 bit jump destination for 8051. Forms
406 / two byte instruction with op-code bits
408 / rtp points at 3 byte locus: first two
409 / will get the instructiion. third one
413 /* Calculate absolute destination
414 / relv must be on same 2K page as pc
416 relv = adw_w(reli, rtp);
418 if ((relv & ~0x7ff) != ((pc + rtp - rtofst) & ~0x7ff)) {
422 /* Merge MSB (byte 0) with op-code, ignoring
423 / top 5 bits of address. Then hide the op-code
425 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+2];
429 else if (IS_R_J19(mode)) {
430 /* 19 bit jump destination for DS80C390. Forms
431 / three byte instruction with op-code bits
433 / rtp points at 4 byte locus: first three
434 / will get the instructiion. fourth one
438 /* Calculate absolute destination
439 / relv must be on same 512K page as pc
441 relv = adw_24(reli, rtp);
443 if ((relv & ~0x7ffff) != ((pc + rtp - rtofst) & ~0x7ffff)) {
447 /* Merge MSB (byte 0) with op-code, ignoring
448 / top 5 bits of address. Then hide the op-code
450 rtval[rtp] = ((rtval[rtp] & 0x07)<<5) | rtval[rtp+3];
454 else if (IS_C24(mode))
457 relv = adw_24(reli, rtp);
461 /* 16 bit address. */
462 relv = adw_w(reli, rtp);
466 * R_BYTE with R_BYT2 offset adjust
475 * Unsigned Byte Checking
477 if (mode & R_USGN && mode & R_BYTE && relv & ~0xFF)
481 * PCR Relocation Error Checking
483 if (mode & R_PCR && mode & R_BYTE) {
485 if (r != (Addr_T) ~0x7F && r != 0)
490 * Page Relocation Error Checking
492 /* if (mode & R_PAG0 && (relv & ~0xFF || paga || pags))
494 if (mode & R_PAG && (relv & ~0xFF))
501 rerr.aindex = aindex;
503 rerr.rtbase = rtbase + rtp - rtofst - 1;
504 rerr.rindex = rindex;
505 rerr.rval = relv - reli;
506 relerr(errmsg[error-1]);
513 /* JLH: output only if data (beyond two byte address) */
514 if ((oflag == 1) && (rtcnt > 2)) {
515 // int extendedAddress = (a[aindex]->a_addr >> 16) & 0xffff;
517 /* Boy, is this a hack: for ABS sections, the
518 * base address is stored as zero, and the T records
519 * indicate the offset from zero.
521 * Since T records can only indicate a 16 bit offset, this
522 * obviously creates a problem for ABS segments located
523 * above 64K (this is only meaningful in flat24 mode).
525 * However, the size of an ABS area is stored as
526 * base address + section size (I suspect this is a bug,
527 * but it's a handy one right now). So the upper 8 bits of
528 * the 24 bit address are stored in the size record.
531 * This is another reason why we can't have areas greater
532 * than 64K yet, even in flat24 mode.
534 // extendedAddress += ((a[aindex]->a_size) >> 16 & 0xffff);
535 // commented out by jr
537 if (lastAreaIndex != aindex) {
538 lastAreaIndex = aindex;
542 if (extendedAddress != lastExtendedAddress)
545 if (lastExtendedAddress!=-1) {
546 printf("output extended linear address record 0x%x 0x%x\n",
547 extendedAddress, lastExtendedAddress);
552 ihxEntendedLinearAddress(extendedAddress);
554 else if (extendedAddress)
556 /* Not allowed to generate extended address records,
557 * but one is called for here...
560 "warning: extended linear address encountered; "
561 "you probably want the -r flag.\n");
563 lastExtendedAddress = extendedAddress;
568 if ((oflag == 2) && (rtcnt > 2)) {
571 if ((oflag == 3) && (rtcnt > 2)) {
577 "Unsigned Byte error",
578 "Byte PCR relocation error",
579 "Page0 relocation error",
580 "Page Mode relocation error"
584 /*)Function VOID relp()
586 * The function relp() evaluates a P line read by
587 * the linker. The P line data is combined with the
588 * previous T line data to set the base page address
589 * and test the paging boundary and length.
593 * P 0 0 nn nn n1 n2 xx xx
595 * The P line provides the paging information to the linker as
596 * specified by a .setdp directive. The format of the relocation
597 * information is identical to that of the R line. The correspond-
598 * ing T line has the following information:
599 * T xx xx aa aa bb bb
601 * Where aa aa is the area reference number which specifies the
602 * selected page area and bb bb is the base address of the page.
603 * bb bb will require relocation processing if the 'n1 n2 xx xx' is
604 * specified in the P line. The linker will verify that the base
605 * address is on a 256 byte boundary and that the page length of an
606 * area defined with the PAG type is not larger than 256 bytes.
609 * areax **a pointer to array of area pointers
610 * int aindex area index
611 * int mode relocation mode
612 * Addr_T relv relocation value
613 * int rindex symbol / area index
614 * int rtp index into T data
615 * sym **s pointer to array of symbol pointers
618 * head *hp pointer to the head structure
619 * int lkerr error flag
620 * sdp sdp base page structure
621 * FILE *stderr standard error device
624 * Addr_T adw_w() lkrloc.c
625 * Addr_T evword() lkrloc.c
626 * int eval() lkeval.c
627 * int fprintf() c_library
629 * int symval() lksym.c
632 * The P and T lines are combined to set
633 * the base page address and report any
640 register int aindex, rindex;
647 * Get area and symbol lists
655 if (eval() != (R_WORD | R_AREA) || eval()) {
656 fprintf(stderr, "P input error\n");
664 if (aindex >= hp->h_narea) {
665 fprintf(stderr, "P area error\n");
671 * Do remaining relocations
679 * R_SYM or R_AREA references
682 if (rindex >= hp->h_nglob) {
683 fprintf(stderr, "P symbol error\n");
687 relv = symval(s[rindex]);
689 if (rindex >= hp->h_narea) {
690 fprintf(stderr, "P area error\n");
694 relv = a[rindex]->a_addr;
703 if (aindex >= hp->h_narea) {
704 fprintf(stderr, "P area error\n");
708 sdp.s_areax = a[aindex];
709 sdp.s_area = sdp.s_areax->a_bap;
710 sdp.s_addr = adw_w(0,4);
711 if (sdp.s_area->a_addr & 0xFF || sdp.s_addr & 0xFF)
712 relerp("Page Definition Boundary Error");
715 /*)Function VOID rele()
717 * The function rele() closes all open output files
718 * at the end of the linking process.
724 * int oflag output type flag
725 * int uflag relocation listing flag
730 * VOID lkulist() lklist.c
734 * All open output files are closed.
754 /*)Function Addr_T evword()
756 * The function evword() combines two byte values
757 * into a single word value.
760 * Addr_T v temporary evaluation variable
763 * hilo byte ordering parameter
766 * int eval() lkeval.c
769 * Relocation text line is scanned to combine
770 * two byte values into a single word value.
788 /*)Function Addr_T adb_b(v, i)
790 * int v value to add to byte
791 * int i rtval[] index
793 * The function adb_b() adds the value of v to
794 * the single byte value contained in rtval[i].
795 * The new value of rtval[i] is returned.
807 * The value of rtval[] is changed.
811 Addr_T adb_b(register Addr_T v, register int i)
813 return(rtval[i] += v);
816 /*)Function Addr_T adb_lo(v, i)
818 * int v value to add to byte
819 * int i rtval[] index
821 * The function adb_lo() adds the value of v to the
822 * double byte value contained in rtval[i] and rtval[i+1].
823 * The new value of rtval[i] / rtval[i+1] is returned.
824 * The MSB rtflg[] is cleared.
827 * Addr_T j temporary evaluation variable
830 * hilo byte ordering parameter
836 * The value of rtval[] is changed.
837 * The rtflg[] value corresponding to the
838 * MSB of the word value is cleared to reflect
839 * the fact that the LSB is the selected byte.
843 Addr_T adb_lo(Addr_T v, int i)
859 /*)Function Addr_T adb_hi(v, i)
861 * int v value to add to byte
862 * int i rtval[] index
864 * The function adb_hi() adds the value of v to the
865 * double byte value contained in rtval[i] and rtval[i+1].
866 * The new value of rtval[i] / rtval[i+1] is returned.
867 * The LSB rtflg[] is cleared.
870 * Addr_T j temporary evaluation variable
873 * hilo byte ordering parameter
879 * The value of rtval[] is changed.
880 * The rtflg[] value corresponding to the
881 * LSB of the word value is cleared to reflect
882 * the fact that the MSB is the selected byte.
886 Addr_T adb_hi(Addr_T v, int i)
902 /*)Function Addr_T adb_24_hi(v, i)
904 * int v value to add to byte
905 * int i rtval[] index
907 * The function adb_24_hi() adds the value of v to the
908 * 24 bit value contained in rtval[i] - rtval[i+2].
909 * The new value of rtval[i] / rtval[i+1] is returned.
910 * The LSB & middle byte rtflg[] is cleared.
913 * Addr_T j temporary evaluation variable
916 * hilo byte ordering parameter
922 * The value of rtval[] is changed.
923 * The rtflg[] value corresponding to the
924 * LSB & middle byte of the word value is cleared to
925 * reflect the fact that the MSB is the selected byte.
929 Addr_T adb_24_hi(Addr_T v, int i)
935 /* Remove the lower two bytes. */
949 /*)Function Addr_T adb_24_mid(v, i)
951 * int v value to add to byte
952 * int i rtval[] index
954 * The function adb_24_mid() adds the value of v to the
955 * 24 bit value contained in rtval[i] - rtval[i+2].
956 * The new value of rtval[i] / rtval[i+1] is returned.
957 * The LSB & MSB byte rtflg[] is cleared.
960 * Addr_T j temporary evaluation variable
963 * hilo byte ordering parameter
969 * The value of rtval[] is changed.
970 * The rtflg[] value corresponding to the
971 * LSB & MSB of the 24 bit value is cleared to reflect
972 * the fact that the middle byte is the selected byte.
976 Addr_T adb_24_mid(Addr_T v, int i)
982 /* remove the MSB & LSB. */
989 /*)Function Addr_T adb_24_lo(v, i)
991 * int v value to add to byte
992 * int i rtval[] index
994 * The function adb_24_lo() adds the value of v to the
995 * 24 bit value contained in rtval[i] - rtval[i+2].
996 * The new value of rtval[i] / rtval[i+1] is returned.
997 * The MSB & middle byte rtflg[] is cleared.
1000 * Addr_T j temporary evaluation variable
1003 * hilo byte ordering parameter
1009 * The value of rtval[] is changed.
1010 * The rtflg[] value corresponding to the
1011 * MSB & middle byte of the word value is cleared to
1012 * reflect the fact that the LSB is the selected byte.
1016 Addr_T adb_24_lo(Addr_T v, int i)
1022 /* Remove the upper two bytes. */
1036 /*)Function Addr_T adw_w(v, i)
1038 * int v value to add to word
1039 * int i rtval[] index
1041 * The function adw_w() adds the value of v to the
1042 * word value contained in rtval[i] and rtval[i+1].
1043 * The new value of rtval[i] / rtval[i+1] is returned.
1046 * Addr_T j temporary evaluation variable
1049 * hilo byte ordering parameter
1055 * The word value of rtval[] is changed.
1059 Addr_T adw_w(register Addr_T v, register int i)
1064 j = v + (rtval[i] << 8) + (rtval[i+1] & 0xff);
1065 rtval[i] = (j >> 8) & 0xff;
1066 rtval[i+1] = j & 0xff;
1068 j = v + (rtval[i] & 0xff) + (rtval[i+1] << 8);
1069 rtval[i] = j & 0xff;
1070 rtval[i+1] = (j >> 8) & 0xff;
1075 /*)Function Addr_T adw_24(v, i)
1077 * int v value to add to word
1078 * int i rtval[] index
1080 * The function adw_w() adds the value of v to the
1081 * 24 bit value contained in rtval[i] - rtval[i+2].
1082 * The new value of rtval[i] - rtval[i+2] is returned.
1085 * Addr_T j temporary evaluation variable
1088 * hilo byte ordering parameter
1094 * The word value of rtval[] is changed.
1097 Addr_T adw_24(Addr_T v, int i)
1102 j = v + ((rtval[i] & 0xff) << 16)
1103 + ((rtval[i+1] & 0xff) << 8)
1104 + (rtval[i+2] & 0xff);
1105 rtval[i] = (j >> 16) & 0xff;
1106 rtval[i+1] = (j >> 8) & 0xff;
1107 rtval[i+2] = j & 0xff;
1109 j = v + (rtval[i] & 0xff)
1110 + ((rtval[i+1] & 0xff) << 8)
1111 + ((rtval[i+2] & 0xff) << 16);
1112 rtval[i] = j & 0xff;
1113 rtval[i+1] = (j >> 8) & 0xff;
1114 rtval[i+2] = (j >> 16) & 0xff;
1119 /*)Function Addr_T adw_lo(v, i)
1121 * int v value to add to byte
1122 * int i rtval[] index
1124 * The function adw_lo() adds the value of v to the
1125 * double byte value contained in rtval[i] and rtval[i+1].
1126 * The new value of rtval[i] / rtval[i+1] is returned.
1127 * The MSB rtval[] is zeroed.
1130 * Addr_T j temporary evaluation variable
1133 * hilo byte ordering parameter
1139 * The value of rtval[] is changed.
1140 * The MSB of the word value is cleared to reflect
1141 * the fact that the LSB is the selected byte.
1145 Addr_T adw_lo(Addr_T v, int i)
1161 /*)Function Addr_T adw_hi(v, i)
1163 * int v value to add to byte
1164 * int i rtval[] index
1166 * The function adw_hi() adds the value of v to the
1167 * double byte value contained in rtval[i] and rtval[i+1].
1168 * The new value of rtval[i] / rtval[i+1] is returned.
1169 * The MSB and LSB values are interchanged.
1170 * The MSB rtval[] is zeroed.
1173 * Addr_T j temporary evaluation variable
1176 * hilo byte ordering parameter
1182 * The value of rtval[] is changed.
1183 * The MSB and LSB values are interchanged and
1184 * then the MSB cleared.
1188 Addr_T adw_hi(Addr_T v, int i)
1194 * LSB = MSB, Clear MSB
1197 rtval[i+1] = rtval[i];
1200 rtval[i] = rtval[i+1];
1206 /*)Function VOID relerr(str)
1208 * char *str error string
1210 * The function relerr() outputs the error string to
1211 * stderr and to the map file (if it is open).
1217 * FILE *mfp handle for the map file
1220 * VOID errdmp() lkrloc.c
1223 * Error message inserted into map file.
1227 VOID relerr(char *str)
1229 errdmp(stderr, str);
1234 /*)Function VOID errdmp(fptr, str)
1236 * FILE *fptr output file handle
1237 * char *str error string
1239 * The function errdmp() outputs the error string str
1240 * to the device specified by fptr. Additional information
1241 * is output about the definition and referencing of
1242 * the symbol / area error.
1245 * int mode error mode
1246 * int aindex area index
1247 * int lkerr error flag
1248 * int rindex error index
1249 * sym **s pointer to array of symbol pointers
1250 * areax **a pointer to array of area pointers
1251 * areax *raxp error area extension pointer
1254 * sdp sdp base page structure
1257 * int fprintf() c_library
1258 * VOID prntval() lkrloc.c
1265 VOID errdmp(FILE *fptr, char *str)
1267 int mode, aindex, rindex;
1276 aindex = rerr.aindex;
1277 rindex = rerr.rindex;
1282 fprintf(fptr, "\n?ASlink-Warning-%s", str);
1286 * Print symbol if symbol based
1289 fprintf(fptr, " for symbol %s\n",
1290 &s[rindex]->s_id[0]);
1292 fprintf(fptr, "\n");
1299 " file module area offset\n");
1301 " Refby %-8.8s %-8.8s %-8.8s ",
1304 &a[aindex]->a_bap->a_id[0]);
1305 prntval(fptr, rerr.rtbase);
1311 raxp = s[rindex]->s_axp;
1316 " Defin %-8.8s %-8.8s %-8.8s ",
1317 raxp->a_bhp->h_lfile->f_idp,
1318 &raxp->a_bhp->m_id[0],
1319 &raxp->a_bap->a_id[0]);
1321 prntval(fptr, s[rindex]->s_addr);
1323 prntval(fptr, rerr.rval);
1327 /*)Function VOID prntval(fptr, v)
1329 * FILE *fptr output file handle
1330 * Addr_T v value to output
1332 * The function prntval() outputs the value v, in the
1333 * currently selected radix, to the device specified
1340 * int xflag current radix
1343 * int fprintf() c_library
1350 VOID prntval(FILE *fptr, Addr_T v)
1353 fprintf(fptr, "%04X\n", v);
1356 fprintf(fptr, "%06o\n", v);
1359 fprintf(fptr, "%05u\n", v);
1363 /*)Function VOID relerp(str)
1365 * char *str error string
1367 * The function relerp() outputs the paging error string to
1368 * stderr and to the map file (if it is open).
1374 * FILE *mfp handle for the map file
1377 * VOID erpdmp() lkrloc.c
1380 * Error message inserted into map file.
1384 VOID relerp(char *str)
1386 erpdmp(stderr, str);
1391 /*)Function VOID erpdmp(fptr, str)
1393 * FILE *fptr output file handle
1394 * char *str error string
1396 * The function erpdmp() outputs the error string str
1397 * to the device specified by fptr.
1400 * head *thp pointer to head structure
1403 * int lkerr error flag
1404 * sdp sdp base page structure
1407 * int fprintf() c_library
1408 * VOID prntval() lkrloc.c
1415 VOID erpdmp(FILE *fptr, char *str)
1417 register struct head *thp;
1419 thp = sdp.s_areax->a_bhp;
1424 fprintf(fptr, "\n?ASlink-Warning-%s\n", str);
1431 " file module pgarea pgoffset\n");
1433 " PgDef %-8.8s %-8.8s %-8.8s ",
1434 thp->h_lfile->f_idp,
1436 &sdp.s_area->a_id[0]);
1437 prntval(fptr, sdp.s_area->a_addr + sdp.s_addr);