Skip to content

Commit a79c141

Browse files
authored
Merge pull request #20633 from compnerd/weak-win
runtime: adjust LLVMSupport for Windows
2 parents fafd21e + 6072d9f commit a79c141

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stdlib/public/runtime/LLVMSupport.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@
1616
// to link.
1717
#if defined(swiftCore_EXPORTS)
1818
namespace llvm {
19+
#if defined(_WIN32)
20+
extern void report_bad_alloc_error(const char *Reason, bool GenCrashDiag);
21+
void _report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {}
22+
#if defined(_WIN64)
23+
#pragma comment(linker, "/alternatename:?report_bad_alloc_error@llvm@@YAXPEBD_N@Z=?_report_bad_alloc_error@llvm@@YAXPEBD_N@Z")
24+
#else
25+
#pragma comment(linker, "/alternatename:?report_bad_alloc_error@llvm@@YAXPBD_N@Z=?_report_bad_alloc_error@llvm@@YAXPBD_N@Z")
26+
#endif
27+
#else
1928
void __attribute__((__weak__, __visibility__("hidden")))
2029
report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {}
30+
#endif
2131
} // end namespace llvm
2232
#endif
2333

0 commit comments

Comments
 (0)