Skip to contentSkip to conversation

Make mpc8572ds, mpc8544ds, mpc8536ds relocatable

PATCH New Ed Swarthout 2 participants 3 messages Oct 9, 2008 – Oct 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Make mpc8572ds, mpc8544ds, mpc8536ds relocatable

Fixes boot crash from bad string pointers in get_table_entry_name when flash is erased or differs from current u-boot image.

Remove .fixup from .text section since __fixup_entries is only calculated from .reloc section.

---

tested with freescale-powerpc-linux-gnu-4.2-171.i686.rpm

Patch #2 is needed only if x86 emulation is used for video bios.

Compiling the x86 bios emulator with -mrelocatable removes the need to force the function pointer tables into got2. see patch #2

 board/freescale/mpc8536ds/config.mk  |    1 +
 board/freescale/mpc8536ds/u-boot.lds |    1 -
 board/freescale/mpc8544ds/config.mk  |    1 +
 board/freescale/mpc8544ds/u-boot.lds |    1 -
 board/freescale/mpc8572ds/config.mk  |    1 +
 board/freescale/mpc8572ds/u-boot.lds |    1 -
 6 files changed, 3 insertions(+), 3 deletions(-)
board/freescale/mpc8536ds/config.mk +1 -0
index 9775ff4..b293583 100644
@@ -30,3 +30,4 @@ endif
 PLATFORM_CPPFLAGS += -DCONFIG_E500=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC8536=1
+PLATFORM_CPPFLAGS += -mrelocatable -DCONFIG_RELOC_FIXUP_WORKS
board/freescale/mpc8536ds/u-boot.lds +0 -1
index 901f633..54f9fbc 100644
@@ -58,7 +58,6 @@ SECTIONS
   .text      :
   {
     *(.text)
-    *(.fixup)
     *(.got1)
    } :text
     _etext = .;
board/freescale/mpc8544ds/config.mk +1 -0
index 85663ef..b5071f2 100644
@@ -30,3 +30,4 @@ endif
 PLATFORM_CPPFLAGS += -DCONFIG_E500=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC8544=1
+PLATFORM_CPPFLAGS += -mrelocatable -DCONFIG_RELOC_FIXUP_WORKS
board/freescale/mpc8544ds/u-boot.lds +0 -1
index a05ece5..6477c69 100644
@@ -58,7 +58,6 @@ SECTIONS
   .text      :
   {
     *(.text)
-    *(.fixup)
     *(.got1)
    } :text
     _etext = .;
board/freescale/mpc8572ds/config.mk +1 -0
index 5b32186..8b3651b 100644
@@ -30,3 +30,4 @@ endif
 PLATFORM_CPPFLAGS += -DCONFIG_E500=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
 PLATFORM_CPPFLAGS += -DCONFIG_MPC8572=1
+PLATFORM_CPPFLAGS += -mrelocatable -DCONFIG_RELOC_FIXUP_WORKS
board/freescale/mpc8572ds/u-boot.lds +0 -1
index a05ece5..6477c69 100644
@@ -58,7 +58,6 @@ SECTIONS
   .text      :
   {
     *(.text)
-    *(.fixup)
     *(.got1)
    } :text
     _etext = .;
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 2/2 Leave x86emu op code tables in default section

Forcing the tables into got2 caused extra relocation when using -mrelocatable. This patch requires any board defining CONFIG_BIOSEMU to use -mrelocatable.

---

The only boards which define CONFIG_BIOSEMU are:
MPC8536DS, MPC8572DS, MPC8544DS, HPC8641HPCN, and sequoia. I've tested this patch on the 8572 and 8544 boards.

 drivers/bios_emulator/x86emu/ops.c  |   17 +++++++----------
 drivers/bios_emulator/x86emu/ops2.c |    5 +----
 2 files changed, 8 insertions(+), 14 deletions(-)
drivers/bios_emulator/x86emu/ops.c +7 -10
index 10f2757..b0ad1fa 100644
@@ -70,9 +70,6 @@
 * calls is especially important; otherwise mistakes in coding an
 * "add" would represent a nightmare in maintenance.
 *
-* Jason ported this file to u-boot. place all the function pointer in
-* the got2 sector. Removed some opcode.
-*
 ****************************************************************************/
 
 #include <common.h>
@@ -91,7 +88,7 @@ static char *x86emu_GenOpName[8] = {
 #endif
 
 /* used by several opcodes  */
-static u8 (*genop_byte_operation[])(u8 d, u8 s) __attribute__ ((section(GOT2_TYPE))) =
+static u8 (*genop_byte_operation[])(u8 d, u8 s) =
 {
     add_byte,		/* 00 */
     or_byte,		/* 01 */
@@ -103,7 +100,7 @@ static u8 (*genop_byte_operation[])(u8 d, u8 s) __attribute__ ((section(GOT2_TYP
     cmp_byte,		/* 07 */
 };
 
-static u16 (*genop_word_operation[])(u16 d, u16 s) __attribute__ ((section(GOT2_TYPE))) =
+static u16 (*genop_word_operation[])(u16 d, u16 s) =
 {
     add_word,		/*00 */
     or_word,		/*01 */
@@ -115,7 +112,7 @@ static u16 (*genop_word_operation[])(u16 d, u16 s) __attribute__ ((section(GOT2_
     cmp_word,		/*07 */
 };
 
-static u32 (*genop_long_operation[])(u32 d, u32 s) __attribute__ ((section(GOT2_TYPE))) =
+static u32 (*genop_long_operation[])(u32 d, u32 s) =
 {
     add_long,		/*00 */
     or_long,		/*01 */
@@ -128,7 +125,7 @@ static u32 (*genop_long_operation[])(u32 d, u32 s) __attribute__ ((section(GOT2_
 };
 
 /* used by opcodes 80, c0, d0, and d2. */
-static u8(*opcD0_byte_operation[])(u8 d, u8 s) __attribute__ ((section(GOT2_TYPE))) =
+static u8(*opcD0_byte_operation[])(u8 d, u8 s) =
 {
     rol_byte,
     ror_byte,
@@ -141,7 +138,7 @@ static u8(*opcD0_byte_operation[])(u8 d, u8 s) __attribute__ ((section(GOT2_TYPE
 };
 
 /* used by opcodes c1, d1, and d3. */
-static u16(*opcD1_word_operation[])(u16 s, u8 d) __attribute__ ((section(GOT2_TYPE))) =
+static u16(*opcD1_word_operation[])(u16 s, u8 d) =
 {
     rol_word,
     ror_word,
@@ -154,7 +151,7 @@ static u16(*opcD1_word_operation[])(u16 s, u8 d) __attribute__ ((section(GOT2_TY
 };
 
 /* used by opcodes c1, d1, and d3. */
-static u32 (*opcD1_long_operation[])(u32 s, u8 d) __attribute__ ((section(GOT2_TYPE))) =
+static u32 (*opcD1_long_operation[])(u32 s, u8 d) =
 {
     rol_long,
     ror_long,
@@ -5147,7 +5144,7 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))
 /***************************************************************************
  * Single byte operation code table:
  **************************************************************************/
-void (*x86emu_optab[256])(u8) __attribute__ ((section(GOT2_TYPE))) =
+void (*x86emu_optab[256])(u8) =
 {
 /*  0x00 */ x86emuOp_genop_byte_RM_R,
 /*  0x01 */ x86emuOp_genop_word_RM_R,
drivers/bios_emulator/x86emu/ops2.c +1 -4
index d90d366..99d1eae 100644
@@ -39,9 +39,6 @@
 *		and emulation of all the x86 extended two-byte processor
 *		instructions.
 *
-*		Jason port this file to u-boot. Put the function pointer into
-*		got2 sector.
-*
 ****************************************************************************/
 
 #include <common.h>
@@ -1498,7 +1495,7 @@ void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
 /***************************************************************************
  * Double byte operation code table:
  **************************************************************************/
-void (*x86emu_optab2[256])(u8) __attribute__((section(GOT2_TYPE))) =
+void (*x86emu_optab2[256])(u8) =
 {
 /*  0x00 */ x86emuOp2_illegal_op,  /* Group F (ring 0 PM)      */
 /*  0x01 */ x86emuOp2_illegal_op,  /* Group G (ring 0 PM)      */
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 2/2 Leave x86emu op code tables in default section

Quoted 15 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Swarthout Edward L-SWARTHOU
Sent: Thursday, October 09, 2008 2:27 PM
To: u-boot at lists.denx.de
Cc: Swarthout Edward L-SWARTHOU
Subject: [U-Boot] [PATCH 2/2] Leave x86emu op code tables in default section

Forcing the tables into got2 caused extra relocation when using -mrelocatable.
This patch requires any board defining CONFIG_BIOSEMU to use -mrelocatable.

Quoted 7 lines

---

The only boards which define CONFIG_BIOSEMU are:
MPC8536DS, MPC8572DS, MPC8544DS, HPC8641HPCN, and sequoia. I've tested this patch on the 8572 and 8544 boards.

Ack, Tested on 8536DS board.

Jason