All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64
@ 2015-03-18  9:49 Zhang Jian
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

This is second version of my patches. This previous version is here[1].
The previous discussion, Gustavo agree that only external toolchain is in
consideration at this time. I will try to work on the buildroot toolchain
after current series patch is upstreamed.

ILP32 is very useful when the user want to migrate from arm 32bit to 64bit
with minimal risk. There is no code changes and almost no footprint changes
after migration. ILP32 could get the better performance compare with arm 32bit
(use 64bit register and instruction instead of 32bit one) and aarch64 LP64
(aarch64 default ABI).

Our test show that the performance of ILP32 is roughly 10% better than arm64
LP64 while the footprint is 86% of LP64. Because of these, It is useful for
both embedded and enterprise system.

Here is the details definition of ILP32:
ILP32 is elf32 with aarch64 assembly and is compiled by 64bit compiler.
Refer the following table:

  \-            |  arm 32bit  | arm64 ILP32 | arm64 LP64
----------------|-------------|-------------|-------------
instruction set |   armv7-a   |   armv8-a   |   armv8-a
int             |   32bit     |   32bit     |   32bit
long            |   32bit     | **32bit**   |   64bit
pointer         |   32bit     | **32bit**   |   64bit

LP64 is the default ABI on arm64(Implies -mabi=lp64 while compiling), and the
kernel remains in LP64 no matter ILP32 enables or not.

These series patches introduce the big endian support in aarch64 and then add
ILP32 special filename and menuconfig step by step.

The test of build is based on linaro kernel [2] and toolchain built by linaro
ABE environment[3], anyone could built this toolchain through the simpile
abe script.

This is my first time I try to contribute the buildroot, feedback is very
appreciated. Sorry if there are some coding style issues.

changes since v1
1.  avoid mabi issue in gcc 4.8 while build aarch64 lp64.
2.  change default libc, toolchain for ilp32 build.
3.  others changes suggested by Gustavo.

[1] http://lists.busybox.net/pipermail/buildroot/2015-March/122115.html
[2] https://git.linaro.org/kernel/linux-linaro-tracking.git
[3] https://wiki.linaro.org/ABE

Zhang Jian(Bamvor) (5):
  aarch64: add big endian(aarch64_be) support
  aarch64: ilp32: handle special file name
  aarch64: ilp32: add ilp32 compiler and linker flags
  aarch64: ilp32: add ilp32 build config
  aarch64: ilp32 defconfig examples

 Makefile                                           | 11 +++++-
 arch/Config.in                                     | 12 +++++--
 arch/Config.in.aarch64                             | 40 ++++++++++++++++++++-
 configs/aarch64_be_defconfig                       |  2 ++
 configs/aarch64_be_ilp32_defconfig                 |  8 +++++
 configs/aarch64_ilp32_defconfig                    |  8 +++++
 package/Makefile.in                                | 10 +++++-
 package/gcc/Config.in.host                         |  3 +-
 toolchain/Config.in                                |  2 ++
 toolchain/helpers.mk                               |  4 +--
 toolchain/toolchain-buildroot/Config.in            | 27 +++++++-------
 toolchain/toolchain-external/Config.in             | 20 +++++++++++
 toolchain/toolchain-external/toolchain-external.mk | 41 ++++++++++++++++++++--
 13 files changed, 165 insertions(+), 23 deletions(-)
 create mode 100644 configs/aarch64_be_defconfig
 create mode 100644 configs/aarch64_be_ilp32_defconfig
 create mode 100644 configs/aarch64_ilp32_defconfig

-- 
1.8.4.5

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
@ 2015-03-18  9:49 ` Zhang Jian
  2015-04-10 12:24   ` Gustavo Zacarias
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name Zhang Jian
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

Add aarch64_be support. Note that CONFIG_CPU_BIG_ENDIAN should be
defined in kernel config when building a big endian kernel.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 Makefile                                |  2 +-
 arch/Config.in                          | 12 ++++++++++--
 arch/Config.in.aarch64                  |  5 ++++-
 toolchain/toolchain-buildroot/Config.in | 27 ++++++++++++++-------------
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index af043a3..84402be 100644
--- a/Makefile
+++ b/Makefile
@@ -315,7 +315,7 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
 	-e s/arcle/arc/ \
 	-e s/arceb/arc/ \
 	-e s/arm.*/arm/ -e s/sa110/arm/ \
-	-e s/aarch64/arm64/ \
+	-e s/aarch64.*/arm64/ \
 	-e s/bfin/blackfin/ \
 	-e s/parisc64/parisc/ \
 	-e s/powerpc64.*/powerpc/ \
diff --git a/arch/Config.in b/arch/Config.in
index 16ad8be..4e4ab37 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -46,7 +46,15 @@ config BR2_armeb
 	  http://en.wikipedia.org/wiki/ARM
 
 config BR2_aarch64
-	bool "AArch64"
+	bool "AArch64 (little endian)"
+	select BR2_ARCH_IS_64
+	help
+	  Aarch64 is a 64-bit architecture developed by ARM Holdings.
+	  http://www.arm.com/products/processors/instruction-set-architectures/armv8-architecture.php
+	  http://en.wikipedia.org/wiki/ARM
+
+config BR2_aarch64_be
+	bool "AArch64 (big endian)"
 	select BR2_ARCH_IS_64
 	help
 	  Aarch64 is a 64-bit architecture developed by ARM Holdings.
