mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
runtime: move the definition of report_bad_alloc_err
Use the reserved spelling for the weak attribute. Move the definition into an implementation file to avoid multiple definitions of the function from being emitted. PE/COFF does not support weak symbols, however, the runtime will never link against LLVMSupport, so provide a single, strong definition of the function. Mark it as hidden visibility so that we do not expose it outside of the runtime.
This commit is contained in:
23
stdlib/public/runtime/LLVMSupport.cpp
Normal file
23
stdlib/public/runtime/LLVMSupport.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//===--- LLVMSupport.cpp - Swift Language ABI Metadata Support ------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// ADT uses report_bad_alloc_error to report an error when it can't allocate
|
||||
// elements for a data structure. The swift runtime uses ADT without linking
|
||||
// against libSupport, so here we provide a stub to make sure we don't fail
|
||||
// to link.
|
||||
#if defined(swiftCore_EXPORTS)
|
||||
namespace llvm {
|
||||
void __attribute__((__weak__, __visibility__("hidden")))
|
||||
report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {}
|
||||
} // end namespace llvm
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user