cmake: pass -Map as discrete link option on non-clang-cl builds #806

Manually merged
github merged 1 commit from gh-pr/806/head into gh-pr/806/base 2026-11-26 09:33:06 +00:00
Owner

@⁠6d4m on GitHub · 2026-09-24 13:56 UTC · original
6d4m:cmake-link-map-path-spaces → main · +4 −1 · 1 files · 1 commits · merged 2026-09-24 17:23 UTC

Summary

Completes the non-clang-cl side of #26. The WIN32 OR LINUX branch still passed the linker map path through LINK_FLAGS, a space-delimited property, so a build path containing spaces broke the final link. The -Wl,-Map=<path> option is now passed via target_link_options, which CMake forwards to the linker as a single argument.

Problem

With the source and build directories under a path containing a space (e.g. /home/user/Documents/future pro/KytyPS5), a clean Release build failed at the final emulator link:

clang++: error: no such file or directory: 'pro/KytyPS5/_Build/linux/kyty_emulator_clang_lld.map'

LINK_FLAGS is split on whitespace, so .../future pro/...map became two arguments and lld received a truncated path (pro/...).

Testing

  • Clean Release configure and full build (emulator + launcher, clang/lld) in a path containing a space: previously failed at the final link, now completes.
  • The linker map file is produced at the expected full path.
  • kyty_emulator and the launcher run; Ghost Song (PPSA09232) boots to controllable gameplay.

AI disclosure

I used AI (OpenCode) to investigate the failure, prepare the patch and run the build. I reviewed the change, the reproduction and this description before submitting.

**@⁠6d4m** on GitHub · 2026-09-24 13:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/806) `6d4m:cmake-link-map-path-spaces` → `main` · +4 −1 · 1 files · 1 commits · merged 2026-09-24 17:23 UTC ## Summary Completes the non-clang-cl side of #26. The `WIN32 OR LINUX` branch still passed the linker map path through `LINK_FLAGS`, a space-delimited property, so a build path containing spaces broke the final link. The `-Wl,-Map=<path>` option is now passed via `target_link_options`, which CMake forwards to the linker as a single argument. ## Problem With the source and build directories under a path containing a space (e.g. `/home/user/Documents/future pro/KytyPS5`), a clean Release build failed at the final emulator link: ``` clang++: error: no such file or directory: 'pro/KytyPS5/_Build/linux/kyty_emulator_clang_lld.map' ``` `LINK_FLAGS` is split on whitespace, so `.../future pro/...map` became two arguments and lld received a truncated path (`pro/...`). ## Testing - Clean Release configure and full build (emulator + launcher, clang/lld) in a path containing a space: previously failed at the final link, now completes. - The linker map file is produced at the expected full path. - `kyty_emulator` and the launcher run; Ghost Song (PPSA09232) boots to controllable gameplay. ## AI disclosure I used AI (OpenCode) to investigate the failure, prepare the patch and run the build. I reviewed the change, the reproduction and this description before submitting.
LINK_FLAGS is a space-delimited string, so when the build path contains
spaces the linker map option is split into bogus arguments and the final
link fails:

  clang++: error: no such file or directory:
  'pro/KytyPS5/_Build/linux/kyty_emulator_clang_lld.map'

Move -Wl,-Map=<path> out of LINK_FLAGS into target_link_options, which
CMake passes to the linker as a single argument. This completes #26 for
the WIN32 OR LINUX branch (clang/gcc builds); the clang-cl branch was
already converted there.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:33:03 +00:00
github manually merged commit 303bdce32a into gh-pr/806/base 2026-11-26 09:33:06 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-24 13:59 UTC · original

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5735d7ce-6ebf-45c2-b940-dbca9ba1c94f

📥 Commits

Reviewing files that changed from the base of the PR and between 2aaf0c9ba3 and 303bdce32a.

📒 Files selected for processing (1)
  • CMakeLists.txt

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

For kyty_emulator on Windows and Linux, the map-file linker option is now passed separately through target_link_options. KYTY_LD_OPTIONS remains in LINK_FLAGS.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 303bd

The map-file option is passed separately while existing linker settings remain intact; no actionable merge risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: passing the -Map linker option separately for non-clang-cl builds.
Description check ✅ Passed The description directly explains the path-with-spaces link failure, the target_link_options fix, and the reported validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-24 13:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/806#issuecomment-5815560866) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/806"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `5735d7ce-6ebf-45c2-b940-dbca9ba1c94f` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2aaf0c9ba3a4322a219b60a254a882716440bb36 and 303bdce32a158ca3c4114c73e6fc50963e042c7a. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `CMakeLists.txt` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough For `kyty_emulator` on Windows and Linux, the map-file linker option is now passed separately through `target_link_options`. `KYTY_LD_OPTIONS` remains in `LINK_FLAGS`. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"303bdce32a158ca3c4114c73e6fc50963e042c7a" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `303bd` <!-- final_review_risk_coverage:{"sourceCommitId":"303bdce32a158ca3c4114c73e6fc50963e042c7a","coveredCommitId":"303bdce32a158ca3c4114c73e6fc50963e042c7a","kind":"reviewed"} --> The map-file option is passed separately while existing linker settings remain intact; no actionable merge risk is evident. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main change: passing the `-Map` linker option separately for non-`clang-cl` builds. | | Description check | ✅ Passed | The description directly explains the path-with-spaces link failure, the `target_link_options` fix, and the reported validation results. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0… | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.