@@ -309,7 +317,7 @@ if BR2_arm || BR2_armeb
 source "arch/Config.in.arm"
 endif
 
-if BR2_aarch64
+if BR2_aarch64 || BR2_aarch64_be
 source "arch/Config.in.aarch64"
 endif
 
diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
index 2e79870..9830302 100644
--- a/arch/Config.in.aarch64
+++ b/arch/Config.in.aarch64
@@ -1,8 +1,11 @@
 config BR2_ARCH
 	default "aarch64"	if BR2_aarch64
+	default "aarch64_be"	if BR2_aarch64_be
 
 config BR2_ENDIAN
-	default "LITTLE"
+	default "LITTLE" if BR2_aarch64
+	default "BIG"	 if BR2_aarch64_be
 
 config BR2_ARCH_HAS_ATOMICS
 	default y
+
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index d4e3bcc..1c2525d 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -23,8 +23,8 @@ source "package/linux-headers/Config.in.host"
 choice
 	prompt "C library"
 	default BR2_TOOLCHAIN_UCLIBC
-	default BR2_TOOLCHAIN_BUILDROOT_GLIBC if BR2_aarch64 || BR2_microblaze \
-		|| BR2_mips64 || BR2_mips64el || BR2_powerpc64
+	default BR2_TOOLCHAIN_BUILDROOT_GLIBC if BR2_aarch64 || BR2_aarch64_be \
+		|| BR2_microblaze || BR2_mips64 || BR2_mips64el || BR2_powerpc64
 
 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	bool "uClibc"
@@ -42,11 +42,12 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 
 config BR2_TOOLCHAIN_BUILDROOT_EGLIBC
 	bool "eglibc"
-	depends on BR2_arm    || BR2_armeb    || BR2_aarch64 || \
-		   BR2_i386   || BR2_mips     || BR2_mipsel  || \
-		   BR2_mips64 || BR2_mips64el || BR2_powerpc || \
-		   BR2_sh     || BR2_sh64     || BR2_sparc   || \
-		   BR2_x86_64 || BR2_microblaze || BR2_powerpc64
+	depends on BR2_arm        || BR2_armeb    || BR2_aarch64    || \
+		   BR2_aarch64_be || BR2_i386     || BR2_mips       || \
+		   BR2_mipsel     || BR2_mips64   || BR2_mips64el   || \
+		   BR2_powerpc    || BR2_sh       || BR2_sh64       || \
+		   BR2_sparc      || BR2_x86_64   || BR2_microblaze || \
+		   BR2_powerpc64
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS
 	select BR2_TOOLCHAIN_USES_GLIBC
@@ -60,12 +61,12 @@ config BR2_TOOLCHAIN_BUILDROOT_EGLIBC
 
 config BR2_TOOLCHAIN_BUILDROOT_GLIBC
 	bool "glibc"
-	depends on BR2_arm         || BR2_armeb    || BR2_aarch64 || \
-		   BR2_i386        || BR2_mips     || BR2_mipsel  || \
-		   BR2_mips64      || BR2_mips64el || BR2_powerpc || \
-		   BR2_powerpc64   || BR2_powerpc64le || BR2_sh   || \
-		   BR2_sh64        || BR2_sparc    || BR2_x86_64  || \
-		   BR2_microblaze  || BR2_nios2
+	depends on BR2_arm         || BR2_armeb      || BR2_aarch64 || \
+		   BR2_aarch64_be  || BR2_i386       || BR2_mips    || \
+		   BR2_mipsel      || BR2_mips64     || BR2_mips64el|| \
+		   BR2_powerpc     || BR2_powerpc64  || BR2_powerpc64le || \
+		   BR2_sh          || BR2_sh64       || BR2_sparc   || \
+		   BR2_x86_64      || BR2_microblaze || BR2_nios2
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS
 	depends on !BR2_powerpc_SPE
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
@ 2015-03-18  9:49 ` Zhang Jian
  2015-04-10 12:35   ` Gustavo Zacarias
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

In aarch64 ilp32, the directory of library is libilp32 and the linker is
ld-linux-aarch64_ilp32.so.1 or ld-linux-aarch64_be_ilp32.so.1.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 Makefile                                           |  9 +++++
 toolchain/helpers.mk                               |  4 +--
 toolchain/toolchain-external/toolchain-external.mk | 41 ++++++++++++++++++++--
 3 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 84402be..0fbb12a 100644
--- a/Makefile
+++ b/Makefile
@@ -456,6 +456,15 @@ LIB_SYMLINK = lib64
 else
 LIB_SYMLINK = lib32
 endif
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+# Leave extension for x32 on x86_64 which is libx32 instead of libx32
+ifeq ($(BR2_aarch64), y)
+LIB_SYMLINK = libilp32
+endif
+ifeq ($(BR2_aarch64_be), y)
+LIB_SYMLINK = libilp32
+endif
+endif
 
 $(STAGING_DIR):
 	@mkdir -p $(STAGING_DIR)/bin
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 3121da4..ffb5c72 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -38,7 +38,7 @@
 #
 # $1: arch specific sysroot directory
 # $2: support libraries directory (can be empty)
