Skip to content

fix(relinker): write Linux and macOS executables with execute permission - #5695

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
YossiYad:fix/relinker-executable-mode
Oct 15, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
YossiYad:fix/relinker-executable-mode

Conversation

@YossiYad

Copy link
Copy Markdown
Contributor

What

The relinker writes its executables with the default file mode, 0644 under a 022 umask. USAGE.md says to chmod +x app.elf, but nothing covers the outputs of --executable (#4786). A title that starts one of them with sceSystemServiceLoadExec then stops at the execv:

what():  sceSystemServiceLoadExec: execv failed: Permission denied
  • main.cpp adds execute permission for owner, group and others to each Linux and macOS executable output after writing it, the same bits --autorun already adds to app.elf. If that fails, the conversion fails and names the file.
  • relinker_executables checks the bits on app.elf and picker.picker.bin.elf.
  • USAGE.md drops the chmod step and keeps it for copies that lost their mode (a browser download, for example), with the error a missing bit gives.

Title. RetroArch (PPSA99169, catalog release) starts its frontend picker with sceSystemServiceLoadExec("/app0/picker/picker.bin"), and the picker then starts ES-DE (/app0/es-de/es-de.bin). Converted with --executable picker/picker.bin --executable es-de/es-de.bin and run after the documented chmod +x app.elf, it stopped with the error above as soon as it started the picker. With this PR all three outputs are -rwxr-xr-x straight from the relinker and RetroArch starts the picker. In an earlier run with the same bits set by hand, the picker also started ES-DE (its es-de-ps5.log reaches ES-DE returned 0).

Tested

Linux (Bazzite 44, GCC 16.2.1, Ninja, Release, -DBUILD_TESTING=ON), based on main d8888df9b:

  • Full build and ctest: 1105 of 1106 pass. agc_driver_tessellation segfaults on unchanged main here too.
  • relinker_executables fails with the previous main.cpp (app.elf is 0o100644).
  • Title run (distrobox, RX 7700 XT): fresh conversion with this relinker, no chmod. Before: the execv error and SIGABRT when the picker starts. After: the picker starts and waits on its menu.
  • tools/check_conventions.py --base upstream/main and tools/pr_overlap.py (no overlap) pass. macOS and Windows were not built here. Windows outputs are not touched.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99169 (RetroArch picker and ES-DE)
  • GPUs tested: n/a
  • AI-assisted: yes

@Bruggi-ch

Copy link
Copy Markdown

macOS data point for the --executable permission change, since the description only covers Linux.

  • Apple M5 (MacBook Air), macOS 27.0.1, Apple clang 21.0.0, CMake 4.4.4, Ninja
  • main at 66f894761 with this PR merged on top (c31b519e3), relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON), native arm64
  • ctest: 149 of 149 pass, including relinker_executables
  • Without the main.cpp change (test kept): relinker_executables fails on macOS with the same assertion, app.elf is 0o100644. With it, it passes.

I did not run a title, and the test only checks the Linux ELF outputs of --executable; I did not check the permission of --macos output separately.

AI-assisted: yes (Claude Code)

@YossiYad

Copy link
Copy Markdown
Contributor Author

Thanks @Bruggi-ch, that covers the half I couldn't build here.

On the part you left open: 563ff6350 adds a --macos case to relinker_executables. It converts the picker case to Mach-O on the Linux runner and requires both outputs (app.elf and picker.picker.bin.elf, cffaedfe) to be executable. With the change limited to Linux outputs (!args.toWindows && !args.toMacos), the new check fails with macos-picker/out/app.elf at 0o100644; with the PR it passes.

I also built this PR together with my other open ones (#5053, #5218, #5699, #5734) on main 43349d433 and ran the full ctest on Linux: 1110 of 1112 pass. agc_driver_tessellation segfaults on this machine without any change, and agc_host_import_sparse (new on main with #5309) fails the same way on main alone here (a failure at vkQueueBindSparse after the sparse path was chosen did not throw), where UDMABUF_CREATE is refused.

The executables were written with the default file mode (0644 under a
022 umask). The documented chmod covered app.elf, but not the outputs of
--executable, so RetroArch (PPSA99169) converted with
--executable picker/picker.bin --executable es-de/es-de.bin stopped as
soon as it started its picker:

  sceSystemServiceLoadExec: execv failed: Permission denied

Every executable output now gets execute permission for owner, group and
others after it is written, as --autorun already did for app.elf. With
it RetroArch starts the picker, and the picker starts ES-DE.
relinker_executables now requires the execute bits on app.elf and on
picker.picker.bin.elf. It fails with the previous main.cpp, where both
are 0644.
Keep it for copies that lost their mode, and name the LoadExec error a
missing execute bit gives.
relinker_executables converts the picker case with --macos too and
requires both Mach-O outputs to be executable. It fails when the
permission change is limited to Linux outputs.
@YossiYad
YossiYad force-pushed the fix/relinker-executable-mode branch from 563ff63 to acc228a Compare October 14, 2026 09:51
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#6127 core/relinker/main.cpp L313-318

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.

Pull request Shared files not compared
#3891 docs/user/USAGE.md
#4156 docs/user/USAGE.md
#4396 docs/user/USAGE.md
#4397 docs/user/USAGE.md
#4422 docs/user/USAGE.md
#4423 docs/user/USAGE.md
#4424 docs/user/USAGE.md
#4520 docs/user/USAGE.md
#4521 docs/user/USAGE.md
#4522 docs/user/USAGE.md
#4523 docs/user/USAGE.md
#4566 docs/user/USAGE.md
#4599 docs/user/USAGE.md
#4718 docs/user/USAGE.md
#4740 docs/user/USAGE.md
#4749 docs/user/USAGE.md
#4760 docs/user/USAGE.md
#4813 docs/user/USAGE.md
#4891 docs/user/USAGE.md
#5021 docs/user/USAGE.md
#5390 docs/user/USAGE.md
#5875 docs/user/USAGE.md
#5925 docs/user/USAGE.md
#6171 docs/user/USAGE.md

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on the PR merged onto current main: build + scoped ctest (relinker) 133/133, including relinker_executables; the execute bits are set for Linux and macOS outputs, Windows is untouched. Relinker jobs green on ubuntu, windows and macOS; macOS also confirmed by @Bruggi-ch on Apple M5. The title run is not reproducible here. Merging.

@adriadam10
adriadam10 merged commit 7a22c43 into boykopovar:main Oct 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants