Name Strings
SPV_AMD_weak_linkage
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Dmitry Sidorov, AMD
Notice
Copyright (c) 2026 The Khronos Group Inc. Copyright terms at http://www.khronos.org/registry/speccopyright.html
Status
-
Complete.
Version
Last Modified Date |
2026-02-18 |
Revision |
1 |
Dependencies
This extension is written against the SPIR-V Specification, Version 1.6 Revision 6, Unified
This extension requires SPIR-V 1.0.
Overview
This extension adds a new Linkage Type WeakAMD and the WeakLinkageAMD capability. A function or global variable with WeakAMD linkage type has a definition that may be replaced during linking by a definition with Export linkage type from another module. If no Export definition of the same name is found, the WeakAMD definition is retained.
Modifications to the SPIR-V Specification, Version 1.6
Capabilities
Modify Section 3.31, "Capability", adding this row to the table:
| Capability | Implicitly Declares | |
|---|---|---|
5181 |
WeakLinkageAMD |
Linkage |
Linkage Type
In section 3.17 "Linkage Type" add the following row to the Linkage Type table:
| Linkage Type | Enabling Capabilities | |
|---|---|---|
3 |
WeakAMD |
WeakLinkageAMD |
Resolution Rules
The following symbol resolution rules apply when linking modules that use the WeakAMD linkage type together with the existing Export and Import linkage types:
| Module A | Module B | Result | Notes |
|---|---|---|---|
WeakAMD |
Export |
Export definition selected |
Strong overrides weak |
WeakAMD |
WeakAMD |
One definition selected |
Linker may select either |
WeakAMD |
Import |
WeakAMD definition selected |
|
Export |
Export |
Error |
Multiple strong definitions |
Issues
-
Should we also add a WeakODRAMD linkage type?
RESOLVED: No. The WeakODRAMD linkage type implies that all definitions are semantically equivalent, which is not the intended use case for this extension. The WeakAMD linkage type is specifically designed for the case where a library provides a default implementation that a user explicitly replaces with a different implementation. The existing LinkOnceODR from SPV_KHR_linkonce_odr already covers the case where all definitions are equivalent.
-
What happens when a WeakAMD definition and a LinkOnceODR definition of the same symbol are linked together?
RESOLVED: A LinkOnceODR definition does not override a WeakAMD definition, as LinkOnceODR does not carry stronger-than-weak semantics. Only an Export definition overrides a WeakAMD definition. If both WeakAMD and LinkOnceODR definitions exist for the same symbol without an Export definition, the linker may select either.
-
Can tools inline a WeakAMD function?
RESOLVED: Tools should not inline a WeakAMD function across module boundaries before linking, as the definition may be replaced. After linking has resolved the final definition, inlining is permitted.
Revision History
| Rev | Date | Author | Changes |
|---|---|---|---|
1 |
2026-02-18 |
Dmitry Sidorov |
Initial draft. |