-# $3: library directory ('lib' or 'lib64') from which libraries must be copied
+# $3: library directory ('lib', 'lib64' or 'libilp32') from which libraries must be copied
 # $4: library name
 # $5: destination directory of the libary, relative to $(TARGET_DIR)
 #
@@ -140,7 +140,7 @@ copy_toolchain_sysroot = \
 	for i in etc $${ARCH_LIB_DIR} sbin usr usr/$${ARCH_LIB_DIR}; do \
 		if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \
 			rsync -au --chmod=Du+w --exclude 'usr/lib/locale' \
-				--exclude lib --exclude lib32 --exclude lib64 \
+				--exclude lib --exclude lib32 --exclude lib64 --exclude libilp32 \
 				$${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \
 		fi ; \
 	done ; \
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index c0429bb..2bb0a39 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -86,6 +86,10 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
 LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
 endif
 
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+LIB_EXTERNAL_LIBS += ld*.so
+endif
+
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 USR_LIB_EXTERNAL_LIBS += libstdc++.so.*
 endif
@@ -253,6 +257,19 @@ define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
 	ln -sf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
 endef
 
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+ifeq ($(BR2_ENDIAN), "LITTLE")
+define TOOLCHAIN_EXTERNAL_ILP32_SYMLINK
+	ln -sf ld*.so $(TARGET_DIR)/lib/ld-linux-aarch64_ilp32.so.1
+endef
+endif
+ifeq ($(BR2_ENDIAN), "BIG")
+define TOOLCHAIN_EXTERNAL_ILP32_SYMLINK
+	ln -sf ld*.so $(TARGET_DIR)/lib/ld-linux-aarch64_be_ilp32.so.1
+endef
+endif
+endif
+
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305),y)
 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi
 TOOLCHAIN_EXTERNAL_SOURCE = arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
@@ -400,6 +417,7 @@ else
 # Custom toolchain
 TOOLCHAIN_EXTERNAL_SITE = $(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
 TOOLCHAIN_EXTERNAL_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
+TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_ILP32_SYMLINK
 endif
 
 # In fact, we don't need to download the toolchain, since it is already
@@ -444,13 +462,13 @@ endef
 
 # Returns the sysroot location for the given compiler + flags
 define toolchain_find_sysroot
-$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64)?/([^/]*/)?libc\.a::')
+$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64|ilp32)?/([^/]*/)?libc\.a::')
 endef
 
 # Returns the lib subdirectory for the given compiler + flags (i.e
 # typically lib32 or lib64 for some toolchains)
 define toolchain_find_libdir
-$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64)?)/([^/]*/)?libc.a:\2:')
+$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64|ilp32)?)/([^/]*/)?libc.a:\2:')
 endef
 
 # Checks for an already installed toolchain: check the toolchain
@@ -716,10 +734,28 @@ define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
 	fi
 endef
 
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+ifeq ($(BR2_ENDIAN), "LITTLE")
+ILP32_SYM = ld-linux-aarch64_ilp32.so.1
+else
+ILP32_SYM = ld-linux-aarch64_be_ilp32.so.1
+endif
+define TOOLCHAIN_EXTERNAL_INSTALL_ILP32_LINK
+	LD_ILP32=`basename $(STAGING_DIR)/lib/ld*.so`; \
+	ln -sf $${LD_ILP32} $(STAGING_DIR)/lib/${ILP32_SYM}
+endef
+
+define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_ILP32_LINK
+	LD_ILP32=`basename $(TARGET_DIR)/lib/ld*.so`; \
+	ln -sf $${LD_ILP32} $(TARGET_DIR)/lib/${ILP32_SYM}
+endef
+endif
+
 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
+	$(TOOLCHAIN_EXTERNAL_INSTALL_ILP32_LINK)
 endef
 
 # Even though we're installing things in both the staging, the host
@@ -729,6 +765,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
 	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
 	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
+	$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_ILP32_LINK)
 endef
 
 $(eval $(generic-package))
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name Zhang Jian
@ 2015-03-18  9:49 ` Zhang Jian
  2015-04-10 12:36   ` Gustavo Zacarias
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config Zhang Jian
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

In aarch64, lp64 is the default ABI. Need pass the special flags if
the user want to compile and link ilp32 application.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 package/Makefile.in | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/Makefile.in b/package/Makefile.in
index 803b162..23f376f 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -106,6 +106,14 @@ ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
 TARGET_ABI += -matomic
 endif
 
+ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64),yy)
+TARGET_ABI += -mabi=ilp32 -Xlinker -maarch64linux32
+endif
+
+ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64_be),yy)
+TARGET_ABI += -mabi=ilp32 -Xlinker -EB -Xlinker -maarch64linux32b
+endif
+
 STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
 STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
 
@@ -142,7 +150,7 @@ endif
 
 TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
 TARGET_CXXFLAGS = $(TARGET_CFLAGS)
-TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
+TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) $(TARGET_ABI)
 
 ifeq ($(BR2_BINFMT_FLAT),y)
 TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (2 preceding siblings ...)
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
@ 2015-03-18  9:49 ` Zhang Jian
  2015-04-10 12:46   ` Gustavo Zacarias
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 5/5] aarch64: ilp32 defconfig examples Zhang Jian
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

