VMA section overlap warnings for overlays
Wed May 12 13:19:00 GMT 2010
> On Fri, May 07, 2010 at 05:14:06PM +0100, David Stubbs wrote:
> > Does the following patch look like the correct fix?
> No, it doesn't look correct. I think your problem is more likely
> to a ldlang.c bug in setting lma. Do you have a testcase handy?
Thanks for the response. I didn't realize / think that you needed to
allocate filespace for bss sections when they're followed by non BSS
sections in the same segment.
I wasn't able to reproduce the problem, but that turned out to be
because I'd somehow lost the bit of code that calls write_zeros in our
copy of the source.
I have however found another potential problem with strip. Here's the
brsbs01 0>cat start.s
.type _start, @function
brsbs01 0>cat over.S
brsbs01 0>cat ldscript.x
: AT (LOADADDR (.text) + SIZEOF (.text))
.overlay1 ADDR (.dmem.bss) + SIZEOF (.dmem.bss)
: AT (LOADADDR (.dmem.bss) + SIZEOF (.dmem.bss))
.overlay2 ADDR (.dmem.bss) + SIZEOF (.dmem.bss)
: AT (LOADADDR (.overlay1) + SIZEOF (.overlay1))
.overlay1.bss ADDR (.overlay1) + SIZEOF (.overlay1)
: AT (LOADADDR (.overlay2) + SIZEOF (.overlay2))
.overlay2.bss ADDR (.overlay2) + SIZEOF (.overlay2)
: AT (LOADADDR (.overlay1.bss) + SIZEOF (.overlay1.bss))
brsbs01 0>gcc over.S -DSEC_NAME=.overlay1 -c -o over1.o
brsbs01 0>gcc over.S -DSEC_NAME=.overlay2 -c -o over2.o
brsbs01 0>gcc start.s -c -o start.o
brsbs01 0>ld over1.o over2.o start.o -T ldscript.x -o test.exe
brsbs01 1>strip test.exe
BFD: stHVOxcK: section .overlay1.bss lma 0x1021 overlaps previous
BFD: stHVOxcK: section .overlay2.bss lma 0x1021 overlaps previous
The overlap warning is being emitted because 'adjust' is being
calculated as a negative number. I don't yet know why.
More information about the Binutils