[llvm] r360442 - [MC][ELF] Copy top 3 bits of st_other to .symver aliases

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 10:09:25 PDT 2019


Author: maskray
Date: Fri May 10 10:09:25 2019
New Revision: 360442

URL: http://llvm.org/viewvc/llvm-project?rev=360442&view=rev
Log:
[MC][ELF] Copy top 3 bits of st_other to .symver aliases

On PowerPC64 ELFv2 ABI, the top 3 bits of st_other encode the local
entry offset. A versioned symbol alias created by .symver should copy
the bits from the source symbol.

This partly fixes PR41048. A full fix needs tracking of .set assignments
and updating st_other fields when finish() is called, see D56586.

Patch by Alfredo Dal'Ava JĂșnior

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

Added:
    llvm/trunk/test/MC/PowerPC/ppc64-localentry-symver.s
Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=360442&r1=360441&r2=360442&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Fri May 10 10:09:25 2019
@@ -1279,6 +1279,7 @@ void ELFObjectWriter::executePostLayoutB
     // 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;

Added: llvm/trunk/test/MC/PowerPC/ppc64-localentry-symver.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/ppc64-localentry-symver.s?rev=360442&view=auto
==============================================================================
--- llvm/trunk/test/MC/PowerPC/ppc64-localentry-symver.s (added)
+++ llvm/trunk/test/MC/PowerPC/ppc64-localentry-symver.s Fri May 10 10:09:25 2019
@@ -0,0 +1,17 @@
+# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-freebsd13.0 %s -o %t
+# RUN: llvm-objdump -t %t | FileCheck %s
+
+# CHECK: 0000000000000000 gw    F .text  00000000 0x60 __impl_foo
+# CHECK: 0000000000000000 g     F .text  00000000 0x60 foo
+# CHECK: 0000000000000000 gw    F .text  00000000 0x60 foo at FBSD_1.1
+
+.globl foo
+.type foo, at function
+foo:
+  nop
+  nop
+  .localentry foo, 8
+
+.symver __impl_foo, foo at FBSD_1.1
+.weak   __impl_foo
+.set    __impl_foo, foo




More information about the llvm-commits mailing list