[LLVMbugs] [Bug 17530] New: MC-COFF: multiple levels of linkonce_odr aliases produce an unlinkable COFF object

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 9 17:32:31 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17530

            Bug ID: 17530
           Summary: MC-COFF: multiple levels of linkonce_odr aliases
                    produce an unlinkable COFF object
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvmbugs at cs.uiuc.edu, peter at pcc.me.uk,
                    rafael.espindola at gmail.com, ruiu at google.com
    Classification: Unclassified

$ cat t.ll
@my_alias = alias linkonce_odr void ()* @my_inline
@my_alias2 = alias linkonce_odr void ()* @my_alias
define linkonce_odr void @my_inline() {
  ret void
}
define i32 @main() {
  call void @my_alias2()
  ret i32 0
}

$ llc t.ll -o tll.obj -filetype=obj && link tll.obj -defaultlib:libcmt.lib
-out:t.exe -nologo
tll.obj : error LNK2001: unresolved external symbol _my_alias2
tll.obj : error LNK2001: unresolved external symbol _my_alias

$ dumpbin /symbols tll.obj
COFF SYMBOL TABLE
000 00000000 SECT1  notype       Static       | .text
    Section length    8, #relocs    1, #linenums    0, checksum        0
002 00000000 SECT2  notype       Static       | .text$my_inline
    Section length    1, #relocs    0, #linenums    0, checksum        0,
selection    2 (pick any)
004 00000001 ABS    notype       Static       | @feat.00
005 00000000 SECT2  notype ()    External     | _my_inline
006 00000000 SECT1  notype ()    External     | _main
007 00000000 UNDEF  notype       WeakExternal | _my_alias2
    Default index        9 library search
009 00000000 UNDEF  notype       WeakExternal | _my_alias
    Default index        5 library search

The symbol at index 7 points to index 9 which points to index 5.

Rui says that these weak external aliases are more like fallbacks.  The symbol
is still undefined, and if nobody provides a definition, then it is resolved to
the "default index".  So, it looks like you can't do this twice.  You can't
fallback to a fallback symbol.

I'm filing this as an MC bug, since any IR could hit this, but I'll probably
try to patch clang to avoid this.

-- 
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/20131010/69703674/attachment.html>


More information about the llvm-bugs mailing list