[llvm-bugs] [Bug 36806] New: sysv_abi on Windows does not use SysV aggregate classification rules

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 19 13:12:21 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36806

            Bug ID: 36806
           Summary: sysv_abi on Windows does not use SysV aggregate
                    classification rules
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org

This is the inverse of https://llvm.org/PR31362 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:
https://skia-review.googlesource.com/c/skia/+/110641

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.

-- 
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/20180319/4f141201/attachment.html>


More information about the llvm-bugs mailing list