diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-31 20:17:44 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-31 20:17:44 +0000 |
| commit | db5e56f7b2c8fd96321bed5b829e77b6e699bfdf (patch) | |
| tree | 4caf5d172b7bd90a4842c904d9936f942c1e82e3 /lld/ELF/LinkerScript.cpp | |
| parent | 1d4cde62832ac8cd8d4955a864bc794523f932d9 (diff) | |
| download | bcm5719-llvm-db5e56f7b2c8fd96321bed5b829e77b6e699bfdf.tar.gz bcm5719-llvm-db5e56f7b2c8fd96321bed5b829e77b6e699bfdf.zip | |
Store a single Parent pointer for InputSectionBase.
Before InputSectionBase had an OutputSection pointer, but that was not
always valid. For example, if it was a merge section one actually had
to look at MergeSec->OutSec.
This was brittle and caused bugs like the one fixed by r304260.
We now have a single Parent pointer that points to an OutputSection
for InputSection, but to a SyntheticSection for merge sections and
.eh_frame. This makes it impossible to accidentally access an invalid
OutSec.
llvm-svn: 304338
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 798f1947ba4..a5ca4a2e6e8 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -488,7 +488,7 @@ void LinkerScript::fabricateDefaultCommands() { // Add sections that didn't match any sections command. void LinkerScript::addOrphanSections(OutputSectionFactory &Factory) { for (InputSectionBase *S : InputSections) { - if (!S->Live || S->OutSec) + if (!S->Live || S->Parent) continue; StringRef Name = getOutputSectionName(S->Name); auto I = std::find_if( @@ -602,7 +602,7 @@ void LinkerScript::process(BaseCommand &Base) { if (!Sec->Live) continue; - assert(CurOutSec == Sec->OutSec); + assert(CurOutSec == Sec->getParent()); output(Sec); } } |

