summaryrefslogtreecommitdiff
path: root/lib_ppc/board.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2005-08-30 14:13:23 +0200
committerWolfgang Denk <wd@pollux.denx.de>2005-08-30 14:13:23 +0200
commitbce84c4dab92062bc5ae7608c4a2508803b1225e (patch)
tree55060df62dd4a227b5eca5b212daa1d560e6404c /lib_ppc/board.c
parentf7fbf269feb10af44001236b1bef984fb0e8fff1 (diff)
downloadu-boot-imx-bce84c4dab92062bc5ae7608c4a2508803b1225e.zip
u-boot-imx-bce84c4dab92062bc5ae7608c4a2508803b1225e.tar.gz
u-boot-imx-bce84c4dab92062bc5ae7608c4a2508803b1225e.tar.bz2
Prepare U-Boot for gcc-4.x: fix global data pointer initialization
The global data pointer, stored in r29 before relocation to RAM, was not initialized to a correct value. This happened because the pointer declaration was done locally in the scope of the board_init_f() function. What follows is a cite from gcc.info, 5.37, "Variables in Specified Registers": ... The compiler's data flow analysis is capable of determining where the specified registers contain live values, and where they are available for other uses. Stores into local register variables may be deleted when they appear to be dead according to dataflow analysis. References to local register variables may be deleted or moved or simplified. ... Moving the global data declaration to global scope solved the problem.
Diffstat (limited to 'lib_ppc/board.c')
-rw-r--r--lib_ppc/board.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 04aa8f9..d1e294f 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -90,6 +90,7 @@ extern flash_info_t flash_info[];
#endif
#include <environment.h>
+DECLARE_GLOBAL_DATA_PTR;
#if defined(CFG_ENV_IS_EMBEDDED)
#define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
@@ -126,8 +127,6 @@ static ulong mem_malloc_brk = 0;
*/
static void mem_malloc_init (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off;
mem_malloc_end = dest_addr;
@@ -187,8 +186,6 @@ typedef int (init_fnc_t) (void);
static int init_baudrate (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
uchar tmp[64]; /* long enough for environment variables */
int i = getenv_r ("baudrate", tmp, sizeof (tmp));
@@ -202,8 +199,6 @@ static int init_baudrate (void)
static int init_func_ram (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
#ifdef CONFIG_BOARD_TYPES
int board_type = gd->board_type;
#else
@@ -348,8 +343,6 @@ init_fnc_t *init_sequence[] = {
void board_init_f (ulong bootflag)
{
- DECLARE_GLOBAL_DATA_PTR;
-
bd_t *bd;
ulong len, addr, addr_sp;
ulong *s;
@@ -589,7 +582,6 @@ void board_init_f (ulong bootflag)
void board_init_r (gd_t *id, ulong dest_addr)
{
- DECLARE_GLOBAL_DATA_PTR;
cmd_tbl_t *cmdtp;
char *s, *e;
bd_t *bd;