From: Fangrui Song Date: Fri, 10 May 2019 17:09:25 +0000 (+0000) Subject: [MC][ELF] Copy top 3 bits of st_other to .symver aliases X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eca0d0a634848f57a7f7020c9ac927d4e653d1f2;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360442 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 96bbc2ee630..95b0e274526 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/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/test/MC/PowerPC/ppc64-localentry-symver.s b/test/MC/PowerPC/ppc64-localentry-symver.s new file mode 100644 index 00000000000..4c7490646db --- /dev/null +++ b/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