Overlap error not generated for sections w/o content

Galit Heller Galit.Heller@nsc.com
Sun Jan 11 14:18:00 GMT 2004


Hi,

We use the following linker script excerpt to define the stack for CR16C
embedded systems:

.stack : { . += 0x600; }

since in our tool chain the input (ELF) files aren't comprised of .stack
sections.

If the linker script is erroneously written, so that the .stack load
address is set to a value which overlaps that of another output section,
no error is generated, since the SEC_ALLOC flag isn't set for .stack. E.g.

.data  0x1000 : { *(.data) }
.stack 0x1000 : { . += 600; }

does not cause an error nor a warning. Whereas if an output section data
expression (e.g. BYTE(0);) is used:

.stack 0x1000 : { BYTE(0);  . += 0x600; }

then the following error is generated, and thus users get indication of a
problematic situation:

section .stack [0001000 -> 0001600] overlaps section .data [0001000 -> 0001200]

Should a linker hook function (e.g. ldemul_after_allocation) be used to
generate an error in such a case, or is there a chance that this behavior will
be changed ?

Regards,
Galit.



More information about the Binutils mailing list