Skip to content

[LLD] Evaluation of DEFINED linker script directive produces wrong output #64600

Closed
@edward-jones

Description

@edward-jones

The following linker script causes unexpected behaviour when APPLE is not defined by any input objects. The unexpected output is that APPLE will resolve to '1' instead of '2'.

APPLE = DEFINED (APPLE) ? 1 : 2;

It appears that when the symbol is first processed it is added to the symbol table with the expected value, however LLD reevaluates symbol assignments, and during these subsequent evaluations of the expression the DEFINED now returns 1 as APPLE has been inserted in the symbol table.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions