From 53d815b8a0364a85b66c3b37884fca087b923267 Mon Sep 17 00:00:00 2001 From: grischka Date: Thu, 12 Sep 2019 17:45:18 +0200 Subject: [PATCH] win32/tccpe: use full dll-path with -run This allows for example this scenario: - A dll to be linked with is specified in file.c, where file.c and the dll exist in the same directory: #pragma comment(lib, "txml") #pragma comment(option, "-L{f}") - tcc is called to run file.c from other, varying directories: $ tcc -run some/dir/file.c Note that tcc replaces {f} by the currently compiled file's directory ('some/dir' in this example). Also: - tccgen.c: fix last commit for gen_cast. --- tccgen.c | 2 +- tccpe.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tccgen.c b/tccgen.c index 06d8f027..dd6a497a 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3569,7 +3569,7 @@ again: if (ds <= ss) goto done; /* ss <= 4 here */ - if (ds <= 4 && dbt != (VT_SHORT | VT_UNSIGNED) && sbt != VT_BYTE) { + if (ds <= 4 && !(dbt == (VT_SHORT | VT_UNSIGNED) && sbt == VT_BYTE)) { gv(RC_INT); goto done; /* no 64bit envolved */ } diff --git a/tccpe.c b/tccpe.c index 9b59d92c..c2aad8a1 100644 --- a/tccpe.c +++ b/tccpe.c @@ -825,7 +825,7 @@ static void pe_build_imports(struct pe_info *pe) dllindex = p->dll_index; if (dllindex) - name = (dllref = pe->s1->loaded_dlls[dllindex-1])->name; + name = tcc_basename((dllref = pe->s1->loaded_dlls[dllindex-1])->name); else name = "", dllref = NULL; @@ -1763,7 +1763,7 @@ static int pe_load_dll(TCCState *s1, const char *filename) if (ret) { return -1; } else if (p) { - index = add_dllref(s1, tcc_basename(filename)); + index = add_dllref(s1, filename); for (q = p; *q; q += 1 + strlen(q)) pe_putimport(s1, index, q, 0); tcc_free(p);