[lld] r293320 - Revert commits r293276 and r293278.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 10:39:30 PST 2017


Author: rafael
Date: Fri Jan 27 12:39:30 2017
New Revision: 293320

URL: http://llvm.org/viewvc/llvm-project?rev=293320&view=rev
Log:
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.

Removed:
    lld/trunk/test/ELF/linkerscript/section-types.s
Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=293320&r1=293319&r2=293320&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Jan 27 12:39:30 2017
@@ -288,7 +288,7 @@ void LinkerScript<ELFT>::addSection(Outp
                                     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);

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=293320&r1=293319&r2=293320&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Jan 27 12:39:30 2017
@@ -631,9 +631,9 @@ template <class ELFT> OutputSectionFacto
 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 @@ static uint64_t getIncompatibleFlags(uin
 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));

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=293320&r1=293319&r2=293320&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Fri Jan 27 12:39:30 2017
@@ -238,10 +238,10 @@ template <class ELFT> class OutputSectio
 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;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=293320&r1=293319&r2=293320&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Jan 27 12:39:30 2017
@@ -840,7 +840,7 @@ void Writer<ELFT>::addInputSec(InputSect
   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);

Removed: lld/trunk/test/ELF/linkerscript/section-types.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/section-types.s?rev=293319&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/section-types.s (original)
+++ lld/trunk/test/ELF/linkerscript/section-types.s (removed)
@@ -1,13 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: echo "SECTIONS { " > %t.script
-# RUN: echo ".bar : { *(.foo) *(.init_array) }" >> %t.script
-# RUN: echo "}" >> %t.script
-
-# RUN: ld.lld -o %t1 --script %t.script %t
-
-.section .foo,"aw"
-  .quad 1
-
-.section .init_array,"aw", at init_array
-  .quad 0




More information about the llvm-commits mailing list