Revert "[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD"

This reverts commit 030ddc0a0b.

This breaks http://lab.llvm.org:8011/builders/lldb-arm-ubuntu
and http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu

Differential Revision: https://reviews.llvm.org/D85100
This commit is contained in:
Muhammad Omair Javaid
2020-08-06 16:30:05 +05:00
parent 55ead5bfff
commit d9e191cb17
5 changed files with 25 additions and 63 deletions

View File

@@ -586,8 +586,6 @@ static OutputSection *findByName(ArrayRef<BaseCommand *> vec,
static OutputSection *createSection(InputSectionBase *isec,
StringRef outsecName) {
OutputSection *sec = script->createOutputSection(outsecName, "<internal>");
if (!(isec->flags & SHF_ALLOC))
sec->addrExpr = [] { return 0; };
sec->recordSection(isec);
return sec;
}
@@ -850,6 +848,9 @@ static OutputSection *findFirstSection(PhdrEntry *load) {
// This function assigns offsets to input sections and an output section
// for a single sections command (e.g. ".text { *(.text); }").
void LinkerScript::assignOffsets(OutputSection *sec) {
if (!(sec->flags & SHF_ALLOC))
dot = 0;
const bool sameMemRegion = ctx->memRegion == sec->memRegion;
const bool prevLMARegionIsDefault = ctx->lmaRegion == nullptr;
ctx->memRegion = sec->memRegion;
@@ -857,7 +858,7 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
if (ctx->memRegion)
dot = ctx->memRegion->curPos;
if (sec->addrExpr)
if ((sec->flags & SHF_ALLOC) && sec->addrExpr)
setDot(sec->addrExpr, sec->location, false);
// If the address of the section has been moved forward by an explicit