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 /tccpe.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 'tccpe.c')
| -rw-r--r-- | tccpe.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1633,7 +1633,7 @@ static int pe_load_res(TCCState *s1, int fd) { struct pe_rsrc_header hdr; Section *rsrc_section; - int i, ret = -1; + int i, ret = -1, sym_index; BYTE *ptr; unsigned offs; @@ -1651,8 +1651,8 @@ static int pe_load_res(TCCState *s1, int fd) if (!read_mem(fd, offs, ptr, hdr.sectionhdr.SizeOfRawData)) goto quit; offs = hdr.sectionhdr.PointerToRelocations; - for (i = 0; i < hdr.sectionhdr.NumberOfRelocations; ++i) - { + sym_index = put_elf_sym(symtab_section, 0, 0, 0, 0, rsrc_section->sh_num, ".rsrc"); + for (i = 0; i < hdr.sectionhdr.NumberOfRelocations; ++i) { struct pe_rsrc_reloc rel; if (!read_mem(fd, offs, &rel, sizeof rel)) goto quit; @@ -1660,7 +1660,7 @@ static int pe_load_res(TCCState *s1, int fd) if (rel.type != RSRC_RELTYPE) goto quit; put_elf_reloc(symtab_section, rsrc_section, - rel.offset, R_XXX_RELATIVE, 0); + rel.offset, R_XXX_RELATIVE, sym_index); offs += sizeof rel; } ret = 0; @@ -1779,9 +1779,9 @@ static unsigned pe_add_uwwind_info(TCCState *s1) if (NULL == s1->uw_pdata) { s1->uw_pdata = find_section(tcc_state, ".pdata"); s1->uw_pdata->sh_addralign = 4; - s1->uw_sym = put_elf_sym(symtab_section, 0, 0, 0, 0, text_section->sh_num, NULL); } - + if (0 == s1->uw_sym) + s1->uw_sym = put_elf_sym(symtab_section, 0, 0, 0, 0, text_section->sh_num, ".uw_base"); if (0 == s1->uw_offs) { /* As our functions all have the same stackframe, we use one entry for all */ static const unsigned char uw_info[] = { @@ -1970,7 +1970,7 @@ ST_FUNC int pe_output_file(TCCState *s1, const char *filename) tcc_add_bcheck(s1); pe_add_runtime(s1, &pe); - resolve_regular_syms(); + resolve_common_syms(s1); pe_set_options(s1, &pe); ret = pe_check_symbols(&pe); |
