mirror of
https://github.com/frida/tinycc
synced 2024-12-24 22:16:49 +03:00
Revert "Add a --multiarch-triplet switch to configure"
This reverts commit 76adc5770f
.
This commit is contained in:
parent
76adc5770f
commit
0b6652003c
89
configure
vendored
89
configure
vendored
@ -31,7 +31,6 @@ includedir=""
|
||||
mandir=""
|
||||
infodir=""
|
||||
sysroot=""
|
||||
multiarch_triplet=""
|
||||
cross_prefix=""
|
||||
cc="gcc"
|
||||
host_cc="gcc"
|
||||
@ -121,8 +120,6 @@ for opt do
|
||||
;;
|
||||
--sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--multiarch-triplet=*) multiarch_triplet=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
|
||||
@ -255,7 +252,6 @@ echo "Advanced options (experts only):"
|
||||
echo " --source-path=PATH path of source code [$source_path]"
|
||||
echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
|
||||
echo " --sysroot=PREFIX prepend PREFIX to library/include paths []"
|
||||
echo " --multiarch-triplet=SUFFIX append SUFFIX to library/include paths []"
|
||||
echo " --cc=CC use C compiler CC [$cc]"
|
||||
echo " --disable-static make libtcc.so instead of libtcc.a"
|
||||
echo " --disable-rpath disable use of -rpath with the above"
|
||||
@ -334,7 +330,6 @@ echo "Manual directory $mandir"
|
||||
echo "Info directory $infodir"
|
||||
echo "Doc directory $docdir"
|
||||
echo "Target root prefix $sysroot"
|
||||
echo "Multiarch triplet $multiarch_triplet"
|
||||
echo "Source path $source_path"
|
||||
echo "C compiler $cc"
|
||||
echo "CPU $cpu"
|
||||
@ -361,93 +356,9 @@ echo "docdir=\$(DESTDIR)$docdir" >> config.mak
|
||||
echo "#ifndef CONFIG_SYSROOT" >> $TMPH
|
||||
echo "#define CONFIG_SYSROOT \"$sysroot\"" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
|
||||
# Set default include and library paths
|
||||
win_incpaths="\\\b/include;\\\b/include/winapi"
|
||||
unix_incpaths="/usr/local/include:/usr/include:\\\b/include"
|
||||
win_libpaths="\\\b/lib"
|
||||
unix_libpaths="CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX"
|
||||
unix_libpaths="$unix_libpaths\":\"CONFIG_SYSROOT CONFIG_TCC_LDDIR"
|
||||
unix_libpaths="$unix_libpaths\":\"CONFIG_SYSROOT \"/usr/local\" CONFIG_TCC_LDDIR"
|
||||
|
||||
# sep: path separator in paths
|
||||
# tmp: paths multiarchified (one path per line)
|
||||
# q: quote (if sep contains ")
|
||||
# r: carriage return pattern (if sep contains ")
|
||||
# s: space (if sep contains ")
|
||||
multiarchify()
|
||||
{
|
||||
local sep tmp
|
||||
|
||||
paths="$1"
|
||||
sep="$2"
|
||||
tmp=""
|
||||
q=""
|
||||
r=""
|
||||
s=""
|
||||
if [ -z "${sep%%\"*}" ] ; then
|
||||
q="\""
|
||||
r=" \\\\\n "
|
||||
s=" "
|
||||
fi
|
||||
paths="$paths$sep"
|
||||
while test -n "$paths" ; do
|
||||
tmp="$tmp${tmp:+$r$sep$s}${paths%%$sep*}$s$q/$multiarch_triplet$q"
|
||||
tmp="$tmp$r$sep$s${paths%%$sep*}"
|
||||
paths="${paths#*$sep}"
|
||||
done
|
||||
paths="$tmp"
|
||||
}
|
||||
|
||||
if test -n "$multiarch_triplet" ; then
|
||||
multiarchify "$win_incpaths" ";"
|
||||
win_incpaths="\"$paths\""
|
||||
multiarchify "$unix_incpaths" ":"
|
||||
unix_incpaths="\"$paths\""
|
||||
multiarchify "$win_libpaths" ";"
|
||||
win_libpaths="\"$paths\""
|
||||
multiarchify "$unix_libpaths" "\":\""
|
||||
unix_libpaths="$paths"
|
||||
echo "#define CONFIG_TCC_MULTIARCH_TRIPLET \"$multiarch_triplet\"" >> $TMPH
|
||||
fi
|
||||
|
||||
echo "#ifndef CONFIG_TCC_LDDIR" >> $TMPH
|
||||
echo " #if defined(TCC_TARGET_X86_64_CENTOS)" >> $TMPH
|
||||
echo " #define CONFIG_TCC_LDDIR \"/lib64\"" >> $TMPH
|
||||
echo " #else" >> $TMPH
|
||||
echo " #define CONFIG_TCC_LDDIR \"/lib\"" >> $TMPH
|
||||
echo " #endif" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
|
||||
echo "/* path to find crt1.o, crti.o and crtn.o */" >> $TMPH
|
||||
echo "#ifndef CONFIG_TCC_CRT_PREFIX" >> $TMPH
|
||||
echo "# define CONFIG_TCC_CRT_PREFIX \"/usr\" CONFIG_TCC_LDDIR" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
|
||||
echo "#ifndef CONFIG_TCC_SYSINCLUDE_PATHS" >> $TMPH
|
||||
echo "# ifdef TCC_TARGET_PE" >> $TMPH
|
||||
echo "# define CONFIG_TCC_SYSINCLUDE_PATHS $win_incpaths" >> $TMPH
|
||||
echo "# else" >> $TMPH
|
||||
echo "# define CONFIG_TCC_SYSINCLUDE_PATHS $unix_incpaths" >> $TMPH
|
||||
echo "# endif" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
echo "#ifndef CONFIG_TCC_LIBPATH" >> $TMPH
|
||||
echo "# ifdef TCC_TARGET_PE" >> $TMPH
|
||||
echo "# define CONFIG_TCC_LIBPATH $win_libpaths" >> $TMPH
|
||||
echo "# else" >> $TMPH
|
||||
echo "# define CONFIG_TCC_LIBPATH $unix_libpaths" >> $TMPH
|
||||
echo "# endif" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
|
||||
echo "#ifndef CONFIG_TCCDIR" >> $TMPH
|
||||
echo "#define CONFIG_TCCDIR \"$tccdir\"" >> $TMPH
|
||||
echo "#endif" >> $TMPH
|
||||
echo "" >> $TMPH
|
||||
echo "CC=$cc" >> config.mak
|
||||
echo "GCC_MAJOR=$gcc_major" >> config.mak
|
||||
echo "#define GCC_MAJOR $gcc_major" >> $TMPH
|
||||
|
20
libtcc.c
20
libtcc.c
@ -1226,19 +1226,14 @@ the_end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tcc_add_file_noerror(TCCState *s, const char *filename, int extra_flags)
|
||||
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename)
|
||||
{
|
||||
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, extra_flags | AFF_PREPROCESS);
|
||||
return tcc_add_file_internal(s, filename, AFF_PRINT_ERROR | AFF_PREPROCESS);
|
||||
else
|
||||
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);
|
||||
return tcc_add_file_internal(s, filename, AFF_PRINT_ERROR);
|
||||
}
|
||||
|
||||
LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname)
|
||||
@ -1352,15 +1347,8 @@ 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) {
|
||||
#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
|
||||
if (output_type != TCC_OUTPUT_DLL)
|
||||
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
|
||||
|
34
tcc.h
34
tcc.h
@ -139,9 +139,37 @@
|
||||
#define true 1
|
||||
typedef int BOOL;
|
||||
|
||||
/* See definition of default values of CONFIG_TCC_LDDIR, CONFIG_TCC_CRT_PREFIX,
|
||||
CONFIG_TCC_SYSINCLUDE_PATHS and CONFIG_TCC_LIBPATH in config.h or configure
|
||||
*/
|
||||
#ifndef CONFIG_TCC_LDDIR
|
||||
#if defined(TCC_TARGET_X86_64_CENTOS)
|
||||
#define CONFIG_TCC_LDDIR "/lib64"
|
||||
#else
|
||||
#define CONFIG_TCC_LDDIR "/lib"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* path to find crt1.o, crti.o and crtn.o */
|
||||
#ifndef CONFIG_TCC_CRT_PREFIX
|
||||
# define CONFIG_TCC_CRT_PREFIX "/usr" CONFIG_TCC_LDDIR
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TCC_SYSINCLUDE_PATHS
|
||||
# ifdef TCC_TARGET_PE
|
||||
# define CONFIG_TCC_SYSINCLUDE_PATHS "\b/include;\b/include/winapi"
|
||||
# else
|
||||
# define CONFIG_TCC_SYSINCLUDE_PATHS "/usr/local/include:/usr/include:\b/include"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_TCC_LIBPATH
|
||||
# ifdef TCC_TARGET_PE
|
||||
# define CONFIG_TCC_LIBPATH "\b/lib"
|
||||
# else
|
||||
# define CONFIG_TCC_LIBPATH \
|
||||
CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX \
|
||||
":" CONFIG_SYSROOT CONFIG_TCC_LDDIR \
|
||||
":" CONFIG_SYSROOT "/usr/local" CONFIG_TCC_LDDIR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define INCLUDE_STACK_SIZE 32
|
||||
#define IFDEF_STACK_SIZE 64
|
||||
|
6
tccelf.c
6
tccelf.c
@ -1238,9 +1238,6 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
|
||||
if (!s1->nostdlib) {
|
||||
#ifdef CONFIG_USE_LIBGCC
|
||||
tcc_add_library(s1, "c");
|
||||
#ifdef CONFIG_TCC_MULTIARCH_TRIPLET
|
||||
if (tcc_add_file_internal(s1, CONFIG_SYSROOT CONFIG_TCC_LDDIR "/" CONFIG_TCC_MULTIARCH_TRIPLET "/libgcc_s.so.1", 0))
|
||||
#endif
|
||||
tcc_add_file(s1, CONFIG_SYSROOT CONFIG_TCC_LDDIR"/libgcc_s.so.1");
|
||||
#else
|
||||
tcc_add_library(s1, "c");
|
||||
@ -1255,9 +1252,6 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
|
||||
}
|
||||
/* add crt end if not memory output */
|
||||
if (s1->output_type != TCC_OUTPUT_MEMORY && !s1->nostdlib) {
|
||||
#ifdef CONFIG_TCC_MULTIARCH_TRIPLET
|
||||
if (tcc_add_file_internal(s1, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/" CONFIG_TCC_MULTIARCH_TRIPLET "/crtn.o", 0))
|
||||
#endif
|
||||
tcc_add_file(s1, CONFIG_SYSROOT CONFIG_TCC_CRT_PREFIX "/crtn.o");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user