2 * COFF file handling for TCC
4 * Copyright (c) 2003, 2004 TK
5 * Copyright (c) 2004 Fabrice Bellard
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define MAXNSCNS 255 /* MAXIMUM NUMBER OF SECTIONS */
24 #define MAX_STR_TABLE 1000000
25 AOUTHDR o_filehdr
; /* OPTIONAL (A.OUT) FILE HEADER */
27 SCNHDR section_header
[MAXNSCNS
];
29 #define MAX_FUNCS 1000
30 #define MAX_FUNC_NAME_LENGTH 128
33 char Func
[MAX_FUNCS
][MAX_FUNC_NAME_LENGTH
];
34 char AssociatedFile
[MAX_FUNCS
][MAX_FUNC_NAME_LENGTH
];
35 int LineNoFilePtr
[MAX_FUNCS
];
36 int EndAddress
[MAX_FUNCS
];
37 int LastLineNo
[MAX_FUNCS
];
38 int FuncEntries
[MAX_FUNCS
];
40 BOOL
OutputTheSection(Section
* sect
);
41 short int GetCoffFlags(const char *s
);
42 void SortSymbolTable(void);
43 Section
*FindSection(TCCState
* s1
, const char *sname
);
45 int C67_main_entry_point
;
47 int FindCoffSymbolIndex(const char *func_name
);
60 unsigned short lineno
;
61 unsigned short nentries
;
69 unsigned short lineno
;
70 unsigned short dummy1
;
73 unsigned short dummy4
;
76 int tcc_output_coff(TCCState
*s1
, FILE *f
)
81 char *Coff_str_table
, *pCoff_str_table
;
82 int CoffTextSectionNo
, coff_nb_syms
;
83 FILHDR file_hdr
; /* FILE HEADER STRUCTURE */
84 Section
*stext
, *sdata
, *sbss
;
86 stext
= FindSection(s1
, ".text");
87 sdata
= FindSection(s1
, ".data");
88 sbss
= FindSection(s1
, ".bss");
90 nb_syms
= symtab_section
->data_offset
/ sizeof(Elf32_Sym
);
91 coff_nb_syms
= FindCoffSymbolIndex("XXXXXXXXXX1");
93 file_hdr
.f_magic
= COFF_C67_MAGIC
; /* magic number */
94 file_hdr
.f_timdat
= 0; /* time & date stamp */
95 file_hdr
.f_opthdr
= sizeof(AOUTHDR
); /* sizeof(optional hdr) */
96 file_hdr
.f_flags
= 0x1143; /* flags (copied from what code composer does) */
97 file_hdr
.f_TargetID
= 0x99; /* for C6x = 0x0099 */
99 o_filehdr
.magic
= 0x0108; /* see magic.h */
100 o_filehdr
.vstamp
= 0x0190; /* version stamp */
101 o_filehdr
.tsize
= stext
->data_offset
; /* text size in bytes, padded to FW bdry */
102 o_filehdr
.dsize
= sdata
->data_offset
; /* initialized data " " */
103 o_filehdr
.bsize
= sbss
->data_offset
; /* uninitialized data " " */
104 o_filehdr
.entrypt
= C67_main_entry_point
; /* entry pt. */
105 o_filehdr
.text_start
= stext
->sh_addr
; /* base of text used for this file */
106 o_filehdr
.data_start
= sdata
->sh_addr
; /* base of data used for this file */
109 // create all the section headers
111 int i
, NSectionsToOutput
= 0;
113 file_pointer
= FILHSZ
+ sizeof(AOUTHDR
);
115 CoffTextSectionNo
= -1;
117 for (i
= 1; i
< s1
->nb_sections
; i
++) {
118 coff_sec
= §ion_header
[i
];
119 tcc_sect
= s1
->sections
[i
];
121 if (OutputTheSection(tcc_sect
)) {
124 if (CoffTextSectionNo
== -1 && tcc_sect
== stext
)
125 CoffTextSectionNo
= NSectionsToOutput
; // rem which coff sect number the .text sect is
127 strcpy(coff_sec
->s_name
, tcc_sect
->name
); /* section name */
129 coff_sec
->s_paddr
= tcc_sect
->sh_addr
; /* physical address */
130 coff_sec
->s_vaddr
= tcc_sect
->sh_addr
; /* virtual address */
131 coff_sec
->s_size
= tcc_sect
->data_offset
; /* section size */
132 coff_sec
->s_scnptr
= 0; /* file ptr to raw data for section */
133 coff_sec
->s_relptr
= 0; /* file ptr to relocation */
134 coff_sec
->s_lnnoptr
= 0; /* file ptr to line numbers */
135 coff_sec
->s_nreloc
= 0; /* number of relocation entries */
136 coff_sec
->s_flags
= GetCoffFlags(coff_sec
->s_name
); /* flags */
137 coff_sec
->s_reserved
= 0; /* reserved byte */
138 coff_sec
->s_page
= 0; /* memory page id */
140 file_pointer
+= sizeof(SCNHDR
);
144 file_hdr
.f_nscns
= NSectionsToOutput
; /* number of sections */
146 // now loop through and determine file pointer locations
150 for (i
= 1; i
< s1
->nb_sections
; i
++) {
151 coff_sec
= §ion_header
[i
];
152 tcc_sect
= s1
->sections
[i
];
154 if (OutputTheSection(tcc_sect
)) {
156 coff_sec
->s_scnptr
= file_pointer
; /* file ptr to raw data for section */
157 file_pointer
+= coff_sec
->s_size
;
161 // now loop through and determine file pointer locations
162 // for the relocation data
164 for (i
= 1; i
< s1
->nb_sections
; i
++) {
165 coff_sec
= §ion_header
[i
];
166 tcc_sect
= s1
->sections
[i
];
168 if (OutputTheSection(tcc_sect
)) {
169 // put relocations data
170 if (coff_sec
->s_nreloc
> 0) {
171 coff_sec
->s_relptr
= file_pointer
; /* file ptr to relocation */
172 file_pointer
+= coff_sec
->s_nreloc
* sizeof(struct reloc
);
177 // now loop through and determine file pointer locations
178 // for the line number data
180 for (i
= 1; i
< s1
->nb_sections
; i
++) {
181 coff_sec
= §ion_header
[i
];
182 tcc_sect
= s1
->sections
[i
];
184 coff_sec
->s_nlnno
= 0;
185 coff_sec
->s_lnnoptr
= 0;
187 if (do_debug
&& tcc_sect
== stext
) {
188 // count how many line nos data
190 // also find association between source file name and function
191 // so we can sort the symbol table
194 Stab_Sym
*sym
, *sym_end
;
195 char func_name
[MAX_FUNC_NAME_LENGTH
],
196 last_func_name
[MAX_FUNC_NAME_LENGTH
];
197 unsigned long func_addr
, last_pc
, pc
;
198 const char *incl_files
[INCLUDE_STACK_SIZE
];
199 int incl_index
, len
, last_line_num
;
202 coff_sec
->s_lnnoptr
= file_pointer
; /* file ptr to linno */
208 last_func_name
[0] = '\0';
209 last_pc
= 0xffffffff;
211 sym
= (Stab_Sym
*) stab_section
->data
+ 1;
213 (Stab_Sym
*) (stab_section
->data
+
214 stab_section
->data_offset
);
217 while (sym
< sym_end
) {
218 switch (sym
->n_type
) {
219 /* function start or end */
221 if (sym
->n_strx
== 0) {
225 file_pointer
+= LINESZ
;
227 pc
= sym
->n_value
+ func_addr
;
230 EndAddress
[nFuncs
] = pc
;
231 FuncEntries
[nFuncs
] =
233 LineNoFilePtr
[nFuncs
]) / LINESZ
- 1;
234 LastLineNo
[nFuncs
++] = last_line_num
+ 1;
236 // beginning of function
238 LineNoFilePtr
[nFuncs
] = file_pointer
;
240 file_pointer
+= LINESZ
;
243 (const char *) stabstr_section
->data
+
246 p
= strchr(str
, ':');
248 pstrcpy(func_name
, sizeof(func_name
), str
);
249 pstrcpy(Func
[nFuncs
], sizeof(func_name
), str
);
252 if (len
> sizeof(func_name
) - 1)
253 len
= sizeof(func_name
) - 1;
254 memcpy(func_name
, str
, len
);
255 memcpy(Func
[nFuncs
], str
, len
);
256 func_name
[len
] = '\0';
259 // save the file that it came in so we can sort later
260 pstrcpy(AssociatedFile
[nFuncs
], sizeof(func_name
),
261 incl_files
[incl_index
- 1]);
263 func_addr
= sym
->n_value
;
267 /* line number info */
269 pc
= sym
->n_value
+ func_addr
;
272 last_line_num
= sym
->n_desc
;
275 strcpy(last_func_name
, func_name
);
278 file_pointer
+= LINESZ
;
283 (const char *) stabstr_section
->data
+ sym
->n_strx
;
285 if (incl_index
< INCLUDE_STACK_SIZE
) {
286 incl_files
[incl_index
++] = str
;
294 if (sym
->n_strx
== 0) {
295 incl_index
= 0; /* end of translation unit */
298 (const char *) stabstr_section
->data
+
300 /* do not add path */
302 if (len
> 0 && str
[len
- 1] != '/')
313 file_hdr
.f_symptr
= file_pointer
; /* file pointer to symtab */
316 file_hdr
.f_nsyms
= coff_nb_syms
; /* number of symtab entries */
318 file_hdr
.f_nsyms
= 0;
320 file_pointer
+= file_hdr
.f_nsyms
* SYMNMLEN
;
322 // OK now we are all set to write the file
325 fwrite(&file_hdr
, FILHSZ
, 1, f
);
326 fwrite(&o_filehdr
, sizeof(o_filehdr
), 1, f
);
328 // write section headers
329 for (i
= 1; i
< s1
->nb_sections
; i
++) {
330 coff_sec
= §ion_header
[i
];
331 tcc_sect
= s1
->sections
[i
];
333 if (OutputTheSection(tcc_sect
)) {
334 fwrite(coff_sec
, sizeof(SCNHDR
), 1, f
);
339 for (i
= 1; i
< s1
->nb_sections
; i
++) {
340 coff_sec
= §ion_header
[i
];
341 tcc_sect
= s1
->sections
[i
];
343 if (OutputTheSection(tcc_sect
)) {
344 fwrite(tcc_sect
->data
, tcc_sect
->data_offset
, 1, f
);
348 // write relocation data
349 for (i
= 1; i
< s1
->nb_sections
; i
++) {
350 coff_sec
= §ion_header
[i
];
351 tcc_sect
= s1
->sections
[i
];
353 if (OutputTheSection(tcc_sect
)) {
354 // put relocations data
355 if (coff_sec
->s_nreloc
> 0) {
356 fwrite(tcc_sect
->reloc
,
357 coff_sec
->s_nreloc
* sizeof(struct reloc
), 1, f
);
363 // group the symbols in order of filename, func1, func2, etc
364 // finally global symbols
369 // write line no data
371 for (i
= 1; i
< s1
->nb_sections
; i
++) {
372 coff_sec
= §ion_header
[i
];
373 tcc_sect
= s1
->sections
[i
];
375 if (do_debug
&& tcc_sect
== stext
) {
376 // count how many line nos data
379 Stab_Sym
*sym
, *sym_end
;
380 char func_name
[128], last_func_name
[128];
381 unsigned long func_addr
, last_pc
, pc
;
382 const char *incl_files
[INCLUDE_STACK_SIZE
];
383 int incl_index
, len
, last_line_num
;
391 last_func_name
[0] = '\0';
394 sym
= (Stab_Sym
*) stab_section
->data
+ 1;
396 (Stab_Sym
*) (stab_section
->data
+
397 stab_section
->data_offset
);
399 while (sym
< sym_end
) {
400 switch (sym
->n_type
) {
401 /* function start or end */
403 if (sym
->n_strx
== 0) {
406 CoffLineNo
.l_addr
.l_paddr
= last_pc
;
407 CoffLineNo
.l_lnno
= last_line_num
+ 1;
408 fwrite(&CoffLineNo
, 6, 1, f
);
410 pc
= sym
->n_value
+ func_addr
;
414 // beginning of function
417 (const char *) stabstr_section
->data
+
421 p
= strchr(str
, ':');
423 pstrcpy(func_name
, sizeof(func_name
), str
);
426 if (len
> sizeof(func_name
) - 1)
427 len
= sizeof(func_name
) - 1;
428 memcpy(func_name
, str
, len
);
429 func_name
[len
] = '\0';
431 func_addr
= sym
->n_value
;
435 // output a function begin
437 CoffLineNo
.l_addr
.l_symndx
=
438 FindCoffSymbolIndex(func_name
);
439 CoffLineNo
.l_lnno
= 0;
441 fwrite(&CoffLineNo
, 6, 1, f
);
445 /* line number info */
447 pc
= sym
->n_value
+ func_addr
;
451 strcpy(last_func_name
, func_name
);
453 // output a line reference
455 CoffLineNo
.l_addr
.l_paddr
= last_pc
;
457 if (last_line_num
== -1) {
458 CoffLineNo
.l_lnno
= sym
->n_desc
;
460 CoffLineNo
.l_lnno
= last_line_num
+ 1;
463 fwrite(&CoffLineNo
, 6, 1, f
);
466 last_line_num
= sym
->n_desc
;
473 (const char *) stabstr_section
->data
+ sym
->n_strx
;
475 if (incl_index
< INCLUDE_STACK_SIZE
) {
476 incl_files
[incl_index
++] = str
;
484 if (sym
->n_strx
== 0) {
485 incl_index
= 0; /* end of translation unit */
488 (const char *) stabstr_section
->data
+
490 /* do not add path */
492 if (len
> 0 && str
[len
- 1] != '/')
502 // write symbol table
512 char _name
[MAX_FUNCS
];
516 Coff_str_table
= (char *) tcc_malloc(MAX_STR_TABLE
);
517 pCoff_str_table
= Coff_str_table
;
520 p
= (Elf32_Sym
*) symtab_section
->data
;
523 for (i
= 0; i
< nb_syms
; i
++) {
525 /* don't add underscores for Code Composer Version 2.xx */
527 #define ADD_UNDERSCORE 0
529 name
= (char *) symtab_section
->link
->data
+ p
->st_name
;
533 strcpy(_name
+ 1, name
);
538 for (k
= 0; k
< 8; k
++)
539 csym
._n
._n_name
[k
] = 0;
541 if (strlen(_name
) <= 8) {
542 strcpy(csym
._n
._n_name
, _name
);
544 if (pCoff_str_table
- Coff_str_table
+ strlen(_name
) >
546 error("String table too large");
548 csym
._n
._n_n
._n_zeroes
= 0;
549 csym
._n
._n_n
._n_offset
=
550 pCoff_str_table
- Coff_str_table
+ 4;
552 strcpy(pCoff_str_table
, _name
);
553 pCoff_str_table
+= strlen(_name
) + 1; // skip over null
557 if (p
->st_info
== 4) {
558 // put a filename symbol
559 csym
.n_value
= 33; // ?????
560 csym
.n_scnum
= N_DEBUG
;
562 csym
.n_sclass
= C_FILE
;
564 fwrite(&csym
, 18, 1, f
);
567 } else if (p
->st_info
== 0x12) {
568 // find the function data
570 for (k
= 0; k
< nFuncs
; k
++) {
571 if (strcmp(name
, Func
[k
]) == 0)
578 sprintf(s
, "debug info can't find function: %s", name
);
582 // put a Function Name
584 csym
.n_value
= p
->st_value
; // physical address
585 csym
.n_scnum
= CoffTextSectionNo
;
586 csym
.n_type
= MKTYPE(T_INT
, DT_FCN
, 0, 0, 0, 0, 0);
587 csym
.n_sclass
= C_EXT
;
589 fwrite(&csym
, 18, 1, f
);
594 auxfunc
.size
= EndAddress
[k
] - p
->st_value
;
595 auxfunc
.fileptr
= LineNoFilePtr
[k
];
596 auxfunc
.nextsym
= n
+ 6; // tktk
598 fwrite(&auxfunc
, 18, 1, f
);
602 strcpy(csym
._n
._n_name
, ".bf");
603 csym
.n_value
= p
->st_value
; // physical address
604 csym
.n_scnum
= CoffTextSectionNo
;
606 csym
.n_sclass
= C_FCN
;
608 fwrite(&csym
, 18, 1, f
);
614 auxbf
.nentries
= FuncEntries
[k
];
615 auxbf
.localframe
= 0;
616 auxbf
.nextentry
= n
+ 6;
618 fwrite(&auxbf
, 18, 1, f
);
622 strcpy(csym
._n
._n_name
, ".ef");
623 csym
.n_value
= EndAddress
[k
]; // physical address
624 csym
.n_scnum
= CoffTextSectionNo
;
626 csym
.n_sclass
= C_FCN
;
628 fwrite(&csym
, 18, 1, f
);
633 auxef
.lineno
= LastLineNo
[k
];
638 fwrite(&auxef
, 18, 1, f
);
643 // try an put some type info
645 if ((p
->st_other
& VT_BTYPE
) == VT_DOUBLE
) {
646 csym
.n_type
= T_DOUBLE
; // int
647 csym
.n_sclass
= C_EXT
;
648 } else if ((p
->st_other
& VT_BTYPE
) == VT_FLOAT
) {
649 csym
.n_type
= T_FLOAT
;
650 csym
.n_sclass
= C_EXT
;
651 } else if ((p
->st_other
& VT_BTYPE
) == VT_INT
) {
652 csym
.n_type
= T_INT
; // int
653 csym
.n_sclass
= C_EXT
;
654 } else if ((p
->st_other
& VT_BTYPE
) == VT_SHORT
) {
655 csym
.n_type
= T_SHORT
;
656 csym
.n_sclass
= C_EXT
;
657 } else if ((p
->st_other
& VT_BTYPE
) == VT_BYTE
) {
658 csym
.n_type
= T_CHAR
;
659 csym
.n_sclass
= C_EXT
;
661 csym
.n_type
= T_INT
; // just mark as a label
662 csym
.n_sclass
= C_LABEL
;
666 csym
.n_value
= p
->st_value
;
669 fwrite(&csym
, 18, 1, f
);
676 fwrite(&auxfunc
, 18, 1, f
);
687 // write string table
689 // first write the size
690 i
= pCoff_str_table
- Coff_str_table
;
693 // then write the strings
694 fwrite(Coff_str_table
, i
, 1, f
);
696 tcc_free(Coff_str_table
);
704 // group the symbols in order of filename, func1, func2, etc
705 // finally global symbols
707 void SortSymbolTable(void)
710 Elf32_Sym
*p
, *p2
, *NewTable
;
713 NewTable
= (Elf32_Sym
*) tcc_malloc(nb_syms
* sizeof(Elf32_Sym
));
715 p
= (Elf32_Sym
*) symtab_section
->data
;
718 // find a file symbol, copy it over
719 // then scan the whole symbol list and copy any function
720 // symbols that match the file association
722 for (i
= 0; i
< nb_syms
; i
++) {
723 if (p
->st_info
== 4) {
724 name
= (char *) symtab_section
->link
->data
+ p
->st_name
;
726 // this is a file symbol, copy it over
730 p2
= (Elf32_Sym
*) symtab_section
->data
;
732 for (j
= 0; j
< nb_syms
; j
++) {
733 if (p2
->st_info
== 0x12) {
734 // this is a func symbol
737 (char *) symtab_section
->link
->data
+ p2
->st_name
;
739 // find the function data index
741 for (k
= 0; k
< nFuncs
; k
++) {
742 if (strcmp(name2
, Func
[k
]) == 0)
750 "debug (sort) info can't find function: %s",
756 if (strcmp(AssociatedFile
[k
], name
) == 0) {
757 // yes they match copy it over
768 // now all the filename and func symbols should have been copied over
769 // copy all the rest over (all except file and funcs)
771 p
= (Elf32_Sym
*) symtab_section
->data
;
772 for (i
= 0; i
< nb_syms
; i
++) {
773 if (p
->st_info
!= 4 && p
->st_info
!= 0x12) {
780 error("Internal Compiler error, debug info");
784 p
= (Elf32_Sym
*) symtab_section
->data
;
785 for (i
= 0; i
< nb_syms
; i
++) {
793 int FindCoffSymbolIndex(const char *func_name
)
799 p
= (Elf32_Sym
*) symtab_section
->data
;
801 for (i
= 0; i
< nb_syms
; i
++) {
803 name
= (char *) symtab_section
->link
->data
+ p
->st_name
;
805 if (p
->st_info
== 4) {
806 // put a filename symbol
808 } else if (p
->st_info
== 0x12) {
810 if (strcmp(func_name
, name
) == 0)
815 // put a Function Name
834 return n
; // total number of symbols
837 BOOL
OutputTheSection(Section
* sect
)
839 const char *s
= sect
->name
;
841 if (!strcmp(s
, ".text"))
843 else if (!strcmp(s
, ".data"))
849 short int GetCoffFlags(const char *s
)
851 if (!strcmp(s
, ".text"))
852 return STYP_TEXT
| STYP_DATA
| STYP_ALIGN
| 0x400;
853 else if (!strcmp(s
, ".data"))
855 else if (!strcmp(s
, ".bss"))
857 else if (!strcmp(s
, ".stack"))
858 return STYP_BSS
| STYP_ALIGN
| 0x200;
859 else if (!strcmp(s
, ".cinit"))
860 return STYP_COPY
| STYP_DATA
| STYP_ALIGN
| 0x200;
865 Section
*FindSection(TCCState
* s1
, const char *sname
)
870 for (i
= 1; i
< s1
->nb_sections
; i
++) {
873 if (!strcmp(sname
, s
->name
))
877 error("could not find section %s", sname
);
881 int tcc_load_coff(TCCState
* s1
, int fd
)
883 // tktk TokenSym *ts;
886 unsigned int str_size
;
887 char *Coff_str_table
, *name
;
891 FILHDR file_hdr
; /* FILE HEADER STRUCTURE */
893 f
= fdopen(fd
, "rb");
895 error("Unable to open .out file for input");
898 if (fread(&file_hdr
, FILHSZ
, 1, f
) != 1)
899 error("error reading .out file for input");
901 if (fread(&o_filehdr
, sizeof(o_filehdr
), 1, f
) != 1)
902 error("error reading .out file for input");
904 // first read the string table
906 if (fseek(f
, file_hdr
.f_symptr
+ file_hdr
.f_nsyms
* SYMESZ
, SEEK_SET
))
907 error("error reading .out file for input");
909 if (fread(&str_size
, sizeof(int), 1, f
) != 1)
910 error("error reading .out file for input");
913 Coff_str_table
= (char *) tcc_malloc(str_size
);
915 if (fread(Coff_str_table
, str_size
- 4, 1, f
) != 1)
916 error("error reading .out file for input");
918 // read/process all the symbols
920 // seek back to symbols
922 if (fseek(f
, file_hdr
.f_symptr
, SEEK_SET
))
923 error("error reading .out file for input");
925 for (i
= 0; i
< file_hdr
.f_nsyms
; i
++) {
926 if (fread(&csym
, SYMESZ
, 1, f
) != 1)
927 error("error reading .out file for input");
929 if (csym
._n
._n_n
._n_zeroes
== 0) {
930 name
= Coff_str_table
+ csym
._n
._n_n
._n_offset
- 4;
932 name
= csym
._n
._n_name
;
935 for (k
= 0; k
< 8; k
++)
943 // if (strcmp("_DAC_Buffer",name)==0) // tktk
946 if (((csym
.n_type
& 0x30) == 0x20 && csym
.n_sclass
== 0x2) || ((csym
.n_type
& 0x30) == 0x30 && csym
.n_sclass
== 0x2) || (csym
.n_type
== 0x4 && csym
.n_sclass
== 0x2) || (csym
.n_type
== 0x8 && csym
.n_sclass
== 0x2) || // structures
947 (csym
.n_type
== 0x18 && csym
.n_sclass
== 0x2) || // pointer to structure
948 (csym
.n_type
== 0x7 && csym
.n_sclass
== 0x2) || // doubles
949 (csym
.n_type
== 0x6 && csym
.n_sclass
== 0x2)) // floats
951 // strip off any leading underscore (except for other main routine)
953 if (name
[0] == '_' && strcmp(name
, "_main") != 0)
956 tcc_add_symbol(s1
, name
, csym
.n_value
);
958 // skip any aux records
960 if (csym
.n_numaux
== 1) {
961 if (fread(&csym
, SYMESZ
, 1, f
) != 1)
962 error("error reading .out file for input");