[lld] r315645 - Correctly handle shared and lazy symbols.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 17:06:38 PDT 2017


Author: rafael
Date: Thu Oct 12 17:06:38 2017
New Revision: 315645

URL: http://llvm.org/viewvc/llvm-project?rev=315645&view=rev
Log:
Correctly handle shared and lazy symbols.

I will try to make this API a bit less error prone, but for now just
get another test passing.

Added:
    lld/trunk/test/ELF/Inputs/wrap-no-real2.s
Modified:
    lld/trunk/ELF/SymbolTable.cpp
    lld/trunk/test/ELF/wrap-no-real.s

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=315645&r1=315644&r2=315645&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Thu Oct 12 17:06:38 2017
@@ -205,7 +205,7 @@ void SymbolTable::applySymbolRenames() {
 
     Symbol *Real = &Origs[I];
     // If __real_foo was undefined, we don't want it in the symbol table.
-    if (Real->body()->isUndefined())
+    if (!Real->body()->isInCurrentDSO())
       continue;
 
     auto *NewSym = make<Symbol>();

Added: lld/trunk/test/ELF/Inputs/wrap-no-real2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/wrap-no-real2.s?rev=315645&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/wrap-no-real2.s (added)
+++ lld/trunk/test/ELF/Inputs/wrap-no-real2.s Thu Oct 12 17:06:38 2017
@@ -0,0 +1,2 @@
+.globl __real_foo
+__real_foo = 0x11020

Modified: lld/trunk/test/ELF/wrap-no-real.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/wrap-no-real.s?rev=315645&r1=315644&r2=315645&view=diff
==============================================================================
--- lld/trunk/test/ELF/wrap-no-real.s (original)
+++ lld/trunk/test/ELF/wrap-no-real.s Thu Oct 12 17:06:38 2017
@@ -1,10 +1,15 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap-no-real.s -o %t2.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap-no-real2.s -o %t3.o
+// RUN: ld.lld -o %t3.so -shared %t3.o
 
 // RUN: ld.lld -o %t %t1.o %t2.o -wrap foo
 // RUN: llvm-objdump -d -print-imm-hex %t | FileCheck %s
 
+// RUN: ld.lld -o %t %t1.o %t2.o %t3.so -wrap foo
+// RUN: llvm-objdump -d -print-imm-hex %t | FileCheck %s
+
 // CHECK: _start:
 // CHECK-NEXT: movl $0x11010, %edx
 // CHECK-NEXT: movl $0x11010, %edx




More information about the llvm-commits mailing list