Add ILP32 in menuconfig. And disable the libc and toolchain which
does not support ILP32.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 arch/Config.in.aarch64                 | 35 ++++++++++++++++++++++++++++++++++
 package/gcc/Config.in.host             |  3 ++-
 toolchain/Config.in                    |  2 ++
 toolchain/toolchain-external/Config.in | 20 +++++++++++++++++++
 4 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
index 9830302..c9434d7 100644
--- a/arch/Config.in.aarch64
+++ b/arch/Config.in.aarch64
@@ -9,3 +9,38 @@ config BR2_ENDIAN
 config BR2_ARCH_HAS_ATOMICS
 	default y
 
+config BR2_GCC_TARGET_ABI
+	default "" if BR2_AARCH64_LP64
+	default "ilp32" if BR2_AARCH64_ILP32
+
+choice
+	prompt "Target ABI"
+	depends on BR2_aarch64 || BR2_aarch64_be
+	default BR2_AARCH64_LP64
+	help
+	  Application Binary Interface to use. The Application Binary
+	  Interface describes the calling conventions (how arguments
+	  are passed to functions, how the return value is passed, how
+	  system calls are made, etc.).
+
+config BR2_AARCH64_LP64
+	bool "LP64"
+	help
+	  The LP64 is the default ABI in aarch64. It means that
+	  long and pointer is 64bit.
+
+ config BR2_AARCH64_ILP32
+	bool "ILP32"
+	help
+	  ILP32 is a method for running 32bit application on 64bit platform, such
+	  binary is elf32 with aarch64 assembly and is compiled by 64bit compiler.
+	  Refer the following table:
+
+	    \-            |  arm 32bit  | arm64 ILP32 | arm64 LP64
+	  ----------------|-------------|-------------|-------------
+	  instruction set |   armv7-a   |   armv8-a   |   armv8-a
+	  int             |   32bit     |   32bit     |   32bit
+	  long            |   32bit     | **32bit**   |   64bit
+	  pointer         |   32bit     | **32bit**   |   64bit
+
+endchoice
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 1a5281c..b072e4d 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -56,7 +56,8 @@ choice
 		bool "gcc 4.8.x"
 		# Broken or unsupported architectures
 		depends on !BR2_microblaze && !BR2_arc \
-			&& !BR2_bfin && !BR2_powerpc64le && !BR2_nios2
+			&& !BR2_bfin && !BR2_powerpc64le && !BR2_nios2 \
+			&& !BR2_AARCH64_ILP32
 		# Broken or unsupported ARM cores
 		depends on !BR2_cortex_a12
 		# Broken or unsupported PPC cores
diff --git a/toolchain/Config.in b/toolchain/Config.in
index efb77f8..c78708d 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -31,6 +31,7 @@ config BR2_TOOLCHAIN_USES_MUSL
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on !BR2_AARCH64_ILP32
 
 choice
 	prompt "Toolchain type"
@@ -44,6 +45,7 @@ choice
 config BR2_TOOLCHAIN_BUILDROOT
 	bool "Buildroot toolchain"
 	depends on !BR2_bfin
+	depends on !BR2_AARCH64_ILP32
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
 
 config BR2_TOOLCHAIN_EXTERNAL
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 8b0f09b..48082b0 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -835,6 +835,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
 	depends on BR2_aarch64
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on !BR2_STATIC_LIBS
+	depends on !BR2_AARCH64_ILP32
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
@@ -849,6 +850,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
 	depends on BR2_aarch64
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on !BR2_STATIC_LIBS
+	depends on !BR2_AARCH64_ILP32
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
@@ -1043,69 +1045,86 @@ config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_15
 	bool "3.15.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_14
 	bool "3.14.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_13
 	bool "3.13.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_12
 	bool "3.12.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_11
 	bool "3.11.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10
 	bool "3.10.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_9
 	bool "3.9.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_8
 	bool "3.8.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_8
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_7
 	bool "3.7.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_6
 	bool "3.6.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_6
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_5
 	bool "3.5.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_4
 	bool "3.4.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_3
 	bool "3.3.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_3
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2
 	bool "3.2.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_1
 	bool "3.1.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_0
 	bool "3.0.x"
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
+	depends on !BR2_AARCH64_ILP32
 
 config BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD
 	bool "2.6.x"
+	depends on !BR2_AARCH64_ILP32
 
 endchoice
 
@@ -1116,6 +1135,7 @@ choice
 config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
 	bool "uClibc"
 	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
