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
Uses weak linkage functionality

Linkage

Linkage Type

In section 3.17 "Linkage Type" add the following row to the Linkage Type table:

Linkage Type Enabling Capabilities

3

WeakAMD
Same as the Export linkage type, but a function or global variable with this linkage type may be replaced during linking by one with Export linkage from another module. If multiple modules provide a definition of the same symbol and at least one has Export linkage, the linker must select an Export definition and discard all WeakAMD definitions of that symbol. If only WeakAMD definitions exist for a given symbol, the linker selects one and discards the rest.

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

  1. 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.

  2. 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.

  3. 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.