This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Report error when memory region is overflowed by data commands.
ClosedPublic

Authored by grimar on Mar 1 2018, 9:03 AM.

Details

Summary

LLD can not catch a memory area overflow when using a data command.
If we have the script below:

.foo : 
{
  *(.foo)
  BYTE(0x1)
} > ram

where BYTE overflows the ram region, we do not report it currently.
Patch fixes that. This change can also be helpful for other places,
I am planning to use it for fixing PR36535.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Mar 1 2018, 9:03 AM
grimar updated this revision to Diff 136546.Mar 1 2018, 9:05 AM
  • Rewrote the comment.
grimar updated this revision to Diff 136549.Mar 1 2018, 9:10 AM
  • Removed the requirement of mips from the test.
ruiu accepted this revision.Mar 1 2018, 10:21 AM

LGTM

test/ELF/linkerscript/memory-data-commands.test
12–25 ↗(On Diff #136549)

nit: please format in the same way as other linker scripts. I.e.

MEMORY {
  text (rwx): org = 0x0, len = 0x1000
  ram (rwx): org = 0x1000, len = 8
}

SECTIONS {
  .text : { *(.text) } > text
  .foo  : { *(.foo) BYTE(0x1) } > ram
}
This revision is now accepted and ready to land.Mar 1 2018, 10:21 AM
This revision was automatically updated to reflect the committed changes.