You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add @_used and @_section attributes for global variables and top-level functions (swiftlang#65901)
* Add @_used and @_section attributes for global variables and top-level functions
This adds:
- @_used attribute that flags as a global variable or a top-level function as
"do not dead-strip" via llvm.used, roughly the equivalent of
__attribute__((used)) in C/C++.
- @_section("...") attribute that places a global variable or a top-level
function into a section with that name, roughly the equivalent of
__attribute__((section("..."))) in C/C++.
in the imported module. The imported module needs to be compiled with
833
833
`-Xfrontend -enable-private-imports` for this to work.
834
834
835
+
## `@_section("section_name")`
836
+
837
+
Places a global variable or a top-level function into a section of the object
838
+
file with the given name. It's the equivalent of clang's
839
+
`__attribute__((section))`.
840
+
835
841
## `@_semantics("uniquely.recognized.id")`
836
842
837
843
Allows the optimizer to make use of some key invariants in performance critical
@@ -994,6 +1000,12 @@ for more details.
994
1000
995
1001
This `async` function uses the pre-SE-0338 semantics of unsafely inheriting the caller's executor. This is an underscored feature because the right way of inheriting an executor is to pass in the required executor and switch to it. Unfortunately, there are functions in the standard library which need to inherit their caller's executor but cannot change their ABI because they were not defined as `@_alwaysEmitIntoClient` in the initial release.
996
1002
1003
+
## `@_used`
1004
+
1005
+
Marks a global variable or a top-level function as "used externally" even if it
1006
+
does not have visible users in the compilation unit. It's the equivalent of
1007
+
clang's `__attribute__((used))`.
1008
+
997
1009
## `@_weakLinked`
998
1010
999
1011
Allows a declaration to be weakly-referenced, i.e., any references emitted by
0 commit comments