From patchwork Fri Mar 18 21:08:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 599708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 3qRdC74nrRz9s8d for ; Sat, 19 Mar 2016 08:09:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D9D96843F1; Fri, 18 Mar 2016 21:09:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B4j1XZPArVTp; Fri, 18 Mar 2016 21:09:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 991008CF93; Fri, 18 Mar 2016 21:08:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BEEDF1BF9E4 for ; Fri, 18 Mar 2016 21:08:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B92892FA96 for ; Fri, 18 Mar 2016 21:08:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X7sY-wyGFlfr for ; Fri, 18 Mar 2016 21:08:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by silver.osuosl.org (Postfix) with ESMTP id BCDA32D862 for ; Fri, 18 Mar 2016 21:08:34 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id DC12D1F6; Fri, 18 Mar 2016 22:08:33 +0100 (CET) Received: from localhost (AToulouse-657-1-41-6.w92-146.abo.wanadoo.fr [92.146.39.6]) by mail.free-electrons.com (Postfix) with ESMTPSA id 9CB301B9; Fri, 18 Mar 2016 22:08:33 +0100 (CET) From: Thomas Petazzoni To: Buildroot List Date: Fri, 18 Mar 2016 22:08:16 +0100 Message-Id: <1458335299-27409-15-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1458335299-27409-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1458335299-27409-1-git-send-email-thomas.petazzoni@free-electrons.com> Cc: Thomas Petazzoni , Lee Jones , Maxime Coquelin Subject: [Buildroot] [PATCH v2 14/17] elf2flt: use new upstream site and add ARM patch X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The uClinux developers now have a Github with elf2flt code, with an upstream that is again active. Let's switch to this upstream, to which Waldemar is contributing as well. We also add an ARM patch from Waldemar that is needed to make ARM FLAT binaries work properly. Since this commit was on the previously used upstream, we add it together with the change of upstream location to keep the same functionality level. Since we're now fetching from github, a hash file is added as well. Finally, we disable -Werror to avoid build issues caused by warnings. Signed-off-by: Thomas Petazzoni --- .../0001-allow-to-build-arm-flat-binaries.patch | 123 +++++++++++++++++++++ package/elf2flt/elf2flt.hash | 2 + package/elf2flt/elf2flt.mk | 8 +- 3 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 package/elf2flt/0001-allow-to-build-arm-flat-binaries.patch create mode 100644 package/elf2flt/elf2flt.hash diff --git a/package/elf2flt/0001-allow-to-build-arm-flat-binaries.patch b/package/elf2flt/0001-allow-to-build-arm-flat-binaries.patch new file mode 100644 index 0000000..a6c63c5 --- /dev/null +++ b/package/elf2flt/0001-allow-to-build-arm-flat-binaries.patch @@ -0,0 +1,123 @@ +From 56b082412c6f49d21f5e54831a40d1e7c45b3ee4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Sat, 12 Mar 2016 22:09:30 +0100 +Subject: [PATCH] allow to build arm flat binaries + +Add patchset from ptxdist which is required to produce working +ARM flat binaries. Tested with busybox on Kinetis K70. + +Signed-off-by: Waldemar Brodkorb +Signed-off-by: Thomas Petazzoni +--- + elf2flt.c | 19 ++++++++++++------- + elf2flt.ld.in | 17 ++++++++++++++--- + 2 files changed, 26 insertions(+), 10 deletions(-) + +diff --git a/elf2flt.c b/elf2flt.c +index fcd797c..c6978e1 100644 +--- a/elf2flt.c ++++ b/elf2flt.c +@@ -56,6 +56,8 @@ const char *elf2flt_progname; + + #if defined(TARGET_h8300) + #include /* TARGET_* ELF support for the BFD library */ ++#elif defined(TARGET_arm) ++#include + #elif defined(__CYGWIN__) || defined(__MINGW32__) || defined(TARGET_nios) || defined(TARGET_nios2) + #include "cygwin-elf.h" /* Cygwin uses a local copy */ + #elif defined(TARGET_xtensa) +@@ -646,16 +648,23 @@ dump_symbols(symbols, number_of_symbols); + default: + goto good_32bit_resolved_reloc; + #elif defined(TARGET_arm) ++ case R_ARM_TARGET1: ++ case R_ARM_TARGET2: + case R_ARM_ABS32: + relocation_needed = 1; + break; + case R_ARM_REL32: ++ case R_ARM_JUMP24: ++ case R_ARM_CALL: + case R_ARM_THM_PC11: + case R_ARM_THM_PC22: ++ case R_ARM_THM_JUMP24: + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_GOTPC: + case R_ARM_GOT32: ++ case R_ARM_PREL31: ++ case R_ARM_NONE: + relocation_needed = 0; + break; + default: +@@ -871,9 +880,7 @@ dump_symbols(symbols, number_of_symbols); + relocation_needed = 1; + if (verbose) + fprintf(stderr, +- "%s vma=0x%x, " +- "value=0x%"BFD_VMA_FMT"x, " +- "address=0x%"BFD_VMA_FMT"x " ++ "%s vma=0x%x, value=0x%x, address=0x%x " + "sym_addr=0x%x rs=0x%x, opcode=0x%x\n", + "ABS32", + sym_vma, (*(q->sym_ptr_ptr))->value, +@@ -890,9 +897,7 @@ dump_symbols(symbols, number_of_symbols); + case R_ARM_PLT32: + if (verbose) + fprintf(stderr, +- "%s vma=0x%x, " +- "value=0x%"BFD_VMA_FMT"x, " +- "address=0x%"BFD_VMA_FMT"x " ++ "%s vma=0x%x, value=0x%x, address=0x%x " + "sym_addr=0x%x rs=0x%x, opcode=0x%x\n", + "PLT32", + sym_vma, (*(q->sym_ptr_ptr))->value, +@@ -1446,7 +1451,7 @@ DIS29_RELOCATION: + } + } + +- sprintf(&addstr[0], "+0x%lx", sym_addr - (*(q->sym_ptr_ptr))->value - ++ sprintf(&addstr[0], "+0x%x", sym_addr - (*(q->sym_ptr_ptr))->value - + bfd_section_vma(abs_bfd, sym_section)); + + +diff --git a/elf2flt.ld.in b/elf2flt.ld.in +index bfda0ef..ec1fe6f 100644 +--- a/elf2flt.ld.in ++++ b/elf2flt.ld.in +@@ -35,6 +35,8 @@ W_RODAT *(.rodata1) + W_RODAT *(.rodata.*) + W_RODAT *(.gnu.linkonce.r*) + ++ /* .ARM.extab name sections containing exception unwinding information */ ++ *(.ARM.extab* .gnu.linkonce.armextab.*) + /* This is special code area at the end of the normal + text section. It contains a small lookup table at + the start followed by the code pointed to by entries +@@ -43,11 +45,20 @@ W_RODAT *(.gnu.linkonce.r*) + PROVIDE(@SYMBOL_PREFIX@__ctbp = .); + *(.call_table_data) + *(.call_table_text) +- +- . = ALIGN(0x20) ; +- @SYMBOL_PREFIX@_etext = . ; + } > flatmem :text + ++ /* .ARM.exidx name sections containing index entries for section unwinding */ ++ /* .ARM.exidx is sorted, so has to go in its own output section. */ ++ @SYMBOL_PREFIX@__exidx_start = .; ++ .ARM.exidx : ++ { ++ *(.ARM.exidx* .gnu.linkonce.armexidx.*) ++ } > flatmem ++ @SYMBOL_PREFIX@__exidx_end = .; ++ ++ . = ALIGN(0x20) ; ++ @SYMBOL_PREFIX@_etext = . ; ++ + .data : { + . = ALIGN(0x4) ; + @SYMBOL_PREFIX@_sdata = . ; +-- +2.6.4 + diff --git a/package/elf2flt/elf2flt.hash b/package/elf2flt/elf2flt.hash new file mode 100644 index 0000000..c5e71db --- /dev/null +++ b/package/elf2flt/elf2flt.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256sum a21a7f7035750bc63bc679777f01c6adc77ac20d2b0dbad4419981ebd22c1492 elf2flt-177ec2701aba30270ec1260746b8db5442c77ef4.tar.gz diff --git a/package/elf2flt/elf2flt.mk b/package/elf2flt/elf2flt.mk index bec270b..eb0baad 100644 --- a/package/elf2flt/elf2flt.mk +++ b/package/elf2flt/elf2flt.mk @@ -4,9 +4,8 @@ # ################################################################################ -ELF2FLT_VERSION = f859213b18a67fcfc09961267e0a1122d35186f4 -ELF2FLT_SITE = http://cgit.openadk.org/cgi/cgit/elf2flt.git -ELF2FLT_SITE_METHOD = git +ELF2FLT_VERSION = 177ec2701aba30270ec1260746b8db5442c77ef4 +ELF2FLT_SITE = $(call github,uclinux-dev,elf2flt,$(ELF2FLT_VERSION)) ELF2FLT_LICENSE = GPLv2+ ELF2FLT_LICENSE_FILES = LICENSE.TXT @@ -19,7 +18,8 @@ HOST_ELF2FLT_CONF_OPTS = \ --with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \ --with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \ --with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \ - --target=$(GNU_TARGET_NAME) + --target=$(GNU_TARGET_NAME) \ + --disable-werror HOST_ELF2FLT_LIBS = -lz