<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - MC-COFF: multiple levels of linkonce_odr aliases produce an unlinkable COFF object"
   href="http://llvm.org/bugs/show_bug.cgi?id=17530">17530</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MC-COFF: multiple levels of linkonce_odr aliases produce an unlinkable COFF object
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rnk@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, peter@pcc.me.uk, rafael.espindola@gmail.com, ruiu@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>