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

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 [1] and toolchain built by linaro
ABE environment[2].

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

regards

bamvor

[1] https://git.linaro.org/kernel/linux-linaro-tracking.git
[2] 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 menuconfig
  aarch64: ilp32 defconfig examples

 Makefile                                           |  9 +++++
 arch/Config.in                                     | 12 +++++--
 arch/Config.in.aarch64                             | 40 ++++++++++++++++++++-
 configs/aarch64_be_defconfig                       | 10 ++++++
 configs/aarch64_be_ilp32_defconfig                 | 12 +++++++
 configs/aarch64_ilp32_defconfig                    | 12 +++++++
 package/Makefile.in                                | 10 +++++-
 toolchain/helpers.mk                               |  4 +--
 toolchain/toolchain-external/toolchain-external.mk | 41 ++++++++++++++++++++--
 9 files changed, 142 insertions(+), 8 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] 12+ messages in thread

* [Buildroot] [PATCH 1/5] aarch64: add big endian(aarch64_be) support
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
@ 2015-03-16 10:00 ` Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name Zhang Jian
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Zhang Jian @ 2015-03-16 10:00 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 arch/Config.in         | 12 ++++++++++--
 arch/Config.in.aarch64 |  5 ++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

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
+
-- 
1.8.4.5

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

* [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
@ 2015-03-16 10:00 ` Zhang Jian
  2015-03-17 10:27   ` Steven Noonan
  2015-03-16 10:00 ` [Buildroot] [PATCH 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Zhang Jian @ 2015-03-16 10:00 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 af043a3..96816c3 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
+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 9aa8123..ed10d5c 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -85,6 +85,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
@@ -248,6 +252,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
@@ -382,6 +399,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
@@ -426,13 +444,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
@@ -698,10 +716,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
@@ -711,6 +747,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] 12+ messages in thread

