Files
swift-mirror/include/swift/AST/DiagnosticsDriver.def
Robert Widmann f6b2294d5a Undo Force Load + Incremental Ban on Darwin Platforms
Gather 'round to hear tell of the saga of autolinking in incremental
mode.

In the beginning, there was Swift code, and there was Objective-C code.
To make one import bind two languages, a twinned Swift module named the same as an
Objective-C module could be imported as an overlay. But all was not
well, for an overlay could be created which had no Swift content, yet
required Swift symbols. And there was much wailing and gnashing of teeth
as loaders everywhere disregarded loading these content-less Swift
libraries.

So, a solution was found - a magical symbol _swift_FORCE_LOAD_$_<MODULE>
that forced the loaders to heed the dependency on a Swift library
regardless of its content. It was a constant with common linkage, and it
was good. But, along came COFF which needed to support autolinking but
had no support for such matters. It did, however, have support for
COMDAT sections into which we placed the symbol. Immediately, a darkness
fell across the land as the windows linker loudly proclaimed it had
discovered a contradiction: "_swift_FORCE_LOAD_$_<MODULE> cannot be
a constant!", it said, gratingly, "for this value requires rebasing."
Undeterred, we switched to a function instead, and the windows linker
happily added a level of indirection to its symbol resolution procedure
and all was right with the world.

But this definition was not all right. In order to support multiple
translation units emitting it, and to prevent the linker from dead
stripping it, Weak ODR linkage was used. Weak ODR linkage has the nasty
side effect of pessimizing load times since the dynamic linker must
assume that loading a later library could produce a more definitive
definition for the symbol.

A compromise was drawn up: To keep load times low, external linkage was
used. To keep the linker from complaining about multiple strong
definitions for the same symbol, the first translation unit in the
module was nominated to recieve the magic symbol. But one final problem
remained:

Incremental builds allow for files to be added or removed during the
build procedure. The placement of the symbol was therefore dependent
entirely upon the order of files passed at the command line. This was no
good, so a decree was set forth that using -autolink-force-load and
-incremental together was a criminal offense.

So we must compromise once more: Return to a symbol with common linkage,
but only on Mach-O targets. Preserve the existing COMDAT-friendly
approach everywhere else.

This concludes our tale.

rdar://77803299
2021-05-24 15:53:13 -07:00

180 lines
7.1 KiB
C++

