<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 - sysv_abi on Windows does not use SysV aggregate classification rules"
href="https://bugs.llvm.org/show_bug.cgi?id=36806">36806</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>sysv_abi on Windows does not use SysV aggregate classification rules
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rnk@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This is the inverse of <a href="https://llvm.org/PR31362">https://llvm.org/PR31362</a> and probably has the same fix.
Consider:
$ cat t.c
struct StringRef {
char *Str;
__SIZE_TYPE__ Size;
};
extern volatile char gc;
char __attribute__((sysv_abi)) getit(struct StringRef s) { return s.Str[0]; }
void callit() {
struct StringRef s = {"asdf", 4};
gc = getit(s);
}
$ clang -S -emit-llvm t.c -o - -O2 --target=x86_64-windows | grep define.*getit
define dso_local x86_64_sysvcc i8 @getit(%struct.StringRef* nocapture readonly
%s) local_unnamed_addr #0 {
$ clang -S -emit-llvm t.c -o - -O2 --target=x86_64-linux | grep define.*getit
define dso_local signext i8 @getit(i8* nocapture readonly %s.coerce0, i64
%s.coerce1) local_unnamed_addr #0 {
Clang came up with the wrong prototype because it applied win64 CC rules
instead of sysv x86_64 psabi rules.
People seem to be reaching for this extension not in the context of Wine
because they want the more efficient struct and vector passing rules:
<a href="https://skia-review.googlesource.com/c/skia/+/110641">https://skia-review.googlesource.com/c/skia/+/110641</a>
We should either make this work or provide some other extension that is less
invasive. I suspect Win64 SEH will not play well with the sysv cc.</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>