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