forked from OSchip/llvm-project
Don't give an address to sections that are not allocated.
llvm-svn: 244900
This commit is contained in:
parent
221104bec6
commit
ef1ac01c2e
|
@ -174,9 +174,11 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() {
|
|||
std::stable_sort(OutputSections.begin(), OutputSections.end(), compSec<ELFT>);
|
||||
|
||||
for (OutputSection<ELFT> *Sec : OutputSections) {
|
||||
if (Sec->getFlags() & SHF_ALLOC) {
|
||||
Sec->setVA(VA);
|
||||
Sec->setFileOffset(FileOff);
|
||||
VA += RoundUpToAlignment(Sec->getSize(), PageSize);
|
||||
}
|
||||
Sec->setFileOffset(FileOff);
|
||||
FileOff += RoundUpToAlignment(Sec->getSize(), 8);
|
||||
StrTabBuilder.add(Sec->getName());
|
||||
}
|
||||
|
|
|
@ -15,11 +15,13 @@ _start:
|
|||
// CHECK-NEXT: Flags [
|
||||
// CHECK-NEXT: SHF_ALLOC
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Address: 0x1000
|
||||
|
||||
// CHECK: Name: foobar
|
||||
// CHECK-NEXT: Type: SHT_PROGBITS
|
||||
// CHECK-NEXT: Flags [
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Address: 0x0
|
||||
|
||||
// Test that the sting "bar" is merged into "foobar"
|
||||
|
||||
|
|
Loading…
Reference in New Issue