diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-10-13 20:52:07 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2018-10-22 17:51:45 +0800 |
commit | 2c78a79ec7fc0b3729e9f16214cf8e08e4664a0b (patch) | |
tree | 7945d654e9e4ee84aa4c582b341287a5a238336c /arch | |
parent | 80df194f0165cb540a2a984f95dd2b37948f54d7 (diff) |
x86: put global data pointer into the .data section
On x86_64 the field global_data_ptr is assigned before relocation. As
sections for uninitialized global data (.bss) overlap with the relocation
sections (.rela) this destroys the relocation table and leads to spurious
errors.
Initialization forces the global_data_ptr into a section for initialized
global data (.data) which cannot overlap any .rela section.
Fixes: a160092a610f ("x86: Support global_data on x86_64")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/cpu/x86_64/cpu.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index 18b3e94e12..ef5e812510 100644 --- a/arch/x86/cpu/x86_64/cpu.c +++ b/arch/x86/cpu/x86_64/cpu.c @@ -7,8 +7,14 @@ #include <common.h> #include <debug_uart.h> -/* Global declaration of gd */ -struct global_data *global_data_ptr; +/* + * Global declaration of gd. + * + * As we write to it before relocation we have to make sure it is not put into + * a .bss section which may overlap a .rela section. Initialization forces it + * into a .data section which cannot overlap any .rela section. + */ +struct global_data *global_data_ptr = (struct global_data *)~0; void arch_setup_gd(gd_t *new_gd) { |