+	depends on !BR2_AARCH64_ILP32
 	# For the time being, we assume that all custom external
 	# toolchains have shadow password support.
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 5/5] aarch64: ilp32 defconfig examples
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (3 preceding siblings ...)
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config Zhang Jian
@ 2015-03-18  9:49 ` Zhang Jian
  2015-04-10  9:16 ` [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
  2015-07-12 16:45 ` Thomas Petazzoni
  6 siblings, 0 replies; 17+ messages in thread
From: Zhang Jian @ 2015-03-18  9:49 UTC (permalink / raw)
  To: buildroot

DO NOT APPLY.

Test aarch64 lp64 through qemu_aarch64_virt_defconfig.
Test aarch64 ilp32, aarch64_be lp64, aarch64_be ilp32 through the
following config.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 configs/aarch64_be_defconfig       | 2 ++
 configs/aarch64_be_ilp32_defconfig | 8 ++++++++
 configs/aarch64_ilp32_defconfig    | 8 ++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 configs/aarch64_be_defconfig
 create mode 100644 configs/aarch64_be_ilp32_defconfig
 create mode 100644 configs/aarch64_ilp32_defconfig

diff --git a/configs/aarch64_be_defconfig b/configs/aarch64_be_defconfig
new file mode 100644
index 0000000..6995953
--- /dev/null
+++ b/configs/aarch64_be_defconfig
@@ -0,0 +1,2 @@
+# Architecture
+BR2_aarch64_be=y
diff --git a/configs/aarch64_be_ilp32_defconfig b/configs/aarch64_be_ilp32_defconfig
new file mode 100644
index 0000000..6a2848a
--- /dev/null
+++ b/configs/aarch64_be_ilp32_defconfig
@@ -0,0 +1,8 @@
+# Architecture
+BR2_aarch64_be=y
+BR2_AARCH64_ILP32=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/path/to/your/toolchain"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
+BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
diff --git a/configs/aarch64_ilp32_defconfig b/configs/aarch64_ilp32_defconfig
new file mode 100644
index 0000000..2956b05
--- /dev/null
+++ b/configs/aarch64_ilp32_defconfig
@@ -0,0 +1,8 @@
+# Architecture
+BR2_aarch64=y
+BR2_AARCH64_ILP32=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/path/to/your/toolchain"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
+BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (4 preceding siblings ...)
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 5/5] aarch64: ilp32 defconfig examples Zhang Jian
@ 2015-04-10  9:16 ` Bamvor Jian Zhang
  2015-07-12 16:45 ` Thomas Petazzoni
  6 siblings, 0 replies; 17+ messages in thread
From: Bamvor Jian Zhang @ 2015-04-10  9:16 UTC (permalink / raw)
  To: buildroot

On 2015/3/18 17:49, Zhang Jian(Bamvor) wrote:
Ping.
It seems that no response in recent four weeks.

bamvor
> This is second version of my patches. This previous version is here[1].
> The previous discussion, Gustavo agree that only external toolchain is in
> consideration at this time. I will try to work on the buildroot toolchain
> after current series patch is upstreamed.
> 
> ILP32 is very useful when the user want to migrate from arm 32bit to 64bit
> with minimal risk. There is no code changes and almost no footprint changes
> after migration. ILP32 could get the better performance compare with arm 32bit
> (use 64bit register and instruction instead of 32bit one) and aarch64 LP64
> (aarch64 default ABI).
> 
> Our test show that the performance of ILP32 is roughly 10% better than arm64
> LP64 while the footprint is 86% of LP64. Because of these, It is useful for
> both embedded and enterprise system.
> 
> Here is the details definition of ILP32:
> ILP32 is elf32 with aarch64 assembly and is compiled by 64bit compiler.
> Refer the following table:
> 
>   \-            |  arm 32bit  | arm64 ILP32 | arm64 LP64
> ----------------|-------------|-------------|-------------
> instruction set |   armv7-a   |   armv8-a   |   armv8-a
> int             |   32bit     |   32bit     |   32bit
> long            |   32bit     | **32bit**   |   64bit
> pointer         |   32bit     | **32bit**   |   64bit
> 
> LP64 is the default ABI on arm64(Implies -mabi=lp64 while compiling), and the
> kernel remains in LP64 no matter ILP32 enables or not.
> 
> These series patches introduce the big endian support in aarch64 and then add
> ILP32 special filename and menuconfig step by step.
> 
> The test of build is based on linaro kernel [2] and toolchain built by linaro
> ABE environment[3], anyone could built this toolchain through the simpile
> abe script.
> 
> This is my first time I try to contribute the buildroot, feedback is very
> appreciated. Sorry if there are some coding style issues.
> 
> changes since v1
> 1.  avoid mabi issue in gcc 4.8 while build aarch64 lp64.
> 2.  change default libc, toolchain for ilp32 build.
> 3.  others changes suggested by Gustavo.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2015-March/122115.html
> [2] https://git.linaro.org/kernel/linux-linaro-tracking.git
> [3] https://wiki.linaro.org/ABE
> 
> Zhang Jian(Bamvor) (5):
>   aarch64: add big endian(aarch64_be) support
>   aarch64: ilp32: handle special file name
>   aarch64: ilp32: add ilp32 compiler and linker flags
>   aarch64: ilp32: add ilp32 build config
>   aarch64: ilp32 defconfig examples
> 
>  Makefile                                           | 11 +++++-
>  arch/Config.in                                     | 12 +++++--
>  arch/Config.in.aarch64                             | 40 ++++++++++++++++++++-
>  configs/aarch64_be_defconfig                       |  2 ++
>  configs/aarch64_be_ilp32_defconfig                 |  8 +++++
>  configs/aarch64_ilp32_defconfig                    |  8 +++++
>  package/Makefile.in                                | 10 +++++-
>  package/gcc/Config.in.host                         |  3 +-
>  toolchain/Config.in                                |  2 ++
>  toolchain/helpers.mk                               |  4 +--
>  toolchain/toolchain-buildroot/Config.in            | 27 +++++++-------
>  toolchain/toolchain-external/Config.in             | 20 +++++++++++
>  toolchain/toolchain-external/toolchain-external.mk | 41 ++++++++++++++++++++--
>  13 files changed, 165 insertions(+), 23 deletions(-)
>  create mode 100644 configs/aarch64_be_defconfig
>  create mode 100644 configs/aarch64_be_ilp32_defconfig
>  create mode 100644 configs/aarch64_ilp32_defconfig
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
@ 2015-04-10 12:24   ` Gustavo Zacarias
  0 siblings, 0 replies; 17+ messages in thread
From: Gustavo Zacarias @ 2015-04-10 12:24 UTC (permalink / raw)
  To: buildroot

On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:

> Add aarch64_be support. Note that CONFIG_CPU_BIG_ENDIAN should be
> defined in kernel config when building a big endian kernel.
> 
> Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>

Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name Zhang Jian
@ 2015-04-10 12:35   ` Gustavo Zacarias
  2015-04-13 10:12     ` Bamvor Jian Zhang
  0 siblings, 1 reply; 17+ messages in thread
From: Gustavo Zacarias @ 2015-04-10 12:35 UTC (permalink / raw)
  To: buildroot

On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:

> In aarch64 ilp32, the directory of library is libilp32 and the linker is
> ld-linux-aarch64_ilp32.so.1 or ld-linux-aarch64_be_ilp32.so.1.

There's a couple of issues here, let's see...

> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
> +# Leave extension for x32 on x86_64 which is libx32 instead of libx32
> +ifeq ($(BR2_aarch64), y)
> +LIB_SYMLINK = libilp32
> +endif
> +ifeq ($(BR2_aarch64_be), y)
> +LIB_SYMLINK = libilp32
> +endif
> +endif

You can simplify this:

ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
LIB_SYMLINK = libilp32
endif
endif

aarch64 & aarch64_be won't be defined at the same time so you can
condense it in a single ifeq.
Also the comment doesn't apply IMHO, there's nothing related to x86_64
here yet.
Additionally it has to be aarch64 before it can be ilp32 right? And is
"ilp32" used for any other architecture? If not you could remove the
whole aarch64 clause.

> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
> +LIB_EXTERNAL_LIBS += ld*.so
> +endif

Can we focus this a little bit more like it's done for ARM EABIhf
instead of just copying ld* blindly?
Otherwise the rest looks ok from a quick look/without having a toolchain
to test things.
Regards.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
@ 2015-04-10 12:36   ` Gustavo Zacarias
  2015-04-13 10:06     ` Bamvor Jian Zhang
  0 siblings, 1 reply; 17+ messages in thread
From: Gustavo Zacarias @ 2015-04-10 12:36 UTC (permalink / raw)
  To: buildroot

On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:

> +ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64),yy)
> +TARGET_ABI += -mabi=ilp32 -Xlinker -maarch64linux32
> +endif
> +
> +ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64_be),yy)
> +TARGET_ABI += -mabi=ilp32 -Xlinker -EB -Xlinker -maarch64linux32b
> +endif

