From patchwork Sat Oct 30 19:48:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 71970 Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id E2332FA for ; Sat, 30 Oct 2010 21:51:27 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id B80E0308B01B for ; Sat, 30 Oct 2010 21:51:27 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Sat, 30 Oct 2010 21:51:27 +0200 (CEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Sat, 30 Oct 2010 21:48:38 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Sat, 30 Oct 2010 21:48:38 +0200 Received: from scanner-2.m-online.net (scanner-2.mail.m-online.net [192.168.8.166]) by mail.m-online.net (Postfix) with ESMTP id 6718F1C0017E; Sat, 30 Oct 2010 21:48:38 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 6A8F946C0DA; Sat, 30 Oct 2010 21:48:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 00D9E28247; Sat, 30 Oct 2010 21:48:33 +0200 (CEST) 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 pNSEAflR-rYa; Sat, 30 Oct 2010 21:48:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C6A61281F6; Sat, 30 Oct 2010 21:48:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 223FD280E4 for ; Sat, 30 Oct 2010 21:48:24 +0200 (CEST) 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 F0zS0gecgGje for ; Sat, 30 Oct 2010 21:48:22 +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 mail.ahsoftware.de (h1047321.serverkompetenz.net [85.214.67.163]) by theia.denx.de (Postfix) with ESMTPS id 08ADE280D1 for ; Sat, 30 Oct 2010 21:48:20 +0200 (CEST) Received: by mail.ahsoftware.de (Postfix, from userid 65534) id CEF50598069; Sat, 30 Oct 2010 21:48:19 +0200 (CEST) Received: from eiche.ahsoftware (p57B202F2.dip0.t-ipconnect.de [87.178.2.242]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTP id 200B8598069; Sat, 30 Oct 2010 21:48:17 +0200 (CEST) Received: from krabat.ahsoftware (krabat.ahsoftware [192.168.207.2]) by eiche.ahsoftware (Postfix) with ESMTP id A2FF33FC1E; Sat, 30 Oct 2010 21:48:15 +0200 (CEST) From: Alexander Holler To: u-boot@lists.denx.de Date: Sat, 30 Oct 2010 21:48:13 +0200 Message-Id: <1288468093-5748-1-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 1.7.2.3 Subject: [U-Boot] [PATCH] ARM: check relocation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: by amavisd-new at m-online.net Relocation fails here using gcc 4.3.4 or gcc 4.5.1. So it seems to be a good idea to check this on startup and print a warning if it failed. If relocation proved to be correct for ARM, this commit could just be reverted or put inside #ifdef DEBUG. Signed-off-by: Alexander Holler --- arch/arm/lib/board.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1fd5f83..2f3c7fe 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -469,6 +469,13 @@ void board_init_r (gd_t *id, ulong dest_addr) debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr); + /* Check if relocation was ok, dest_addr is the relocated _TEXT_BASE */ + if ( ! ( _bss_start_ofs + dest_addr <= (ulong)&monitor_flash_len && (ulong)&monitor_flash_len < _bss_end_ofs + dest_addr) ) { + printf("(relocated) BSS is from %08lx to %08lx\n", _bss_start_ofs + dest_addr, _bss_end_ofs + dest_addr); + printf("&monitor_flash_len: %p\n", &monitor_flash_len); + puts("WARNING: relocation failed (&monitor_flash_len is outside reloctated BSS)!\n"); + } + #ifdef CONFIG_LOGBUFFER logbuff_init_ptrs (); #endif