forked from KolibriOS/kolibrios
ktcc:
- fixed bug with crt0.o search when using -B parameter. - removed support for tcc.conf. git-svn-id: svn://kolibrios.org@9557 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b91e4571a3
commit
5c8619e65c
@ -2,7 +2,7 @@ CC=gcc
|
|||||||
NAME=kos32-tcc
|
NAME=kos32-tcc
|
||||||
|
|
||||||
SRC=libtcc.c tcc.c
|
SRC=libtcc.c tcc.c
|
||||||
CFLAGS= -DTCC_TARGET_MEOS_LINUX
|
CFLAGS= -DTCC_TARGET_MEOS_LINUX
|
||||||
LFLAGS= -m32
|
LFLAGS= -m32
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
@ -113,17 +113,12 @@ static void tcc_set_lib_path_w32(TCCState *s)
|
|||||||
{
|
{
|
||||||
char path[1024], *p;
|
char path[1024], *p;
|
||||||
GetModuleFileNameA(tcc_module, path, sizeof path);
|
GetModuleFileNameA(tcc_module, path, sizeof path);
|
||||||
#ifdef TCC_TARGET_KX
|
|
||||||
kx_fix_root_directory(path, sizeof path);
|
|
||||||
normalize_slashes(strlwr(path));
|
|
||||||
#else
|
|
||||||
p = tcc_basename(normalize_slashes(strlwr(path)));
|
p = tcc_basename(normalize_slashes(strlwr(path)));
|
||||||
if (p - 5 > path && 0 == strncmp(p - 5, "/bin/", 5))
|
if (p - 5 > path && 0 == strncmp(p - 5, "/bin/", 5))
|
||||||
p -= 5;
|
p -= 5;
|
||||||
else if (p > path)
|
else if (p > path)
|
||||||
p--;
|
p--;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
#endif
|
|
||||||
tcc_set_lib_path(s, path);
|
tcc_set_lib_path(s, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,17 +150,13 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
#if defined TCC_TARGET_MEOS
|
#if defined TCC_TARGET_MEOS
|
||||||
/* on Kolibri host, we suppose the lib and includes are at the location of 'tcc' /lib, /include */
|
/* 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)
|
static void tcc_set_lib_path_kos(TCCState *s)
|
||||||
{
|
{
|
||||||
char** argv0 = (char**)0x20; // path in kolibri header
|
char** argv0 = (char**)0x20; // path in kolibri header
|
||||||
char path[1024], *p;
|
char path[1024], *p;
|
||||||
strncpy(path, *argv0, sizeof path);
|
strncpy(path, *argv0, sizeof path);
|
||||||
#ifdef TCC_TARGET_KX
|
|
||||||
kx_fix_root_directory(path, sizeof path);
|
|
||||||
#else
|
|
||||||
p = tcc_basename(path);
|
p = tcc_basename(path);
|
||||||
if (p > path) p--;
|
if (p > path) p--;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
#endif
|
|
||||||
tcc_set_lib_path(s, path);
|
tcc_set_lib_path(s, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,12 +165,7 @@ static void tcc_set_lib_path_linux(TCCState *s)
|
|||||||
{
|
{
|
||||||
char buff[4096+1];
|
char buff[4096+1];
|
||||||
readlink("/proc/self/exe", buff, 4096);
|
readlink("/proc/self/exe", buff, 4096);
|
||||||
#ifdef TCC_TARGET_KX
|
|
||||||
kx_fix_root_directory(buff, sizeof buff);
|
|
||||||
const char *path = buff;
|
|
||||||
#else
|
|
||||||
const char *path = dirname(buff);
|
const char *path = dirname(buff);
|
||||||
#endif
|
|
||||||
tcc_set_lib_path(s, path);
|
tcc_set_lib_path(s, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1540,7 +1526,7 @@ ST_FUNC int tcc_add_crt(TCCState *s, const char *filename)
|
|||||||
{
|
{
|
||||||
if (-1 == tcc_add_library_internal(s, "%s/%s",
|
if (-1 == tcc_add_library_internal(s, "%s/%s",
|
||||||
filename, 0, s->crt_paths, s->nb_crt_paths))
|
filename, 0, s->crt_paths, s->nb_crt_paths))
|
||||||
tcc_error_noabort("file '%s' not found", filename);
|
tcc_error("file '%s' not found", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1745,9 +1731,7 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
|
|||||||
#elif defined(TCC_TARGET_MEOS)
|
#elif defined(TCC_TARGET_MEOS)
|
||||||
if (s->output_type != TCC_OUTPUT_OBJ && !s->nostdlib)
|
if (s->output_type != TCC_OUTPUT_OBJ && !s->nostdlib)
|
||||||
{
|
{
|
||||||
tcc_add_crt(s,"crt0.o");
|
|
||||||
tcc_add_library_err(s, "c");
|
tcc_add_library_err(s, "c");
|
||||||
tcc_add_library_err(s, "tcc1");
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* add libc crt1/crti objects */
|
/* add libc crt1/crti objects */
|
||||||
@ -2280,6 +2264,7 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv)
|
|||||||
case TCC_OPTION_B:
|
case TCC_OPTION_B:
|
||||||
/* set tcc utilities path (mainly for tcc development) */
|
/* set tcc utilities path (mainly for tcc development) */
|
||||||
tcc_set_lib_path(s, optarg);
|
tcc_set_lib_path(s, optarg);
|
||||||
|
tcc_split_path(s, (void ***)&s->crt_paths, &s->nb_crt_paths, CONFIG_TCC_CRTPREFIX);
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_l:
|
case TCC_OPTION_l:
|
||||||
args_parser_add_file(s, r, TCC_FILETYPE_BINARY);
|
args_parser_add_file(s, r, TCC_FILETYPE_BINARY);
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#ifndef TCC_TARGET_MEOS
|
#ifndef TCC_TARGET_MEOS
|
||||||
#define TCC_TARGET_MEOS
|
#define TCC_TARGET_MEOS
|
||||||
#endif
|
#endif
|
||||||
void kx_fix_root_directory(char *buf, size_t size);
|
//void kx_fix_root_directory(char *buf, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -323,6 +323,7 @@ typedef struct {
|
|||||||
This function correct tcc_root if tcc_root/kx is a run directory,
|
This function correct tcc_root if tcc_root/kx is a run directory,
|
||||||
otherwise do trim filename
|
otherwise do trim filename
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
void kx_fix_root_directory(char *buf, size_t size) {
|
void kx_fix_root_directory(char *buf, size_t size) {
|
||||||
|
|
||||||
int defult = 1;
|
int defult = 1;
|
||||||
@ -363,5 +364,6 @@ typedef struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tcc_free(tcc_conf);
|
tcc_free(tcc_conf);
|
||||||
//kx_debug_output("tcc root = %s\n", buf);
|
kx_debug_output("tcc root = %s\n", buf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -303,6 +303,7 @@ int tcc_output_me(TCCState* s1,const char *filename)
|
|||||||
kx_init(&me);
|
kx_init(&me);
|
||||||
#endif
|
#endif
|
||||||
if (s1->output_type != TCC_OUTPUT_OBJ && !s1->nostdlib){
|
if (s1->output_type != TCC_OUTPUT_OBJ && !s1->nostdlib){
|
||||||
|
tcc_add_crt(s1, "crt0.o");
|
||||||
tcc_add_library_err(s1, "tcc1");
|
tcc_add_library_err(s1, "tcc1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user