[U-Boot] [PATCH 1/1] x86: put global data pointer into the .text section

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Oct 13 01:07:17 UTC 2018


On x86_64 the field global_data_ptr is assigned before relocation. As
global data sections (.data and .bss) overlap with the relocation sections
(.rela) this destroys the relocation table and leads to spurious errors.

By moving the field to the .text section it will not overlap any relocation
section anymore.

Fixes: a160092a610f ("x86: Support global_data on x86_64")
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 arch/x86/cpu/x86_64/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index 18b3e94e12..676a789524 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -8,7 +8,7 @@
 #include <debug_uart.h>
 
 /* Global declaration of gd */
-struct global_data *global_data_ptr;
+struct global_data *global_data_ptr __attribute__((section(".text")));
 
 void arch_setup_gd(gd_t *new_gd)
 {
-- 
2.19.1



More information about the U-Boot mailing list