<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - extern_weak creates invalid data"
href="https://bugs.llvm.org/show_bug.cgi?id=38976">38976</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>extern_weak creates invalid data
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>COFF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ck@remobjects.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20885" name="attach_20885" title="t.il">attachment 20885</a> <a href="attachment.cgi?id=20885&action=edit" title="t.il">[details]</a></span>
t.il
An extern_weak method that's *not* resolved ends up as a as a non 0 value once
linked with lld (it becomes IMAGEBASE + 80000000):
testcase:
target triple = "x86_64-pc-windows-msvc"
declare extern_weak i8 @__elements_dll_main(i8*, i32, i8*)
define x86_stdcallcc i8 @_DllMainCRTStartup(i8*, i32, i8*) {
BasicBlock256:
%csLoc0 = alloca i8 (i8*, i32, i8*)*
store i8 (i8*, i32, i8*)* @__elements_dll_main, i8 (i8*, i32, i8*)** %csLoc0
%a = load i8 (i8*, i32, i8*)*, i8 (i8*, i32, i8*)** %csLoc0
%b = icmp eq i8 (i8*, i32, i8*)* %a, null
br i1 %b, label %BasicBlock258, label %BasicBlock259
BasicBlock258: ; preds = %BasicBlock256
ret i8 1
BasicBlock259: ; preds = %BasicBlock256
%c = call i8 %a(i8* null, i32 0, i8* null)
ret i8 %c
}
steps:
llc t.il -filetype=obj
lld -flavor link /dll t.il.obj</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>