diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index a2f611a1d49..661f693537d 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -213,11 +213,11 @@ template <class ELFT> void LinkerScript<ELFT>::filter() { if (Cmd->Constraint == ConstraintKind::NoConstraint) continue; + bool RO = (Cmd->Constraint == ConstraintKind::ReadOnly); + bool RW = (Cmd->Constraint == ConstraintKind::ReadWrite); + removeElementsIf(*OutputSections, [&](OutputSectionBase<ELFT> *S) { bool Writable = (S->getFlags() & SHF_WRITE); - bool RO = (Cmd->Constraint == ConstraintKind::ReadOnly); - bool RW = (Cmd->Constraint == ConstraintKind::ReadWrite); - return S->getName() == Cmd->Name && ((RO && Writable) || (RW && !Writable)); }); |