* as/link/aslink.h,
[fw/sdcc] / as / link / aslink.h
1 /* aslink.h */
2
3 /*
4  * (C) Copyright 1989-1996
5  * All Rights Reserved
6  *
7  * Alan R. Baldwin
8  * 721 Berkeley St.
9  * Kent, Ohio  44240
10  *
11  * 28-Oct-97 JLH:
12  *           - add proto for StoreString
13  *           - change s_id from [NCPS] to pointer
14  *           - change NCPS to 80
15  *           - case sensitive
16  *           - add R_J11 for 8051 assembler
17  * 31-Oct-97 JLH:
18  *           - add jflag and jfp for NoICE output
19  * 30-Jan-98 JLH:
20  *           - add memory space flags to a_flag for 8051
21  *
22  * Extensions: P. Felber
23  */
24
25 #define VERSION "V01.75 + NoICE + SDCC Feb 1999"
26
27 /*
28  * Case Sensitivity Flag
29  */
30 #define CASE_SENSITIVE  1
31
32 /*)Module       asmlnk.h
33  *
34  *      The module asmlnk.h contains the definitions for constants,
35  *      structures, global variables, and LKxxxx functions
36  *      contained in the LKxxxx.c files.
37  */
38
39 /*)BUILD
40         $(PROGRAM) =    ASLINK
41         $(INCLUDE) =    ASLINK.H
42         $(FILES) = {
43                 LKMAIN.C
44                 LKLEX.C
45                 LKAREA.C
46                 LKHEAD.C
47                 LKSYM.C
48                 LKEVAL.C
49                 LKDATA.C
50                 LKLIST.C
51                 LKRLOC.C
52                 LKLIBR.C
53                 LKS19.C
54                 LKIHX.C
55         }
56         $(STACK) = 2000
57 */
58
59 /* DECUS C void definition */
60 /* File/extension seperator */
61
62 #ifdef  decus
63 #define VOID    char
64 #define FSEPX   '.'
65 #endif
66
67 /* PDOS C void definition */
68 /* File/extension seperator */
69
70 #ifdef  PDOS
71 #define VOID    char
72 #define FSEPX   ':'
73 #endif
74
75 /* Default void definition */
76 /* File/extension seperator */
77
78 #ifndef VOID
79 #define VOID    void
80 #define FSEPX   '.'
81 #define OTHERSYSTEM
82 #endif
83
84 /*
85  * PATH_MAX
86  */
87 #include <limits.h>
88 #ifndef PATH_MAX                /* POSIX, but not required   */
89  #if defined(__BORLANDC__) || defined(_MSC_VER)
90   #include <stdlib.h>
91   #define PATH_MAX      _MAX_PATH
92  #else
93   #define PATH_MAX      255     /* define a reasonable value */
94  #endif
95 #endif
96
97 /*
98  * This file defines the format of the
99  * relocatable binary file.
100  */
101
102 #define NCPS    80              /* characters per symbol (JLH: change from 8) */
103 #define NDATA   16              /* actual data */
104 #define NINPUT  PATH_MAX        /* Input buffer size */
105 #define NHASH   64              /* Buckets in hash table */
106 #define HMASK   077             /* Hash mask */
107 #define NLPP    60              /* Lines per page */
108 #define NTXT    16              /* T values */
109
110 /*
111  *      The "R_" relocation constants define values used in
112  *      generating the assembler relocation output data for
113  *      areas, symbols, and code.
114  *
115  *
116  *      Relocation types.
117  *
118  *             7     6     5     4     3     2     1     0
119  *          +-----+-----+-----+-----+-----+-----+-----+-----+
120  *          | MSB | PAGn| PAG0| USGN| BYT2| PCR | SYM | BYT |
121  *          +-----+-----+-----+-----+-----+-----+-----+-----+
122  */
123
124 #define R_WORD  0x00            /* 16 bit */
125 #define R_BYTE  0x01            /*  8 bit */
126
127 #define R_AREA  0x00            /* Base type */
128 #define R_SYM   0x02
129
130 #define R_NORM  0x00            /* PC adjust */
131 #define R_PCR   0x04
132
133 #define R_BYT1  0x00            /* Byte count for R_BYTE = 1 */
134 #define R_BYT2  0x08            /* Byte count for R_BYTE = 2 */
135
136 #define R_SGND  0x00            /* Signed Byte */
137 #define R_USGN  0x10            /* Unsigned Byte */
138
139 #define R_NOPAG 0x00            /* Page Mode */
140 #define R_PAG0  0x20            /* Page '0' */
141 #define R_PAG   0x40            /* Page 'nnn' */
142
143 #define R_LSB   0x00            /* low byte */
144 #define R_MSB   0x80            /* high byte */
145
146 #define R_BYT3  0x100           /* if R_BYTE is set, this is a
147                                  * 3 byte address, of which
148                                  * the linker must select one byte.
149                                  */
150 #define R_HIB   0x200           /* If R_BYTE & R_BYT3 are set, linker
151                                  * will select byte 3 of the relocated
152                                  * 24 bit address.
153                                  */
154
155 #define R_BIT   0x400           /* Linker will convert from byte-addressable
156                                  * space to bit-addressable space.
157                                  */
158
159 #define R_J11   (R_WORD|R_BYT2) /* JLH: 11 bit JMP and CALL (8051) */
160 #define R_J19   (R_WORD|R_BYT2|R_MSB) /* 19 bit JMP/CALL (DS80C390) */
161 #define R_C24   (R_WORD|R_BYT1|R_MSB) /* 24 bit address (DS80C390) */
162 #define R_J19_MASK (R_BYTE|R_BYT2|R_MSB)
163
164 #define IS_R_J19(x) (((x) & R_J19_MASK) == R_J19)
165 #define IS_R_J11(x) (((x) & R_J19_MASK) == R_J11)
166 #define IS_C24(x) (((x) & R_J19_MASK) == R_C24)
167
168 #define R_ESCAPE_MASK   0xf0    /* Used to escape relocation modes
169                                  * greater than 0xff in the .rel
170                                  * file.
171                                  */
172
173 /*
174  * Global symbol types.
175  */
176 #define S_REF   1               /* referenced */
177 #define S_DEF   2               /* defined */
178
179 /*
180  * Area type flags
181  */
182 #define A_CON     0000          /* concatenate */
183 #define A_OVR     0004          /* overlay */
184 #define A_REL     0000          /* relocatable */
185 #define A_ABS     0010          /* absolute */
186 #define A_NOPAG   0000          /* non-paged */
187 #define A_PAG     0020          /* paged */
188
189 /* Additional flags for 8051 address spaces */
190 #define A_DATA    0000          /* data space (default)*/
191 #define A_CODE    0040          /* code space */
192 #define A_XDATA   0100          /* external data space */
193 #define A_BIT     0200          /* bit addressable space */
194
195 /* Additional flags for hc08 */
196 #define A_NOLOAD  0400          /* nonloadable */
197 #define A_LOAD    0000          /* loadable (default) */
198
199 /*
200  * File types
201  */
202 #define F_INV   0               /* invalid */
203 #define F_STD   1               /* stdin */
204 #define F_LNK   2               /* File.lnk */
205 #define F_REL   3               /* File.rel */
206 #define F_CMD   4               /* Command line */
207
208 #ifdef GAMEBOY
209 /*
210  * Multiple banks support
211  */
212 extern int nb_rom_banks;
213 extern int nb_ram_banks;
214 extern int current_rom_bank;
215 extern int mbc_type;
216 extern char cart_name[];
217 /*
218  * ROM patching support
219  */
220 typedef struct _patch {
221   unsigned int addr;
222   unsigned char value;
223   struct _patch *next;
224 } patch;
225 extern patch* patches;
226 #endif /* GAMEBOY */
227
228 /*
229  *      General assembler address type
230  */
231 typedef unsigned int Addr_T;
232
233 /*
234  *      The structures of head, area, areax, and sym are created
235  *      as the REL files are read during the first pass of the
236  *      linker.  The struct head is created upon encountering a
237  *      H directive in the REL file.  The structure contains a
238  *      link to a link file structure (struct lfile) which describes
239  *      the file containing the H directive, the number of data/code
240  *      areas contained in this header segment, the number of
241  *      symbols referenced/defined in this header segment, a pointer
242  *      to an array of pointers to areax structures (struct areax)
243  *      created as each A directive is read, and a pointer to an
244  *      array of pointers to symbol structures (struct sym) for
245  *      all referenced/defined symbols.  As H directives are read
246  *      from the REL files a linked list of head structures is
247  *      created by placing a link to the new head structure
248  *      in the previous head structure.
249  */
250 struct  head
251 {
252         struct  head   *h_hp;   /* Header link */
253         struct  lfile  *h_lfile;/* Associated file */
254         int     h_narea;        /* # of areas */
255         struct  areax **a_list; /* Area list */
256         int     h_nglob;        /* # of global symbols */
257         struct  sym   **s_list; /* Globle symbol list */
258         char    m_id[NCPS];     /* Module name */
259 };
260
261 /*
262  *      A structure area is created for each 'unique' data/code
263  *      area definition found as the REL files are read.  The
264  *      struct area contains the name of the area, a flag byte
265  *      which contains the area attributes (REL/CON/OVR/ABS),
266  *      an area subtype (not used in this assembler), and the
267  *      area base address and total size which will be filled
268  *      in at the end of the first pass through the REL files.
269  *      As A directives are read from the REL files a linked
270  *      list of unique area structures is created by placing a
271  *      link to the new area structure in the previous area structure.
272  */
273 struct  area
274 {
275         struct  area    *a_ap;  /* Area link */
276         struct  areax   *a_axp; /* Area extension link */
277         Addr_T  a_addr;         /* Beginning address of area */
278         Addr_T  a_size;         /* Total size of the area */
279         Addr_T  a_unaloc;       /* Total number of unallocated bytes, for error reporting */
280         char    a_type;         /* Area subtype */
281         char    a_flag;         /* Flag byte */
282         char    a_id[NCPS];     /* Name */
283 };
284
285 /*
286  *      An areax structure is created for every A directive found
287  *      while reading the REL files.  The struct areax contains a
288  *      link to the 'unique' area structure referenced by the A
289  *      directive and to the head structure this area segment is
290  *      a part of.  The size of this area segment as read from the
291  *      A directive is placed in the areax structure.  The beginning
292  *      address of this segment will be filled in at the end of the
293  *      first pass through the REL files.  As A directives are read
294  *      from the REL files a linked list of areax structures is
295  *      created for each unique area.  The final areax linked
296  *      list has at its head the 'unique' area structure linked
297  *      to the linked areax structures (one areax structure for
298  *      each A directive for this area).
299  */
300 struct  areax
301 {
302         struct  areax   *a_axp; /* Area extension link */
303         struct  area    *a_bap; /* Base area link */
304         struct  head    *a_bhp; /* Base header link */
305         Addr_T  a_addr;         /* Beginning address of section */
306         Addr_T  a_size;         /* Size of the area in section */
307 };
308
309 /*
310  *      A sym structure is created for every unique symbol
311  *      referenced/defined while reading the REL files.  The
312  *      struct sym contains the symbol's name, a flag value
313  *      (not used in this linker), a symbol type denoting
314  *      referenced/defined, and an address which is loaded
315  *      with the relative address within the area in which
316  *      the symbol was defined.  The sym structure also
317  *      contains a link to the area where the symbol was defined.
318  *      The sym structures are linked into linked lists using
319  *      the symbol link element.
320  */
321 struct  sym
322 {
323         struct  sym     *s_sp;  /* Symbol link */
324         struct  areax   *s_axp; /* Symbol area link */
325         char    s_type;         /* Symbol subtype */
326         char    s_flag;         /* Flag byte */
327         Addr_T  s_addr;         /* Address */
328         char    *s_id;          /* Name: JLH change from [NCPS] */
329 };
330
331 /*
332  *      The structure lfile contains a pointer to a
333  *      file specification string, the file type, and
334  *      a link to the next lfile structure.
335  */
336 struct  lfile
337 {
338         struct  lfile   *f_flp; /* lfile link */
339         int     f_type;         /* File type */
340         char    *f_idp;         /* Pointer to file spec */
341 };
342
343 /*
344  *      The struct base contains a pointer to a
345  *      base definition string and a link to the next
346  *      base structure.
347  */
348 struct  base
349 {
350         struct  base  *b_base;  /* Base link */
351         char          *b_strp;  /* String pointer */
352 };
353
354 /*
355  *      The struct globl contains a pointer to a
356  *      global definition string and a link to the next
357  *      global structure.
358  */
359 struct  globl
360 {
361         struct  globl *g_globl; /* Global link */
362         char          *g_strp;  /* String pointer */
363 };
364
365 /*
366  *      A structure sdp is created for each 'unique' paged
367  *      area definition found as the REL files are read.
368  *      As P directives are read from the REL files a linked
369  *      list of unique sdp structures is created by placing a
370  *      link to the new sdp structure in the previous area structure.
371  */
372 struct  sdp
373 {
374         struct  area  *s_area;  /* Paged Area link */
375         struct  areax *s_areax; /* Paged Area Extension Link */
376         Addr_T  s_addr;         /* Page address offset */
377 };
378
379 /*
380  *      The structure rerr is loaded with the information
381  *      required to report an error during the linking
382  *      process.  The structure contains an index value
383  *      which selects the areax structure from the header
384  *      areax structure list, a mode value which selects
385  *      symbol or area relocation, the base address in the
386  *      area section, an area/symbol list index value, and
387  *      an area/symbol offset value.
388  */
389 struct  rerr
390 {
391         int     aindex;         /* Linking area */
392         int     mode;           /* Relocation mode */
393         Addr_T  rtbase;         /* Base address in section */
394         int     rindex;         /* Area/Symbol reloaction index */
395         Addr_T  rval;           /* Area/Symbol offset value */
396 };
397
398 /*
399  *      The structure lbpath is created for each library
400  *      path specification input by the -k option.  The
401  *      lbpath structures are linked into a list using
402  *      the next link element.
403  */
404 struct lbpath {
405         struct  lbpath  *next;
406         char            *path;
407 };
408
409 /*
410  *      The structure lbname is created for all combinations of the
411  *      library path specifications (input by the -k option) and the
412  *      library file specifications (input by the -l option) that
413  *      lead to an existing file.  The element path points to
414  *      the path string, element libfil points to the library
415  *      file string, and the element libspc is the concatenation
416  *      of the valid path and libfil strings.
417  *
418  *      The lbpath structures are linked into a list
419  *      using the next link element.
420  *
421  *      Each library file contains a list of object files
422  *      that are contained in the particular library. e.g.:
423  *
424  *              \iolib\termio
425  *              \inilib\termio
426  *
427  *      Only one specification per line is allowed.
428  */
429 struct lbname {
430         struct  lbname  *next;
431         char            *path;
432         char            *libfil;
433         char            *libspc;
434 };
435
436 /*
437  *      The function fndsym() searches through all combinations of the
438  *      library path specifications (input by the -k option) and the
439  *      library file specifications (input by the -l option) that
440  *      lead to an existing file for a symbol definition.
441  *
442  *      The structure lbfile is created for the first library
443  *      object file which contains the definition for the
444  *      specified undefined symbol.
445  *
446  *      The element libspc points to the library file path specification
447  *      and element relfil points to the object file specification string.
448  *      The element filspc is the complete path/file specification for
449  *      the library file to be imported into the linker.  The
450  *      file specicifation may be formed in one of two ways:
451  *
452  *      (1)     If the library file contained an absolute
453  *              path/file specification then this becomes filspc.
454  *              (i.e. C:\...)
455  *
456  *      (2)     If the library file contains a relative path/file
457  *              specification then the concatenation of the path
458  *              and this file specification becomes filspc.
459  *              (i.e. \...)
460  *
461  *      The lbpath structures are linked into a list
462  *      using the next link element.
463  */
464 struct lbfile {
465         struct  lbfile  *next;
466         char            *libspc;
467         char            *relfil;
468         char            *filspc;
469         long            offset; /*>=0 if rel file is embedded in a lib file at this offset*/
470 };
471
472 /*
473  *      External Definitions for all Global Variables
474  */
475
476 extern  char    *_abs_;         /*      = { ".  .ABS." };
477                                  */
478 extern  int     lkerr;          /*      ASLink error flag
479                                  */
480 extern  char    *ip;            /*      pointer into the REL file
481                                  *      text line in ib[]
482                                  */
483 extern  char    ib[NINPUT];     /*      REL file text line
484                                  */
485 extern  char    *rp;            /*      pointer into the LST file
486                                  *      text line in rb[]
487                                  */
488 extern  char    rb[NINPUT];     /*      LST file text line being
489                                  *      address relocated
490                                  */
491 extern  unsigned char   ctype[];        /*      array of character types, one per
492                                  *      ASCII character
493                                  */
494
495 extern char sdccopt[NINPUT];
496 extern char sdccopt_module[NINPUT];
497 extern char curr_module[NINPUT];
498
499 /*
500  *      Character Type Definitions
501  */
502 #define SPACE   0000
503 #define ETC     0000
504 #define LETTER  0001
505 #define DIGIT   0002
506 #define BINOP   0004
507 #define RAD2    0010
508 #define RAD8    0020
509 #define RAD10   0040
510 #define RAD16   0100
511 #define ILL     0200
512
513 #define DGT2    DIGIT|RAD16|RAD10|RAD8|RAD2
514 #define DGT8    DIGIT|RAD16|RAD10|RAD8
515 #define DGT10   DIGIT|RAD16|RAD10
516 #define LTR16   LETTER|RAD16
517
518 #if     CASE_SENSITIVE
519 #else
520 extern  char    ccase[];        /*      an array of characters which
521                                  *      perform the case translation function
522                                  */
523 #endif
524
525 extern  struct  lfile   *filep; /*      The pointers (lfile *) filep,
526                                  *      (lfile *) cfp, and (FILE *) sfp
527                                  *      are used in conjunction with
528                                  *      the routine lk_getline() to read
529                                  *      asmlnk commands from
530                                  *      (1) the standard input or
531                                  *      (2) or a command file
532                                  *      and to read the REL files
533                                  *      sequentially as defined by the
534                                  *      asmlnk input commands.
535                                  *
536                                  *      The pointer *filep points to the
537                                  *      beginning of a linked list of
538                                  *      lfile structures.
539                                  */
540 extern  struct  lfile   *cfp;   /*      The pointer *cfp points to the
541                                  *      current lfile structure
542                                  */
543 extern  struct  lfile   *startp;/*      asmlnk startup file structure
544                                  */
545 extern  struct  lfile   *linkp; /*      pointer to first lfile structure
546                                  *      containing an input REL file
547                                  *      specification
548                                  */
549 extern  struct  lfile   *lfp;   /*      pointer to current lfile structure
550                                  *      being processed by parse()
551                                  */
552 extern  struct  head    *headp; /*      The pointer to the first
553                                  *      head structure of a linked list
554                                  */
555 extern  struct  head    *hp;    /*      Pointer to the current
556                                  *      head structure
557                                  */
558 extern  struct  area    *areap; /*      The pointer to the first
559                                  *      area structure of a linked list
560                                  */
561 extern  struct  area    *ap;    /*      Pointer to the current
562                                  *      area structure
563                                  */
564 extern  struct  areax   *axp;   /*      Pointer to the current
565                                  *      areax structure
566                                  */
567 extern  struct  sym *symhash[NHASH]; /* array of pointers to NHASH
568                                       * linked symbol lists
569                                       */
570 extern  struct  base    *basep; /*      The pointer to the first
571                                  *      base structure
572                                  */
573 extern  struct  base    *bsp;   /*      Pointer to the current
574                                  *      base structure
575                                  */
576 extern  struct  globl   *globlp;/*      The pointer to the first
577                                  *      globl structure
578                                  */
579 extern  struct  globl   *gsp;   /*      Pointer to the current
580                                  *      globl structure
581                                  */
582 extern  struct  sdp     sdp;    /*      Base Paged structure
583                                  */
584 extern  struct  rerr    rerr;   /*      Structure containing the
585                                  *      linker error information
586                                  */
587 extern  FILE    *ofp;           /*      Linker Output file handle
588                                  */
589 extern  FILE    *mfp;           /*      Map output file handle
590                                  */
591 extern  FILE    *jfp;           /*      NoICE output file handle
592                                  */
593 extern  FILE    *rfp;           /*      File handle for output
594                                  *      address relocated ASxxxx
595                                  *      listing file
596                                  */
597 extern  FILE    *sfp;           /*      The file handle sfp points to the
598                                  *      currently open file
599                                  */
600 extern  FILE    *tfp;           /*      File handle for input
601                                  *      ASxxxx listing file
602                                  */
603 extern  FILE    *dfp;           /*      File handle for debug info output
604                                  */
605 extern  int     dflag;          /*      Output debug information flag
606                                  */
607 extern  int     oflag;          /*      Output file type flag
608                                  */
609 extern  int     mflag;          /*      Map output flag
610                                  */
611 extern  int     sflag;          /*      JCF: Memory usage output flag
612                                  */
613 extern  int     packflag;       /*      Pack data memory flag
614                                  */
615 extern  int     stacksize;      /*      Pack data memory flag
616                                  */
617 extern  int     jflag;          /*      NoICE output flag
618                                  */
619 extern  int     symflag;        /*      no$gmb .sym output flag
620                                  */
621 extern  int     xflag;          /*      Map file radix type flag
622                                  */
623 extern  int     pflag;          /*      print linker command file flag
624                                  */
625 extern  int     uflag;          /*      Listing relocation flag
626                                  */
627 extern int      rflag;          /*      Extended linear address record flag.
628                                 */
629 extern  int     radix;          /*      current number conversion radix:
630                                  *      2 (binary), 8 (octal), 10 (decimal),
631                                  *      16 (hexadecimal)
632                                  */
633 extern  int     line;           /*      current line number
634                                  */
635 extern  int     page;           /*      current page number
636                                  */
637 extern  int     lop;            /*      current line number on page
638                                  */
639 extern  int     pass;           /*      linker pass number
640                                  */
641 extern  int     rtcnt;          /*      count of elements in the
642                                  *      rtval[] and rtflg[] arrays
643                                  */
644 extern  Addr_T  rtval[];        /*      data associated with relocation
645                                  */
646 extern  int     rtflg[];        /*      indicates if rtval[] value is
647                                  *      to be sent to the output file.
648                                  *      (always set in this linker)
649                                  */
650 extern  int     hilo;           /*      REL file byte ordering
651                                  */
652 extern  int     gline;          /*      LST file relocation active
653                                  *      for current line
654                                  */
655 extern  int     gcntr;          /*      LST file relocation active
656                                  *      counter
657                                  */
658 extern  struct lbpath *lbphead; /*      pointer to the first
659                                  *      library path structure
660                                  */
661 extern  struct lbname *lbnhead; /*      pointer to the first
662                                  *      library name structure
663                                  */
664 extern  struct lbfile *lbfhead; /*      pointer to the first
665                                  *      library file structure
666                                  */
667 extern  Addr_T iram_size;       /*      internal ram size
668                                  */
669 extern  long xram_size;         /*      external ram size
670                                  */
671 extern  long code_size;         /*      code size
672                                  */
673
674
675 /* C Library function definitions */
676 /* for reference only
677 extern  VOID            exit();
678 extern  int             fclose();
679 extern  char *          fgets();
680 extern  FILE *          fopen();
681 extern  int             fprintf();
682 extern  VOID            free();
683 extern  VOID *          malloc();
684 extern  char            putc();
685 extern  char *          strcpy();
686 extern  int             strlen();
687 extern  char *          strncpy();
688 */
689
690 /* Program function definitions */
691
692 /* lkmain.c */
693 extern  FILE *          afile();
694 extern  VOID            bassav();
695 extern  VOID            gblsav();
696 extern  VOID            iramsav();
697 extern  VOID            xramsav();
698 extern  VOID            codesav();
699 extern  VOID            iramcheck();
700 extern  VOID            link_main();
701 extern  VOID            lkexit();
702 extern  int             main();
703 extern  VOID            map();
704 extern  VOID            sym();
705 extern  int             parse();
706 extern  VOID            setbas();
707 extern  VOID            setgbl();
708 extern  VOID            usage();
709 extern  VOID            copyfile();
710
711 /* lklex.c */
712 extern  char            endline();
713 extern  char            get();
714 extern  VOID            getfid();
715 extern  VOID            getid();
716 extern  VOID            getSid(char *id);
717 extern  int             lk_getline();
718 extern  int             getmap();
719 extern  char            getnb();
720 extern  int             more();
721 extern  VOID            skip();
722 extern  VOID            unget();
723 extern  VOID            chop_crlf();
724
725 /* lkarea.c */
726 extern  VOID            lkparea();
727 extern  VOID            lnkarea();
728 extern  VOID            lnkarea2();
729 extern  VOID            newarea();
730
731 /* lkhead.c */
732 extern  VOID            module();
733 extern  VOID            newhead();
734
735 /* lksym.c */
736 extern  int             hash();
737 extern  struct  sym *   lkpsym();
738 extern  VOID *          new();
739 extern  struct  sym *   newsym();
740 extern  VOID            symdef();
741 extern  int             symeq();
742 extern  VOID            syminit();
743 extern  VOID            symmod();
744 extern  Addr_T          symval();
745
746 /* lkeval.c */
747 extern  int             digit();
748 extern  Addr_T          eval();
749 extern  Addr_T          expr();
750 extern  int             oprio();
751 extern  Addr_T          term();
752
753 /* lklist.c */
754 extern  int             dgt();
755 extern  VOID            lkulist();
756 extern  VOID            lkalist();
757 extern  VOID            lkglist();
758 extern  VOID            lstarea();
759 extern  VOID            newpag();
760 extern  VOID            slew();
761
762 /* lkrloc.c */
763 extern  Addr_T          adb_b(register Addr_T v, register int i);
764 extern  Addr_T          adb_bit(register Addr_T v, register int i);
765 extern  Addr_T          adb_hi(Addr_T  v, int i);
766 extern  Addr_T          adb_lo(Addr_T  v, int i);
767 extern  Addr_T          adb_24_bit(register Addr_T v, register int i);
768 extern  Addr_T          adb_24_hi(Addr_T v, int i);
769 extern  Addr_T          adb_24_mid(Addr_T v, int i);
770 extern  Addr_T          adb_24_lo(Addr_T v, int i);
771 extern  Addr_T          adw_w(register Addr_T v, register int i);
772 extern  Addr_T          adw_24(Addr_T v, int i);
773 extern  Addr_T          adw_hi(Addr_T  v, int i);
774 extern  Addr_T          adw_lo(Addr_T  v, int i);
775 extern  Addr_T          evword(VOID);
776 extern  VOID            rele(VOID);
777 extern  VOID            reloc(char c);
778 extern  VOID            relt(VOID);
779 extern  VOID            relr(VOID);
780 extern  VOID            relp(VOID);
781 extern  VOID            relerr(char *str);
782 extern  char *          errmsg[];
783 extern  VOID            errdmp(FILE *fptr, char *str);
784 extern  VOID            relerp(char *str);
785 extern  VOID            erpdmp(FILE *fptr, char *str);
786 extern  VOID            prntval(FILE *fptr, Addr_T v);
787 extern  int             lastExtendedAddress;
788
789 /* lklibr.c */
790 extern  int             addfile();
791 extern  VOID            addlib();
792 extern  VOID            addpath();
793 extern  int             fndsym();
794 extern  VOID            library();
795 extern  VOID            loadfile();
796 extern  VOID            search();
797
798 /* lks19.c */
799 extern  VOID            s19();
800
801 /* lkihx.c */
802 extern  VOID            ihx();
803 extern  VOID            ihxEntendedLinearAddress(Addr_T);
804 extern  VOID            newArea();
805
806 /* lkstore.c */
807 extern  char *          StoreString( char *str );
808
809 /* lknoice.c */
810 extern  void            DefineNoICE( char *name, Addr_T value, int page );
811
812 /* EEP: lkelf.c */
813 extern  VOID            elf();
814
815 /* JCF: lkmem.c */
816 extern int summary(struct area * xp);
817 extern int summary2(struct area * xp);
818
819 /* JCF: lkaomf51.c */
820 extern void SaveLinkedFilePath(char * filepath);
821 extern void CreateAOMF51(void);
822
823 /* lkgb.h */
824 VOID gb(int in);
825 VOID gg(int in);
826
827 /* strcmpi.h */
828 extern int as_strcmpi(const char *s1, const char *s2);
829 extern int as_strncmpi(const char *s1, const char *s2, size_t n);