fix(build): link the Linux library tests as PIE #2798

Closed
ThatsLeo wants to merge 1 commit from upstream-pr/2798 into main
ThatsLeo commented 2026-10-10 15:30:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-10T15:30:15Z.


What

On Linux the loader treats the unnamed main image as guest code: FromGuestModule compares dladdr's dli_fbase with the main program's dlpi_addr, and IsRelinkedImage takes the unnamed image as relinked. Both hold for the ET_DYN executables the relinker emits. Fedora's GCC does not default to PIE, so the library test executables were ET_EXEC at 0x400000: dlpi_addr is 0 there, and the address of a libkernel function is a canonical PLT entry inside the test executable.

  • core/libs sets CMAKE_POSITION_INDEPENDENT_CODE on Linux after check_pie_supported, so its executables link as PIE whatever the compiler default.

Tested

Fedora 44, GCC 16.2.1, Release.

  • guest_dynamic_loader, guest_unwind_module_info and guest_unwind_module_info_failure fail on main and pass.
  • Full ctest on main (5edae353) and on this branch, on Intel Arc (Meteor Lake, Mesa 26.2.3) and lavapipe: Intel Arc 9 failures on main, 6 here; lavapipe 4 and 1; no new failure. The remaining failures also fail on main: on Intel Arc agc_driver_mesh, agc_driver_f64_fma_subnormals, agc_driver_vop1_float_unary, agc_driver_vopc_compare, agc_pipeline_cache, agc_driver_lds_beyond_device_limit; on lavapipe agc_driver_f64_fma_subnormals.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812333553 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2798). Originally posted by [ThatsLeo](https://github.com/ThatsLeo) on 2026-10-10T15:30:15Z. --- ### What On Linux the loader treats the unnamed main image as guest code: `FromGuestModule` compares `dladdr`'s `dli_fbase` with the main program's `dlpi_addr`, and `IsRelinkedImage` takes the unnamed image as relinked. Both hold for the `ET_DYN` executables the relinker emits. Fedora's GCC does not default to PIE, so the library test executables were `ET_EXEC` at `0x400000`: `dlpi_addr` is 0 there, and the address of a libkernel function is a canonical PLT entry inside the test executable. - `core/libs` sets `CMAKE_POSITION_INDEPENDENT_CODE` on Linux after `check_pie_supported`, so its executables link as PIE whatever the compiler default. ### Tested Fedora 44, GCC 16.2.1, Release. - `guest_dynamic_loader`, `guest_unwind_module_info` and `guest_unwind_module_info_failure` fail on `main` and pass. - Full `ctest` on `main` (`5edae353`) and on this branch, on Intel Arc (Meteor Lake, Mesa 26.2.3) and lavapipe: Intel Arc 9 failures on `main`, 6 here; lavapipe 4 and 1; no new failure. The remaining failures also fail on `main`: on Intel Arc `agc_driver_mesh`, `agc_driver_f64_fma_subnormals`, `agc_driver_vop1_float_unary`, `agc_driver_vopc_compare`, `agc_pipeline_cache`, `agc_driver_lds_beyond_device_limit`; on lavapipe `agc_driver_f64_fma_subnormals`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-10 15:30:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T15:30:26Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099114390 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2798#issuecomment-6099114390). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T15:30:26Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2798
No description provided.