[PATCH] D59436: [ELF] Fix missing ELF st_other field on versioned symbols

Alfredo Dal'Ava JĂșnior via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 12:48:36 PDT 2019


adalava updated this revision to Diff 198513.
adalava edited the summary of this revision.
adalava added a comment.
Herald added subscribers: jsji, kbarton, nemanjai.

add test case


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59436/new/

https://reviews.llvm.org/D59436

Files:
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/test/MC/PowerPC/ppc64-localentry-versioned-flags.s


Index: llvm/test/MC/PowerPC/ppc64-localentry-versioned-flags.s
===================================================================
--- /dev/null
+++ llvm/test/MC/PowerPC/ppc64-localentry-versioned-flags.s
@@ -0,0 +1,58 @@
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-freebsd13.0 %s -o %t.o
+# RUN: llvm-objdump -t %t.o | FileCheck %s
+
+
+.text
+.abiversion 2
+
+.symver __impl_openattt, openattt at FBSD_1.1
+.weak   __impl_openattt
+.set    __impl_openattt, openattt
+
+.globl   openattt
+.p2align 2
+.type    openattt, at function
+
+
+openattt:                               # @openattt
+.Lfunc_begin0:
+.Lfunc_gep0:
+        addis 2, 12, .TOC.-.Lfunc_gep0 at ha
+        addi 2, 2, .TOC.-.Lfunc_gep0 at l
+.Lfunc_lep0:
+        .localentry     openattt, .Lfunc_lep0-.Lfunc_gep0
+# %bb.0:
+        addis 3, 2, .LC0 at toc@ha
+        ld 3, .LC0 at toc@l(3)
+        li 4, 123
+        stw 4, 0(3)
+        lwa 3, 0(3)
+        blr
+        .long   0
+        .quad   0
+.Lfunc_end0:
+        .size   openattt, .Lfunc_end0-.Lfunc_begin0
+        .section        .toc,"aw", at progbits
+.LC0:
+        .tc a[TC],a
+        .type   a, at object               # @a
+        .section        .bss,"aw", at nobits
+        .globl  a
+        .p2align        2
+a:
+        .long   0                       # 0x0
+        .size   a, 4
+
+        .addrsig
+        .addrsig_sym a
+
+
+# CHECK: SYMBOL TABLE:
+# CHECK-NEXT: 0000000000000000 l    d  .toc		 00000000 .toc
+# CHECK-NEXT: 0000000000000000         *UND*		 00000000 .TOC.
+# CHECK-NEXT: 0000000000000000 gw    F .text		 0000002c 0x60 __impl_openattt
+# CHECK-NEXT: 0000000000000000 g     O .bss		 00000004 a
+# CHECK-NEXT: 0000000000000000 g     F .text		 0000002c 0x60 openattt
+# CHECK-NEXT: 0000000000000000 gw    F .text		 0000002c 0x60 openattt at FBSD_1.1
+
Index: llvm/lib/MC/ELFObjectWriter.cpp
===================================================================
--- llvm/lib/MC/ELFObjectWriter.cpp
+++ llvm/lib/MC/ELFObjectWriter.cpp
@@ -1279,6 +1279,7 @@
     // This is the first place we are able to copy this information.
     Alias->setExternal(Symbol.isExternal());
     Alias->setBinding(Symbol.getBinding());
+    Alias->setOther(Symbol.getOther());
 
     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59436.198513.patch
Type: text/x-patch
Size: 2282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/43024a26/attachment.bin>


More information about the llvm-commits mailing list