[lld] r316879 - Move "Assigned" bit from SectionBase to InputSectionBase.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 16:32:23 PDT 2017


Author: ruiu
Date: Sun Oct 29 16:32:23 2017
New Revision: 316879

URL: http://llvm.org/viewvc/llvm-project?rev=316879&view=rev
Log:
Move "Assigned" bit from SectionBase to InputSectionBase.

This bit is to manage whether an input section has already been assigned
to some output section by linker scripts or not. So it logically belongs
to InputSectionBase. SectionBase is a common base class for input and
output sections, so that wasn't the right place to define the bit.

Modified:
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=316879&r1=316878&r2=316879&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Sun Oct 29 16:32:23 2017
@@ -55,19 +55,6 @@ public:
   // If GC is disabled, all sections are considered live by default.
   unsigned Live : 1;
 
-  // True if this section has already been placed to a linker script
-  // output section. This is needed because, in a linker script, you
-  // can refer to the same section more than once. For example, in
-  // the following linker script,
-  //
-  //   .foo : { *(.text) }
-  //   .bar : { *(.text) }
-  //
-  // .foo takes all .text sections, and .bar becomes empty. To achieve
-  // this, we need to memorize whether a section has been placed or
-  // not for each input section.
-  unsigned Assigned : 1;
-
   // These corresponds to the fields in Elf_Shdr.
   uint32_t Alignment;
   uint64_t Flags;
@@ -91,7 +78,7 @@ protected:
   SectionBase(Kind SectionKind, StringRef Name, uint64_t Flags,
               uint64_t Entsize, uint64_t Alignment, uint32_t Type,
               uint32_t Info, uint32_t Link)
-      : Name(Name), SectionKind(SectionKind), Live(false), Assigned(false),
+      : Name(Name), SectionKind(SectionKind), Live(false),
         Alignment(Alignment), Flags(Flags), Entsize(Entsize), Type(Type),
         Link(Link), Info(Info) {}
 };
@@ -130,6 +117,19 @@ public:
 
   static InputSectionBase Discarded;
 
+  // True if this section has already been placed to a linker script
+  // output section. This is needed because, in a linker script, you
+  // can refer to the same section more than once. For example, in
+  // the following linker script,
+  //
+  //   .foo : { *(.text) }
+  //   .bar : { *(.text) }
+  //
+  // .foo takes all .text sections, and .bar becomes empty. To achieve
+  // this, we need to memorize whether a section has been placed or
+  // not for each input section.
+  bool Assigned = false;
+
   // Input sections are part of an output section. Special sections
   // like .eh_frame and merge sections are first combined into a
   // synthetic section that is then added to an output section. In all




More information about the llvm-commits mailing list