[PATCH] D40535: Handle binding in --wrap

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 17:57:59 PST 2017


rafael created this revision.
Herald added a subscriber: emaste.

I am checking what should and should not be copied in copyFrom.

Copying the binding seems reasonable and matches the bfd behavior.


https://reviews.llvm.org/D40535

Files:
  ELF/Symbols.cpp
  test/ELF/Inputs/wrap.s
  test/ELF/wrap.s


Index: test/ELF/wrap.s
===================================================================
--- test/ELF/wrap.s
+++ test/ELF/wrap.s
@@ -15,10 +15,16 @@
 // RUN: llvm-readobj -t %t3 | FileCheck -check-prefix=SYM %s
 // SYM:      Name: foo
 // SYM-NEXT: Value: 0x11000
+// SYM-NEXT: Size:
+// SYM-NEXT: Binding: Global
 // SYM:      Name: __wrap_foo
 // SYM-NEXT: Value: 0x11010
+// SYM-NEXT: Size:
+// SYM-NEXT: Binding: Weak
 // SYM:      Name: __real_foo
 // SYM-NEXT: Value: 0x11020
+// SYM-NEXT: Size:
+// SYM-NEXT: Binding: Global
 
 .global _start
 _start:
Index: test/ELF/Inputs/wrap.s
===================================================================
--- test/ELF/Inputs/wrap.s
+++ test/ELF/Inputs/wrap.s
@@ -1,4 +1,6 @@
-.globl foo, __wrap_foo, __real_foo
+.global foo
+.weak __wrap_foo
+.global __real_foo
 foo = 0x11000
 __wrap_foo = 0x11010
 __real_foo = 0x11020
Index: ELF/Symbols.cpp
===================================================================
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -141,7 +141,6 @@
   Symbol Sym = *this;
   memcpy(this, Other, sizeof(SymbolUnion));
 
-  Binding = Sym.Binding;
   VersionId = Sym.VersionId;
   Visibility = Sym.Visibility;
   IsUsedInRegularObj = Sym.IsUsedInRegularObj;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40535.124504.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171128/1d5c653c/attachment.bin>


More information about the llvm-commits mailing list