[llvm-bugs] [Bug 31495] New: LLD fails to link object file with version-extended symbol

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 29 10:00:42 PST 2016


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

            Bug ID: 31495
           Summary: LLD fails to link object file with version-extended
                    symbol
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at lists.llvm.org
            Blocks: 23214
    Classification: Unclassified

FreeBSD's "pkg" package management tool is currently building an object file
that depends on a compatibility symbol. I think this needs to be addressed in
pkg itself, but GNU ld is able to link such an object.

LLD reports:

% ld.lld $(cat response.txt)                                
/tank/emaste/src/llvm/build-nodebug/bin/ld.lld: error:
wrkdirs/usr/ports/ports-mgmt/pkg/work/pkg-1.7.2/libpkg/.libs/libpkg.lax/libbsd_compat.a/libbsd_compat_la-basename.o:
symbol basename at FBSD_1.0 has undefined version FBSD_1.0
/tank/emaste/src/llvm/build-nodebug/bin/ld.lld: error:
wrkdirs/usr/ports/ports-mgmt/pkg/work/pkg-1.7.2/libpkg/.libs/libpkg.lax/libbsd_compat.a/libbsd_compat_la-dirname.o:
symbol dirname at FBSD_1.0 has undefined version FBSD_1.0

ld.bfd has no complaints:
% ld.bfd $(cat response.txt)
% 

The offending symbol is basename at FBSD_1.0:

% readelf -s libbsd_compat_la-basename.o

Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS basename.c
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2 
     3: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND basename at FBSD_1.0
     4: 0000000000000000    10 FUNC    GLOBAL DEFAULT    2 bsd_basename

And indeed, a .o file has no symver information:

% readelf -V libbsd_compat_la-basename.o

No version information found in this file.

I suspect we should accept version-extended symbols from object files.
Reprodcer available at
https://people.freebsd.org/~emaste/lld/object-sym-version.cpio

-- 
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/20161229/70d7711f/attachment.html>


More information about the llvm-bugs mailing list