From patchwork Tue Jan 18 16:14:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Weisser X-Patchwork-Id: 79325 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 7DEE9B70F6 for ; Wed, 19 Jan 2011 03:15:01 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AAF98280CB; Tue, 18 Jan 2011 17:14:58 +0100 (CET) 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 Bn3wCfwQQPYw; Tue, 18 Jan 2011 17:14:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9AAAC2809D; Tue, 18 Jan 2011 17:14:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 235342809D for ; Tue, 18 Jan 2011 17:14:54 +0100 (CET) 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 9++U7OMytrLF for ; Tue, 18 Jan 2011 17:14:52 +0100 (CET) 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-in-11.arcor-online.net (mail-in-11.arcor-online.net [151.189.21.51]) by theia.denx.de (Postfix) with ESMTPS id 0745E28094 for ; Tue, 18 Jan 2011 17:14:50 +0100 (CET) Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id C47CB35AD2B for ; Tue, 18 Jan 2011 17:14:49 +0100 (CET) Received: from mail-in-16.arcor-online.net (mail-in-16.arcor-online.net [151.189.21.56]) by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id AADC51CB7C7; Tue, 18 Jan 2011 17:14:49 +0100 (CET) Received: from localhost.localdomain (unknown [212.87.136.142]) (Authenticated sender: weisserm@arcor.de) by mail-in-16.arcor-online.net (Postfix) with ESMTPA id 3DAF39736; Tue, 18 Jan 2011 17:14:49 +0100 (CET) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-16.arcor-online.net 3DAF39736 From: Matthias Weisser To: u-boot@lists.denx.de Date: Tue, 18 Jan 2011 17:14:43 +0100 Message-Id: <1295367283-4696-1-git-send-email-weisserm@arcor.de> X-Mailer: git-send-email 1.7.0.4 Subject: [U-Boot] [PATCH] Do not copy elf section to same adress 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 When an elf section is already at the right position (e.g. after image decompression by bootm) there is no need to copy it. Signed-off-by: Matthias Weisser --- common/cmd_elf.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/cmd_elf.c b/common/cmd_elf.c index bf32612..aec4579 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -342,9 +342,10 @@ static unsigned long load_elf_image_shdr(unsigned long addr) memset ((void *)shdr->sh_addr, 0, shdr->sh_size); } else { image = (unsigned char *) addr + shdr->sh_offset; - memcpy ((void *) shdr->sh_addr, - (const void *) image, - shdr->sh_size); + if ((void *) shdr->sh_addr != (void *) image) + memcpy((void *) shdr->sh_addr, + (const void *) image, + shdr->sh_size); } flush_cache (shdr->sh_addr, shdr->sh_size); }