
Hi Heinrich,
On Sat, Oct 13, 2018 at 12:57 PM Bin Meng bmeng.cn@gmail.com wrote:
Hi Heinrich,
On Sat, Oct 13, 2018 at 9:07 AM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On x86_64 the field global_data_ptr is assigned before relocation. As global data sections (.data and .bss) overlap with the relocation sections
Good catch! But I think the x86_64 global data is in the .bss, not .data. .data is not overlapped with the .rela section.
(.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.
It turns out putting this field to the .data section will fix this issue, without causing any compiler warning.
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index 676a789..2e602f3 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 __attribute__((section(".text"))); +struct global_data *global_data_ptr __attribute__((section(".data")));
Regards, Bin