summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/TargetLayout.cpp
diff options
context:
space:
mode:
authorDenis Protivensky <dprotivensky@accesssoftek.com>2015-06-15 08:00:51 +0000
committerDenis Protivensky <dprotivensky@accesssoftek.com>2015-06-15 08:00:51 +0000
commit1aaf736d897170af4140643b49a5074b18f82fed (patch)
tree5bc7af7754b0740ec2e3318523a1f2261b1df644 /lld/lib/ReaderWriter/ELF/TargetLayout.cpp
parent12b0c2835ea651a96af0061137cf4811a966ec35 (diff)
downloadbcm5719-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.cpp12
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 {
OpenPOWER on IntegriCloud