diff --git a/Makefile b/Makefile index c530eb8..dd11a9f 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ ALLOCA_O=alloca86.o alloca86-bt.o else ifeq ($(ARCH),x86-64) NATIVE_DEFINES=-DTCC_TARGET_X86_64 +NATIVE_DEFINES+=$(if $(wildcard /lib64/ld-linux-x86-64.so.2),-DTCC_TARGET_X86_64_CENTOS) LIBTCC1=libtcc1.a BCHECK_O= ALLOCA_O=alloca86_64.o diff --git a/libtcc.c b/libtcc.c index 520abfd..2f23fe6 100644 --- a/libtcc.c +++ b/libtcc.c @@ -944,9 +944,15 @@ LIBTCCAPI TCCState *tcc_new(void) #ifndef TCC_TARGET_PE /* default library paths */ - tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib"); +# if defined(TCC_TARGET_X86_64_CENTOS) + tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib64"); + tcc_add_library_path(s, CONFIG_SYSROOT "/lib64"); + tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib64"); +# else tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib"); tcc_add_library_path(s, CONFIG_SYSROOT "/lib"); + tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib"); +# endif #endif /* no section zero */ diff --git a/tcc.h b/tcc.h index 156bdd0..ef0bb78 100644 --- a/tcc.h +++ b/tcc.h @@ -136,7 +136,11 @@ typedef int BOOL; /* path to find crt1.o, crti.o and crtn.o. Only needed when generating executables or dlls */ -#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib" +#if defined(TCC_TARGET_X86_64_CENTOS) +# define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib64" +#else +# define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib" +#endif #define INCLUDE_STACK_SIZE 32 #define IFDEF_STACK_SIZE 64 diff --git a/tccelf.c b/tccelf.c index 2d884d2..f262ac5 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1307,7 +1307,11 @@ static const char elf_interp[] = "/libexec/ld-elf.so.1"; #elif defined TCC_ARM_EABI static const char elf_interp[] = "/lib/ld-linux.so.3"; #elif defined(TCC_TARGET_X86_64) +# if defined(TCC_TARGET_X86_64_CENTOS) +static const char elf_interp[] = "/lib64/ld-linux-x86-64.so.2"; +# else static const char elf_interp[] = "/lib/ld-linux-x86-64.so.2"; +# endif /* TCC_TARGET_X86_64_CENTOS */ #elif defined(TCC_UCLIBC) static const char elf_interp[] = "/lib/ld-uClibc.so.0"; #else