diff options
-rw-r--r-- | src/arch/x86/car.ld | 15 | ||||
-rw-r--r-- | src/arch/x86/include/arch/early_variables.h | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld index 7122776068..33fb5c926c 100644 --- a/src/arch/x86/car.ld +++ b/src/arch/x86/car.ld @@ -71,7 +71,17 @@ * cbmem console. This is useful for clearing this area on a per-stage * basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */ _car_global_start = .; +#if IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION) + /* Allow global unitialized variables when CAR_GLOBALs are not used. */ + *(.bss) + *(.bss.*) + *(.sbss) + *(.sbss.*) +#else + /* .car.global_data objects only around when + * !CONFIG_NO_CAR_GLOBAL_MIGRATION is employed. */ *(.car.global_data); +#endif . = ALIGN(ARCH_POINTER_ALIGN_SIZE); _car_global_end = .; _car_relocatable_data_end = .; @@ -88,10 +98,15 @@ .illegal_globals . : { *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data) *(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*) +#if !IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION) *(.bss) *(.bss.*) *(.sbss) *(.sbss.*) +#else + /* In case something sneaks through when it shouldn't. */ + *(.car.global_data); +#endif } _bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full"); diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index 1b6810de86..d215e47bc0 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -20,7 +20,7 @@ #include <stdlib.h> #include <rules.h> -#if ENV_CACHE_AS_RAM +#if ENV_CACHE_AS_RAM && !IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION) asm(".section .car.global_data,\"w\",@nobits"); asm(".previous"); #ifdef __clang__ @@ -34,7 +34,7 @@ asm(".previous"); * accessed unconditionally because cbmem is never initialized until romstage * when dram comes up. */ -#if ENV_VERSTAGE || ENV_BOOTBLOCK || IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION) +#if ENV_VERSTAGE || ENV_BOOTBLOCK static inline void *car_get_var_ptr(void *var) { return var; |