* [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64
@ 2015-07-21 8:45 Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 1/5] aarch64: align aarch64_be config with aarch64s' Bamvor Jian Zhang
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:45 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. rebase on the patch have been .
"827ba46 aarch64: add big endian(aarch64_be) support"
2. Add "!BR2_aarch64_be" along with "!BR2_aarch64" in patch 1/5 according to
the suggestion from Thomas.
3. Improve the ifeq in patch 2/5 according to Gustavo.
4. 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
Bamvor Jian Zhang (5):
aarch64: align aarch64_be config with aarch64s'
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 | 6 +++
arch/Config.in.aarch64 | 36 ++++++++++++++++++
configs/aarch64_be_defconfig | 2 +
configs/aarch64_be_ilp32_defconfig | 8 ++++
configs/aarch64_ilp32_defconfig | 8 ++++
package/Makefile.in | 13 ++++++-
package/binutils/Config.in | 4 +-
package/binutils/Config.in.host | 5 ++-
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 | 5 ++-
toolchain/toolchain-buildroot/Config.in | 7 ++--
toolchain/toolchain-external/Config.in | 22 +++++++++++
toolchain/toolchain-external/toolchain-external.mk | 44 +++++++++++++++++++++-
20 files changed, 169 insertions(+), 27 deletions(-)
create mode 100644 configs/aarch64_be_defconfig
create mode 100644 configs/aarch64_be_ilp32_defconfig
create mode 100644 configs/aarch64_ilp32_defconfig
--
2.1.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH V3 1/5] aarch64: align aarch64_be config with aarch64s'
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
@ 2015-07-21 8:46 ` Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 2/5] aarch64: ilp32: handle special file name Bamvor Jian Zhang
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:46 UTC (permalink / raw)
To: buildroot
Suggested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
---
package/binutils/Config.in | 4 ++--
package/binutils/Config.in.host | 5 +++--
package/dropwatch/Config.in | 5 +++--
package/gcc/Config.in.host | 8 ++++----
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/toolchain-buildroot/Config.in | 7 ++++---
10 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/package/binutils/Config.in b/package/binutils/Config.in
index 64d0a09..f9e0f16 100644
--- a/package/binutils/Config.in
+++ b/package/binutils/Config.in
@@ -1,7 +1,7 @@
config BR2_PACKAGE_BINUTILS
bool "binutils"
select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE
- depends on !BR2_aarch64 && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on BR2_USE_WCHAR
help
Install binutils on the target
@@ -22,5 +22,5 @@ config BR2_PACKAGE_BINUTILS_TARGET
endif
comment "binutils needs a toolchain w/ wchar"
- depends on !BR2_aarch64 && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on !BR2_USE_WCHAR
diff --git a/package/binutils/Config.in.host b/package/binutils/Config.in.host
index 70253cc..751ff77 100644
--- a/package/binutils/Config.in.host
+++ b/package/binutils/Config.in.host
@@ -8,8 +8,9 @@ choice
Select the version of binutils you wish to use.
config BR2_BINUTILS_VERSION_2_23_2
- depends on !BR2_aarch64 && !BR2_microblaze && \
- !BR2_powerpc64le && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && \
+ !BR2_microblaze && !BR2_powerpc64le && \
+ !BR2_nios2
bool "binutils 2.23.2"
config BR2_BINUTILS_VERSION_2_24
diff --git a/package/dropwatch/Config.in b/package/dropwatch/Config.in
index d331e5e..e109242 100644
--- a/package/dropwatch/Config.in
+++ b/package/dropwatch/Config.in
@@ -1,7 +1,8 @@
config BR2_PACKAGE_DROPWATCH
bool "dropwatch"
select BR2_PACKAGE_BINUTILS
- depends on !BR2_aarch64 && !BR2_nios2 # binutils
+ # binutils
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on BR2_USE_WCHAR # binutils
select BR2_PACKAGE_READLINE
select BR2_PACKAGE_LIBNL
@@ -13,5 +14,5 @@ config BR2_PACKAGE_DROPWATCH
https://fedorahosted.org/dropwatch/
comment "dropwatch needs a toolchain w/ threads, wchar"
- depends on !BR2_aarch64 && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 3d64b6f..7d2c999 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -17,8 +17,8 @@ choice
bool "gcc 4.5.x"
depends on BR2_DEPRECATED_SINCE_2015_05
# Broken or unsupported architectures
- depends on !BR2_microblaze && !BR2_aarch64 && !BR2_arc \
- && !BR2_powerpc64le && !BR2_nios2
+ depends on !BR2_microblaze && !BR2_aarch64 && !BR2_aarch64_be && \
+ !BR2_arc && !BR2_powerpc64le && !BR2_nios2
# Broken or unsupported ARM cores
depends on !BR2_cortex_a7 && !BR2_cortex_a12 && \
!BR2_cortex_a15 && !BR2_fa526 && !BR2_pj4
@@ -38,8 +38,8 @@ choice
config BR2_GCC_VERSION_4_7_X
bool "gcc 4.7.x"
# Broken or unsupported architectures
- depends on !BR2_microblaze && !BR2_aarch64 && !BR2_arc \
- && !BR2_powerpc64le && !BR2_nios2
+ depends on !BR2_microblaze && !BR2_aarch64 && !BR2_aarch64_be && \
+ !BR2_arc && !BR2_powerpc64le && !BR2_nios2
# Broken or unsupported ARM cores
depends on !BR2_cortex_a12 && !BR2_pj4
# Broken or unsupported PPC cores
diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host
index 3207794..d736f25 100644
--- a/package/gdb/Config.in.host
+++ b/package/gdb/Config.in.host
@@ -4,7 +4,7 @@ config BR2_PACKAGE_HOST_GDB
# allow to build a cross-gdb, as the one of the external
# toolchain should be used.
depends on !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
- depends on !BR2_aarch64 && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
help
Build a cross gdb that runs on the host machine and debugs
programs running on the target. It requires 'gdbserver'
diff --git a/package/gpsd/Config.in b/package/gpsd/Config.in
index fa8b8f6..36813ab 100644
--- a/package/gpsd/Config.in
+++ b/package/gpsd/Config.in
@@ -39,7 +39,7 @@ config BR2_PACKAGE_GPSD_OLDSTYLE
config BR2_PACKAGE_GPSD_PROFILING
bool "profiling support"
depends on BR2_TOOLCHAIN_USES_GLIBC
- depends on !BR2_aarch64
+ depends on !BR2_aarch64 && !BR2_aarch64_be
comment "profiling support not available with uClibc-based toolchain"
depends on !BR2_TOOLCHAIN_USES_GLIBC
diff --git a/package/lightning/Config.in b/package/lightning/Config.in
index 8caf39f..3ca477a 100644
--- a/package/lightning/Config.in
+++ b/package/lightning/Config.in
@@ -14,13 +14,14 @@ config BR2_PACKAGE_LIGHTNING_DISASSEMBLER
bool "enable disassembler"
select BR2_PACKAGE_BINUTILS
select BR2_PACKAGE_ZLIB
- depends on !BR2_aarch64 && !BR2_nios2 # binutils
+ # binutils
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on BR2_USE_WCHAR # binutils
help
Enable the GNU lightning disassembler.
comment "lightning disassembler needs a toolchain w/ wchar"
- depends on !BR2_aarch64 && !BR2_nios2
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on !BR2_USE_WCHAR
endif
diff --git a/package/nginx/Config.in b/package/nginx/Config.in
index be445f4..ef0266e 100644
--- a/package/nginx/Config.in
+++ b/package/nginx/Config.in
@@ -15,8 +15,7 @@ config BR2_PACKAGE_NGINX_FILE_AIO
# but it's available on neither AArch64 nor ARC where only
# eventfd() is available. See
# https://bugs.launchpad.net/linaro-aarch64/+bug/1160013
- depends on !BR2_aarch64
- depends on !BR2_arc
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_arc
config BR2_PACKAGE_NGINX_HTTP
bool "http server"
diff --git a/package/oprofile/Config.in b/package/oprofile/Config.in
index 9cf5693..b5d0bb6 100644
--- a/package/oprofile/Config.in
+++ b/package/oprofile/Config.in
@@ -5,7 +5,8 @@ config BR2_PACKAGE_OPROFILE
select BR2_PACKAGE_BINUTILS
select BR2_PACKAGE_LIBPFM4 if BR2_powerpc
depends on BR2_INSTALL_LIBSTDCPP
- depends on !BR2_aarch64 && !BR2_nios2 # binutils
+ # binutils
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2
depends on BR2_USE_WCHAR # binutils
depends on !BR2_xtensa
# libpfm4 is needed on PowerPC, and requires thread support
@@ -28,7 +29,8 @@ config BR2_PACKAGE_OPROFILE
comment "oprofile needs a toolchain w/ C++, wchar"
depends on BR2_USE_MMU
- depends on !BR2_aarch64 && !BR2_nios2 && !BR2_xtensa
+ depends on !BR2_aarch64 && !BR2_aarch64_be && !BR2_nios2 && \
+ !BR2_xtensa
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
comment "oprofile needs a toolchain w/ NPTL on PPC"
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index 13e2b15..0869243 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -85,9 +85,10 @@ comment "(e)glibc only available with shared lib support"
config BR2_TOOLCHAIN_BUILDROOT_MUSL
bool "musl (experimental)"
- depends on BR2_aarch64 || BR2_arm || BR2_armeb || BR2_i386 || \
- BR2_microblaze || BR2_mips || BR2_mipsel || BR2_powerpc || \
- BR2_sh || BR2_x86_64
+ depends on BR2_arm || BR2_armeb || BR2_aarch64 || \
+ BR2_aarch64_be || BR2_i386 || BR2_microblaze || \
+ BR2_mips || BR2_mipsel || BR2_powerpc || \
+ BR2_sh || BR2_x86_64
depends on !BR2_powerpc_SPE # not supported, build breaks
select BR2_TOOLCHAIN_USES_MUSL
help
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH V3 2/5] aarch64: ilp32: handle special file name
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 1/5] aarch64: align aarch64_be config with aarch64s' Bamvor Jian Zhang
@ 2015-07-21 8:46 ` Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Bamvor Jian Zhang
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:46 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 which is
linked to libilp32/ld-VERSION.so(ld-2.20.so in my system).
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
---
Makefile | 6 +++
toolchain/helpers.mk | 5 ++-
toolchain/toolchain-external/toolchain-external.mk | 44 +++++++++++++++++++++-
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 8b9c5d9..12e82d0 100644
--- a/Makefile
+++ b/Makefile
@@ -451,6 +451,12 @@ LIB_SYMLINK = lib64
else
LIB_SYMLINK = lib32
endif
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+# On X86_64, ilp32 library will be located in libx32 directory.
+ifeq ($(BR2_aarch64)$(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 895f3f1..c573654 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)
#
@@ -141,7 +141,8 @@ copy_toolchain_sysroot = \
if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \
rsync -au --chmod=u=rwX,go=rX --exclude 'usr/lib/locale' \
--exclude lib --exclude lib32 --exclude lib64 \
- $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \
+ --exclude libilp32 $${ARCH_SYSROOT_DIR}/$$i/ \
+ $(STAGING_DIR)/$$i/ ; \
fi ; \
done ; \
if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 5ce4d33..cff8591 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 -snf . $(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
@@ -394,6 +411,7 @@ TOOLCHAIN_EXTERNAL_SITE = $(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
TOOLCHAIN_EXTERNAL_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
# We can't check hashes for custom downloaded toolchains
BR_NO_CHECK_HASH_FOR += $(TOOLCHAIN_EXTERNAL_SOURCE)
+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
@@ -445,17 +463,18 @@ endef
# - lib64/
# - lib32-fp/ (Cavium toolchain)
# - lib64-fp/ (Cavium toolchain)
+# - libilp32/ (Aarch64/aarch64_be ilp32 library)
# - usr/lib/<tuple>/ (Linaro toolchain)
#
# And variations on these.
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
@@ -735,10 +754,30 @@ define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
fi
endef
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
+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
+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
@@ -749,6 +788,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
+ $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_ILP32_LINK)
endef
$(eval $(generic-package))
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH V3 3/5] aarch64: ilp32: add ilp32 compiler and linker flags
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 1/5] aarch64: align aarch64_be config with aarch64s' Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 2/5] aarch64: ilp32: handle special file name Bamvor Jian Zhang
@ 2015-07-21 8:46 ` Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 4/5] aarch64: ilp32: add ilp32 build config Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 5/5] aarch64: ilp32 defconfig examples Bamvor Jian Zhang
4 siblings, 0 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:46 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.
Pass the special flags to linker to ensure that linker see the
same abi with compiler.
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
---
package/Makefile.in | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index 545694f..fa81b44 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -107,6 +107,17 @@ ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
TARGET_ABI += -matomic
endif
+ifeq ($(BR2_GCC_TARGET_ABI), "ilp32")
+ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
+ifeq ($(BR2_ENDIAN), "BIG")
+TARGET_ABI_LDFLAGS += -Xlinker -EB -Xlinker -maarch64linux32b
+else
+TARGET_ABI_LDFLAGS += -Xlinker -maarch64linux32
+endif
+TARGET_ABI += -mabi=ilp32 $(TARGET_ABI_LDFLAGS)
+endif
+endif
+
STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR)
@@ -140,7 +151,7 @@ endif
TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
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_LDFLAGS)
ifeq ($(BR2_BINFMT_FLAT),y)
TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH V3 4/5] aarch64: ilp32: add ilp32 build config
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
` (2 preceding siblings ...)
2015-07-21 8:46 ` [Buildroot] [PATCH V3 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Bamvor Jian Zhang
@ 2015-07-21 8:46 ` Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 5/5] aarch64: ilp32 defconfig examples Bamvor Jian Zhang
4 siblings, 0 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:46 UTC (permalink / raw)
To: buildroot
Add ILP32 in menuconfig. And disable the libc and toolchain which
does not support ILP32.
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
---
arch/Config.in.aarch64 | 36 ++++++++++++++++++++++++++++++++++
package/gcc/Config.in.host | 3 ++-
toolchain/Config.in | 2 ++
toolchain/toolchain-external/Config.in | 22 +++++++++++++++++++++
4 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
index 325bccc..b4e3e43 100644
--- a/arch/Config.in.aarch64
+++ b/arch/Config.in.aarch64
@@ -8,3 +8,39 @@ 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 7d2c999..015f80a 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -55,7 +55,8 @@ choice
bool "gcc 4.8.x"
# Broken or unsupported architectures
depends on !BR2_microblaze && !BR2_arc \
- && !BR2_powerpc64le && !BR2_nios2
+ && !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 a851ce4..794bf8b 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -27,6 +27,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"
@@ -40,6 +41,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 e70989e..12ad00a 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -588,6 +588,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201203
depends on BR2_sh4a || BR2_sh4aeb
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
@@ -611,6 +612,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201103
depends on BR2_sh4a || BR2_sh4aeb
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_TOOLCHAIN_HAS_NATIVE_RPC
select BR2_INSTALL_LIBSTDCPP
@@ -789,6 +791,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
@@ -803,6 +806,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
@@ -1008,69 +1012,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
@@ -1081,6 +1102,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
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH V3 5/5] aarch64: ilp32 defconfig examples
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
` (3 preceding siblings ...)
2015-07-21 8:46 ` [Buildroot] [PATCH V3 4/5] aarch64: ilp32: add ilp32 build config Bamvor Jian Zhang
@ 2015-07-21 8:46 ` Bamvor Jian Zhang
4 siblings, 0 replies; 6+ messages in thread
From: Bamvor Jian Zhang @ 2015-07-21 8:46 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: Bamvor Jian Zhang <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..2b59806
--- /dev/null
+++ b/configs/aarch64_ilp32_defconfig
@@ -0,0 +1,8 @@
+# Architecture
+BR2_aarch64=y
+BR2_AARCH64_ILP32=y
+BR2_TOOLCHAIN_EXTERNAL_PATH="/home/bamvor/works/software/toolchain/gcc-linaro-4.9~git82c1251-aarch64_aarch64-ilp32-linux-gnu-20150310"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-ilp32-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_16=y
+BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-21 8:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 8:45 [Buildroot] [PATCH V3 0/5] Add ILP32 support in aarch64 Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 1/5] aarch64: align aarch64_be config with aarch64s' Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 2/5] aarch64: ilp32: handle special file name Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 3/5] aarch64: ilp32: add ilp32 compiler and linker flags Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 4/5] aarch64: ilp32: add ilp32 build config Bamvor Jian Zhang
2015-07-21 8:46 ` [Buildroot] [PATCH V3 5/5] aarch64: ilp32 defconfig examples Bamvor Jian Zhang
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.