Skip to content

fixes #26015; Multiple definition error when using codegenDecl regression - #26018

Open
ringabout wants to merge 1 commit into
develfrom
pr_uti
Open

fixes #26015; Multiple definition error when using codegenDecl regression#26018
ringabout wants to merge 1 commit into
develfrom
pr_uti

Conversation

@ringabout

Copy link
Copy Markdown
Member

fixes #26015

Fixes imported global variables with codegenDecl being emitted as definitions instead of extern declarations.

A variable’s codegenDecl format should customize its definition in the owning module. Other modules referencing the variable must emit a normal declaration:

extern NI variable;

After the variable-declaration builder refactor, genVarPrototype passed Extern visibility to addVar. However, the sfCodegenDecl branch returned before applying that visibility. This caused importing modules to emit another tentative definition, resulting in duplicate-symbol linker errors.

The fix restores the previous distinction between the custom definition and cross-module prototypes. It also adds C and C++ regression coverage for both direct access and access through an inline procedure.

follows up #24423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple definition error when using codegenDecl

1 participant