[llvm-bugs] [Bug 46420] New: LLD with LTO breaks ELF symbol versioning

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 22 06:50:50 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46420

            Bug ID: 46420
           Summary: LLD with LTO breaks ELF symbol versioning
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: itay.bookstein at nextsilicon.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

Minimal repro follows below.
My debugging seems to indicate that the call to sym->parseSymbolVersion() in
LinkerDriver::compileBitcodeFiles() causes the observed truncation. The method
does indeed truncate the symbol object's name as reported by Symbol::getName(),
but that seems to be the very intention of that method. Perhaps it is done too
early? Perhaps the code that builds the symbol table needs to take the
parsed-version-state into account? I'm not quite sure yet.

~itay at local:~> cat try.ll
target triple = "x86_64-unknown-linux-gnu"
module asm ".symver loc1,loc1 at GLIBC_2.2.5"
@loc1 = local_unnamed_addr global i8* null, align 8

~itay at local:~> cat build.sh
#!/bin/bash -eu

_DIR=/home/itay/Projects/llvm-project/Debug/bin

${_DIR}/llvm-as try.ll -o try.bc
${_DIR}/clang -fuse-ld=lld -nostdlib -nostartfiles -r try.bc -o
try_reloclink_nolto.o
${_DIR}/clang -fuse-ld=lld -nostdlib -nostartfiles -r try.bc -o
try_reloclink_lto.o -flto
file try_reloclink*
${_DIR}/llvm-nm try_reloclink*

~itay at local:~> ./build.sh
try_reloclink_lto.o:   ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV),
not stripped
try_reloclink_nolto.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV),
not stripped

try_reloclink_lto.o:
0000000000000000 B loc1
0000000000000000 B loc1

try_reloclink_nolto.o:
0000000000000000 B loc1
0000000000000000 B loc1 at GLIBC_2.2.5

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200622/f882dfce/attachment-0001.html>


More information about the llvm-bugs mailing list