diff options
| author | Denis Protivensky <dprotivensky@accesssoftek.com> | 2015-06-15 08:00:51 +0000 |
|---|---|---|
| committer | Denis Protivensky <dprotivensky@accesssoftek.com> | 2015-06-15 08:00:51 +0000 |
| commit | 1aaf736d897170af4140643b49a5074b18f82fed (patch) | |
| tree | 5bc7af7754b0740ec2e3318523a1f2261b1df644 /lld/lib/ReaderWriter/ELF/TargetLayout.cpp | |
| parent | 12b0c2835ea651a96af0061137cf4811a966ec35 (diff) | |
| download | bcm5719-llvm-1aaf736d897170af4140643b49a5074b18f82fed.tar.gz bcm5719-llvm-1aaf736d897170af4140643b49a5074b18f82fed.zip | |
[LinkerScript] Add matching of output sections to segments
Add method to query segments for specified output section name.
Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
NOTE: no actual functionality of using custom segments is implemented.
Differential Revision: http://reviews.llvm.org/D10359
llvm-svn: 239719
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/TargetLayout.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/TargetLayout.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/TargetLayout.cpp b/lld/lib/ReaderWriter/ELF/TargetLayout.cpp index 87cbcd5cab5..c0dae207bd6 100644 --- a/lld/lib/ReaderWriter/ELF/TargetLayout.cpp +++ b/lld/lib/ReaderWriter/ELF/TargetLayout.cpp @@ -320,6 +320,7 @@ template <class ELFT> void TargetLayout<ELFT>::createOutputSections() { } else { outputSection = new (_allocator.Allocate<OutputSection<ELFT>>()) OutputSection<ELFT>(section->outputSectionName()); + checkOutputSectionSegment(outputSection); _outputSections.push_back(outputSection); outputSectionInsert.first->second = outputSection; } @@ -327,6 +328,17 @@ template <class ELFT> void TargetLayout<ELFT>::createOutputSections() { } } +// Check that output section has proper segment set +template <class ELFT> +void TargetLayout<ELFT>::checkOutputSectionSegment( + const OutputSection<ELFT> *sec) { + std::vector<const script::PHDR *> phdrs; + if (_linkerScriptSema.getPHDRsForOutputSection(sec->name(), phdrs)) { + llvm::report_fatal_error( + "Linker script has wrong segments set for output sections"); + } +} + template <class ELFT> uint64_t TargetLayout<ELFT>::getLookupSectionFlags(const OutputSection<ELFT> *os) const { |

