PTX ISA v9.4

11.6.3. Linking Directives: .weak

.weak

Visible (externally) symbol declaration.

Syntax

ptx
.weak identifier

Description

Declares identifier to be globally visible but weak. Weak symbols are similar to globally visible symbols, except during linking, weak symbols are only chosen after globally visible symbols during symbol resolution. Unlike globally visible symbols, multiple object files may declare the same weak symbol, and references to a symbol get resolved against a weak symbol only if no global symbols have the same name.

PTX ISA Notes

Introduced in PTX ISA version 3.1.

Target ISA Notes

Supported on all target architectures.

Examples

ptx
.weak .func (.reg .b32 val) foo;  // foo will be externally visible
esc
Type to search across all documentation