aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-12-12 17:57:20 +0100
committergrischka <grischka>2017-12-12 17:57:20 +0100
commitd348a9a51d32cece842b7885d27a411436d7887b (patch)
tree52a0593e253b75ba7fa8d29a487771c977cff4c1 /tccelf.c
parent1a4d4b76e803a32db1168e66ad8f8b26c29c8ea0 (diff)
downloadtinycc-d348a9a51d32cece842b7885d27a411436d7887b.tar.gz
tinycc-d348a9a51d32cece842b7885d27a411436d7887b.tar.bz2
final update for 0.9.27main
tccgen.c: - fix ldouble asm hack - fix a VLA problem on Win64 (also x86_64-gen.c) - patch_type(): make sure that no symbol ever changes from global to static tcc.c: - tcc -vv: print libtcc1.a path also on win32 tccpe.c, tcctools.c: - use unix LF mode to for .def output files (that is for creating reproducible output trees) Makefile: - suppress some warnings when makeinfo is missing - call 'which install' only on win32 tests/Makefile: - change PATH only on WINNT systems (i.e. not if cross-compiling on linux for win32) - asm-c-connect.test: slim output and do diff tccrun.c tccpe.c *-link.c: - integrate former 'pe_relocate_rva()' into normal relocation This also fixes linkage of the unwind data on WIN64 for -run (reported by Janus Lynggaard Thorborg) tccasm.c, tests/tcctest.c: - fix dot (sym_index of -1 crashed in put_elf_reloc) - massage .set a bit (see test) other: - #define SECTION_ABS removed - ST_DATA Section *strtab_section: removed - put_extern_sym2(): take int section number Conflicts: tccelf.c tccpe.c Conflicts: tccelf.c
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tccelf.c b/tccelf.c
index 080c72b..70d47e1 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -38,13 +38,18 @@ ST_DATA Section *bounds_section; /* contains global data bound description */
ST_DATA Section *lbounds_section; /* contains local data bound description */
#endif
/* symbol sections */
-ST_DATA Section *symtab_section, *strtab_section;
+ST_DATA Section *symtab_section;
/* debug sections */
ST_DATA Section *stab_section, *stabstr_section;
/* XXX: avoid static variable */
static int new_undef_sym = 0; /* Is there a new undefined sym since last new_undef_sym() */
+/* special flag to indicate that the section should not be linked to the other ones */
+#define SHF_PRIVATE 0x80000000
+/* section is dynsymtab_section */
+#define SHF_DYNSYM 0x40000000
+
/* ------------------------------------------------------------------------- */
ST_FUNC void tccelf_new(TCCState *s)
@@ -63,11 +68,10 @@ ST_FUNC void tccelf_new(TCCState *s)
symtab_section = new_symtab(s, ".symtab", SHT_SYMTAB, 0,
".strtab",
".hashtab", SHF_PRIVATE);
- strtab_section = symtab_section->link;
s->symtab = symtab_section;
/* private symbol table for dynamic symbols */
- s->dynsymtab_section = new_symtab(s, ".dynsymtab", SHT_SYMTAB, SHF_PRIVATE,
+ s->dynsymtab_section = new_symtab(s, ".dynsymtab", SHT_SYMTAB, SHF_PRIVATE|SHF_DYNSYM,
".dynstrtab",
".dynhashtab", SHF_PRIVATE);
get_sym_attr(s, 0, 1);
@@ -128,6 +132,8 @@ ST_FUNC void tccelf_delete(TCCState *s1)
/* free loaded dlls array */
dynarray_reset(&s1->loaded_dlls, &s1->nb_loaded_dlls);
tcc_free(s1->sym_attrs);
+
+ symtab_section = NULL; /* for tccrun.c:rt_printline() */
}
/* save section data state */
@@ -536,7 +542,7 @@ ST_FUNC int set_elf_sym(Section *s, addr_t value, unsigned long size,
goto do_patch;
} else if (shndx == SHN_COMMON || shndx == bss_section->sh_num) {
/* data symbol keeps precedence over common/bss */
- } else if (s == tcc_state->dynsymtab_section) {
+ } else if (s->sh_flags & SHF_DYNSYM) {
/* we accept that two DLL define the same symbol */
} else if (esym->st_other & ST_ASM_SET) {
/* If the existing symbol came from an asm .set
@@ -779,7 +785,7 @@ ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve)
for_each_elem(symtab, 1, sym, ElfW(Sym)) {
sh_num = sym->st_shndx;
if (sh_num == SHN_UNDEF) {
- name = (char *) strtab_section->data + sym->st_name;
+ name = (char *) s1->symtab->link->data + sym->st_name;
/* Use ld.so to resolve symbol for us (for tcc -run) */
if (do_resolve) {
#if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE