linker: Modify linker scripts to be more generic
[oweals/u-boot.git] / arch / powerpc / cpu / mpc85xx / start.S
index 63fdffddb1a345e43584e7361eea00e5987e3f8e..dbc705388c9610195f89776620e4aa29fa644e44 100644 (file)
@@ -1,8 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2004, 2007-2012 Freescale Semiconductor, Inc.
  * Copyright (C) 2003  Motorola,Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /* U-Boot Startup Code for Motorola 85xx PowerPC based Embedded Boards
@@ -1183,14 +1182,13 @@ _start_cont:
        lis     r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
        ori     r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-
-#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
-#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
+#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
 #endif
 
        /* Leave 16+ byte for back chain termination and NULL return address */
-       subi    r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
+       subi    r3,r3,((CONFIG_VAL(SYS_MALLOC_F_LEN)+16+15)&~0xf)
 #endif
 
        /* End of RAM */
@@ -1204,7 +1202,7 @@ _start_cont:
        cmplw   r4,r3
        bne     1b
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
        lis     r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
        ori     r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
 
@@ -1218,6 +1216,9 @@ _start_cont:
        mr      r1,r3           /* Transfer to SP(r1) */
 
        GET_GOT
+       /* Needed for -msingle-pic-base */
+       bl      _GLOBAL_OFFSET_TABLE_@local-4
+       mflr    r30
 
        /* Pass our potential ePAPR device tree pointer to cpu_init_early_f */
        mr      r3, r24
@@ -1427,16 +1428,6 @@ dcache_status:
        andi.   r3,r3,L1CSR0_DCE
        blr
 
-       .globl get_pvr
-get_pvr:
-       mfspr   r3,PVR
-       blr
-
-       .globl get_svr
-get_svr:
-       mfspr   r3,SVR
-       blr
-
 /*------------------------------------------------------------------------------- */
 /* Function:    in8 */
 /* Description:         Input 8 bits */