* [Buildroot] [PATCH 3/5] aarch64: ilp32: add ilp32 compiler and linker flags
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name Zhang Jian
@ 2015-03-16 10:00 ` Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 4/5] aarch64: ilp32: add ilp32 menuconfig Zhang Jian
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Zhang Jian @ 2015-03-16 10:00 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] 12+ messages in thread

* [Buildroot] [PATCH 4/5] aarch64: ilp32: add ilp32 menuconfig
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (2 preceding siblings ...)
  2015-03-16 10:00 ` [Buildroot] [PATCH 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
@ 2015-03-16 10:00 ` Zhang Jian
  2015-03-16 10:00 ` [Buildroot] [PATCH 5/5] aarch64: ilp32 defconfig examples Zhang Jian
  2015-03-17 13:30 ` [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Gustavo Zacarias
  5 siblings, 0 replies; 12+ messages in thread
From: Zhang Jian @ 2015-03-16 10:00 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 arch/Config.in.aarch64 | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
index 9830302..d383246 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 "lp64" 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
-- 
1.8.4.5

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

* [Buildroot] [PATCH 5/5] aarch64: ilp32 defconfig examples
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (3 preceding siblings ...)
  2015-03-16 10:00 ` [Buildroot] [PATCH 4/5] aarch64: ilp32: add ilp32 menuconfig Zhang Jian
@ 2015-03-16 10:00 ` Zhang Jian
  2015-03-17 13:30 ` [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Gustavo Zacarias
  5 siblings, 0 replies; 12+ messages in thread
From: Zhang Jian @ 2015-03-16 10:00 UTC (permalink / raw)
  To: buildroot

DO NOT APPLY.

Here is the examples about how do I test my patches.

Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
---
 configs/aarch64_be_defconfig       | 10 ++++++++++
 configs/aarch64_be_ilp32_defconfig | 12 ++++++++++++
 configs/aarch64_ilp32_defconfig    | 12 ++++++++++++
 3 files changed, 34 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..0d1119d
--- /dev/null
+++ b/configs/aarch64_be_defconfig
@@ -0,0 +1,10 @@
+# Architecture
+BR2_aarch64_be=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/path/to/toolchain/"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
diff --git a/configs/aarch64_be_ilp32_defconfig b/configs/aarch64_be_ilp32_defconfig
new file mode 100644
index 0000000..1a228df
--- /dev/null
+++ b/configs/aarch64_be_ilp32_defconfig
@@ -0,0 +1,12 @@
+# Architecture
+BR2_aarch64_be=y
+BR2_AARCH64_ILP32=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/path/to/toolchain/"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=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..c6841c5
--- /dev/null
+++ b/configs/aarch64_ilp32_defconfig
@@ -0,0 +1,12 @@
+# Architecture
+BR2_aarch64=y
+BR2_AARCH64_ILP32=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/path/to/toolchain/"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
-- 
1.8.4.5

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

* [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name
  2015-03-16 10:00 ` [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name Zhang Jian
@ 2015-03-17 10:27   ` Steven Noonan
  2015-03-17 14:31     ` Bamvor Zhang
  0 siblings, 1 reply; 12+ messages in thread
From: Steven Noonan @ 2015-03-17 10:27 UTC (permalink / raw)
  To: buildroot

On Mon, Mar 16, 2015 at 3:00 AM, Zhang Jian(Bamvor)
<bamvor.zhangjian@huawei.com> 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.
>
> 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 af043a3..96816c3 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

Surely this comment is wrong.

> +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 9aa8123..ed10d5c 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -85,6 +85,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
> @@ -248,6 +252,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
> @@ -382,6 +399,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
> @@ -426,13 +444,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
> @@ -698,10 +716,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
> @@ -711,6 +747,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
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64
  2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
                   ` (4 preceding siblings ...)
  2015-03-16 10:00 ` [Buildroot] [PATCH 5/5] aarch64: ilp32 defconfig examples Zhang Jian
@ 2015-03-17 13:30 ` Gustavo Zacarias
  2015-03-17 14:44   ` Bamvor Zhang
  5 siblings, 1 reply; 12+ messages in thread
From: Gustavo Zacarias @ 2015-03-17 13:30 UTC (permalink / raw)
  To: buildroot

On 03/16/2015 07:00 AM, Zhang Jian(Bamvor) wrote:
> 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 [1] and toolchain built by linaro
> ABE environment[2].
> 
> This is my first time I try to contribute the buildroot, feedback is very
> appreciated. Sorry if there are some coding style issues.

Hi.
A couple of issues i've discovered with this patchset are:

1) You're using -mabi unconditionally.
Current default gcc is 4.8.x which doesn't understand -mabi for aarch64.

2) You're not taking care of the internal toolchain backend for ILP32.
Currently we default to gcc 4.8.x which doesn't handle ilp32 at all
hence errors out for aarch64 in that configuration (doesn't understand
-mabi, point 1).
The proper action would be to lock down available versions in
package/gcc/Config.in.host via "depends on !BR2_AARCH64_ILP32"
(basically just for 4.8.x since previous versions are already locked out
for aarch64 in general).
This will only fix the ILP32 problem, doesn't help for -mabi=lp64 though
(point 1).

3) ILP32 little endian doesn't build with gcc 4.9.x/binutils 2.25/glibc
2.20: it results in an internal compiler error while building glibc, so
very likely gcc's fault. This should be handled as well, by fixing it or
disabling the internal toolchain backend for this combination.

3) Big endian support is broken for the internal toolchain.
The glibc package isn't enabled for aarch64 BE, so basically it builds a
toolchain without a libc, not nice.
Fix in toolchain/toolchain-buildroot/Config.in - add appropiate
BR2_aarch64_be depends.

4) We don't know/have any external toolchains to test this.
Suggestions? :)

5) You're not setting KERNEL_ARCH appropiately for big endian, right now
the regex is: -e s/aarch64/arm64/
It should be: -e s/aarch64.*/arm64/
Otherwise we end up with KERNEL_ARCH being arm64_be which obviously
fails badly, not only for kernel builds, but also for internal
toolchains builds (headers), possibly some packages and linux extensions.
Fix in top Makefile.

There are probably other details missing, these are the quick/big ones i
could see.

Regards.

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

* [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name
  2015-03-17 10:27   ` Steven Noonan
@ 2015-03-17 14:31     ` Bamvor Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Bamvor Zhang @ 2015-03-17 14:31 UTC (permalink / raw)
  To: buildroot

2015-03-17 18:50  "Steven Noonan" <steven@uplinklabs.net> wrote?
>
> On Mon, Mar 16, 2015 at 3:00 AM, Zhang Jian(Bamvor)
> <bamvor.zhangjian@huawei.com> 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.
> >
> > 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 af043a3..96816c3 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
>
> Surely this comment is wrong
sorry for confuse.
x32 is the ilp32 implementation on x86_64. the library is libx32 instead of
libilp32.
What I mean is that we  could handle it later.

regards

bamvor
>
> > +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 9aa8123..ed10d5c 100644
> > --- a/toolchain/toolchain-external/toolchain-external.mk
> > +++ b/toolchain/toolchain-external/toolchain-external.mk
> > @@ -85,6 +85,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
> > @@ -248,6 +252,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
> > @@ -382,6 +399,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
> > @@ -426,13 +444,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
> > @@ -698,10 +716,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
> > @@ -711,6 +747,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
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150317/1b71ae2c/attachment.html>

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

* [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64
  2015-03-17 13:30 ` [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Gustavo Zacarias
@ 2015-03-17 14:44   ` Bamvor Zhang
  2015-03-17 17:49     ` Gustavo Zacarias
  0 siblings, 1 reply; 12+ messages in thread
From: Bamvor Zhang @ 2015-03-17 14:44 UTC (permalink / raw)
  To: buildroot

2015-3-17 21:30  "Gustavo Zacarias" <gustavo@zacarias.com.ar> wrote:
>
> On 03/16/2015 07:00 AM, Zhang Jian(Bamvor) wrote:
> > 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 [1] and toolchain built by
linaro
> > ABE environment[2].
> >
> > This is my first time I try to contribute the buildroot, feedback is
very
> > appreciated. Sorry if there are some coding style issues.
>
> Hi.
> A couple of issues i've discovered with this patchset are:
>
Hi, Gustavo

> 1) You're using -mabi unconditionally.
> Current default gcc is 4.8.x which doesn't understand -mabi for aarch64.
Yes.
>
> 2) You're not taking care of the internal toolchain backend for ILP32.
> Currently we default to gcc 4.8.x which doesn't handle ilp32 at all
> hence errors out for aarch64 in that configuration (doesn't understand
> -mabi, point 1).
> The proper action would be to lock down available versions in
> package/gcc/Config.in.host via "depends on !BR2_AARCH64_ILP32"
> (basically just for 4.8.x since previous versions are already locked out
> for aarch64 in general).
I will do it in next version.
> This will only fix the ILP32 problem, doesn't help for -mabi=lp64 though
> (point 1).
Well, do you mean I should handle -mabi=lp64 as well? It is the default api
in aarch64 gcc 4.9.x. It may be useful when build the kernel.
> 3) ILP32 little endian doesn't build with gcc 4.9.x/binutils 2.25/glibc
> 2.20: it results in an internal compiler error while building glibc, so
> very likely gcc's fault. This should be handled as well, by fixing it or
> disabling the internal toolchain backend for this combination.
I guess linaro has the patch in it while I hope I could deal with it after
the external toolchain patches is accept. Do you comfortable with only
external toolchain support at this time?
>
> 3) Big endian support is broken for the internal toolchain.
> The glibc package isn't enabled for aarch64 BE, so basically it builds a
> toolchain without a libc, not nice.
> Fix in toolchain/toolchain-buildroot/Config.in - add appropiate
> BR2_aarch64_be depends.
Ok,  i will do it.
>
> 4) We don't know/have any external toolchains to test this.
> Suggestions? :)
We could test it with linaro gcc built from linaro abe system.
>
> 5) You're not setting KERNEL_ARCH appropiately for big endian, right now
> the regex is: -e s/aarch64/arm64/
> It should be: -e s/aarch64.*/arm64/
> Otherwise we end up with KERNEL_ARCH being arm64_be which obviously
> fails badly, not only for kernel builds, but also for internal
> toolchains builds (headers), possibly some packages and linux extensions.
> Fix in top Makefile.
Ok.
>
> There are probably other details missing, these are the quick/big ones i
> could see.
maybe I should add RFC for my next verion of patches.

regards

bamvor
>
> Regards.
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150317/7cfdc158/attachment.html>

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

* [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64
  2015-03-17 14:44   ` Bamvor Zhang
@ 2015-03-17 17:49     ` Gustavo Zacarias
  0 siblings, 0 replies; 12+ messages in thread
From: Gustavo Zacarias @ 2015-03-17 17:49 UTC (permalink / raw)
  To: buildroot

On 03/17/2015 11:44 AM, Bamvor Zhang wrote:

>> 1) You're using -mabi unconditionally.
>> Current default gcc is 4.8.x which doesn't understand -mabi for aarch64.
> Yes.

This is bad for the scenario where gcc = default = 4.8.x and we use lp64
(default as well).
Since you're setting BR2_GCC_TARGET_ABI to lp64 in patch 4 and this is
used in package/gcc/gcc.mk it causes breakage for: internal toolchain,
aarch64 BE or LE, lp64.
Just make it empty, it's the default for gcc and that won't change:

arch/Config.in.aarch64 -> default "" if BR2_AARCH64_LP64

It's not "pretty" but it works just fine and reflects previous behaviour.

>> This will only fix the ILP32 problem, doesn't help for -mabi=lp64 though
>> (point 1).
> Well, do you mean I should handle -mabi=lp64 as well? It is the default
> api in aarch64 gcc 4.9.x. It may be useful when build the kernel.

