Skip to content

Make last conflicting option take precedence#1190

Open
Steven6798 wants to merge 1 commit into
qualcomm:mainfrom
Steven6798:issue-1179
Open

Make last conflicting option take precedence#1190
Steven6798 wants to merge 1 commit into
qualcomm:mainfrom
Steven6798:issue-1179

Conversation

@Steven6798
Copy link
Copy Markdown
Contributor

Update option handling so that the last occurrence of conflicting flags (e.g. --warn-mismatch/--no-warn-mismatch) takes precedence, matching standard command-line semantics and user expectations.

Fix: #1179

Copy link
Copy Markdown
Contributor

@quic-areg quic-areg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should apply to these options too:

--gc-sections / --no-gc-sections	
--export-dynamic / --no-export-dynamic	
--relax / --no-relax (riscv)

Unrelated to this PR, these options are hard errors today when both forms are present; we might want to relax them in the future for consistency:

--enable-linker-version / --disable-linker-version	
--thread-count / --no-threads	
--enable-new-dtags / --disable-new-dtags	

Another tangent, Hexagon has no --no-relax option like riscv does, and the --help text for hexagon's --relax says "Enable Hexagon Relaxation (default behavior)", but it is not actually the default.

Comment thread lib/LinkerWrapper/GnuLdDriver.cpp Outdated
Comment thread lib/LinkerWrapper/GnuLdDriver.cpp
@Steven6798 Steven6798 force-pushed the issue-1179 branch 2 times, most recently from 7a3458c to f066933 Compare May 19, 2026 17:58
@Steven6798 Steven6798 marked this pull request as ready for review May 19, 2026 20:14
@Steven6798 Steven6798 requested a review from quic-areg May 19, 2026 20:14
Comment thread test/Common/standalone/FlagOverwrite/FlagOverwrite.test
Copy link
Copy Markdown
Contributor

@quic-areg quic-areg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from the minor test comment

Comment thread test/AArch64/standalone/TLS_IE_ALIGN/IEAlign.test Outdated
Comment thread test/Common/standalone/FlagOverwrite/FlagOverwrite.test Outdated
DEMANGLE: Verbose: Adding symbol foo()
NODEMANGLE: Verbose: Adding symbol _Z3foov
CHECKSECT: section .comment file range overlaps with .text
NOCHECKSECT-NOT: section .comment file range overlaps with .text
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a bug ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean a bug in my test or that the check itself found a bug?

If it is a bug in eld then awesome. Since you understand why it is a bug then raise an issue. Great catch.

Comment thread lib/LinkerWrapper/GnuLdDriver.cpp
Comment thread test/AArch64/standalone/TLS_GD_ALIGN/GDAlign.test Outdated
Update option handling so that the last occurrence of conflicting
flags (e.g. --demangle/--no-demangle) takes precedence,
matching standard command-line semantics and user expectations.

Fix: qualcomm#1179

Signed-off-by: Steven Ramirez Rosa <ramirezr@qti.qualcomm.com>
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.

Mutually Exclusive Options Do Not Override Each Other

4 participants