Le mercredi 13 février 2013 12:12:34, Thomas Preud'homme a écrit : > Le mardi 12 février 2013 19:28:16, Ramsay Jones a écrit : > > Also we see: > > $ ls -l /usr/lib/crt?.o > > -rw-r--r-- 1 root root 2459 2007-04-04 11:31 /usr/lib/crt1.o > > -rw-r--r-- 1 root root 2296 2007-04-04 11:31 /usr/lib/crti.o > > -rw-r--r-- 1 root root 1824 2007-04-04 11:31 /usr/lib/crtn.o > > $ > > > > > Also, can you tell me > > > what is > > > > > > the final destination of the symbolic link /lib/ld-linux.so.2? > > > > > $ ls -l /lib/ld-linux.so.2 > > lrwxrwxrwx 1 root root 9 2007-06-24 19:44 /lib/ld-linux.so.2 -> > > > > ld-2.5.so* $ ls -l /lib/ld-*.so > > > > -rwxr-xr-x 1 root root 109268 2007-04-04 11:48 /lib/ld-2.5.so* > > $ > > I'm working on a patch. Once finished, I'll ask for testing and then we'll > release.
Here is a first version of the patch. Granted, detecting multiarch at configure time and specifying the triplet in tcc.h is better but the result is quite ugly for now. The diffstat is as follows: Makefile | 10 +--------- configure | 12 ++++++++++++ tcc.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 9 deletions(-) > > To be honest I'm tempted to delay the patch after the release since it's > possible for you to just set crtprefix at configure time and everything > should work. Thus still tempted. Best regards, Thomas
diff --git a/Makefile b/Makefile index 23045eb..9ca5149 100644 --- a/Makefile +++ b/Makefile @@ -35,16 +35,10 @@ endif ifeq ($(ARCH),i386) NATIVE_DEFINES=-DTCC_TARGET_I386 -NATIVE_DEFINES+=\ - $(if $(wildcard /lib/i386-linux-gnu),-DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\",\ - $(if $(wildcard /lib/i386-kfreebsd-gnu),-DCONFIG_MULTIARCHDIR=\"i386-kfreebsd-gnu\",\ - $(if $(wildcard /lib/i386-gnu),-DCONFIG_MULTIARCHDIR=\"i386-gnu\"))) else ifeq ($(ARCH),x86-64) NATIVE_DEFINES=-DTCC_TARGET_X86_64 NATIVE_DEFINES+=\ - $(if $(wildcard /usr/lib64),-DCONFIG_LDDIR=\"lib64\",\ - $(if $(wildcard /lib/x86_64-linux-gnu),-DCONFIG_MULTIARCHDIR=\"x86_64-linux-gnu\",\ - $(if $(wildcard /lib/x86_64-kfreebsd-gnu),-DCONFIG_MULTIARCHDIR=\"x86_64-kfreebsd-gnu\"))) + $(if $(wildcard /usr/lib64),-DCONFIG_LDDIR=\"lib64\") endif ifeq ($(ARCH),arm) @@ -52,10 +46,8 @@ NATIVE_DEFINES=-DTCC_TARGET_ARM NATIVE_DEFINES+=-DWITHOUT_LIBTCC ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 /lib/arm-linux-gnueabihf/ld-linux.so.3)) NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT -NATIVE_DEFINES+=$(if $(wildcard /lib/arm-linux-gnueabihf),-DCONFIG_MULTIARCHDIR=\"arm-linux-gnueabihf\") else ifneq (,$(wildcard /lib/ld-linux.so.3)) NATIVE_DEFINES+=-DTCC_ARM_EABI -NATIVE_DEFINES+=$(if $(wildcard /lib/arm-linux-gnueabi), -DCONFIG_MULTIARCHDIR=\"arm-linux-gnueabi\") endif NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP) endif diff --git a/configure b/configure index f8619a3..eca801e 100755 --- a/configure +++ b/configure @@ -260,6 +260,15 @@ if $cc -o $TMPO $TMPC 2> /dev/null ; then gcc_major="4" fi +# check if system is multiarch +if test -z "$cross_prefix" -a -z "$tcc_crtprefix" ; then + if test ! -f $sysroot/usr/lib/crti.o -a ! -f $sysroot/usr/lib64/crti.o ; then + use_multiarch="yes" + elif test -L $sysroot/usr/lib/crti.o -o -L $sysroot/usr/lib64/crti.o ; then + use_multiarch="yes" + fi +fi + if test x"$show_help" = "xyes" ; then cat << EOF Usage: configure [options] @@ -491,6 +500,9 @@ if test "$have_selinux" = "yes" ; then echo "#define HAVE_SELINUX" >> $TMPH echo "HAVE_SELINUX=yes" >> config.mak fi +if test "$use_multiarch" = "yes" ; then + echo "#define CONFIG_TCC_MULTIARCH" >> $TMPH +fi version=`head $source_path/VERSION` echo "VERSION=$version" >>config.mak diff --git a/tcc.h b/tcc.h index 885951c..bf5a818 100644 --- a/tcc.h +++ b/tcc.h @@ -167,6 +167,34 @@ # define CONFIG_SYSROOT "" #endif +#if defined(CONFIG_TCC_MULTIARCH) && defined(TCC_IS_NATIVE) +/* Define architecture */ +# if defined(TCC_TARGET_I386) +# define TRIPLET_ARCH "i386" +# elif defined(TCC_TARGET_X86_64) +# define TRIPLET_ARCH "x86_64" +# elif defined(TCC_TARGET_ARM) +# define TRIPLET_ARCH "arm" +# else +# define TRIPLET_ARCH "unknown" +# endif +/* Define OS */ +# if defined (__linux__) +# define TRIPLET_OS "linux" +# elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) +# define TRIPLET_OS "kfreebsd" +# elif !defined (__GNU__) +# define TRIPLET_OS "unknown" +# endif +/* Define calling convention and ABI */ +# define TRIPLET_ABI "gnu" +# ifdef __GNU__ +# define CONFIG_MULTIARCHDIR TRIPLET_ARCH "-" TRIPLET_ABI +# else +# define CONFIG_MULTIARCHDIR TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI +# endif +#endif + #ifndef CONFIG_LDDIR # ifdef CONFIG_MULTIARCHDIR # define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel