[ELF/LinkerScript] Support ONLY_IF_{RO, RW} directive.
Differential Revision: https://reviews.llvm.org/D22660
llvm-svn: 276384
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index 0af38b4..2277cd0 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -53,6 +53,13 @@
std::vector<StringRef> Expr;
};
+// Linker scripts allow additional constraints to be put on ouput sections.
+// An output section will only be created if all of its input sections are
+// read-only
+// or all of its input sections are read-write by using the keyword ONLY_IF_RO
+// and ONLY_IF_RW respectively.
+enum ConstraintKind { NoConstraint, ReadOnly, ReadWrite };
+
struct OutputSectionCommand : BaseCommand {
OutputSectionCommand(StringRef Name)
: BaseCommand(OutputSectionKind), Name(Name) {}
@@ -61,6 +68,7 @@
std::vector<std::unique_ptr<BaseCommand>> Commands;
std::vector<StringRef> Phdrs;
std::vector<uint8_t> Filler;
+ ConstraintKind Constraint = NoConstraint;
};
struct InputSectionDescription : BaseCommand {