On 12/03/13 21:24, Andrew Pinski wrote:
Hi,
This is the final patch which adds support for the dynamic linker and
multi-lib directories for ILP32. I did not change multi-arch support as
I did not know what it should be changed to and internally here at Cavium,
we don't use multi-arch.
OK? Build and tested for aarch64-linux-gnu with and without
--with-multilib-list=lp64,ilp32.
Thanks,
Andrew Pinski
* config/aarch64/aarch64-linux.h (GLIBC_DYNAMIC_LINKER):
/lib/ld-linux32-aarch64.so.1
is used for ILP32.
(LINUX_TARGET_LINK_SPEC): Add linker script
file whose name depends on -mabi= and -mbig-endian.
* config/aarch64/t-aarch64-linux (MULTILIB_OSDIRNAMES): Handle LP64
better
and handle ilp32 too.
(MULTILIB_OPTIONS): Delete.
(MULTILIB_DIRNAMES): Delete.
---
gcc/ChangeLog | 11 +++++++++++
gcc/config/aarch64/aarch64-linux.h | 5 +++--
gcc/config/aarch64/t-aarch64-linux | 7 ++-----
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h
b/gcc/config/aarch64/aarch64-linux.h
index 83efad4..408297a 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -21,7 +21,7 @@
#ifndef GCC_AARCH64_LINUX_H
#define GCC_AARCH64_LINUX_H
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux%{mabi=ilp32:32}-aarch64.so.1"
To be more explicit and consistent, the name of the ILP32 loader shall
have 'ilp32' instead of '32'. The extension field shall be appended to
'aarch64', separated by '_', and we should probably add the big-endian
name at the same time. With the extension fields sorted alphabetically,
GLIBC_DYNAMIC_LINKER can be defined as:
"/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
The multi-arch names shall follow the same naming convention (although
we don't have to add the multi-arch support right now).
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
@@ -32,7 +32,8 @@
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER " \
-X \
- %{mbig-endian:-EB} %{mlittle-endian:-EL}"
+ %{mbig-endian:-EB} %{mlittle-endian:-EL} \
+ -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}"
#define LINK_SPEC LINUX_TARGET_LINK_SPEC
diff --git a/gcc/config/aarch64/t-aarch64-linux
b/gcc/config/aarch64/t-aarch64-linux
index ca1525e..5032ea9 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -22,10 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = .=../lib64$(call
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call
if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
-# Disable the multilib for linux-gnu targets for the time being; focus
-# on the baremetal targets.
-MULTILIB_OPTIONS =
-MULTILIB_DIRNAMES =
+MULTILIB_OSDIRNAMES += mabi.ilp32=../lib32
Similarly, we shall use libilp32 for the OSDIRNAME. Although a bit
ugly, libilp32 is much less ambiguous than lib32; the latter is easily
confused with a directory for aarch32 libs.
Thanks,
Yufeng