tcc: re-enable correct option -r support
Forgot about it. It allows to compile several
sources (and other .o's) to one single .o file;
tcc -r -o all.o f1.c f2.c f3.S o4.o ...
Also:
- option -fold-struct-init-code removed, no effect anymore
- (tcc_)set_environment() moved to tcc.c
- win32/lib/(win)crt1 minor fix & add dependency
- debug line output for asm (tcc -c -g xxx.S) enabled
- configure/Makefiles: x86-64 -> x86_64 changes
- README: cleanup
This commit is contained in:
52
tcc.c
52
tcc.c
@ -104,9 +104,8 @@ static const char help2[] =
|
||||
" signed-char default char is signed\n"
|
||||
" common use common section instead of bss\n"
|
||||
" leading-underscore decorate extern symbols\n"
|
||||
" ms-extensions allow struct w/o identifier\n"
|
||||
" ms-extensions allow anonymous struct in struct\n"
|
||||
" dollars-in-identifiers allow '$' in C symbols\n"
|
||||
" old-struct-init-code some hack for parsing initializers\n"
|
||||
"-m... target specific options:\n"
|
||||
" ms-bitfields use MSVC bitfield layout\n"
|
||||
#ifdef TCC_TARGET_ARM
|
||||
@ -151,32 +150,18 @@ static const char version[] =
|
||||
"C67"
|
||||
#elif defined TCC_TARGET_ARM
|
||||
"ARM"
|
||||
# ifdef TCC_ARM_HARDFLOAT
|
||||
" Hard Float"
|
||||
# endif
|
||||
#elif defined TCC_TARGET_ARM64
|
||||
"AArch64"
|
||||
# ifdef TCC_ARM_HARDFLOAT
|
||||
#endif
|
||||
#ifdef TCC_ARM_HARDFLOAT
|
||||
" Hard Float"
|
||||
# endif
|
||||
#endif
|
||||
#ifdef TCC_TARGET_PE
|
||||
" Windows"
|
||||
#elif defined(__APPLE__)
|
||||
/* Current Apple OS name as of 2016 */
|
||||
" macOS"
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
" FreeBSD"
|
||||
#elif defined(__DragonFly__)
|
||||
" DragonFly BSD"
|
||||
#elif defined(__NetBSD__)
|
||||
" NetBSD"
|
||||
#elif defined(__OpenBSD__)
|
||||
" OpenBSD"
|
||||
#elif defined(__linux__)
|
||||
" Linux"
|
||||
#else
|
||||
" Unidentified system"
|
||||
" Linux"
|
||||
#endif
|
||||
")\n"
|
||||
;
|
||||
@ -201,6 +186,24 @@ static void print_search_dirs(TCCState *s)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void set_environment(TCCState *s)
|
||||
{
|
||||
char * path;
|
||||
|
||||
path = getenv("C_INCLUDE_PATH");
|
||||
if(path != NULL) {
|
||||
tcc_add_include_path(s, path);
|
||||
}
|
||||
path = getenv("CPATH");
|
||||
if(path != NULL) {
|
||||
tcc_add_include_path(s, path);
|
||||
}
|
||||
path = getenv("LIBRARY_PATH");
|
||||
if(path != NULL) {
|
||||
tcc_add_library_path(s, path);
|
||||
}
|
||||
}
|
||||
|
||||
static char *default_outputfile(TCCState *s, const char *first_file)
|
||||
{
|
||||
char buf[1024];
|
||||
@ -265,9 +268,6 @@ redo:
|
||||
#endif
|
||||
if (opt == OPT_V)
|
||||
return 0;
|
||||
|
||||
tcc_set_environment(s);
|
||||
|
||||
if (opt == OPT_PRINT_DIRS) {
|
||||
/* initialize search dirs */
|
||||
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
|
||||
@ -287,8 +287,8 @@ redo:
|
||||
if (!s->ppfp)
|
||||
tcc_error("could not write '%s'", s->outfile);
|
||||
}
|
||||
} else if (s->output_type == TCC_OUTPUT_OBJ) {
|
||||
if (s->nb_libraries != 0 && !s->option_r)
|
||||
} else if (s->output_type == TCC_OUTPUT_OBJ && !s->option_r) {
|
||||
if (s->nb_libraries)
|
||||
tcc_error("cannot specify libraries with -c");
|
||||
if (n > 1 && s->outfile)
|
||||
tcc_error("cannot specify output file with -c many files");
|
||||
@ -301,6 +301,7 @@ redo:
|
||||
start_time = getclock_ms();
|
||||
}
|
||||
|
||||
set_environment(s);
|
||||
if (s->output_type == 0)
|
||||
s->output_type = TCC_OUTPUT_EXE;
|
||||
tcc_set_output_type(s, s->output_type);
|
||||
@ -323,7 +324,8 @@ redo:
|
||||
}
|
||||
s->filetype = 0;
|
||||
s->alacarte_link = 1;
|
||||
if (ret || --n == 0 || s->output_type == TCC_OUTPUT_OBJ)
|
||||
if (ret || --n == 0
|
||||
|| (s->output_type == TCC_OUTPUT_OBJ && !s->option_r))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user