x86: fix SMM programs linked with gc-sections

Commit f69a99db (coreboot: x86: enable gc-sections) added
gc-sections to the linker command line. The SMM-specific
linker scripts were not interrogated to see if all the
sections were being included properly. .data, .bss, and .sbss
did not have the proper globs set to put the SMM programs in
the expected order.

Lastly, explicitly set the ENTRY for the SMM programs.

Change-Id: Ibb579d18d4819af666d6ec7dfc30776e8c404b71
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9160
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Aaron Durbin 2015-03-29 22:16:55 -05:00 committed by Aaron Durbin
parent 83a8df52b0
commit e73dae4bf5
4 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
/* Maximum number of CPUs/cores */ /* Maximum number of CPUs/cores */
CPUS = 4; CPUS = 4;
ENTRY(smm_handler_start);
SECTIONS SECTIONS
{ {
@ -25,11 +26,14 @@ SECTIONS
/* C read-write data of the SMM handler */ /* C read-write data of the SMM handler */
. = ALIGN(4); . = ALIGN(4);
*(.data) *(.data)
*(.data.*)
/* C uninitialized data of the SMM handler */ /* C uninitialized data of the SMM handler */
. = ALIGN(4); . = ALIGN(4);
*(.bss) *(.bss)
*(.bss.*)
*(.sbss) *(.sbss)
*(.sbss.*)
/* What is this? */ /* What is this? */
*(COMMON) *(COMMON)

View File

@ -1,5 +1,6 @@
/* Maximum number of CPUs/cores */ /* Maximum number of CPUs/cores */
CPUS = 16; CPUS = 16;
ENTRY(smm_handler_start);
SECTIONS SECTIONS
{ {
@ -52,11 +53,14 @@ SECTIONS
/* C read-write data of the SMM handler */ /* C read-write data of the SMM handler */
. = ALIGN(4); . = ALIGN(4);
*(.data) *(.data)
*(.data.*)
/* C uninitialized data of the SMM handler */ /* C uninitialized data of the SMM handler */
. = ALIGN(4); . = ALIGN(4);
*(.bss) *(.bss)
*(.bss.*)
*(.sbss) *(.sbss)
*(.sbss.*)
*(COMMON) *(COMMON)
. = ALIGN(4); . = ALIGN(4);

View File

@ -75,6 +75,7 @@
* *
* All the bad magic is not all that bad after all. * All the bad magic is not all that bad after all.
*/ */
.global smm_handler_start
smm_handler_start: smm_handler_start:
movw $(smm_gdtptr16 - smm_handler_start + SMM_HANDLER_OFFSET), %bx movw $(smm_gdtptr16 - smm_handler_start + SMM_HANDLER_OFFSET), %bx
data32 lgdt %cs:(%bx) data32 lgdt %cs:(%bx)

View File

@ -91,6 +91,7 @@
* *
* All the bad magic is not all that bad after all. * All the bad magic is not all that bad after all.
*/ */
.global smm_handler_start
smm_handler_start: smm_handler_start:
movl $(TSEG_BAR), %eax /* Get TSEG base from PCIE */ movl $(TSEG_BAR), %eax /* Get TSEG base from PCIE */
addr32 movl (%eax), %edx /* Save TSEG_BAR in %edx */ addr32 movl (%eax), %edx /* Save TSEG_BAR in %edx */