Ok, but...

> -TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
> +TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) $(TARGET_ABI)

...you're throwing -mabi at ld, i don't think ld understands that and
would probably break other architectures like PowerPC e500.
Regards.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config
  2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config Zhang Jian
@ 2015-04-10 12:46   ` Gustavo Zacarias
  2015-04-13 10:02     ` Bamvor Jian Zhang
  0 siblings, 1 reply; 17+ messages in thread
From: Gustavo Zacarias @ 2015-04-10 12:46 UTC (permalink / raw)
  To: buildroot

On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:

> +config BR2_GCC_TARGET_ABI
> +	default "" if BR2_AARCH64_LP64
> +	default "ilp32" if BR2_AARCH64_ILP32

Even though it's unused we like giving things a name, so it would be
"lp64" for the pure 64-bit ABI.
Also like i said before having a toolchain to test all this would be nice.
Regards.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config
  2015-04-10 12:46   ` Gustavo Zacarias
@ 2015-04-13 10:02     ` Bamvor Jian Zhang
  0 siblings, 0 replies; 17+ messages in thread
From: Bamvor Jian Zhang @ 2015-04-13 10:02 UTC (permalink / raw)
  To: buildroot

On 2015/4/10 20:46, Gustavo Zacarias wrote:
> On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:
> 
>> > +config BR2_GCC_TARGET_ABI
>> > +	default "" if BR2_AARCH64_LP64
>> > +	default "ilp32" if BR2_AARCH64_ILP32
> Even though it's unused we like giving things a name, so it would be
> "lp64" for the pure 64-bit ABI.
> Also like i said before having a toolchain to test all this would be nice.
> Regards.
> 
I think I need to leave it as empty(""), because I want to follow your
suggection in March[1].
Please correct, if I misunderstand you.

regards

bamvor

[1] http://lists.busybox.net/pipermail/buildroot/2015-March/122332.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags
  2015-04-10 12:36   ` Gustavo Zacarias
@ 2015-04-13 10:06     ` Bamvor Jian Zhang
  0 siblings, 0 replies; 17+ messages in thread
