[llvm-bugs] [Bug 33598] New: lld copies st_size value from a DSO into the SHN_UNDEF symbol

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 26 12:19:56 PDT 2017


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

            Bug ID: 33598
           Summary: lld copies st_size value from a DSO into the SHN_UNDEF
                    symbol
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: roland at hack.frob.com
                CC: llvm-bugs at lists.llvm.org, phosek at chromium.org

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@306055
91177308-0d34-0410-b5e6-96231b3b80d8


        frobland 734 % head shlib.c reflib.c
        ==> shlib.c <==
        void foo(void) {}

        ==> reflib.c <==
        extern void foo(void);
        void bar(void) { foo(); }
        frobland 735 % gcc -fPIC -c shlib.c reflib.c
        frobland 736 % ./hack/bin/ld.lld -shared -o shlib.so shlib.o
        frobland 737 % ld.gold -shared -o reflib.so.gold reflib.o shlib.so
        frobland 738 % ./hack/bin/ld.lld -shared -o reflib.so.lld reflib.o
shlib.so
        frobland 739 % readelf -Ws reflib.so.gold

        Symbol table '.dynsym' contains 6 entries:
           Num:    Value          Size Type    Bind   Vis      Ndx Name
             0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
             1: 00000000000002c0    11 FUNC    GLOBAL DEFAULT    6 bar
good==>      2: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND foo
             3: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 _edata
             4: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 __bss_start
             5: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 _end

        Symbol table '.symtab' contains 9 entries:
           Num:    Value          Size Type    Bind   Vis      Ndx Name
             0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
             1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS reflib.c
             2: 0000000000001ee8   256 OBJECT  LOCAL  HIDDEN     8 _DYNAMIC
             3: 0000000000001fe8    32 OBJECT  LOCAL  HIDDEN    10
_GLOBAL_OFFSET_TABLE_
             4: 00000000000002c0    11 FUNC    GLOBAL DEFAULT    6 bar
good==>      5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND foo
             6: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 _edata
             7: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 __bss_start
             8: 0000000000002008     0 NOTYPE  GLOBAL DEFAULT    8 _end
        frobland 740 % readelf -Ws reflib.so.lld

        Symbol table '.dynsym' contains 3 entries:
           Num:    Value          Size Type    Bind   Vis      Ndx Name
             0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
bad ==>      1: 0000000000001000    11 FUNC    GLOBAL DEFAULT    6 bar
             2: 0000000000000000     6 FUNC    GLOBAL DEFAULT  UND foo

        Symbol table '.symtab' contains 5 entries:
           Num:    Value          Size Type    Bind   Vis      Ndx Name
             0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
             1: 0000000000000000     0 NOTYPE  LOCAL  HIDDEN   ABS
_GLOBAL_OFFSET_TABLE_
             2: 0000000000003000     0 NOTYPE  LOCAL  HIDDEN    10 _DYNAMIC
bad ==>      3: 0000000000001000    11 FUNC    GLOBAL DEFAULT    6 bar
             4: 0000000000000000     6 FUNC    GLOBAL DEFAULT  UND foo
        frobland 741 %

-- 
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/20170626/001fb9d5/attachment.html>


More information about the llvm-bugs mailing list