aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2012-05-23 00:14:15 +0200
committerThomas Preud'homme <robotux@celest.fr>2012-05-23 00:14:15 +0200
commitb56edc7b90631795c246c0220685e139c628ef94 (patch)
tree914f67cb2dbd3971643c5d7344f1e8ccdcde70ef
parenta2c71af1ea750587950121aca3f2a67076b03e07 (diff)
downloadtinycc-b56edc7b90631795c246c0220685e139c628ef94.tar.gz
tinycc-b56edc7b90631795c246c0220685e139c628ef94.tar.bz2
Several multiarch/biarch fixes
* Add multiarch directories for arm and i386 * Fix detection of biarch: /lib64/ld-linux-x86-64.so.2 is mandated by ABI and is thus always present, even if there is no biarch * Define CONFIG_LDDIR directly with the right value in case of multiarch instead of defining it to /lib and then redifining it.
-rw-r--r--Makefile6
-rw-r--r--tcc.h9
2 files changed, 8 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index fe5dea9..60aabbd 100644
--- a/Makefile
+++ b/Makefile
@@ -37,13 +37,14 @@ endif
ifeq ($(ARCH),i386)
NATIVE_DEFINES=-DTCC_TARGET_I386
+NATIVE_DEFINES+=$(if $(wildcard /lib/i386-linux-gnu),-DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\")
CFLAGS+=-m32
else
ifeq ($(ARCH),x86-64)
NATIVE_DEFINES=-DTCC_TARGET_X86_64
CFLAGS+=-m64
-NATIVE_DEFINES+=$(if $(wildcard /lib64/ld-linux-x86-64.so.2),-DCONFIG_LDDIR=\"lib64\")
-NATIVE_DEFINES+=$(if $(wildcard /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2),-DCONFIG_MULTIARCHDIR=\"x86_64-linux-gnu\")
+NATIVE_DEFINES+=$(if $(wildcard /usr/lib64),-DCONFIG_LDDIR=\"lib64\")
+NATIVE_DEFINES+=$(if $(wildcard /lib/x86_64-linux-gnu),-DCONFIG_MULTIARCHDIR=\"x86_64-linux-gnu\")
endif
endif
@@ -51,6 +52,7 @@ ifeq ($(ARCH),arm)
NATIVE_DEFINES=-DTCC_TARGET_ARM
NATIVE_DEFINES+=-DWITHOUT_LIBTCC
NATIVE_DEFINES+=$(if $(wildcard /lib/ld-linux.so.3),-DTCC_ARM_EABI)
+NATIVE_DEFINES+=$(if $(wildcard /lib/arm-linux-gnueabi),-DCONFIG_MULTIARCHDIR=\"arm-linux-gnueabi\")
NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo),-DTCC_ARM_VFP)
endif
diff --git a/tcc.h b/tcc.h
index 029d52b..a53dd78 100644
--- a/tcc.h
+++ b/tcc.h
@@ -152,15 +152,14 @@
# define CONFIG_SYSROOT ""
#endif
-#ifndef CONFIG_LDDIR
-# define CONFIG_LDDIR "lib"
-#endif
-
#ifdef CONFIG_MULTIARCHDIR
-# undef CONFIG_LDDIR
# define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR
#endif
+#ifndef CONFIG_LDDIR
+# define CONFIG_LDDIR "lib"
+#endif
+
/* path to find crt1.o, crti.o and crtn.o */
#ifndef CONFIG_TCC_CRTPREFIX
# define CONFIG_TCC_CRTPREFIX CONFIG_SYSROOT "/usr/" CONFIG_LDDIR