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.
This commit is contained in:
Thomas Preud'homme 2012-05-22 23:44:03 +02:00
parent 2daae0dc99
commit a2c71af1ea

17
tcc.h
View File

@ -153,11 +153,12 @@
#endif
#ifndef CONFIG_LDDIR
# ifdef CONFIG_MULTIARCHDIR
# define CONFIG_LDDIR "lib/" CONFIG_MULTIARCHDIR
# else
# 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