diff --git a/doc/rules.md b/doc/rules.md index 3b9c54b78..6d9fdb366 100644 --- a/doc/rules.md +++ b/doc/rules.md @@ -1010,7 +1010,7 @@ Once that is the case, this macro will be deprecated. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | The name of the target. | none | -| alwayslink | If true, any binary that depends (directly or indirectly) on this library will link in all the object files for the files listed in `swift_srcs`, even if some contain no symbols referenced by the binary. This is useful if your code isn't explicitly called by code in the binary; for example, if you rely on runtime checks for protocol conformances added in extensions in the library but do not directly reference any other symbols in the object file that adds that conformance. | `False` | +| alwayslink | If true, any binary that depends (directly or indirectly) on this library will link in all the object files for the files listed in `clang_srcs` and `swift_srcs`, even if some contain no symbols referenced by the binary. This is useful if your code isn't explicitly called by code in the binary; for example, if you rely on runtime checks for protocol conformances added in extensions in the library but do not directly reference any other symbols in the object file that adds that conformance. | `False` | | clang_copts | The compiler flags for the clang library. These will only be used for the clang library. If you want them to affect the swift library as well, you need to pass them with `-Xcc` in `swift_copts`. | `[]` | | clang_defines | Extra clang `-D` flags to pass to the compiler. They should be in the form `KEY=VALUE` or simply `KEY` and are passed not only to the compiler for this target (as `clang_copts` are) but also to all dependers of this target. Subject to "Make variable" substitution and Bourne shell tokenization. | `[]` | | clang_srcs | The list of C, C++, Objective-C, or Objective-C++ sources for the clang library. | none | diff --git a/mixed_language/mixed_language_library.bzl b/mixed_language/mixed_language_library.bzl index 2c62d3baf..927d1c25c 100644 --- a/mixed_language/mixed_language_library.bzl +++ b/mixed_language/mixed_language_library.bzl @@ -69,12 +69,12 @@ def mixed_language_library( name: The name of the target. alwayslink: If true, any binary that depends (directly or indirectly) on this library will link in all the object files for the files listed - in `swift_srcs`, even if some contain no symbols referenced by the - binary. This is useful if your code isn't explicitly called by code - in the binary; for example, if you rely on runtime checks for - protocol conformances added in extensions in the library but do not - directly reference any other symbols in the object file that adds - that conformance. + in `clang_srcs` and `swift_srcs`, even if some contain no symbols + referenced by the binary. This is useful if your code isn't + explicitly called by code in the binary; for example, if you rely on + runtime checks for protocol conformances added in extensions in the + library but do not directly reference any other symbols in the + object file that adds that conformance. clang_copts: The compiler flags for the clang library. These will only be used for the clang library. If you want them to affect the swift library as well, you need to pass them with `-Xcc` in `swift_copts`. @@ -341,6 +341,7 @@ a mixed language Swift library, use a clang only library rule like \ native.objc_library( name = clang_library_name, srcs = clang_srcs, + alwayslink = alwayslink, hdrs = adjusted_hdrs, non_arc_srcs = non_arc_srcs, # `internal_swift_interop_name` isn't needed here because