See solution above.

>> 3) ILP32 little endian doesn't build with gcc 4.9.x/binutils 2.25/glibc
>> 2.20: it results in an internal compiler error while building glibc, so
>> very likely gcc's fault. This should be handled as well, by fixing it or
>> disabling the internal toolchain backend for this combination.
> I guess linaro has the patch in it while I hope I could deal with it
> after the external toolchain patches is accept. Do you comfortable with
> only external toolchain support at this time?

Yes that's not a problem, it'll probably be part of some future release
and then we can unleash it.
Or add the patch(es) if they're small and non-intrusive.
Regardless it may be an external-only option at this point since ILP32
is labelled as beta all over the place.
Regards.

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

* [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64
@ 2015-07-20 11:25 Zhang Jian
  0 siblings, 0 replies; 12+ messages in thread
From: Zhang Jian @ 2015-07-20 11:25 UTC (permalink / raw)
  To: buildroot

This is third version of my patches. This previous version is
here[1][2]. 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 almost no code 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[3] and toolchain built by
linaro ABE environment[4], 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 v2
1.  Add "!BR2_aarch64_be" along with "!BR2_aarch64" in patch 1/5 according to
    the suggestion from Thomas.
2.  Improve the ifeq in patch 2/5 according to Gustavo.
3.  Do not pass invalid "-mabi" option to ld in patch 3/5 according to Gustavo.

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] http://lists.busybox.net/pipermail/buildroot/2015-March/122424.html
[3] https://git.linaro.org/kernel/linux-linaro-tracking.git
[4] 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                                           |  8 +++-
 arch/Config.in                                     | 13 ++++++-
 arch/Config.in.aarch64                             | 40 ++++++++++++++++++-
 configs/aarch64_be_defconfig                       |  2 +
 configs/aarch64_be_ilp32_defconfig                 |  8 ++++
 configs/aarch64_ilp32_defconfig                    |  8 ++++
 package/Makefile.in                                | 12 +++++-
 package/binutils/Config.in                         |  4 +-
 package/binutils/Config.in.host                    | 10 +++--
 package/dropwatch/Config.in                        |  5 ++-
 package/gcc/Config.in.host                         | 11 +++---
 package/gdb/Config.in.host                         |  2 +-
 package/gpsd/Config.in                             |  2 +-
 package/lightning/Config.in                        |  5 ++-
 package/nginx/Config.in                            |  3 +-
 package/oprofile/Config.in                         |  6 ++-
 toolchain/Config.in                                |  2 +
 toolchain/helpers.mk                               |  4 +-
 toolchain/toolchain-buildroot/Config.in            | 27 ++++++-------
 toolchain/toolchain-external/Config.in             | 22 +++++++++++
 toolchain/toolchain-external/toolchain-external.mk | 45 +++++++++++++++++++++-
 21 files changed, 196 insertions(+), 43 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] 12+ messages in thread

end of thread, other threads:[~2015-07-20 11:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16 10:00 [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Zhang Jian
2015-03-16 10:00 ` [Buildroot] [PATCH 1/5] aarch64: add big endian(aarch64_be) support Zhang Jian
2015-03-16 10:00 ` [Buildroot] [PATCH 2/5] aarch64: ilp32: handle special file name Zhang Jian
2015-03-17 10:27   ` Steven Noonan
2015-03-17 14:31     ` Bamvor Zhang
2015-03-16 10:00 ` [Buildroot] [PATCH 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Zhang Jian
2015-03-16 10:00 ` [Buildroot] [PATCH 4/5] aarch64: ilp32: add ilp32 menuconfig Zhang Jian
2015-03-16 10:00 ` [Buildroot] [PATCH 5/5] aarch64: ilp32 defconfig examples Zhang Jian
2015-03-17 13:30 ` [Buildroot] [PATCH 0/5] Add ILP32 support in aarch64 Gustavo Zacarias
2015-03-17 14:44   ` Bamvor Zhang
2015-03-17 17:49     ` Gustavo Zacarias
2015-07-20 11:25 Zhang Jian

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.