Skip to content

fix: improve SHT_SYMTAB_SHNDX handling - #1846

Merged
davidlattimore merged 1 commit into
wild-linker:mainfrom
philipc:xindex
Apr 16, 2026
Merged

davidlattimore merged 1 commit into
wild-linker:mainfrom
philipc:xindex

Conversation

@philipc

@philipc philipc commented Apr 16, 2026

Copy link
Copy Markdown
Contributor
  • add SymbolSection to fix conflated meaning of the shndx parameter to define_symbol. Previously a section index of 0xfff1 or 0xfff2 would be encoded in st_shndx as SHN_ABS or SHN_COMMON instead of SHN_XINDEX
  • check against SHN_LORESERVE instead of using try_into in a few places
  • a couple of other minor fixes

This fixes the issue I noted in #1783 (comment) plus some related issues. I noticed these while doing newtype changes for #1831.

The From<u16> impl for SymbolSection is slightly error prone, but significantly more concise for calls, and I expect it to change to From<object::elf::ShdrIndex> in future.

The mold tests for this still pass.

- add SymbolSection to fix conflated meaning of the shndx parameter to
  define_symbol. Previously a section index of 0xfff1 or 0xfff2 would
  be encoded in st_shndx as SHN_ABS or SHN_COMMON instead of SHN_XINDEX
- check against SHN_LORESERVE instead of using try_into in a few places
- a couple of other minor fixes
@davidlattimore
davidlattimore merged commit 42f8cb5 into wild-linker:main Apr 16, 2026
60 of 74 checks passed
@philipc
philipc deleted the xindex branch April 16, 2026 22:42
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