From patchwork Tue Jun 11 12:17:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert ARIBAUD X-Patchwork-Id: 250540 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 878B22C0079 for ; Tue, 11 Jun 2013 22:19:11 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7EA2E4A056; Tue, 11 Jun 2013 14:19:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5AVGFy4xqGgn; Tue, 11 Jun 2013 14:19:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F34C74A0B6; Tue, 11 Jun 2013 14:18:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C3F304A08F for ; Tue, 11 Jun 2013 14:18:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hqI-Dt9ZjbAb for ; Tue, 11 Jun 2013 14:18:40 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by theia.denx.de (Postfix) with ESMTP id 9EB794A092 for ; Tue, 11 Jun 2013 14:18:21 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2a01:e35:2eb9:20:e4bb:a557:720c:b64e]) (Authenticated sender: albert.aribaud) by smtp1-g21.free.fr (Postfix) with ESMTPSA id 2962C940197; Tue, 11 Jun 2013 14:18:13 +0200 (CEST) From: Albert ARIBAUD To: U-Boot Date: Tue, 11 Jun 2013 14:17:33 +0200 Message-Id: <1370953055-13482-5-git-send-email-albert.u.boot@aribaud.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1370953055-13482-4-git-send-email-albert.u.boot@aribaud.net> References: <1369724512-4047-1-git-send-email-albert.u.boot@aribaud.net> <1370953055-13482-1-git-send-email-albert.u.boot@aribaud.net> <1370953055-13482-2-git-send-email-albert.u.boot@aribaud.net> <1370953055-13482-3-git-send-email-albert.u.boot@aribaud.net> <1370953055-13482-4-git-send-email-albert.u.boot@aribaud.net> Subject: [U-Boot] [PATCH v3 4/6] arm: make __image_copy_{start, end} compiler-generated X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This change is only done where needed: some linker scripts may contain __image_copy_{start,end} yet remain unchanged. Also, __image_copy_end needs its own section; putting it in relocation sections changes their flags and makes relocation break. Signed-off-by: Albert ARIBAUD --- Changes in v3: - fix commit message typo (breaks -> break) Changes in v2: None arch/arm/cpu/arm920t/ep93xx/u-boot.lds | 6 +++++- arch/arm/cpu/ixp/u-boot.lds | 6 +++++- arch/arm/cpu/u-boot.lds | 7 +++++-- arch/arm/lib/relocate.S | 7 ++----- arch/arm/lib/sections.c | 2 ++ board/actux1/u-boot.lds | 6 +++++- board/actux2/u-boot.lds | 6 +++++- board/actux3/u-boot.lds | 6 +++++- board/dvlhost/u-boot.lds | 6 +++++- board/freescale/mx31ads/u-boot.lds | 6 +++++- 10 files changed, 44 insertions(+), 14 deletions(-) diff --git a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds index cf55bf7..367c805 100644 --- a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds +++ b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds @@ -31,6 +31,7 @@ SECTIONS . = ALIGN(4); .text : { + *(.__image_copy_start) arch/arm/cpu/arm920t/start.o (.text*) /* the EP93xx expects to find the pattern 'CRUS' at 0x1000 */ . = 0x1000; @@ -56,7 +57,10 @@ SECTIONS . = ALIGN(4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } __bss_start = .; .bss : { *(.bss*) } diff --git a/arch/arm/cpu/ixp/u-boot.lds b/arch/arm/cpu/ixp/u-boot.lds index 5cfff68..9141199 100644 --- a/arch/arm/cpu/ixp/u-boot.lds +++ b/arch/arm/cpu/ixp/u-boot.lds @@ -31,6 +31,7 @@ SECTIONS . = ALIGN(4); .text : { + *(.__image_copy_start) arch/arm/cpu/ixp/start.o(.text*) *(.text*) } @@ -54,7 +55,10 @@ SECTIONS . = ALIGN(4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds index fe2ca98..d7adf90 100644 --- a/arch/arm/cpu/u-boot.lds +++ b/arch/arm/cpu/u-boot.lds @@ -33,7 +33,7 @@ SECTIONS . = ALIGN(4); .text : { - __image_copy_start = .; + *(.__image_copy_start) CPUDIR/start.o (.text*) *(.text*) } @@ -57,7 +57,10 @@ SECTIONS . = ALIGN(4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S index 7a7c4c0..3767a95 100644 --- a/arch/arm/lib/relocate.S +++ b/arch/arm/lib/relocate.S @@ -39,13 +39,12 @@ ENTRY(relocate_code) mov r6, r0 /* save addr of destination */ - ldr r0, =_start /* r0 <- SRC &_start */ + ldr r0, =__image_copy_start /* r0 <- SRC &__image_copy_start */ subs r9, r6, r0 /* r9 <- relocation offset */ beq relocate_done /* skip relocation */ mov r1, r6 /* r1 <- scratch for copy loop */ adr r7, relocate_code /* r7 <- SRC &relocate_code */ - ldr r3, _image_copy_end_ofs /* r3 <- __image_copy_end local ofs */ - add r2, r7, r3 /* r2 <- SRC &__image_copy_end */ + ldr r2, =__image_copy_end /* r2 <- SRC &__image_copy_end */ copy_loop: ldmia r0!, {r10-r11} /* copy from source address [r0] */ @@ -89,8 +88,6 @@ relocate_done: bx lr #endif -_image_copy_end_ofs: - .word __image_copy_end - relocate_code _rel_dyn_start_ofs: .word __rel_dyn_start - relocate_code _rel_dyn_end_ofs: diff --git a/arch/arm/lib/sections.c b/arch/arm/lib/sections.c index e52fec9..03e846f 100644 --- a/arch/arm/lib/sections.c +++ b/arch/arm/lib/sections.c @@ -37,3 +37,5 @@ char __bss_start[0] __attribute__((section(".__bss_start"))); char __bss_end[0] __attribute__((section(".__bss_end"))); +char __image_copy_start[0] __attribute__((section(".__image_copy_start"))); +char __image_copy_end[0] __attribute__((section(".__image_copy_end"))); diff --git a/board/actux1/u-boot.lds b/board/actux1/u-boot.lds index 989ad71..531e598 100644 --- a/board/actux1/u-boot.lds +++ b/board/actux1/u-boot.lds @@ -30,6 +30,7 @@ SECTIONS . = ALIGN (4); .text : { + *(.__image_copy_start) arch/arm/cpu/ixp/start.o(.text*) net/libnet.o(.text*) board/actux1/libactux1.o(.text*) @@ -62,7 +63,10 @@ SECTIONS . = ALIGN (4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/board/actux2/u-boot.lds b/board/actux2/u-boot.lds index 0e20670..aff773c 100644 --- a/board/actux2/u-boot.lds +++ b/board/actux2/u-boot.lds @@ -30,6 +30,7 @@ SECTIONS . = ALIGN (4); .text : { + *(.__image_copy_start) arch/arm/cpu/ixp/start.o(.text*) net/libnet.o(.text*) board/actux2/libactux2.o(.text*) @@ -62,7 +63,10 @@ SECTIONS . = ALIGN (4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/board/actux3/u-boot.lds b/board/actux3/u-boot.lds index b7d29b4..9d43e95 100644 --- a/board/actux3/u-boot.lds +++ b/board/actux3/u-boot.lds @@ -30,6 +30,7 @@ SECTIONS . = ALIGN (4); .text : { + *(.__image_copy_start) arch/arm/cpu/ixp/start.o(.text*) net/libnet.o(.text*) board/actux3/libactux3.o(.text*) @@ -62,7 +63,10 @@ SECTIONS . = ALIGN (4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/board/dvlhost/u-boot.lds b/board/dvlhost/u-boot.lds index ecd9efe..ee7219f 100644 --- a/board/dvlhost/u-boot.lds +++ b/board/dvlhost/u-boot.lds @@ -30,6 +30,7 @@ SECTIONS . = ALIGN (4); .text : { + *(.__image_copy_start) arch/arm/cpu/ixp/start.o(.text*) net/libnet.o(.text*) board/dvlhost/libdvlhost.o(.text*) @@ -62,7 +63,10 @@ SECTIONS . = ALIGN (4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .; diff --git a/board/freescale/mx31ads/u-boot.lds b/board/freescale/mx31ads/u-boot.lds index 2197883..f8ef00c 100644 --- a/board/freescale/mx31ads/u-boot.lds +++ b/board/freescale/mx31ads/u-boot.lds @@ -34,6 +34,7 @@ SECTIONS . = ALIGN(4); .text : { + *(.__image_copy_start) /* WARNING - the following is hand-optimized to fit within */ /* the sector layout of our flash chips! XXX FIXME XXX */ @@ -65,7 +66,10 @@ SECTIONS . = ALIGN(4); - __image_copy_end = .; + .image_copy_end : + { + *(.__image_copy_end) + } .rel.dyn : { __rel_dyn_start = .;