Aaron Durbin (adurbin@chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11509
-gerrit
commit c45c3e98d4c0f134d4d59494fca65be336c43330 Author: Aaron Durbin adurbin@chromium.org Date: Fri Sep 4 12:09:49 2015 -0500
linking: move romstage and bootblock to use program.ld
Instead of having separate <stage>.ld files in src/lib one file can be used: program.ld. There's now only one touch point for stage layout.
BUG=chrome-os-partner:44827 BRANCH=None TEST=Built a myriad of boards. Analyzed readelf output.
Change-Id: I4c3e3671d696caa2c7601065a85fab803e86f971 Signed-off-by: Aaron Durbin adubin@chromium.org --- src/include/memlayout.h | 12 +++++----- src/lib/Makefile.inc | 4 ++-- src/lib/bootblock.ld | 51 --------------------------------------- src/lib/romstage.ld | 64 ------------------------------------------------- 4 files changed, 8 insertions(+), 123 deletions(-)
diff --git a/src/include/memlayout.h b/src/include/memlayout.h index 3b3ff6d..1a38256 100644 --- a/src/include/memlayout.h +++ b/src/include/memlayout.h @@ -103,24 +103,24 @@ #endif
/* Careful: 'INCLUDE <filename>' must always be at the end of the output line */ -#ifdef __BOOTBLOCK__ +#if ENV_BOOTBLOCK #define BOOTBLOCK(addr, sz) \ SET_COUNTER(bootblock, addr) \ - _ = ASSERT(_ebootblock - _bootblock <= sz, \ + _ = ASSERT(_eprogram - _program <= sz, \ STR(Bootblock exceeded its allotted size! (sz))); \ - INCLUDE "lib/bootblock.bootblock.ld" + INCLUDE "lib/program.bootblock.ld" #else #define BOOTBLOCK(addr, sz) \ SET_COUNTER(bootblock, addr) \ . += sz; #endif
-#ifdef __ROMSTAGE__ +#if ENV_ROMSTAGE #define ROMSTAGE(addr, sz) \ SET_COUNTER(romstage, addr) \ - _ = ASSERT(_eromstage - _romstage <= sz, \ + _ = ASSERT(_eprogram - _program <= sz, \ STR(Romstage exceeded its allotted size! (sz))); \ - INCLUDE "lib/romstage.romstage.ld" + INCLUDE "lib/program.romstage.ld" #else #define ROMSTAGE(addr, sz) \ SET_COUNTER(romstage, addr) \ diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index cd2b70a..4aa6bf8 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -194,8 +194,8 @@ secmon-y += halt.c ifneq ($(CONFIG_ARCH_X86),y) # X86 bootblock and romstage use custom ldscripts that are all glued together, # so we need to exclude it here or it would pick these up as well -bootblock-y += bootblock.ld -romstage-y += romstage.ld +bootblock-y += program.ld +romstage-y += program.ld endif
ramstage-y += program.ld diff --git a/src/lib/bootblock.ld b/src/lib/bootblock.ld deleted file mode 100644 index 42e6d64..0000000 --- a/src/lib/bootblock.ld +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright 2014 Google Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc. - */ - -/* This file is included inside a SECTIONS block */ - -.bootblock . : { - _program = .; - _bootblock = .; - *(.text._start); - *(.text.stage_entry); - KEEP(*(.id)); - *(.text); - *(.text.*); - *(.rodata); - *(.rodata.*); - *(.data); - *(.data.*); - *(.bss); - *(.bss.*); - *(.sbss); - *(.sbss.*); - _preram_cbmem_console = DEFINED(_preram_cbmem_console) ? _preram_cbmem_console : 0; - _epreram_cbmem_console = DEFINED(_epreram_cbmem_console) ? _epreram_cbmem_console : 0; - _ebootblock = .; - _eprogram = .; -} : to_load = 0xff - -/DISCARD/ : { - *(.comment) - *(.note) - *(.comment.*) - *(.note.*) - *(.ARM.*) - *(.MIPS.*) -} diff --git a/src/lib/romstage.ld b/src/lib/romstage.ld deleted file mode 100644 index ba154ef..0000000 --- a/src/lib/romstage.ld +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright 2014 Google Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc. - */ - -/* This file is included inside a SECTIONS block */ - -.text . : { - _program = .; - _romstage = .; - *(.text._start); - *(.text.stage_entry); - *(.text); - *(.text.*); -} : to_load - -.data . : { - . = ALIGN(8); - _cbmem_init_hooks = .; - KEEP(*(.rodata.cbmem_init_hooks)); - _ecbmem_init_hooks = .; - *(.rodata); - *(.rodata.*); - *(.data); - *(.data.*); - PROVIDE(_preram_cbmem_console = .); - PROVIDE(_epreram_cbmem_console = _preram_cbmem_console); - . = ALIGN(8); -} - -.bss . : { - . = ALIGN(8); - _bss = .; - *(.bss) - *(.bss.*) - *(.sbss) - *(.sbss.*) - _ebss = .; - _eromstage = .; - _eprogram = .; -} - -/* Discard the sections we don't need/want */ -/DISCARD/ : { - *(.comment) - *(.note) - *(.comment.*) - *(.note.*) - *(.eh_frame); -}