fix(build): link the ATRAC9 gradient test with libm #9710

Merged
milescoviello merged 1 commit from upstream-pr/9710 into main 2026-10-25 22:09:23 +00:00
milescoviello commented 2026-10-22 09:30:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T09:30:01Z.


What

atrac9_gradient_tests doesn't link in an ANYPS5_ENABLE_ASAN build, so ctest reports atrac9_gradient as "Not Run":

/usr/bin/x86_64-linux-gnu-ld.bfd: core/libs/prx/libSceAjm.native/libatrac9.a(band_extension.c.o): undefined reference to symbol 'pow@@GLIBC_2.29'
/usr/bin/x86_64-linux-gnu-ld.bfd: /usr/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line

How

The test is a C program linked against the static atrac9 library, whose band_extension.c calls pow, and it never listed libm.

  • The default Linux build links tests statically with --gc-sections. That drops the band extension code the test never reaches, so pow never has to resolve.
  • A shared link, as in the ASan build, resolves symbols first. ld finds pow only in the libm.so.6 that libasan.so.8 lists as NEEDED, and refuses an indirect dependency.

The test now links m outside Windows, as atrac9_config_data_tests next to it already does.

Tested

Rebased onto main 093149c5bd as 2fee42278f, with no conflicts; git range-diff shows the commit unchanged. On that head, atrac9_gradient links and passes 3 of 3 in the ASan build, and 3 of 3 in the default Release build.

Ubuntu 26.04.1, GCC 15.2, on main 7e2ba73e4c:

  • ANYPS5_ENABLE_ASAN=ON (RelWithDebInfo), cmake --build --target atrac9_gradient_tests:
    • main: the link fails with the error above.
    • With this change: it links, and ctest -R '^atrac9_gradient$' --repeat until-fail:3 passes.
  • Default Release build with BUILD_TESTING=ON: the target still links and the test passes 3 of 3.
  • tools/check_conventions.py --base upstream/main passes. The overlap scan lists only #6044, which conflicts with main.

This was one of five failures in a full ASan run of the CPU-side suites on main d6eafa54d0 (1161 tests). Three others are already covered: #9236, #9238 and #9240. The fifth, input_magic, is #9711.

Not tested: Windows (unchanged there), macOS.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: none needed (test link only)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4965179923 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9710). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T09:30:01Z. --- ### What `atrac9_gradient_tests` doesn't link in an `ANYPS5_ENABLE_ASAN` build, so ctest reports `atrac9_gradient` as "Not Run": ``` /usr/bin/x86_64-linux-gnu-ld.bfd: core/libs/prx/libSceAjm.native/libatrac9.a(band_extension.c.o): undefined reference to symbol 'pow@@GLIBC_2.29' /usr/bin/x86_64-linux-gnu-ld.bfd: /usr/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line ``` ### How The test is a C program linked against the static `atrac9` library, whose `band_extension.c` calls `pow`, and it never listed `libm`. - The default Linux build links tests statically with `--gc-sections`. That drops the band extension code the test never reaches, so `pow` never has to resolve. - A shared link, as in the ASan build, resolves symbols first. `ld` finds `pow` only in the `libm.so.6` that `libasan.so.8` lists as `NEEDED`, and refuses an indirect dependency. The test now links `m` outside Windows, as `atrac9_config_data_tests` next to it already does. ### Tested **Rebased** onto `main` 093149c5bd as `2fee42278f`, with no conflicts; `git range-diff` shows the commit unchanged. On that head, `atrac9_gradient` links and passes 3 of 3 in the ASan build, and 3 of 3 in the default Release build. Ubuntu 26.04.1, GCC 15.2, on `main` 7e2ba73e4c: - `ANYPS5_ENABLE_ASAN=ON` (RelWithDebInfo), `cmake --build --target atrac9_gradient_tests`: - `main`: the link fails with the error above. - With this change: it links, and `ctest -R '^atrac9_gradient$' --repeat until-fail:3` passes. - Default Release build with `BUILD_TESTING=ON`: the target still links and the test passes 3 of 3. - `tools/check_conventions.py --base upstream/main` passes. The overlap scan lists only #6044, which conflicts with `main`. This was one of five failures in a full ASan run of the CPU-side suites on `main` d6eafa54d0 (1161 tests). Three others are already covered: #9236, #9238 and #9240. The fifth, `input_magic`, is #9711. Not tested: Windows (unchanged there), macOS. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: none needed (test link only) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-22 12:08:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:08:41Z.

Review: COMMENTED


Reviewed exact head 73f999a5982ea2be4b2d5ce8ad93dc22836df795. The change adds m only to the non-Windows gradient test target, which is the narrow platform-aware link fix for the direct pow dependency; it leaves the existing dead-code elimination and test behavior intact. Current conventions and diff checks pass, and the merge is clean. The reported ASan red/green plus three repeated ASan and Release runs are useful; I could not rerun locally because there is no configured build tree and the filesystem is full. GitHub currently has conventions/intake/labels/report checks passing, with the product/relinker jobs skipped. Please update this 13-commits-behind branch to current main and confirm the focused link/test result there before approval. I found no code-level defect.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613884210 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9710#pullrequestreview-5613884210). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T12:08:41Z. **Review:** COMMENTED --- Reviewed exact head 73f999a5982ea2be4b2d5ce8ad93dc22836df795. The change adds `m` only to the non-Windows gradient test target, which is the narrow platform-aware link fix for the direct `pow` dependency; it leaves the existing dead-code elimination and test behavior intact. Current conventions and diff checks pass, and the merge is clean. The reported ASan red/green plus three repeated ASan and Release runs are useful; I could not rerun locally because there is no configured build tree and the filesystem is full. GitHub currently has conventions/intake/labels/report checks passing, with the product/relinker jobs skipped. Please update this 13-commits-behind branch to current main and confirm the focused link/test result there before approval. I found no code-level defect.
milescoviello commented 2026-10-22 12:29:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T12:29:58Z.