From: Bamvor Jian Zhang @ 2015-04-13 10:06 UTC (permalink / raw)
  To: buildroot

On 2015/4/10 20:36, Gustavo Zacarias wrote:
> On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:
> 
>> +ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64),yy)
>> +TARGET_ABI += -mabi=ilp32 -Xlinker -maarch64linux32
>> +endif
>> +
>> +ifeq ($(BR2_AARCH64_ILP32)$(BR2_aarch64_be),yy)
>> +TARGET_ABI += -mabi=ilp32 -Xlinker -EB -Xlinker -maarch64linux32b
>> +endif
> 
> Ok, but...
> 
>> -TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
>> +TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) $(TARGET_ABI)
> 
> ...you're throwing -mabi at ld, i don't think ld understands that and
> would probably break other architectures like PowerPC e500.
Well, I guess it will only work for aarch64 because the BR2_AARCH64_ILP32.
Meanwhile, maybe I only need the "-Xlinker -EB -Xlinker -maarch64linux32b".
I will change it in my next version.

regards

bamvor
> Regards.
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name
  2015-04-10 12:35   ` Gustavo Zacarias
@ 2015-04-13 10:12     ` Bamvor Jian Zhang
  2015-04-13 10:16       ` Bamvor Jian Zhang
  0 siblings, 1 reply; 17+ messages in thread
From: Bamvor Jian Zhang @ 2015-04-13 10:12 UTC (permalink / raw)
  To: buildroot

On 2015/4/10 20:35, Gustavo Zacarias wrote:
> On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:
> 
>> In aarch64 ilp32, the directory of library is libilp32 and the linker is
>> ld-linux-aarch64_ilp32.so.1 or ld-linux-aarch64_be_ilp32.so.1.
> 
> There's a couple of issues here, let's see...
> 
>> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
>> +# Leave extension for x32 on x86_64 which is libx32 instead of libx32
>> +ifeq ($(BR2_aarch64), y)
>> +LIB_SYMLINK = libilp32
>> +endif
>> +ifeq ($(BR2_aarch64_be), y)
>> +LIB_SYMLINK = libilp32
>> +endif
>> +endif
> 
> You can simplify this:
> 
> ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
> ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
> LIB_SYMLINK = libilp32
> endif
> endif
> 
> aarch64 & aarch64_be won't be defined at the same time so you can
> condense it in a single ifeq.
> Also the comment doesn't apply IMHO, there's nothing related to x86_64
> here yet.
> Additionally it has to be aarch64 before it can be ilp32 right? And is
> "ilp32" used for any other architecture? If not you could remove the
> whole aarch64 clause.
Ilp32 is used in x86_64 too. But the name of ilp32 in x86_64 is x32.
> 
>> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
>> +LIB_EXTERNAL_LIBS += ld*.so
>> +endif
> 
> Can we focus this a little bit more like it's done for ARM EABIhf
> instead of just copying ld* blindly?
Oh, it is ld-VERSION.so in libilp32 directory. The ld-linux-aarch64_ilp32.so.1
is only existed in lib directory. And ld-linux-aarch64_ilp32.so.1 is the
only file I need in lib. So, here, I just skip the lib directory.

regards

bamvor
> Otherwise the rest looks ok from a quick look/without having a toolchain
> to test things.
> Regards.
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name
  2015-04-13 10:12     ` Bamvor Jian Zhang
