[llvm-bugs] [Bug 39182] New: Clang compiled with mingw-w64 emits available_externally for IsWindowsXPOrGreater()

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 4 11:51:19 PDT 2018


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

            Bug ID: 39182
           Summary: Clang compiled with mingw-w64 emits
                    available_externally for IsWindowsXPOrGreater()
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 6yearold at gmail.com
                CC: llvm-bugs at lists.llvm.org

I've compiled release_70 branch with recent mingw-w64 toolchain (GCC 8.2.0) and
using produced Clang to compile following program:

#include <VersionHelpers.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
    IsWindowsXPOrGreater();
    printf("OK\n");
    return 0;
}

It fails on linking stage with "undefined reference to IsWindowsXPOrGreater".
When I use clang.exe from the official installer, it works fine.

I examined -S -emit-llvm output and found that my clang emits

define available_externally dso_local i32 @IsWindowsXPOrGreater {
...
}

while official clang emits

define linkonce_odr dso_local i32 @IsWindowsXPOrGreater {
...
}

Am I missing something, or it is a bug in Clang?

For reference, here is VersionHelpers.h source:
https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/include/versionhelpers.h

-- 
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/20181004/1d12ea75/attachment.html>


More information about the llvm-bugs mailing list