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

Merged
MarcZX10 merged 1 commit from upstream-pr/2818 into main 2026-10-10 18:30:26 +00:00
MarcZX10 commented 2026-10-10 16:04:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:04:55Z.


What

Fixes #2803. Fedora GCC can produce ET_EXEC binaries when the compiler does not default to PIE, but the Linux guest loader expects the test executable to be an ET_DYN main image. Check PIE support and enable position-independent code for Linux targets configured under core/libs.

Tested

Linux x86_64, Debian GCC 12.2, Release, configured with CMAKE_EXE_LINKER_FLAGS=-no-pie to reproduce a non-PIE default.

  • Built guest_dynamic_loader_tests, guest_unwind_module_info_tests, and guest_unwind_module_info_failure_tests.
  • All three corresponding CTests passed (3/3).
  • readelf confirmed each executable is DYN (position-independent executable).
  • tools/check_conventions.py --base upstream/main and git diff --check passed.
  • Not tested on Fedora 44/GCC 16.

Checklist

  • Based on current main; no open PR implements the same change
  • One topic
  • No comments added to code
  • No investigation files added
  • No third-party code added
  • Generic Linux build behavior
  • Depends on: none
  • AI-assisted: yes (Codex assisted review and PR preparation; the patch is authored by ThatsLeo and reviewed by MarcZX100)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812571228 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2818). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T16:04:55Z. --- ### What Fixes #2803. Fedora GCC can produce `ET_EXEC` binaries when the compiler does not default to PIE, but the Linux guest loader expects the test executable to be an `ET_DYN` main image. Check PIE support and enable position-independent code for Linux targets configured under `core/libs`. ### Tested Linux x86_64, Debian GCC 12.2, Release, configured with `CMAKE_EXE_LINKER_FLAGS=-no-pie` to reproduce a non-PIE default. - Built `guest_dynamic_loader_tests`, `guest_unwind_module_info_tests`, and `guest_unwind_module_info_failure_tests`. - All three corresponding CTests passed (3/3). - `readelf` confirmed each executable is `DYN` (position-independent executable). - `tools/check_conventions.py --base upstream/main` and `git diff --check` passed. - Not tested on Fedora 44/GCC 16. ### Checklist - [x] Based on current `main`; no open PR implements the same change - [x] One topic - [x] No comments added to code - [x] No investigation files added - [x] No third-party code added - [x] Generic Linux build behavior - [x] Depends on: none - [x] AI-assisted: yes (Codex assisted review and PR preparation; the patch is authored by ThatsLeo and reviewed by MarcZX100)
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!2818
No description provided.