From b42cb16b65ed237e6ec30f65d4f9647561515cb8 Mon Sep 17 00:00:00 2001 From: grischka Date: Wed, 5 Oct 2016 18:34:17 +0200 Subject: Misc. fixes Makefile : - do not 'uninstall' peoples /usr/local/doc entirely libtcc.c : - MEM_DEBUG : IDE-friendly output "file:line: ..." - always ELF for objects tccgen.c : - fix memory leak in new switch code - move static 'in_sizeof' out of function profiling : - define 'static' to empty resolve_sym() : - replace by dlsym() win32/64: fix R_XXX_RELATIVE fixme - was fixed for i386 already in 8e4d64be2fc1d707c7800c5096f6e0ea22cbd - do not -Lsystemdir if compiling to .o --- tccelf.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tccelf.c') diff --git a/tccelf.c b/tccelf.c index 23c7e9b..e6468b2 100644 --- a/tccelf.c +++ b/tccelf.c @@ -450,7 +450,7 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) #if defined TCC_IS_NATIVE && !defined _WIN32 void *addr; name = (char *) symtab_section->link->data + sym->st_name; - addr = resolve_sym(s1, name); + addr = dlsym(RTLD_DEFAULT, name); if (addr) { sym->st_value = (addr_t)addr; #ifdef DEBUG_RELOC @@ -576,15 +576,18 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) goto output_file; write16le(ptr, read16le(ptr) + val - addr); break; - case R_386_RELATIVE: - /* do nothing */ + +#ifdef TCC_TARGET_PE + case R_386_RELATIVE: /* handled in pe_relocate_rva() */ break; +#endif case R_386_COPY: /* This reloction must copy initialized data from the library to the program .bss segment. Currently made like for ARM (to remove noise of defaukt case). Is this true? */ break; + default: fprintf(stderr,"FIXME: handle reloc type %d at %x [%p] to %x\n", type, (unsigned)addr, ptr, (unsigned)val); @@ -773,6 +776,10 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) /* Nothing to do. Normally used to indicate a dependency on a certain symbol (like for exception handling under EABI). */ break; +#ifdef TCC_TARGET_PE + case R_ARM_RELATIVE: /* handled in pe_relocate_rva() */ + break; +#endif default: fprintf(stderr,"FIXME: handle reloc type %x at %x [%p] to %x\n", type, (unsigned)addr, ptr, (unsigned)val); @@ -973,6 +980,11 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) /* we load the got offset */ write32le(ptr, read32le(ptr) + s1->sym_attrs[sym_index].got_offset); break; +#ifdef TCC_TARGET_PE + case R_X86_64_RELATIVE: /* handled in pe_relocate_rva() */ + break; +#endif + #else #error unsupported processor #endif -- cgit v1.3.1