[lld] r317446 - Do not consider Shared symbols as defined symbols.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 5 20:13:24 PST 2017


Author: ruiu
Date: Sun Nov  5 20:13:24 2017
New Revision: 317446

URL: http://llvm.org/viewvc/llvm-project?rev=317446&view=rev
Log:
Do not consider Shared symbols as defined symbols.

I don't remember why I made shared symbols one type of defined symbols.
Shared symbols aren't undefined, so it could be considered defined, but
categorizing three symbols as:

 - defined
   - really defined
   - shared
 - undefined

is not as intuitive as

 - defined
 - shared
 - undefined

to me. So, in this patch, I made a change to stop handling shared
symbols as defined symbols.

Surprisingly, I didn't have to update any tests for this change.

Differential Revision: https://reviews.llvm.org/D39394

Modified:
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=317446&r1=317445&r2=317446&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Sun Nov  5 20:13:24 2017
@@ -40,9 +40,9 @@ public:
   enum Kind {
     DefinedFirst,
     DefinedRegularKind = DefinedFirst,
-    SharedKind,
     DefinedCommonKind,
     DefinedLast = DefinedCommonKind,
+    SharedKind,
     UndefinedKind,
     LazyArchiveKind,
     LazyObjectKind,
@@ -247,13 +247,13 @@ public:
   static bool classof(const Symbol *S) { return S->kind() == UndefinedKind; }
 };
 
-class SharedSymbol : public Defined {
+class SharedSymbol : public Symbol {
 public:
   static bool classof(const Symbol *S) { return S->kind() == SharedKind; }
 
   SharedSymbol(StringRef Name, uint8_t StOther, uint8_t Type, uint64_t Value,
                uint64_t Size, uint32_t Alignment, const void *Verdef)
-      : Defined(SharedKind, Name, /*IsLocal=*/false, StOther, Type),
+      : Symbol(SharedKind, Name, /*IsLocal=*/false, StOther, Type),
         Verdef(Verdef), Value(Value), Size(Size), Alignment(Alignment) {
     // GNU ifunc is a mechanism to allow user-supplied functions to
     // resolve PLT slot values at load-time. This is contrary to the




More information about the llvm-commits mailing list