summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-05-10 17:09:25 +0000
committerFangrui Song <maskray@google.com>2019-05-10 17:09:25 +0000
commit9529c563eb54e0937d6945e142a693d03b4b6893 (patch)
tree48584c637632a083ac7fdab21e5affaa1e913c1b
parentc396f09ce96e56260cc7d5d3398615904b473265 (diff)
downloadbcm5719-llvm-9529c563eb54e0937d6945e142a693d03b4b6893.tar.gz
bcm5719-llvm-9529c563eb54e0937d6945e142a693d03b4b6893.zip
[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 llvm-svn: 360442
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp1
-rw-r--r--llvm/test/MC/PowerPC/ppc64-localentry-symver.s17
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 96bbc2ee630..95b0e274526 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1279,6 +1279,7 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
// 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;
diff --git a/llvm/test/MC/PowerPC/ppc64-localentry-symver.s b/llvm/test/MC/PowerPC/ppc64-localentry-symver.s
new file mode 100644
index 00000000000..4c7490646db
--- /dev/null
+++ b/llvm/test/MC/PowerPC/ppc64-localentry-symver.s
@@ -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@FBSD_1.1
+
+.globl foo
+.type foo,@function
+foo:
+ nop
+ nop
+ .localentry foo, 8
+
+.symver __impl_foo, foo@FBSD_1.1
+.weak __impl_foo
+.set __impl_foo, foo
OpenPOWER on IntegriCloud