Skip to content

Initialize sentinel rule hash in SectionMap constructor - #1759

Open
Bhoumik Patidar (BhoumikPatidar) wants to merge 1 commit into
qualcomm:mainfrom
BhoumikPatidar:fix/sectionmap-sentinel-rule-hash
Open

Initialize sentinel rule hash in SectionMap constructor#1759
Bhoumik Patidar (BhoumikPatidar) wants to merge 1 commit into
qualcomm:mainfrom
BhoumikPatidar:fix/sectionmap-sentinel-rule-hash

Conversation

@BhoumikPatidar

@BhoumikPatidar Bhoumik Patidar (BhoumikPatidar) commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The SectionMap constructor creates an OutputSectionEntry with an empty name and pattern via insert("",""). This entry's RuleContainer's RuleHash field is never set and remains std::nullopt. Calling RuleContainer::getRuleHash() and dereferencing the result leads to an assertion failure.

Fix: After insert("",""), call setRuleHash on the returned RuleContainer with llvm::hash_combine("","",0) as this is an empty RuleText. This ensures every RuleContainer in the SectionMap has a valid hash.

Resolves #1758

@parth-07 Parth (parth-07) left a comment

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.

Please add tests for this fix.

The SectionMap constructor creates an OutputSectionEntry with an empty name
and pattern via insert("",""). This entry's RuleContainer's RuleHash field is
never set and remains std::nullopt. Calling RuleContainer::getRuleHash() and
dereferencing the result leads to an assertion failure.

Fix: After insert("",""), call setRuleHash on the returned RuleContainer with
llvm::hash_combine("","",0) as this is an empty RuleText. This ensures
every RuleContainer in the SectionMap has a valid hash.

Resolves qualcomm#1758

Signed-off-by: Bhoumik Patidar <bpatidar@qti.qualcomm.com>

@parth-07 Parth (parth-07) left a comment

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.

LGTM.

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.

SectionMap sentinel RuleContainer has no hash

3 participants