diff options
| author | grischka <grischka> | 2017-12-12 17:33:37 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2017-12-12 17:33:37 +0100 |
| commit | 1a4d4b76e803a32db1168e66ad8f8b26c29c8ea0 (patch) | |
| tree | 007fdd21ccfe4e47e8cf44662cff4751d6c7c3bc /libtcc.c | |
| parent | 8490c54dbd756130962825adf32ab955137da8a4 (diff) | |
| download | tinycc-1a4d4b76e803a32db1168e66ad8f8b26c29c8ea0.tar.gz tinycc-1a4d4b76e803a32db1168e66ad8f8b26c29c8ea0.tar.bz2 | |
tccgen_begin/end_file
This is supposed to make compilation and linking with
multiple source files (tcc f1.c f2.S ...) behave just
the same as linking object files.
tccgen.c:put_extern_sym2():
- use put_elf_sym to enter new symbols unconditionally
tccelf.c:
- save section state before compilation
- disable symbol hashing during compilation
- merge symbols and update relocations after compilation
tccpe.c:
- re-create s1->uw_sym for each compilation (because it
may change)
Diffstat (limited to 'libtcc.c')
| -rw-r--r-- | libtcc.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -486,7 +486,7 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap) for(pf = s1->include_stack; pf < s1->include_stack_ptr; pf++) strcat_printf(buf, sizeof(buf), "In file included from %s:%d:\n", (*pf)->filename, (*pf)->line_num); - if (f->line_num > 0) { + if (s1->error_set_jmp_enabled) { strcat_printf(buf, sizeof(buf), "%s:%d: ", f->filename, f->line_num - !!(tok_flags & TOK_FLAG_BOL)); } else { @@ -629,6 +629,7 @@ static int tcc_compile(TCCState *s1) define_start = define_stack; filetype = s1->filetype; is_asm = filetype == AFF_TYPE_ASM || filetype == AFF_TYPE_ASMPP; + tccelf_begin_file(s1); if (setjmp(s1->error_jmp_buf) == 0) { s1->nb_errors = 0; @@ -655,6 +656,7 @@ static int tcc_compile(TCCState *s1) free_defines(define_start); sym_pop(&global_stack, NULL, 0); sym_pop(&local_stack, NULL, 0); + tccelf_end_file(s1); return s1->nb_errors != 0 ? -1 : 0; } @@ -1016,9 +1018,6 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) obj_type = tcc_object_type(fd, &ehdr); lseek(fd, 0, SEEK_SET); - /* do not display line number if error */ - file->line_num = 0; - #ifdef TCC_TARGET_MACHO if (0 == obj_type && 0 == strcmp(tcc_fileextension(filename), ".dylib")) obj_type = AFF_BINTYPE_DYN; |
