arch/x86: Prevent .text/.init overlap with older linkers

Add Kconfig option `X86_BOOTBLOCK_EXTRA_PROGRAM_SZ` to reserve extra
space, avoiding overlap between .text and .init sections when using
older linkers (binutils 2.3x). Default is 1024 bytes (1 KiB) for
ChromeOS, 0 otherwise.

BUG=b:332445618
TEST=Built and booted google/rex (32-bit/64-bit).

Change-Id: I019bf6896d84b2a84dff6f22323f0f446c0740b5
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81886
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Subrata Banik 2024-04-13 07:14:04 +00:00
parent a70493d5b2
commit 93f2f0f7bd
2 changed files with 12 additions and 1 deletions

View File

@ -412,4 +412,15 @@ config SOC_PHYSICAL_ADDRESS_WIDTH
If not set, both CPU and SoC physical address width are If not set, both CPU and SoC physical address width are
assume to be the same. assume to be the same.
config X86_BOOTBLOCK_EXTRA_PROGRAM_SZ
int
default 1024 if CHROMEOS
default 0
help
Add extra space to prevent overlap between .text and .init sections.
This is necessary for older linkers (pre-binutils 2.4x) like those used
on ChromeOS platforms.
The default value is 1024 bytes (1 KiB) for ChromeOS and 0 for other platforms.
endif endif

View File

@ -26,7 +26,7 @@ SECTIONS {
INCLUDE "bootblock/lib/program.ld" INCLUDE "bootblock/lib/program.ld"
PROGRAM_SZ = SIZEOF(.text) + SIZEOF(.data); PROGRAM_SZ = SIZEOF(.text) + SIZEOF(.data) + CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ;
. = MIN(_ECFW_PTR, MIN(_ID_SECTION, _FIT_POINTER)) - EARLYASM_SZ; . = MIN(_ECFW_PTR, MIN(_ID_SECTION, _FIT_POINTER)) - EARLYASM_SZ;
. = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16); . = CONFIG(SIPI_VECTOR_IN_ROM) ? ALIGN(4096) : ALIGN(16);