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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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

~itay@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@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@GLIBC_2.2.5

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to