@ 2015-04-13 10:16       ` Bamvor Jian Zhang
  0 siblings, 0 replies; 17+ messages in thread
From: Bamvor Jian Zhang @ 2015-04-13 10:16 UTC (permalink / raw)
  To: buildroot

On 2015/4/13 18:12, Bamvor Jian Zhang wrote:
> On 2015/4/10 20:35, Gustavo Zacarias wrote:
>> On 03/18/2015 06:49 AM, Zhang Jian(Bamvor) wrote:
>>
>>> In aarch64 ilp32, the directory of library is libilp32 and the linker is
>>> ld-linux-aarch64_ilp32.so.1 or ld-linux-aarch64_be_ilp32.so.1.
>>
>> There's a couple of issues here, let's see...
>>
>>> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
>>> +# Leave extension for x32 on x86_64 which is libx32 instead of libx32
>>> +ifeq ($(BR2_aarch64), y)
>>> +LIB_SYMLINK = libilp32
>>> +endif
>>> +ifeq ($(BR2_aarch64_be), y)
>>> +LIB_SYMLINK = libilp32
>>> +endif
>>> +endif
>>
>> You can simplify this:
>>
>> ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
>> ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
>> LIB_SYMLINK = libilp32
>> endif
>> endif
>>
>> aarch64 & aarch64_be won't be defined at the same time so you can
>> condense it in a single ifeq.
>> Also the comment doesn't apply IMHO, there's nothing related to x86_64
>> here yet.
>> Additionally it has to be aarch64 before it can be ilp32 right? And is
>> "ilp32" used for any other architecture? If not you could remove the
>> whole aarch64 clause.
> Ilp32 is used in x86_64 too. But the name of ilp32 in x86_64 is x32.
>>
>>> +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
>>> +LIB_EXTERNAL_LIBS += ld*.so
>>> +endif
>>
>> Can we focus this a little bit more like it's done for ARM EABIhf
>> instead of just copying ld* blindly?
> Oh, it is ld-VERSION.so in libilp32 directory. The ld-linux-aarch64_ilp32.so.1
> is only existed in lib directory. And ld-linux-aarch64_ilp32.so.1 is the
> only file I need in lib. So, here, I just skip the lib directory.
> 
> regards
> 
> bamvor
>> Otherwise the rest looks ok from a quick look/without having a toolchain
>> to test things.
Well, you could test it with the toolchain built by linaro ABE. The abe script
and the source of linaro gcc is public, but the toolchain binary with ilp32
support is not public.
I contact with linaro guys last month. They told me that linaro will not
provide the toolchain binary with ilp32 support until the libilp32 is upstreamed.

regards

bamvor
>> Regards.
>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64
  2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (5 preceding siblings ...)
  2015-04-10  9:16 ` [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
@ 2015-07-12 16:45 ` Thomas Petazzoni
  2015-07-13  2:21   ` Zhangjian
  6 siblings, 1 reply; 17+ messages in thread
From: Thomas Petazzoni @ 2015-07-12 16:45 UTC (permalink / raw)
  To: buildroot

Dear Zhang Jian(Bamvor),

On Wed, 18 Mar 2015 17:49:47 +0800, Zhang Jian(Bamvor) wrote:

> Zhang Jian(Bamvor) (5):
>   aarch64: add big endian(aarch64_be) support

I've now applied this patch. However it is not complete enough: you
need to audit all the places where BR2_aarch64 is used in Buildroot,
and see whether adding BR2_aarch64_be is needed. For example, in
package/binutils/Config.in.host:

        config BR2_BINUTILS_VERSION_2_23_2
                depends on !BR2_aarch64 && !BR2_microblaze && \
                           !BR2_powerpc64le && !BR2_nios2
                bool "binutils 2.23.2"

You quite probably want to add !BR2_aarch64_be here as well.

>   aarch64: ilp32: handle special file name
>   aarch64: ilp32: add ilp32 compiler and linker flags
>   aarch64: ilp32: add ilp32 build config
>   aarch64: ilp32 defconfig examples

For those patches, you had some comments. A while ago, when I sent you
a reminder about those patches, you said you would resend an updated
version, but this didn't happen. For now, we marked those patches as
"Changes Requested" in patchwork. Do not hesitate to resend a new
version.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64
  2015-07-12 16:45 ` Thomas Petazzoni
@ 2015-07-13  2:21   ` Zhangjian
  0 siblings, 0 replies; 17+ messages in thread
From: Zhangjian @ 2015-07-13  2:21 UTC (permalink / raw)
  To: buildroot

Hi,

On 2015/7/13 0:45, Thomas Petazzoni wrote:
> Dear Zhang Jian(Bamvor),
>
> On Wed, 18 Mar 2015 17:49:47 +0800, Zhang Jian(Bamvor) wrote:
>
>> Zhang Jian(Bamvor) (5):
>>    aarch64: add big endian(aarch64_be) support
>
> I've now applied this patch. However it is not complete enough: you
> need to audit all the places where BR2_aarch64 is used in Buildroot,
> and see whether adding BR2_aarch64_be is needed. For example, in
> package/binutils/Config.in.host:
>
>          config BR2_BINUTILS_VERSION_2_23_2
>                  depends on !BR2_aarch64 && !BR2_microblaze && \
>                             !BR2_powerpc64le && !BR2_nios2
>                  bool "binutils 2.23.2"
>
> You quite probably want to add !BR2_aarch64_be here as well.
>
>>    aarch64: ilp32: handle special file name
>>    aarch64: ilp32: add ilp32 compiler and linker flags
>>    aarch64: ilp32: add ilp32 build config
>>    aarch64: ilp32 defconfig examples
>
> For those patches, you had some comments. A while ago, when I sent you
> a reminder about those patches, you said you would resend an updated
> version, but this didn't happen. For now, we marked those patches as
> "Changes Requested" in patchwork. Do not hesitate to resend a new
> version.
Sorry for not sending the updated patches. I will do it in this week.

bamvor
>
> Thanks a lot!
>
> Thomas
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-07-13  2:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18  9:49 [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Zhang Jian
2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
2015-04-10 12:24   ` Gustavo Zacarias
2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 2/5] aarch64: ilp32: handle special file name Zhang Jian
2015-04-10 12:35   ` Gustavo Zacarias
2015-04-13 10:12     ` Bamvor Jian Zhang
2015-04-13 10:16       ` Bamvor Jian Zhang
2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
2015-04-10 12:36   ` Gustavo Zacarias
2015-04-13 10:06     ` Bamvor Jian Zhang
2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 4/5] aarch64: ilp32: add ilp32 build config Zhang Jian
2015-04-10 12:46   ` Gustavo Zacarias
2015-04-13 10:02     ` Bamvor Jian Zhang
2015-03-18  9:49 ` [Buildroot] [RFC PATCH v2 5/5] aarch64: ilp32 defconfig examples Zhang Jian
2015-04-10  9:16 ` [Buildroot] [RFC PATCH v2 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
2015-07-12 16:45 ` Thomas Petazzoni
2015-07-13  2:21   ` Zhangjian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.