diff mbox

[RFC,v2,3/5] aarch64: ilp32: add ilp32 compiler and linker flags

Message ID 1426672192-21041-4-git-send-email-bamvor.zhangjian@huawei.com
State Changes Requested
Headers show

Commit Message

Bamvor Jian Zhang March 18, 2015, 9:49 a.m. UTC
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(-)

Comments

Gustavo Zacarias April 10, 2015, 12:36 p.m. UTC | #1
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.
Bamvor Jian Zhang April 13, 2015, 10:06 a.m. UTC | #2
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.
>
diff mbox

Patch

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),\