comparison src/lwlink.h @ 298:96a35a4245f3

reading files implemented
author lost
date Wed, 21 Jan 2009 03:15:49 +0000
parents c52ad3135bd3
children 460d96987670
comparison
equal deleted inserted replaced
297:c52ad3135bd3 298:96a35a4245f3
22 22
23 23
24 #ifndef __lwlink_h_seen__ 24 #ifndef __lwlink_h_seen__
25 #define __lwlink_h_seen__ 25 #define __lwlink_h_seen__
26 26
27 #include "expr.h"
28
27 #define OUTPUT_DECB 0 // DECB multirecord format 29 #define OUTPUT_DECB 0 // DECB multirecord format
28 #define OUTPUT_RAW 1 // raw sequence of bytes 30 #define OUTPUT_RAW 1 // raw sequence of bytes
29 31
32 typedef struct symtab_s symtab_t;
33 struct symtab_s
34 {
35 unsigned char *sym; // symbol name
36 int offset; // local offset
37 int realval; // resolved value
38 symtab_t *next; // next symbol
39 };
40
41 typedef struct reloc_s reloc_t;
42 struct reloc_s
43 {
44 int offset; // where in the section
45 lw_expr_stack_t *expr; // the expression to calculate it
46 reloc_t *next; // ptr to next relocation
47 };
48
49 #define SECTION_BSS 1
50 typedef struct
51 {
52 unsigned char *name; // name of the section
53 int flags; // section flags
54 int codesize; // size of the code
55 unsigned char *code; // pointer to the code
56 int loadaddress; // the actual load address of the section
57
58 symtab_t *localsyms; // local symbol table
59 symtab_t *exportedsyms; // exported symbols table
60
61 reloc_t *incompletes; // table of incomplete references
62 } section_t;
30 63
31 typedef struct 64 typedef struct
32 { 65 {
33 char *filename; 66 char *filename;
34 unsigned char *filedata; 67 unsigned char *filedata;
35 long filesize; 68 long filesize;
69 section_t *sections;
70 int nsections;
71
36 } fileinfo_t; 72 } fileinfo_t;
73
74
37 75
38 #ifndef __lwlink_c_seen__ 76 #ifndef __lwlink_c_seen__
39 77
40 extern int debug_level; 78 extern int debug_level;
41 extern int outformat; 79 extern int outformat;