summaryrefslogtreecommitdiff
path: root/arch/arm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/Makefile4
-rw-r--r--arch/arm/lib/board.c1
-rw-r--r--arch/arm/lib/bss.c39
-rw-r--r--arch/arm/lib/crt0.S4
-rw-r--r--arch/arm/lib/spl.c2
5 files changed, 47 insertions, 3 deletions
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 57111afd90..6ae161a51d 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -39,7 +39,11 @@ GLCOBJS += div0.o
SOBJS-y += crt0.o
ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_SYS_GENERIC_BOARD
COBJS-y += board.o
+endif
+COBJS-y += bss.o
+
COBJS-y += bootm.o
COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 162e2cc863..0521178ac3 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -53,6 +53,7 @@
#include <fdtdec.h>
#include <post.h>
#include <logbuff.h>
+#include <asm/sections.h>
#ifdef CONFIG_BITBANGMII
#include <miiphy.h>
diff --git a/arch/arm/lib/bss.c b/arch/arm/lib/bss.c
new file mode 100644
index 0000000000..99eda59137
--- /dev/null
+++ b/arch/arm/lib/bss.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/**
+ * These two symbols are declared in a C file so that the linker
+ * uses R_ARM_RELATIVE relocation, rather than the R_ARM_ABS32 one
+ * it would use if the symbols were defined in the linker file.
+ * Using only R_ARM_RELATIVE relocation ensures that references to
+ * the symbols are correct after as well as before relocation.
+ *
+ * We need a 0-byte-size type for these symbols, and the compiler
+ * does not allow defining objects of C type 'void'. Using an empty
+ * struct is allowed by the compiler, but causes gcc versions 4.4 and
+ * below to complain about aliasing. Therefore we use the next best
+ * thing: zero-sized arrays, which are both 0-byte-size and exempt from
+ * aliasing warnings.
+ */
+
+char __bss_start[0] __attribute__((used, section(".__bss_start")));
+char __bss_end[0] __attribute__((used, section(".__bss_end")));
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 4f60958b1d..37d9927d2c 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -85,7 +85,7 @@
*/
.globl __bss_start
-.globl __bss_end__
+.globl __bss_end
/*
* entry point of crt0 sequence
@@ -141,7 +141,7 @@ here:
bl c_runtime_cpu_setup /* we still call old routine here */
ldr r0, =__bss_start /* this is auto-relocated! */
- ldr r1, =__bss_end__ /* this is auto-relocated! */
+ ldr r1, =__bss_end /* this is auto-relocated! */
mov r2, #0x00000000 /* prepare zero to clear BSS */
diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index f568f619cb..301f082ea3 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -45,7 +45,7 @@ void __weak board_init_f(ulong dummy)
asm volatile("mov sp, %0\n" : : "r"(CONFIG_SPL_STACK));
/* Clear the BSS. */
- memset(__bss_start, 0, __bss_end__ - __bss_start);
+ memset(__bss_start, 0, __bss_end - __bss_start);
/* Set global data pointer. */
gd = &gdata;