All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] [PATCH V2] arm: arm926ejs: use ELF relocations
Date: Tue, 05 Oct 2010 09:40:21 +0200	[thread overview]
Message-ID: <4CAAD665.5090500@denx.de> (raw)
In-Reply-To: <1286260287-1571-1-git-send-email-albert.aribaud@free.fr>

Hello Albert,

Albert Aribaud wrote:
> HISTORY:
> 
> V1	Initial patch
> V2	Rebased on latest mainline master
> 
> This patch is *not* a submission for master!
> 
> It is a proof of concept of ELF relocations for ARM, hastily done
> in a day's work time for people on the list to try and to comment.
> All comments are welcome, as several suggestions have been made
> today on the list that I did not have time to incorporate, such as
> rewriting the elf table fixup code in C.
> 
> The basic idea of this patch is to replace the -fPIC compile-time
> option with the -pie link-time option. This removes the GOT but adds
> the .rel.dyn and .dynsym tables, which together allow fixing up code
> more completely than with -fPIC and the GOT; for instance, all pointers
> inside structures are fixed up with -pie, whereas they are not with GOT.
> 
> Note that references to linker-file-generated symbols were also made
> relative to _start rather than absolute. This is not needed as such,
> but it will be useful when optimizing the relocation tables. Actually
> I should have separated this from the ELF relocation support per se.
> 
> The edminiv2.h config file is there for reference only; this is the
> one I used for tests. Latest numbers are:
> 
> With GOT relocs:
> 
>    text	   data	    bss	    dec	    hex	filename	.bin size
>  141376	   4388	  16640	 162404	  27a64	./u-boot	145764
>  
> With ELF relocs:
> 
>    text	   data	    bss	    dec	    hex	filename	.bin size
>  149677	   3727	  16636	 170040	  29838	./u-boot	153408
> 
> The size difference is essentially due to .rel.dyn not being optimal.
> As discussed, an added build step should allow reducing it by half and
> making ELF sizes roughly similar to GOT ones.
> 
> Tests and comments not only welcome but also heartily called for.

Tested based on your patch on the magnesium board (ARM926ejs and
boots from NOR Flash). U-Boot works, with the following patch:

! I had to set TEXT_BASE to 0xc0000000 as u-boot starts from there,
a TEXT_BASE = 0 didn;t work for me!

diff --git a/board/logicpd/imx27lite/config.mk b/board/logicpd/imx27lite/config.mk
index 2f9c4e6..af1c82b 100644
--- a/board/logicpd/imx27lite/config.mk
+++ b/board/logicpd/imx27lite/config.mk
@@ -1 +1,4 @@
+# with relocation TEXT_BASE can be anything, and making it 0
+# makes relative and absolute relocation fixups interchangeable.
+#TEXT_BASE = 0
 TEXT_BASE = 0xc0000000
diff --git a/include/configs/imx27lite-common.h b/include/configs/imx27lite-common.h
index 812e5f2..58f3c49 100644
--- a/include/configs/imx27lite-common.h
+++ b/include/configs/imx27lite-common.h
@@ -236,7 +236,8 @@
 	"mtdparts=" MTDPARTS_DEFAULT "\0"				\

 /* additions for new relocation code, must added to all boards */
-#undef CONFIG_SYS_ARM_WITHOUT_RELOC /* This board is tested with relocation support */
+#define CONFIG_RELOC_FIXUP_WORKS
+#undef  CONFIG_SYS_ARM_WITHOUT_RELOC
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
 					CONFIG_SYS_GBL_DATA_SIZE)

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  parent reply	other threads:[~2010-10-05  7:40 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05  6:31 [U-Boot] [RFC] [PATCH V2] arm: arm926ejs: use ELF relocations Albert Aribaud
2010-10-05  6:45 ` Wolfgang Denk
2010-10-05  7:05   ` Reinhard Meyer
2010-10-05  7:23     ` Reinhard Meyer
2010-10-05  7:52       ` Reinhard Meyer
2010-10-05  8:33         ` Heiko Schocher
2010-10-05  8:41           ` Albert ARIBAUD
2010-10-05  9:00             ` Heiko Schocher
2010-10-05  9:10               ` Reinhard Meyer
2010-10-05  9:15                 ` Heiko Schocher
2010-10-05  9:19                   ` Reinhard Meyer
2010-10-05  9:29                     ` Heiko Schocher
2010-10-05  9:33                       ` Reinhard Meyer
2010-10-05  9:39                         ` Reinhard Meyer
2010-10-05 10:11                           ` Albert ARIBAUD
2010-10-05 10:36                             ` Reinhard Meyer
2010-10-05 10:49                               ` Graeme Russ
2010-10-05 11:01                                 ` Reinhard Meyer
2010-10-05 11:18                                   ` Albert ARIBAUD
2010-10-05 10:33                         ` Albert ARIBAUD
2010-10-05 10:40                           ` Wolfgang Denk
2010-10-05 11:10                             ` Albert ARIBAUD
2010-10-05 11:17                               ` Reinhard Meyer
2010-10-05 11:46                                 ` Albert ARIBAUD
2010-10-05 13:18                                   ` Reinhard Meyer
2010-10-05 13:24                                     ` Graeme Russ
2010-10-05 13:36                                     ` Albert ARIBAUD
2010-10-05 14:06                                       ` Reinhard Meyer
2010-10-05 11:43                               ` Wolfgang Denk
2010-10-05 10:20         ` Albert ARIBAUD
2010-10-05  8:27     ` Wolfgang Denk
2010-10-05  8:38       ` Reinhard Meyer
2010-10-05  8:50         ` Albert ARIBAUD
2010-10-05  8:59           ` Reinhard Meyer
2010-10-05  7:07   ` Wolfgang Denk
2010-10-05  7:40 ` Heiko Schocher [this message]
2010-10-05  8:32   ` Albert ARIBAUD
2010-10-05  8:02 ` Wolfgang Denk
2010-10-05  9:25 ` Heiko Schocher
2010-10-05  9:32   ` Albert ARIBAUD
2010-10-05 12:07   ` Heiko Schocher
2010-10-05 12:52 ` Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CAAD665.5090500@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.