fix(relinker): preserve imported ELF symbol types #8899
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8899"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by SteelCrab on 2026-10-21T05:05:43Z.
What
Superseded by #10017, which carries the reviewed symbol-type correction on current main. This closed PR retains the earlier review snapshot; use #10017 for the active diff, current test results and CI.
Carry the original ELF symbol-type nibble through parsing in
NidReference::SymbolType, then use it when writing named imports to the SysV dynamic symbol table.STT_NOTYPE,STT_OBJECTandSTT_FUNCremain distinct; non-function imports are no longer all converted to objects. Existing TLS relocation handling and weak/global binding remain in place.Addresses the STT_NOTYPE review. The regression covers all 16 type values with both weak/global binding and GLOB_DAT/JUMP_SLOT relocations.
The relinker prerequisite of #6879 is now tracked in #10017.
Historical tested source: earlier branch diff. GitHub rejected reopening this PR after the branch history changed, so #10017 replaces it.
Tested
Ubuntu 26.04.1 x86-64, GCC 15.2, Release. Rebased onto main
a6646f8464140180351e4c08694dccdd55b2814d; tested head15366612f433497db718d701a313136448b1f8fd.STT_NOTYPEassertion, emitting type 1 (STT_OBJECT) for input type 0.ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON), build and full CTest: 240/240 passed.ctest -R '^import_symbol_types$' -V: 1/1 passed, exercising 64 conversion fixtures (16 types × 2 bindings × 2 relocation kinds).python3 tools/check_conventions.py --base origin/mainand the complete PR-template check passed locally. Merge check against the tested main is clean.CI coverage: Build /
relinkerruns this regression and the complete relinker suite on Linux, Windows and macOS. A maintainer-triggered Build run is required for this contributor. No remote native matrix result is claimed for this head; Windows and macOS were not run locally.This PR remains closed and is superseded by #10017. The results above are historical local results for the explicitly listed commit.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T05:06:25Z.
Code review location:
core/relinker/relinker/src/output/SysVDynamicSectionBuilder.cpp; line 90Could we preserve the input symbol type here instead of deriving every non-function import as
STT_OBJECT? The parser currently reducesst_info & 0xftoFunction = (type == STT_FUNC), so an undefinedSTT_NOTYPEimport is indistinguishable fromSTT_OBJECTby this point and will now be emitted as an object. If normalizingSTT_NOTYPEto object is intentional, please narrow the PR description; otherwise retaining the original type inNidReference(or explicitly mapping onlySTT_OBJECTto object) would make the preservation claim accurate.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T05:13:59Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/elfpatcher/include/elfpatcher/general/ElfConstants.hppImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T12:04:34Z.
Thank you for your contribution! Authors with no pull requests merged into
maincan have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.Pull request closed