Summary: | avr-ld doesn't warn when a memory section is over | ||
---|---|---|---|
Product: | binutils | Reporter: | massi <massimiliano.cialdi> |
Component: | ld | Assignee: | unassigned |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | nickc, s.pitchumani |
Priority: | P2 | ||
Version: | 2.21 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | A sample to reproduce the problem |
IMO, linker script should have been changed, from: .data : AT (ADDR (.text) + SIZEOF (.text)) { PROVIDE (__data_start = .) ; *(.data) *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; } > data to: .data : { PROVIDE (__data_start = .) ; *(.data) *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; } > data AT> text This way linker knows from which region the .data to be loaded, and finds overflow correctly. Hi Pitchumani, (In reply to Pitchumani from comment #1) > IMO, linker script should have been changed, I think that you are using an old version of the linker. The latest release (2.28) already contains the change you are suggesting. Cheers Nick (In reply to Nick Clifton from comment #2) > Hi Pitchumani, > > (In reply to Pitchumani from comment #1) > > IMO, linker script should have been changed, > > I think that you are using an old version of the linker. The latest release > (2.28) already contains the change you are suggesting. Hi Nick Thanks. Yes, I meant the OP's attached testcase/ linker script. |
Created attachment 5235 [details] A sample to reproduce the problem the initialized data belongs to ram, but them images is hold in flash of microcontroller. Suppose to have a 32KB flash ans 2KB sram microncontroller. Suppose to have a .text section as big as 31KB, and suppose to have a vector of initialized data as big as 1.5KB. The binary file will be 32.5KB long, too long to be programmed into microcontroller's flash. I would expect a linker error like: region `text' overflowed by xx bytes