suballocator plus path fixes

git-svn-id: svn://kolibrios.org@7520 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl
2018-11-01 17:24:22 +00:00
parent da1718dca4
commit 2650f5831f
24 changed files with 514 additions and 2191 deletions

View File

@@ -86,6 +86,8 @@ ST_FUNC void asm_global_instr(void)
}
#endif
/********************************************************/
#ifdef _WIN32
static char *normalize_slashes(char *path)
@@ -137,6 +139,20 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
return TRUE;
}
#endif
#else // _WIN32
#ifdef TCC_TARGET_MEOS
/* on Kolibri host, we suppose the lib and includes are at the location of 'tcc' /lib, /include */
static void tcc_set_lib_path_kos(TCCState *s)
{
char** argv0 = (char**)0x20; // path in kolibri header
char path[1024], *p;
strncpy(path, *argv0, sizeof path);
p = tcc_basename(path);
if (p > path) p--;
*p = 0;
tcc_set_lib_path(s, path);
}
#endif
#endif
/********************************************************/
@@ -1075,8 +1091,12 @@ LIBTCCAPI TCCState *tcc_new(void)
tcc_state = s;
#ifdef _WIN32
tcc_set_lib_path_w32(s);
#else
#ifdef TCC_TARGET_MEOS
tcc_set_lib_path_kos(s);
#else
tcc_set_lib_path(s, CONFIG_TCCDIR);
#endif
#endif
s->output_type = 0;
preprocess_new();
@@ -1453,7 +1473,7 @@ static int tcc_add_library_internal(TCCState *s, const char *fmt,
for(i = 0; i < nb_paths; i++) {
snprintf(buf, sizeof(buf), fmt, paths[i], filename);
//printf("added lib [%s]\n", buf);
//printf("tcc_add_library_internal::added lib [%s]\n", buf);
if (tcc_add_file_internal(s, buf, flags, TCC_FILETYPE_BINARY) == 0)
return 0;
}