Revert commits r293276 and r293278.
[ELF] Fixed formatting. NFC
and
[ELF] Bypass section type check
Differential revision: https://reviews.llvm.org/D28761
They do the opposite of what was asked for in the code review.
llvm-svn: 293320
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index ed9c88f..0357357 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -288,7 +288,7 @@
StringRef Name) {
OutputSectionBase *OutSec;
bool IsNew;
- std::tie(OutSec, IsNew) = Factory.create(Sec, Name, true);
+ std::tie(OutSec, IsNew) = Factory.create(Sec, Name);
if (IsNew)
OutputSections->push_back(OutSec);
OutSec->addSection(Sec);
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index b726582..0e99de5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -631,9 +631,9 @@
template <class ELFT>
std::pair<OutputSectionBase *, bool>
OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C,
- StringRef OutsecName, bool IsScripted) {
+ StringRef OutsecName) {
SectionKey Key = createKey(C, OutsecName);
- return create(Key, C, IsScripted);
+ return create(Key, C);
}
static uint64_t getIncompatibleFlags(uint64_t Flags) {
@@ -643,19 +643,18 @@
template <class ELFT>
std::pair<OutputSectionBase *, bool>
OutputSectionFactory<ELFT>::create(const SectionKey &Key,
- InputSectionBase<ELFT> *C, bool IsScripted) {
+ InputSectionBase<ELFT> *C) {
uintX_t Flags = getOutFlags(C);
OutputSectionBase *&Sec = Map[Key];
if (Sec) {
if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(C->Flags))
error("Section has flags incompatible with others with the same name " +
toString(C));
-
// Convert notbits to progbits if they are mixed. This happens is some
// linker scripts.
if (Sec->Type == SHT_NOBITS && C->Type == SHT_PROGBITS)
Sec->Type = SHT_PROGBITS;
- if (!IsScripted && Sec->Type != C->Type &&
+ if (Sec->Type != C->Type &&
!(Sec->Type == SHT_PROGBITS && C->Type == SHT_NOBITS))
error("Section has different type from others with the same name " +
toString(C));
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index d21d6a4..3671322 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -238,10 +238,10 @@
public:
OutputSectionFactory();
~OutputSectionFactory();
- std::pair<OutputSectionBase *, bool>
- create(InputSectionBase<ELFT> *C, StringRef OutsecName, bool IsScripted);
- std::pair<OutputSectionBase *, bool>
- create(const SectionKey &Key, InputSectionBase<ELFT> *C, bool IsScripted);
+ std::pair<OutputSectionBase *, bool> create(InputSectionBase<ELFT> *C,
+ StringRef OutsecName);
+ std::pair<OutputSectionBase *, bool> create(const SectionKey &Key,
+ InputSectionBase<ELFT> *C);
private:
llvm::SmallDenseMap<SectionKey, OutputSectionBase *> Map;
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 6e53fbf..a0ae508 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -840,7 +840,7 @@
OutputSectionBase *Sec;
bool IsNew;
StringRef OutsecName = getOutputSectionName(IS->Name);
- std::tie(Sec, IsNew) = Factory.create(IS, OutsecName, false);
+ std::tie(Sec, IsNew) = Factory.create(IS, OutsecName);
if (IsNew)
OutputSections.push_back(Sec);
Sec->addSection(IS);