//===--- DiagnosticsDriver.def - Diagnostics Text ---------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 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
//
//===----------------------------------------------------------------------===//
//
// This file defines driver-only diagnostics emitted in processing
// command-line arguments and setting up compilation.
// Each diagnostic is described using one of three kinds (error, warning, or
// note) along with a unique identifier, category, options, and text, and is
// followed by a signature describing the diagnostic argument kinds.
//
//===----------------------------------------------------------------------===//
#define DEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
WARNING(warning_parallel_execution_not_supported,none,
"parallel execution not supported; falling back to serial execution",
())
ERROR(error_unable_to_execute_command,none,
"unable to execute command: %0", (StringRef))
ERROR(error_command_signalled_without_signal_number,none,
"%0 command failed due to signal (use -v to see invocation)", (StringRef))
ERROR(error_command_signalled,none,
"%0 command failed due to signal %1 (use -v to see invocation)", (StringRef, int))
ERROR(error_command_failed,none,
"%0 command failed with exit code %1 (use -v to see invocation)",
(StringRef, int))
ERROR(error_expected_one_frontend_job,none,
"unable to handle compilation, expected exactly one frontend job", ())
ERROR(error_expected_frontend_command,none,
"expected a swift frontend command", ())
ERROR(error_cannot_specify__o_for_multiple_outputs,none,
"cannot specify -o when generating multiple output files", ())
ERROR(error_static_emit_executable_disallowed,none,
"-static may not be used with -emit-executable", ())
ERROR(error_unable_to_load_output_file_map, none,
"unable to load output file map '%1': %0", (StringRef, StringRef))
ERROR(error_no_output_file_map_specified,none,
"no output file map specified", ())
ERROR(error_unable_to_make_temporary_file,none,
"unable to make temporary file: %0", (StringRef))
ERROR(error_no_input_files,none,
"no input files", ())
ERROR(error_unexpected_input_file,none,
"unexpected input file: %0", (StringRef))
ERROR(error_unknown_target,none,
"unknown target '%0'", (StringRef))
ERROR(error_framework_bridging_header,none,
"using bridging headers with framework targets is unsupported", ())
ERROR(error_bridging_header_module_interface,none,
"using bridging headers with module interfaces is unsupported",
())
ERROR(error_i_mode,none,
"the flag '-i' is no longer required and has been removed; "
"use '%0 input-filename'", (StringRef))
WARNING(warning_unnecessary_repl_mode,none,
"unnecessary option '%0'; this is the default for '%1' "
"with no input files", (StringRef, StringRef))
ERROR(error_unsupported_option,none,
"option '%0' is not supported by '%1'; did you mean to use '%2'?",
(StringRef, StringRef, StringRef))
WARNING(incremental_requires_output_file_map,none,
"ignoring -incremental (currently requires an output file map)", ())
WARNING(incremental_requires_build_record_entry,none,
"ignoring -incremental; output file map has no master dependencies "
"entry (\"%0\" under \"\")", (StringRef))
WARNING(unable_to_open_incremental_comparison_log,none,
"unable to open incremental comparison log file '%0'", (StringRef))
ERROR(error_os_minimum_deployment,none,
"Swift requires a minimum deployment target of %0", (StringRef))
ERROR(error_sdk_too_old,none,
"Swift does not support the SDK '%0'", (StringRef))
ERROR(error_ios_maximum_deployment_32,none,
"iOS %0 does not support 32-bit programs", (unsigned))
ERROR(error_unsupported_target_variant,none,
"unsupported '%select{-target|-target-variant}1' value '%0'; use 'ios-macabi' instead",
(StringRef, bool))
WARNING(warn_arclite_not_found_when_link_objc_runtime,none,
"unable to find Objective-C runtime support library 'arclite'; "
"pass '-no-link-objc-runtime' to silence this warning", ())
WARNING(warn_cannot_stat_input,none,
"unable to determine when '%0' was last modified: %1",
(StringRef, StringRef))
WARNING(warn_unable_to_load_dependencies, none,
"unable to load dependencies file \"%0\", disabling incremental mode",
(StringRef))
ERROR(error_input_changed_during_build,none,
"input file '%0' was modified during the build",
(StringRef))
ERROR(error_conflicting_options, none,
"conflicting options '%0' and '%1'",
(StringRef, StringRef))
ERROR(error_requirement_not_met, none,
"'%0' requires '%1'",
(StringRef, StringRef))
WARNING(warn_ignore_embed_bitcode, none,
"ignoring -embed-bitcode since no object file is being generated", ())
WARNING(warn_ignore_embed_bitcode_marker, none,
"ignoring -embed-bitcode-marker since no object file is being generated", ())
WARNING(verify_debug_info_requires_debug_option,none,
"ignoring '-verify-debug-info'; no debug info is being generated", ())
ERROR(verify_incremental_dependencies_needs_incremental,none,
"'-verify-incremental-dependencies' requires '-incremental'", ())
ERROR(error_profile_missing,none,
"no profdata file exists at '%0'", (StringRef))
WARNING(warn_opt_remark_disabled, none,
"Emission of optimization records has been disabled, because it "
"requires a single compiler invocation: consider enabling the "
"-whole-module-optimization flag", ())
WARNING(warn_ignoring_batch_mode,none,
"ignoring '-enable-batch-mode' because '%0' was also specified", (StringRef))
WARNING(warn_ignoring_wmo, none,
"ignoring '-wmo' because '-dump-ast' was also specified", ())
WARNING(warn_use_filelists_deprecated, none,
"the option '-driver-use-filelists' is deprecated; use "
"'-driver-filelist-threshold=0' instead", ())
WARNING(warn_unable_to_load_primary, none,
"unable to load primary swift file \"%0\", %1",
(StringRef, StringRef))
ERROR(cannot_find_migration_script, none,
"missing migration script from path '%0'", (StringRef))
ERROR(error_darwin_static_stdlib_not_supported, none,
"-static-stdlib is no longer supported on Apple platforms", ())
ERROR(error_darwin_only_supports_libcxx, none,
"The only C++ standard library supported on Apple platforms is libc++",
())
WARNING(warn_drv_darwin_sdk_invalid_settings, none,
"SDK settings were ignored because 'SDKSettings.json' could not be parsed",
())
WARNING(warning_unsupported_driver_option,none,
"option '%0' is ony supported in swift-driver", (StringRef))
WARNING(old_driver_deprecated,none,
"legacy driver is now deprecated; consider avoiding specifying `%0`", (StringRef))
#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"