diff options
| author | grischka <grischka> | 2014-05-08 17:32:29 +0200 |
|---|---|---|
| committer | David Mertens <dcmertens.perl@gmail.com> | 2014-06-24 22:09:12 -0400 |
| commit | 6e0a658e9619b8e8040332361352b8a883292364 (patch) | |
| tree | 50206f257acf7ae6e713aa30727697042da3a8b7 /x86_64-gen.c | |
| parent | 2ac238fc507b64a8dd2d5d3d5c00210c1ffabea5 (diff) | |
| download | tinycc-6e0a658e9619b8e8040332361352b8a883292364.tar.gz tinycc-6e0a658e9619b8e8040332361352b8a883292364.tar.bz2 | |
win64: try to fix linkage
- revert to R_X86_64_PC32 for near calls on PE
- revert to s1->section_align set to zero by default
Untested. Compared to release_0_9_26 the pe-image looks back to
normal. There are some differences in dissassembly (r10/r11 usage)
but maybe that's ok.
Diffstat (limited to 'x86_64-gen.c')
| -rw-r--r-- | x86_64-gen.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/x86_64-gen.c b/x86_64-gen.c index eb201c8..c8fed85 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -288,7 +288,8 @@ static void gen_gotpcrel(int r, Sym *sym, int c) rel = (ElfW(Rela) *)(sr->data + sr->data_offset - sizeof(ElfW(Rela))); rel->r_addend = -4; #else - printf("picpic: %s %x %x | %02x %02x %02x\n", get_tok_str(sym->v, NULL), c, r, + tcc_error("internal error: no GOT on PE: %s %x %x | %02x %02x %02x\n", + get_tok_str(sym->v, NULL), c, r, cur_text_section->data[ind-3], cur_text_section->data[ind-2], cur_text_section->data[ind-1] @@ -603,8 +604,11 @@ static void gcall_or_jmp(int is_jmp) /* constant case */ if (vtop->r & VT_SYM) { /* relocation case */ - greloc(cur_text_section, vtop->sym, - ind + 1, R_X86_64_PLT32); +#ifdef TCC_TARGET_PE + greloc(cur_text_section, vtop->sym, ind + 1, R_X86_64_PC32); +#else + greloc(cur_text_section, vtop->sym, ind + 1, R_X86_64_PLT32); +#endif } else { /* put an empty PC32 relocation */ put_elf_reloc(symtab_section, cur_text_section, |
