Skip to content

fix: ifunc address equality for data section references#1441

Merged
lapla-cogito merged 2 commits into
wild-linker:mainfrom
lapla-cogito:ifunc_alias
Jan 12, 2026
Merged

fix: ifunc address equality for data section references#1441
lapla-cogito merged 2 commits into
wild-linker:mainfrom
lapla-cogito:ifunc_alias

Conversation

@lapla-cogito

Copy link
Copy Markdown
Member

When an ifunc is referenced from a data section (e.g., void *ptr = my_ifunc), the pointer should have the same value as a direct function pointer reference to ensure address equality comparisons work correctly.
For dynamic executables (both PIE and non-PIE), we now emit IRELATIVE relocations in .rela.dyn for such references, allowing the dynamic linker to resolve them to the same target address.
For static executables without a dynamic linker, the PLT address is used directly, which is handled automatically by value_with_addend().

@davidlattimore davidlattimore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice improvement!

@lapla-cogito lapla-cogito merged commit a873f9c into wild-linker:main Jan 12, 2026
20 checks passed
@lapla-cogito lapla-cogito deleted the ifunc_alias branch January 12, 2026 02:58
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.

2 participants