[PATCH] D51027: [LLD][ELD] - Do not reject INFO output section type when used with a start address.
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 21 07:56:46 PDT 2018
peter.smith added a comment.
I'm not sure it is possible to do exactly what the author is doing with https://bugs.llvm.org/show_bug.cgi?id=38625 with a section without SHF_ALLOC. The entire contents of the output section are defined by .= stack_start. As stack_start is calculated by the linker I don't think it would have been possible to do this with a section.
My preference would be to support the INFO, COPY, OVERLAY with an address for embedded users. Many people start by porting examples from GNU ld and aren't experts in linker scripts or startup code. I think it would be useful to be as compatible as possible. I also think we can't imply deprecation from "supported for backwards compatibility" as deprecation often implies removal at a future point.
PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM));
.stack _edata (INFO) :
{
_estack = .;
. = _stack_start;
_sstack = .;
} > RAM
In the arm-none-eabi gcc toolchain the sample linker scripts using COPY have a .heap and .stack section to provide the size that are already not SHF_ALLOC (so the COPY isn't strictly necessary):
.heap (COPY):
{
__end__ = .;
PROVIDE(end = .);
*(.heap*)
__HeapLimit = .;
} > RAM
/* .stack_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign
* values to stack symbols later */
.stack_dummy (COPY):
{
*(.stack*)
} > RAM
With the .heap and .stack sections being defined in the startup code for a particular device with something like:
.section .stack
.align 3
#ifdef __STACK_SIZE
.equ Stack_Size, __STACK_SIZE
#else
.equ Stack_Size, 0xc00
#endif
.globl __StackTop
.globl __StackLimit
__StackLimit:
.space Stack_Size
.size __StackLimit, . - __StackLimit
__StackTop:
.size __StackTop, . - __StackTop
https://reviews.llvm.org/D51027
More information about the llvm-commits
mailing list