Linux: three loader tests fail when GCC does not default to PIE (Fedora) #2803

Closed
opened 2026-10-10 15:34:44 +00:00 by ThatsLeo · 1 comment
ThatsLeo commented 2026-10-10 15:34:44 +00:00 (Migrated from github.com)
Contributor

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


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.

Fix: ThatsLeo/AnyPS5:fix/linux-test-executables-pie (one commit, 0c505d42, on main 5edae353). Details: #2798 (closed by the intake pause).

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.

Happy for anyone with intake access to carry it.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5792675109 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2803). Originally posted by [ThatsLeo](https://github.com/ThatsLeo) on 2026-10-10T15:34:44Z. --- 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. **Fix:** [`ThatsLeo/AnyPS5:fix/linux-test-executables-pie`](https://github.com/ThatsLeo/AnyPS5/tree/fix/linux-test-executables-pie) (one commit, `0c505d42`, on `main` `5edae353`). Details: #2798 (closed by the intake pause). **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`. Happy for anyone with intake access to carry it. AI-assisted: yes.
MarcZX10 commented 2026-10-10 15:40:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T15:40:16Z.


I carried ThatsLeo’s author-attributed Linux test PIE fix onto current upstream main (de5e541d) in codex/linux-test-pie-2803, commit 230ff18eb1e663b6bd76166cae9faf71f7b5a147.

I configured a fresh Release build with CMAKE_EXE_LINKER_FLAGS=-no-pie to emulate a toolchain that does not default to PIE, then built the three affected test executables. All three were ELF DYN position-independent executables, and the tests passed:

Test Result
guest_dynamic_loader Passed
guest_unwind_module_info Passed
guest_unwind_module_info_failure Passed

tools/check_conventions.py --base upstream/main and git diff --check also pass. I have not run this on Fedora 44/GCC 16; the validation here used Debian GCC 12.2 with the explicit non-PIE linker default.

I did not open an upstream PR because the intake workflow requires 20 PRs merged into main; my current merged count is 15. The fork branch is ready for review or cherry-pick.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099204177 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2803#issuecomment-6099204177). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T15:40:16Z. --- I carried ThatsLeo’s author-attributed Linux test PIE fix onto current upstream `main` (`de5e541d`) in [`codex/linux-test-pie-2803`](https://github.com/MarcZX100/AnyPS5/tree/codex/linux-test-pie-2803), commit `230ff18eb1e663b6bd76166cae9faf71f7b5a147`. I configured a fresh Release build with `CMAKE_EXE_LINKER_FLAGS=-no-pie` to emulate a toolchain that does not default to PIE, then built the three affected test executables. All three were ELF `DYN` position-independent executables, and the tests passed: | Test | Result | | --- | --- | | `guest_dynamic_loader` | Passed | | `guest_unwind_module_info` | Passed | | `guest_unwind_module_info_failure` | Passed | `tools/check_conventions.py --base upstream/main` and `git diff --check` also pass. I have not run this on Fedora 44/GCC 16; the validation here used Debian GCC 12.2 with the explicit non-PIE linker default. I did not open an upstream PR because the intake workflow requires 20 PRs merged into `main`; my current merged count is 15. The fork branch is ready for review or cherry-pick.
Sign in to join this conversation.
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#2803
No description provided.