Add a --multiarch-triplet switch to configure

Add a --multiarch-triplet switch to configure. The switch will allow
files to be search for each default path in path/<triplet> and then
path.
Default paths handled that way:
- CONFIG_TCC_SYSINCLUDE_PATHS
- CONFIG_TCC_LIBPATH
- path to crt*.o
- path to libgcc_s.so.1

Path missing: elf interpreter path (will be handled in another commit)
This commit is contained in:
Thomas Preud'homme
2011-08-01 22:32:44 +02:00
parent 5e954fef32
commit 76adc5770f
4 changed files with 153 additions and 74 deletions

View File

@ -1226,14 +1226,19 @@ the_end:
return ret;
}
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename)
static int tcc_add_file_noerror(TCCState *s, const char *filename, int extra_flags)
{
dynarray_add((void ***)&s->input_files, &s->nb_input_files, tcc_strdup(filename));
if (s->output_type == TCC_OUTPUT_PREPROCESS)
return tcc_add_file_internal(s, filename, AFF_PRINT_ERROR | AFF_PREPROCESS);
return tcc_add_file_internal(s, filename, extra_flags | AFF_PREPROCESS);
else
return tcc_add_file_internal(s, filename, AFF_PRINT_ERROR);
return tcc_add_file_internal(s, filename, extra_flags);
}
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename)
{
return tcc_add_file_noerror(s, filename, AFF_PRINT_ERROR);
}
LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname)
@ -1347,9 +1352,16 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
#else
if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) &&
!s->nostdlib) {
if (output_type != TCC_OUTPUT_DLL)
tcc_add_file(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/crt1.o");
tcc_add_file(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/crti.o");
if (output_type != TCC_OUTPUT_DLL) {
#ifdef CONFIG_TCC_MULTIARCH_TRIPLET
if (tcc_add_file_noerror(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/" CONFIG_TCC_MULTIARCH_TRIPLET "/crt1.o", 0))
#endif
tcc_add_file(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/crt1.o");
}
#ifdef CONFIG_TCC_MULTIARCH_TRIPLET
if (tcc_add_file_noerror(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/" CONFIG_TCC_MULTIARCH_TRIPLET "/crti.o", 0))
#endif
tcc_add_file(s, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/crti.o");
}
#endif
return 0;