Julius Werner has submitted this change. ( https://review.coreboot.org/c/coreboot/+/79144?usp=email )
Change subject: libpayload: Fix the stack and data labels ......................................................................
libpayload: Fix the stack and data labels
We should make sure _stack/_estack and the other labels are consistent. And _data & _edata is also useful to clean up the sensitive data on the data section.
BUG=b:248610274 TEST=emerge-cherry libpayload BRANCH=none
Cq-Depend: chromium:5052462 Change-Id: I589040f4db60b35813ea9f4ba9503244bd7def00 Signed-off-by: Yi Chou yich@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/79144 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M payloads/libpayload/arch/arm/head.S M payloads/libpayload/arch/arm/libpayload.ldscript M payloads/libpayload/arch/arm64/head.S M payloads/libpayload/arch/arm64/libpayload.ldscript M payloads/libpayload/arch/x86/head.S M payloads/libpayload/arch/x86/libpayload.ldscript 6 files changed, 33 insertions(+), 15 deletions(-)
Approvals: Yu-Ping Wu: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/payloads/libpayload/arch/arm/head.S b/payloads/libpayload/arch/arm/head.S index c9a97b5..0640c50 100644 --- a/payloads/libpayload/arch/arm/head.S +++ b/payloads/libpayload/arch/arm/head.S @@ -56,4 +56,4 @@ 1: .word cb_header_ptr 2: -.word _stack +.word _estack diff --git a/payloads/libpayload/arch/arm/libpayload.ldscript b/payloads/libpayload/arch/arm/libpayload.ldscript index 5510218..d60ba8a 100644 --- a/payloads/libpayload/arch/arm/libpayload.ldscript +++ b/payloads/libpayload/arch/arm/libpayload.ldscript @@ -40,29 +40,35 @@ _start = .;
.text : { + _text = .; *(.text._entry) *(.text) *(.text.*) + _etext = .; }
.rodata : { + _rodata = .; *(.rodata) *(.rodata.*) + _erodata = .; }
.data : { + _data = .; *(.data) *(.data.*) + _edata = .; }
- _edata = .; - .bss : { + _bss = .; *(.sbss) *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) + _ebss = .;
/* Stack and heap */
@@ -72,10 +78,10 @@ . = ALIGN(16); _eheap = .;
- _estack = .; + _stack = .; . += CONFIG_LP_STACK_SIZE; . = ALIGN(16); - _stack = .; + _estack = .; }
_end = .; diff --git a/payloads/libpayload/arch/arm64/head.S b/payloads/libpayload/arch/arm64/head.S index 0b26fe5..0ebadea 100644 --- a/payloads/libpayload/arch/arm64/head.S +++ b/payloads/libpayload/arch/arm64/head.S @@ -55,4 +55,4 @@ 1: .quad cb_header_ptr 2: -.quad _stack +.quad _estack diff --git a/payloads/libpayload/arch/arm64/libpayload.ldscript b/payloads/libpayload/arch/arm64/libpayload.ldscript index e225aa8..c9881f7 100644 --- a/payloads/libpayload/arch/arm64/libpayload.ldscript +++ b/payloads/libpayload/arch/arm64/libpayload.ldscript @@ -40,31 +40,37 @@ _start = .;
.text : { + _text = .; *(.text._entry) *(.text) *(.text.*) + _etext = .; }
.rodata : { + _rodata = .; *(.rodata) *(.rodata.*) + _erodata = .; }
.data : { + _data = .; *(.data) *(.data.*) + _edata = .; }
- _edata = .; - .bss : { *(.ttb_buffer)
+ _bss = .; *(.sbss) *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) + _ebss = .;
/* Stack and heap */
@@ -74,10 +80,10 @@ . = ALIGN(16); _eheap = .;
- _estack = .; + _stack = .; . += CONFIG_LP_STACK_SIZE; . = ALIGN(16); - _stack = .; + _estack = .; }
_end = .; diff --git a/payloads/libpayload/arch/x86/head.S b/payloads/libpayload/arch/x86/head.S index 87d0037..1e0e4a0 100644 --- a/payloads/libpayload/arch/x86/head.S +++ b/payloads/libpayload/arch/x86/head.S @@ -73,7 +73,7 @@
/* Store current stack pointer and set up new stack. */ movl %esp, %eax - movl $_stack, %esp + movl $_estack, %esp pushl %eax
/* Enable special x86 functions if present. */ diff --git a/payloads/libpayload/arch/x86/libpayload.ldscript b/payloads/libpayload/arch/x86/libpayload.ldscript index 2d7e912..0f27ed9 100644 --- a/payloads/libpayload/arch/x86/libpayload.ldscript +++ b/payloads/libpayload/arch/x86/libpayload.ldscript @@ -39,29 +39,35 @@ _start = .;
.text : { + _text = .; *(.text._entry) *(.text) *(.text.*) + _etext = .; }
.rodata : { + _rodata = .; *(.rodata) *(.rodata.*) + _erodata = .; }
.data : { + _data = .; *(.data) *(.data.*) + _edata = .; }
- _edata = .; - .bss : { + _bss = .; *(.sbss) *(.sbss.*) *(.bss) *(.bss.*) *(COMMON) + _ebss = .;
/* Stack and heap */
@@ -71,10 +77,10 @@ . = ALIGN(16); _eheap = .;
- _estack = .; + _stack = .; . += CONFIG_LP_STACK_SIZE; . = ALIGN(16); - _stack = .; + _estack = .; }
_end = .;