@MarcZX10 rebased onto main 8b3a6ba88d as 65461aa1ba, with no conflicts; the commit is unchanged. On that head, atrac9_gradient links and passes 3 of 3 in the ASan build, and 3 of 3 in the default Release build. Tested names the head.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340771671 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9710#issuecomment-6340771671). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-22T12:29:58Z. --- @MarcZX10 rebased onto `main` 8b3a6ba88d as `65461aa1ba`, with no conflicts; the commit is unchanged. On that head, `atrac9_gradient` links and passes 3 of 3 in the ASan build, and 3 of 3 in the default Release build. Tested names the head. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-22 15:44:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T15:44:20Z.

Review: DISMISSED


I reviewed exact head 65461aa1ba6f0d653a09b4840b0c5216b551ca88. The platform guard around linking m is narrowly scoped and is the normal fix for a direct pow dependency. Conventions and diff checks pass. The PR reports three passing ASan and Release runs; the hosted current-head jobs here cover eligibility/conventions/labels/report but skip product builds, so I could not independently verify the link or runtime test in this environment.

Before merge:

  1. Update to current main and rerun the focused ASan link/test. This branch is 50 commits behind current main, and CONTRIBUTING.md requires branches to stay current. The intervening main commits do not touch this CMake file.
  2. Coordinate with open #6044. It changes core/libs/prx/libSceAjm.native/CMakeLists.txt and removes the atrac9 link from atrac9_gradient_tests while changing the test registration. A merge-tree check between the two heads reports a content conflict in this file. Please agree which sources/libraries the final test should link, update the registration/link change on that order, and declare Depends on if it requires #6044 first.

I found no issue with the m link itself; the main open items are current-main validation and the concrete #6044 conflict.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5616911605 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9710#pullrequestreview-5616911605). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T15:44:20Z. **Review:** DISMISSED --- I reviewed exact head 65461aa1ba6f0d653a09b4840b0c5216b551ca88. The platform guard around linking m is narrowly scoped and is the normal fix for a direct pow dependency. Conventions and diff checks pass. The PR reports three passing ASan and Release runs; the hosted current-head jobs here cover eligibility/conventions/labels/report but skip product builds, so I could not independently verify the link or runtime test in this environment. Before merge: 1. Update to current main and rerun the focused ASan link/test. This branch is 50 commits behind current main, and CONTRIBUTING.md requires branches to stay current. The intervening main commits do not touch this CMake file. 2. Coordinate with open #6044. It changes core/libs/prx/libSceAjm.native/CMakeLists.txt and removes the atrac9 link from atrac9_gradient_tests while changing the test registration. A merge-tree check between the two heads reports a content conflict in this file. Please agree which sources/libraries the final test should link, update the registration/link change on that order, and declare Depends on if it requires #6044 first. I found no issue with the m link itself; the main open items are current-main validation and the concrete #6044 conflict.
THEMANnt commented 2026-10-25 04:22:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T04:22:14Z.

Review: APPROVED


Reviewed 9c73da714bc61f0b06dbc78a144e087d6affb25e against cf528e78c6c8fd30696ccfca6c097f9828be2cf6. No actionable findings in this focused review.

Source review: Inspected the complete three-line link change, surrounding ATRAC9 targets and gradient test source. The dependency is private to the gradient executable and follows the neighboring config-data test's existing non-Windows libm pattern. The library order retains atrac9 before m; Windows behavior is unchanged.

Validation: Disposable CMake 4.3.1 projects using the exact submitted link fragment generated successfully for both WIN32 conditional values on head and baseline. Head yields atrac9;m only in the non-Windows branch; baseline yields atrac9 in both. These are conditional-generation checks on Windows, not Linux execution. Conventions, whitespace and script registration passed. Hosted metadata/conventions succeeded; native/relinker jobs were skipped.

Scope: Approval covers the bounded build dependency correction. No Linux/macOS link or ATRAC9 runtime pass is claimed; WSL is not installed on this host. No application/game test.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641475681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9710#pullrequestreview-5641475681). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-25T04:22:14Z. **Review:** APPROVED --- Reviewed `9c73da714bc61f0b06dbc78a144e087d6affb25e` against `cf528e78c6c8fd30696ccfca6c097f9828be2cf6`. No actionable findings in this focused review. **Source review:** Inspected the complete three-line link change, surrounding ATRAC9 targets and gradient test source. The dependency is private to the gradient executable and follows the neighboring config-data test's existing non-Windows libm pattern. The library order retains atrac9 before m; Windows behavior is unchanged. **Validation:** Disposable CMake 4.3.1 projects using the exact submitted link fragment generated successfully for both WIN32 conditional values on head and baseline. Head yields atrac9;m only in the non-Windows branch; baseline yields atrac9 in both. These are conditional-generation checks on Windows, not Linux execution. Conventions, whitespace and script registration passed. Hosted metadata/conventions succeeded; native/relinker jobs were skipped. **Scope:** Approval covers the bounded build dependency correction. No Linux/macOS link or ATRAC9 runtime pass is claimed; WSL is not installed on this host. No application/game test.
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!9710
No description provided.