diff options
| author | grischka <grischka> | 2017-02-23 08:41:57 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2017-02-23 08:41:57 +0100 |
| commit | 569255e6c40f45a0d78b409c05353d4c1de6ca43 (patch) | |
| tree | 5ec1e51fe2a233d74d5570af8fb62ac41fd25989 /tccelf.c | |
| parent | 576bee9a37cbe53227a27308a1b8ccc25e9b0e35 (diff) | |
| download | tinycc-569255e6c40f45a0d78b409c05353d4c1de6ca43.tar.gz tinycc-569255e6c40f45a0d78b409c05353d4c1de6ca43.tar.bz2 | |
cross-compilers: allow individual configuration
since configure supports only native configuration
a file 'cross-tcc.mak' needs to be created manually.
It is included in the Makefile if present.
# ----------------------------------------------------
# Example config-cross.mak:
#
# windows -> i386-linux cross-compiler
# (it expects the linux files in <prefix>/i386-linux)
ROOT-i386 = {B}/i386-linux
CRT-i386 = $(ROOT-i386)/usr/lib
LIB-i386 = $(ROOT-i386)/lib:$(ROOT-i386)/usr/lib
INC-i386 = {B}/lib/include:$(ROOT-i386)/usr/include
DEF-i386 += -D__linux__
# ----------------------------------------------------
Also:
- use libtcc1-<target>.a instead of directories
- add dummy arm assembler
- remove include dependencies from armeabi.c/lib-arm64.c
- tccelf/ld_add_file: add SYSROOT (when defined) to absolute
filenames coming from ld-scripts
Diffstat (limited to 'tccelf.c')
| -rw-r--r-- | tccelf.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -1063,7 +1063,7 @@ static void add_init_array_defines(TCCState *s1, const char *section_name) static int tcc_add_support(TCCState *s1, const char *filename) { char buf[1024]; - snprintf(buf, sizeof(buf), "%s/"TCC_ARCH_DIR"%s", s1->tcc_lib_path, filename); + snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, filename); return tcc_add_file(s1, buf); } @@ -1106,12 +1106,15 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) /* add libc */ if (!s1->nostdlib) { tcc_add_library_err(s1, "c"); -#ifdef CONFIG_USE_LIBGCC +#ifdef TCC_LIBGCC if (!s1->static_link) { - tcc_add_file(s1, TCC_LIBGCC); + if (TCC_LIBGCC[0] == '/') + tcc_add_file(s1, TCC_LIBGCC); + else + tcc_add_dll(s1, TCC_LIBGCC, 0); } #endif - tcc_add_support(s1, "libtcc1.a"); + tcc_add_support(s1, TCC_LIBTCC1); /* add crt end if not memory output */ if (s1->output_type != TCC_OUTPUT_MEMORY) tcc_add_crt(s1, "crtn.o"); @@ -2758,12 +2761,13 @@ static int ld_next(TCCState *s1, char *name, int name_size) static int ld_add_file(TCCState *s1, const char filename[]) { - int ret; - - ret = tcc_add_file_internal(s1, filename, AFF_TYPE_BIN); - if (ret) - ret = tcc_add_dll(s1, filename, 0); - return ret; + if (filename[0] == '/') { + if (CONFIG_SYSROOT[0] == '\0' + && tcc_add_file_internal(s1, filename, AFF_TYPE_BIN) == 0) + return 0; + filename = tcc_basename(filename); + } + return tcc_add_dll(s1, filename, 0); } static inline int new_undef_syms(void) |
