Skip to content

Commit

Permalink
x86: Don't duplicate global_ptr in 64-bit EFI app
Browse files Browse the repository at this point in the history
This variable is already defined by the EFI code. Drop the duplicate
definition when building a 64-bit EFI app.

Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
sjg20 authored and xypron committed Nov 7, 2021
1 parent e16c47f commit 9c297a3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
15 changes: 1 addition & 14 deletions arch/x86/cpu/x86_64/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@
#include <cpu_func.h>
#include <debug_uart.h>
#include <init.h>

/*
* 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)
{
global_data_ptr = new_gd;
}
#include <asm/global_data.h>

int cpu_has_64bit(void)
{
Expand Down
16 changes: 16 additions & 0 deletions arch/x86/cpu/x86_64/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
#include <common.h>
#include <init.h>

DECLARE_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)
{
global_data_ptr = new_gd;
}

int misc_init_r(void)
{
return 0;
Expand Down
9 changes: 9 additions & 0 deletions lib/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
#include <efi.h>
#include <efi_api.h>

/*
* 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;

/*
* Unfortunately we cannot access any code outside what is built especially
* for the stub. lib/string.c is already being built for the U-Boot payload
Expand Down

0 comments on commit 9c297a3

Please sign in to comment.