Skip to content

Mutually Exclusive Options Do Not Override Each Other #1179

@Steven6798

Description

@Steven6798

Description

When passing mutually exclusive options, the last occurrence does not override the previous one, leading to inconsistent behavior.

For example:

$ ld.eld --no-warn-mismatch --warn-mismatch ...
# Warning is shown (expected)

$ ld.eld --warn-mismatch --no-warn-mismatch ...
# Warning is still shown (unexpected)

Expected Behavior

Command-line option parsing should follow the standard convention where:

The last occurrence of a conflicting option takes precedence.

So the second invocation should disable the warning:

$ ld.eld --warn-mismatch --no-warn-mismatch ...
# Warning should NOT be shown

Actual Behavior

The --no-warn-mismatch option does not override a prior --warn-mismatch, even when it appears later in the argument list.

Impact

  • Breaks expected CLI semantics
  • Can lead to confusing or misleading behavior for users
  • Makes it difficult to reliably control linker behavior via scripts or build systems

Notes

This issue may affect other pairs of mutually exclusive options that follow a similar pattern (--foo / --no-foo).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions