<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - clang emitting RIP-relative relocation for weak external on Windows x86-64"
href="https://bugs.llvm.org/show_bug.cgi?id=37598">bug 37598</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>FIXED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - clang emitting RIP-relative relocation for weak external on Windows x86-64"
href="https://bugs.llvm.org/show_bug.cgi?id=37598#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - clang emitting RIP-relative relocation for weak external on Windows x86-64"
href="https://bugs.llvm.org/show_bug.cgi?id=37598">bug 37598</a>
from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
<pre>Fixed for x86 in r360207. I checked AArch64 and it also seems to use
.refptr.sym for extern_weak symbols.
C code:
int __attribute__((weak)) optionalFoo(int x); // { return x; }
int main() {
if (optionalFoo)
return optionalFoo(0);
return 13;
}
relevant asm -O1:
main: ; @main
.seh_proc main
; %bb.0: ; %entry
adrp x8, .refptr.optionalFoo
ldr x8, [x8, .refptr.optionalFoo]
cbz x8, .LBB1_2
; %bb.1: ; %if.then
mov w0, wzr
b optionalFoo
.LBB1_2: ; %return
mov w0, #13
ret
relevant asm -O0:
main: ; @main
.seh_proc main
; %bb.0: ; %entry
sub sp, sp, #32 ; =32
str x30, [sp, #16] ; 8-byte Folded Spill
adrp x8, .refptr.optionalFoo
ldr x8, [x8, .refptr.optionalFoo]
mov x9, #0
cmp x8, x9
cset w10, ne
str wzr, [sp, #12]
tbnz w10, #0, .LBB1_1
b .LBB1_2
.LBB1_1: ; %if.then
mov w0, #0
bl optionalFoo
str w0, [sp, #12]
b .LBB1_3
.LBB1_2: ; %if.end
mov w8, #13
str w8, [sp, #12]
.LBB1_3: ; %return
ldr w0, [sp, #12]
ldr x30, [sp, #16] ; 8-byte Folded Reload
add sp, sp, #32 ; =32
ret</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>