aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Díaz <daniel.diaz@linaro.org>2017-11-01 21:49:18 +0000
committerDaniel Díaz <daniel.diaz@linaro.org>2017-11-23 04:50:17 -0600
commit28fc2536a2083737be24760e922af8df03fa18ff (patch)
treeb6a91662e76bab848b8079a92d29873df008b874
parent7fd59321c6528059316f99b29bcd538cf52eb604 (diff)
meta-ilp32: edk2-hikey: fix build with ILP32 toolchain
Change-Id: Iefd0b96c765558a70ef32a0c47b410c2ce7384c3 Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
-rw-r--r--meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch23
-rw-r--r--meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atffastboot-Build-with-LP64-mode-for-AArch64.patch45
-rw-r--r--meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-include-common-asm_macros-update-to-build-with-GAS-2.patch58
-rw-r--r--meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch27
-rw-r--r--meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey_git.bbappend2
5 files changed, 135 insertions, 20 deletions
diff --git a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch
index 19ffccac..ef77dafd 100644
--- a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch
+++ b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch
@@ -4,17 +4,18 @@ Date: Fri, 15 Sep 2017 12:05:09 +0100
Subject: [PATCH] atf:set flag to build in lp64 mode for ilp32 toolchain
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
---
- Makefile | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ Makefile | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/atf/Makefile b/atf/Makefile
index 6fb10b76..24016366 100644
--- a/atf/Makefile
+++ b/atf/Makefile
-@@ -253,11 +253,11 @@ $(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
- $(eval $(call add_define,TRUSTED_BOARD_BOOT))
-
+@@ -204,11 +204,11 @@ $(eval $(call assert_boolean,USE_COHERENT_MEM))
+ $(eval $(call add_define,USE_COHERENT_MEM))
+
ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
- -Werror -Wmissing-include-dirs \
+ -Wno-error -Wmissing-include-dirs -mabi=lp64 \
@@ -26,6 +27,14 @@ index 6fb10b76..24016366 100644
-mgeneral-regs-only -mstrict-align \
-std=c99 -c -Os ${DEFINES} ${INCLUDES} -fno-pic
CFLAGS += -ffunction-sections -fdata-sections \
---
-2.13.0
+@@ -216,6 +216,7 @@ CFLAGS += -ffunction-sections -fdata-sections \
+
+ LDFLAGS += --fatal-warnings -O1
+ LDFLAGS += --gc-sections
++LDFLAGS += -m aarch64elf
+
+
+ CC := ${CROSS_COMPILE}gcc
+--
+2.7.4
diff --git a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atffastboot-Build-with-LP64-mode-for-AArch64.patch b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atffastboot-Build-with-LP64-mode-for-AArch64.patch
new file mode 100644
index 00000000..6f412a21
--- /dev/null
+++ b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-atffastboot-Build-with-LP64-mode-for-AArch64.patch
@@ -0,0 +1,45 @@
+From 6fe0265f848e873b0475cb179cd587226d1a01f6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
+Date: Wed, 1 Nov 2017 13:39:55 -0600
+Subject: [PATCH] Build with LP64 mode for AArch64.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The effect of this is that LP64 will be used even when
+targetting ILP32.
+
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
+---
+ Makefile | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index e6bef47..cca4438 100644
+--- a/atf-fastboot/Makefile
++++ b/atf-fastboot/Makefile
+@@ -204,11 +204,11 @@ $(eval $(call assert_boolean,USE_COHERENT_MEM))
+ $(eval $(call add_define,USE_COHERENT_MEM))
+
+ ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
+- -Werror -Wmissing-include-dirs \
++ -Wno-error -Wmissing-include-dirs -mabi=lp64 \
+ -mgeneral-regs-only -D__ASSEMBLY__ \
+ ${DEFINES} ${INCLUDES}
+ CFLAGS += -nostdinc -ffreestanding -Wall \
+- -Werror -Wmissing-include-dirs \
++ -Wno-error -Wmissing-include-dirs -mabi=lp64 \
+ -mgeneral-regs-only -mstrict-align \
+ -std=c99 -c -Os ${DEFINES} ${INCLUDES} -fno-pic
+ CFLAGS += -ffunction-sections -fdata-sections \
+@@ -216,6 +216,7 @@ CFLAGS += -ffunction-sections -fdata-sections \
+
+ LDFLAGS += --fatal-warnings -O1
+ LDFLAGS += --gc-sections
++LDFLAGS += -m aarch64elf
+
+
+ CC := ${CROSS_COMPILE}gcc
+--
+2.7.4
+
diff --git a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-include-common-asm_macros-update-to-build-with-GAS-2.patch b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-include-common-asm_macros-update-to-build-with-GAS-2.patch
new file mode 100644
index 00000000..9b2af69b
--- /dev/null
+++ b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-include-common-asm_macros-update-to-build-with-GAS-2.patch
@@ -0,0 +1,58 @@
+From dbcf674ff19e3ecf48fd5d195613d1a1ec1207c1 Mon Sep 17 00:00:00 2001
+From: Martin Roth <martinroth@chromium.org>
+Date: Wed, 13 Jul 2016 12:33:03 -0600
+Subject: [PATCH] include/common/asm_macros: update to build with GAS 2.26
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GNU Binutils v2.26 no longer builds arm-trusted-firmware. It fails
+with the error "Error: non-constant expression in ".if" statement"
+
+The issue is described here:
+https://www.mail-archive.com/linaro-toolchain%40lists.linaro.org/msg05689.html
+
+Because the 2nd value in the align directive is the padding byte, by
+changing '.align 11, 0' and '.align 7,0' to just 'align 11' and
+'align 7', all that gets changed is the padding. Using GAS 2.26
+and looking in the manuals back to GAS 2.15, the padding changes
+from 0x00000000 to the value for nop (0xd403201f), which seems
+appropriate anyway.
+
+https://sourceware.org/binutils/docs-2.26/as/Align.html#Align
+
+This issue is affecting the coreboot toolchain, which has been updated
+to binutils 2.26, and cannot be reverted to 2.25 as other platforms
+require the updated version.
+
+Signed-off-by: Martin Roth <martinroth@chromium.org>
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
+---
+ include/common/aarch64/asm_macros.S | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/common/aarch64/asm_macros.S b/include/common/aarch64/asm_macros.S
+index 6d6989c..fc3384e 100644
+--- a/atf/include/common/aarch64/asm_macros.S
++++ b/atf/include/common/aarch64/asm_macros.S
+@@ -53,7 +53,7 @@
+ */
+ .macro vector_base label
+ .section .vectors, "ax"
+- .align 11, 0
++ .align 11
+ \label:
+ .endm
+
+@@ -67,7 +67,7 @@
+ .macro vector_entry label
+ .cfi_sections .debug_frame
+ .section .vectors, "ax"
+- .align 7, 0
++ .align 7
+ .type \label, %function
+ .func \label
+ .cfi_startproc
+--
+2.7.4
+
diff --git a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch
index 9f88cb8f..3f68ab66 100644
--- a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch
+++ b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey/0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch
@@ -4,6 +4,7 @@ Date: Fri, 15 Sep 2017 12:04:13 +0100
Subject: [PATCH] set flag to build in lp64 mode for ilp32 toolchain
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
---
BaseTools/Conf/tools_def.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -12,24 +13,24 @@ diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.templa
index 1e05d0c959..b0360f12d5 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
-@@ -4323,7 +4323,7 @@ DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
- DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
+@@ -4341,7 +4341,7 @@ DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-ad
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
- DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
--DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic
-+DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic -mabi=lp64 -Wno-error
+ DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -mfloat-abi=soft
+ DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
+-DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
++DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -mabi=lp64 -Wno-error
+ DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
- DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
- DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
-@@ -4395,7 +4395,7 @@ DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
+ DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+@@ -4415,7 +4415,7 @@ DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
DEFINE GCC47_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
-DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
+DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian -mabi=lp64
- DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-access
- DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
- DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
---
-2.13.0
+ DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS)
+ DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
+ DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) -save-temps
+--
+2.7.4
diff --git a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey_git.bbappend b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey_git.bbappend
index 6f94512e..89c020f2 100644
--- a/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey_git.bbappend
+++ b/meta-ilp32/recipes-overlayed/edk2-hikey/edk2-hikey_git.bbappend
@@ -4,6 +4,8 @@ COMPATIBLE_MACHINE = "hikey|hikey-ilp32"
SRC_URI += "file://0001-set-flag-to-build-in-lp64-mode-for-ilp32-toolchain.patch \
file://0001-atf-set-flag-to-build-in-lp64-mode-for-ilp32-toolcha.patch \
+ file://0001-include-common-asm_macros-update-to-build-with-GAS-2.patch \
+ file://0001-atffastboot-Build-with-LP64-mode-for-AArch64.patch \
file://grub.cfg.ilp32 \
"