fix(relinker): preserve imported ELF symbol types #10017
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10017"
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-23T04:12:38Z.
What
Preserve the input ELF symbol type when relinking named imports. Carry
st_info & 0xfthroughNidReference::SymbolTypeand emit it in the SysV dynamic symbol table, soSTT_NOTYPE,STT_OBJECTandSTT_FUNCremain distinct. Existing TLS relocation handling and weak/global binding remain in place.Add a regression covering all 16 type values with global/weak binding and GLOB_DAT/JUMP_SLOT relocations (64 conversion fixtures).
Replaces closed #8899 and addresses its STT_NOTYPE review.
Tested
Ubuntu 26.04.1 x86-64, GCC 15.2, Release. Based on main
9d6adeb5500c6b65e6591bc8e0a3c71b38c4b3e9; tested head70329ada1c2039ab43ea7ba46143321b0d284db5.ANYPS5_RELINKER_ONLY=ONandBUILD_TESTING=ON; Release build passed.ctest --test-dir build-relinker --output-on-failure --parallel 3: 241/241 passed, including all 64import_symbol_typesconversion fixtures and the TLS regression coverage.STT_NOTYPE: input type 0 was emitted as type 1 (STT_OBJECT). Range-diff confirms both fix commits are unchanged by the latest rebase.python3 tools/check_conventions.py --base origin/main, the complete PR-template check andgit diff --checkpassed locally. The branch merges cleanly with the tested main.python3 tools/pr_overlap.py --branch review/relinker-import-typescompleted. Manually inspected the shared files it could not compare: #5021 and #9408 add separate macOS test registrations, #6044 changes CMake test registration mechanically, and #8076 changes unwind/data-table scanning after import parsing. None implements this symbol-type preservation; no ordering dependency is required.CI coverage: Build /
relinkerbuilds and runs the regression plus the relinker suite on Linux, Windows and macOS. For this first-time contributor, a maintainer must dispatch Build on main with this PR number andfull=false. Conventions /conventionschecks repository and PR rules automatically. No remote native build/test result is claimed; Windows and macOS were not run locally.Remote status: Conventions passed and PR intake passed. Build is
action_required; native CI is awaiting maintainer approval and is not a passing build result.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-23T04:22:31Z.
Review: APPROVED
Reviewed head
70329ada1c2039ab43ea7ba46143321b0d284db5. The parser carries the ELFst_infotype intoNidReference, and the dynamic symbol builder preserves that type while retaining TLS relocation handling and weak/global binding. The new fixture exercises all 16 type values under both bindings and both GLOB_DAT/JUMP_SLOT relocation paths. I found no blocking issue.Validation on this exact head: Release relinker-only build completed;
ctest -R ^import_symbol_types$passed (1/1), and the relinker-labeled tests passed (3/3). The complete 241-test relinker-only CTest run had 239 passes and two unrelated failures:web_release(test_main_reconfigures_streams, argparse error-stream mock) andfile_identity(SameFile accepted a missing file). Hosted Conventions and intake passed; hosted native build remainsaction_requiredpending maintainer dispatch, so I have not counted it as a pass.