From 5f33d313c8a2455ff9036cd7f7028339bdbde622 Mon Sep 17 00:00:00 2001 From: grischka Date: Mon, 20 Feb 2017 18:58:08 +0100 Subject: 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 --- tcc.c | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'tcc.c') diff --git a/tcc.c b/tcc.c index 5890b89..a504661 100644 --- a/tcc.c +++ b/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; } -- cgit v1.3.1