From a2c71af1ea750587950121aca3f2a67076b03e07 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 22 May 2012 23:44:03 +0200 Subject: [PATCH] Fix CONFIG_LDDIR usage This patch fix 2 bugs in CONFIG_LDDIR usage: * CONFIG_LDDIR used for 2 purposes there is confusion between the directory to find libraries, crt* files and headers and the directory in which the program interpreter is. These two directories are not related. The latter is specified by the ABI and should not be configurable while the former depends on the system (single arch, biarch, multiarch). This end a longstanding issue with amd64 program interpreter later propagated to other architecture interpreters. * If multiarch is in effect, then the library directory should be /lib. /lib64 denotes biarch architecture, everything which is here would be in /lib/x86_64-linux-gnu instead. --- tcc.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tcc.h b/tcc.h index a674f92..029d52b 100644 --- a/tcc.h +++ b/tcc.h @@ -153,11 +153,12 @@ #endif #ifndef CONFIG_LDDIR -# ifdef CONFIG_MULTIARCHDIR -# define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR -# else -# define CONFIG_LDDIR "lib" -# endif +# define CONFIG_LDDIR "lib" +#endif + +#ifdef CONFIG_MULTIARCHDIR +# undef CONFIG_LDDIR +# define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR #endif /* path to find crt1.o, crti.o and crtn.o */ @@ -203,15 +204,15 @@ # if defined __FreeBSD__ # define CONFIG_TCC_ELFINTERP "/libexec/ld-elf.so.1" # elif defined __FreeBSD_kernel__ -# define CONFIG_TCC_ELFINTERP "/" CONFIG_LDDIR "/ld.so.1" +# define CONFIG_TCC_ELFINTERP "/lib/ld.so.1" # elif defined TCC_ARM_EABI -# define CONFIG_TCC_ELFINTERP "/" CONFIG_LDDIR "/ld-linux.so.3" +# define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.3" # elif defined(TCC_TARGET_X86_64) -# define CONFIG_TCC_ELFINTERP "/" CONFIG_LDDIR "/ld-linux-x86-64.so.2" +# define CONFIG_TCC_ELFINTERP "/lib64/ld-linux-x86-64.so.2" # elif defined(TCC_UCLIBC) -# define CONFIG_TCC_ELFINTERP "/" CONFIG_LDDIR "/ld-uClibc.so.0" +# define CONFIG_TCC_ELFINTERP "/lib/ld-uClibc.so.0" # else -# define CONFIG_TCC_ELFINTERP "/" CONFIG_LDDIR "/ld-linux.so.2" +# define CONFIG_TCC_ELFINTERP "/lib/ld-linux.so.2" # endif #endif