public inbox for u-boot@lists.denx.de
 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 14:07:00 +0200	[thread overview]
Message-ID: <4CAB14E4.6070301@denx.de> (raw)
In-Reply-To: <4CAAEEFC.8080205@denx.de>

Hello Albert,

Heiko Schocher wrote:
> 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.
> 
> Following patch works on the tx25 with booting from nand:

Sorry, I was to fast, I had a problem with to big nand_spl code,
fixed this now, as I didn;t activate -pie flag for NAND_SPL code,
as this don;t need relocation.

Also I use "blo" instead "ble" in start.S

here now the v2 patch for the tx25 board:

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index e9e02da..19b8f02 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -72,4 +72,6 @@ PLATFORM_LIBS += $(OBJTREE)/arch/arm/lib/eabi_compat.o
 endif
 endif
 LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
-PLATFORM_LDFLAGS += -pie
\ No newline at end of file
+ifndef CONFIG_NAND_SPL
+PLATFORM_LDFLAGS += -pie
+endif
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 5a7ae7e..68e597c 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -266,7 +266,7 @@ fixnext:
 	str	r1, [r0]
 	add	r2, r2, #8	/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
-	ble	fixloop
+	blo	fixloop
 #endif
 #endif	/* #ifndef CONFIG_SKIP_RELOCATE_UBOOT */

@@ -295,10 +295,10 @@ clbss_l:str	r2, [r0]		/* clear loop...		    */
  */
 #ifdef CONFIG_NAND_SPL
 	ldr     r0, _nand_boot_ofs
-	adr	r1, _start
-	add	pc, r0, r1
-_nand_boot_ofs
-	: .word nand_boot - _start
+	mov	pc, r0
+
+_nand_boot_ofs:
+	.word nand_boot
 #else
 	ldr	r0, _board_init_r_ofs
 	adr	r1, _start
diff --git a/board/karo/tx25/config.mk b/board/karo/tx25/config.mk
index 51ca1ab..8be6466 100644
--- a/board/karo/tx25/config.mk
+++ b/board/karo/tx25/config.mk
@@ -1,5 +1,5 @@
 ifdef CONFIG_NAND_SPL
 TEXT_BASE = 0x810c0000
 else
-TEXT_BASE = 0x81fc0000
+TEXT_BASE = 0x81200000
 endif
diff --git a/include/configs/tx25.h b/include/configs/tx25.h
index c798570..2be3699 100644
--- a/include/configs/tx25.h
+++ b/include/configs/tx25.h
@@ -41,7 +41,7 @@
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
 #define CONFIG_SYS_NAND_U_BOOT_SIZE	0x30000

-#define CONFIG_SYS_NAND_U_BOOT_DST      (0x81fc0000)
+#define CONFIG_SYS_NAND_U_BOOT_DST      (0x81200000)
 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST

 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
@@ -178,6 +178,7 @@

 /* 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
 #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)
diff --git a/nand_spl/board/karo/tx25/u-boot.lds b/nand_spl/board/karo/tx25/u-boot.lds
index c572557..5f95c87 100644
--- a/nand_spl/board/karo/tx25/u-boot.lds
+++ b/nand_spl/board/karo/tx25/u-boot.lds
@@ -53,6 +53,11 @@ SECTIONS
 		*(.data.rel.ro)
 	}

+	. = ALIGN(4);
+	__rel_dyn_start = .;
+	__rel_dyn_end = .;
+	__dynsym_start = .;
+
 	__got_start = .;
 	. = ALIGN(4);
 	.got : { *(.got) }
@@ -67,4 +72,12 @@ SECTIONS
 	__bss_start = .;
 	.bss : { *(.bss) }
 	_end = .;
+	/DISCARD/ : { *(.bss*) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynsym*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.hash*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
 }
-- 
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 12:07 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
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 [this message]
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=4CAB14E4.6070301@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox