arch/x86/bootblock.ld: Align the base of bootblock downwards

Instead of using some aritmetics that sometimes works, use the largest
alignment necessary (page tables) and align downwards in the linker
script.

This fixes linking failing when linking in page tables inside the
bootblock.

This can result in a slight increase in bootblock size of at most 4096 -
512 bytes.

Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: I78c6ba6e250ded3f04b12cd0c20b18cb653a1506
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80346
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans
2024-02-05 15:10:28 +01:00
committed by Martin L Roth
parent e8c3d39edb
commit 929dfec0bd

View File

@@ -17,19 +17,16 @@ SECTIONS {
. = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE; . = _ebootblock - CONFIG_C_ENV_BOOTBLOCK_SIZE;
#else #else
. = BOOTBLOCK_TOP - PROGRAM_SZ; . = BOOTBLOCK_TOP - PROGRAM_SZ;
. = ALIGN(64); /* Page tables need to be at a 4K boundary so align the bootblock downwards */
. = ALIGN(4096);
. -= 4096;
#endif #endif
_bootblock = .; _bootblock = .;
INCLUDE "bootblock/lib/program.ld" INCLUDE "bootblock/lib/program.ld"
/* PROGRAM_SZ = SIZEOF(.text);
* Allocation reserves extra space here. Alignment requirements
* may cause the total size of a section to change when the start
* address gets applied.
*/
PROGRAM_SZ = SIZEOF(.text) + 512;
. = 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);