https://bugs.kde.org/show_bug.cgi?id=510193

            Bug ID: 510193
           Summary: Valgrind (3.25.1) fails to start on riscv64:
                    "must-be-redirected function ... strcmp" for
                    ld-linux-riscv64-lp64d.so.1
    Classification: Developer tools
           Product: valgrind
      Version First 3.25.1
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: memcheck
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

# Description (paste this into the bug description)

When running tests under CTest (valgrind-run-test) on a riscv64 Arch/WSL2
environment, Valgrind (3.25.1) aborts at startup with:
```
Starting check()... Running tests... Test project
/build/chewing-editor/src/build Connected to MAKE jobserver Start 1: test 1/2
Test #1: test ............................. Passed 0.02 sec Start 2:
valgrind-run-test 2/2 Test #2: valgrind-run-test ................***Failed 0.64
sec 50% tests passed, 1 tests failed out of 2 Total Test time (real) = 0.66 sec
The following tests FAILED: 2 - valgrind-run-test (Failed) Errors while running
CTest Output from these tests are in:
/build/chewing-editor/src/build/Testing/Temporary/LastTest.log Use
"--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
make: *** [Makefile:91: test] Error 8 ==> ERROR: A failure occurred in check().
Aborting... make test
```
Try to output the most detailed information
```
ctest -R valgrind-run-test --output-on-failure -V

...
2: ==1690== Memcheck, a memory error detector
2: ==1690== Using Valgrind-3.25.1 and LibVEX; rerun with -h for copyright info
2: ==1690== Command: /build/chewing-editor/src/build/run-test
2:
2: valgrind:  Fatal error at startup: a function redirection
2: valgrind:  which is mandatory for this platform-tool combination
2: valgrind:  cannot be set up.  Details of the redirection are:
2: valgrind:
2: valgrind:  A must-be-redirected function
2: valgrind:  whose name matches the pattern:      strcmp
2: valgrind:  in an object with soname matching:   ld-linux-riscv64-lp64d.so.1
2: valgrind:  was not found whilst processing
2: valgrind:  symbols from the object with soname: ld-linux-riscv64-lp64d.so.1
2: valgrind:
2: valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
2: valgrind:  package on this machine.  (2, longer term): ask the packagers
2: valgrind:  for your Linux distribution to please in future ship a non-
2: valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
2: valgrind:  that exports the above-named function using the standard
2: valgrind:  calling conventions for this platform.  The package you need
2: valgrind:  to install for fix (1) is called ...
2: valgrind:  Cannot continue -- exiting now.  Sorry.
```
The test executable itself runs fine without Valgrind. The dynamic linker
/lib/ld-linux-riscv64-lp64d.so.1 on this system is stripped and does not export
the expected symbol(s) that Valgrind requires to set up function redirection.

# STEPS TO REPRODUCE
1. `pkgctl repo clone chewing-editor`
2. change arch in PKGBUILD to riscv64
```
pkgname=chewing-editor
pkgver=0.1.2
pkgrel=1
pkgdesc="Cross platform chewing user phrase editor"
arch=(riscv64 x86_64)
url='https://chewing.im/'
# https://github.com/chewing/chewing-editor/blob/0.1.1/README.md?plain=1#L98
license=('GPL-2.0-or-later')
depends=('glibc' 'libchewing' 'qt5-base')
makedepends=('cmake' 'qt5-tools' 'help2man' 'gtest' 'gmock')
checkdepends=('valgrind')
source=("https://github.com/chewing/$pkgname/archive/$pkgver/$pkgname-$pkgver.tar.gz";)
```
3. `extra-riscv64-build  `
4. enter the chroot 
5. `cd /build/chewing-editor/src/build` `ctest -R valgrind-run-test
--output-on-failure -V`

# OBSERVED RESULT
ctest runs two tests: the plain test passes, the valgrind-run-test fails
immediately because Valgrind cannot start.

Valgrind prints the fatal startup error about a required function redirection
(looking for strcmp in ld-linux-riscv64-lp64d.so.1) and exits.

Running the test binary directly (without Valgrind) shows all tests pass (so
the binary itself is not crashing).

Attempts to enable debuginfod (installed elfutils, exported DEBUGINFOD_URLS)
did not resolve the problem — Valgrind still reports the same startup error.

file /lib/ld-linux-riscv64-lp64d.so.1 reports the loader as stripped.

# EXPECTED RESULT
Valgrind memcheck should start successfully and run the test binary, or at
least fail with a more actionable message if the platform packaging truly
prevents the needed redirections.

# SOFTWARE/OS VERSIONS
Host: Linux archriscv1 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC
Thu Jun 5 18:30:46 UTC 2025 riscv64 GNU/Linux

Valgrind: valgrind-3.25.1 (/usr/sbin/valgrind — reported as stripped)

Dynamic linker: /lib/ld-linux-riscv64-lp64d.so.1 (exists; file reports it is
stripped)

Distribution / Packaging environment: Arch Linux on WSL2/riscv64 (using pacman)


# ADDITIONAL INFORMATION
1.installed elfutils and attempted to enable debuginfod via:
source /etc/profile.d/debuginfod.sh || true
export DEBUGINFOD_URLS="https://debuginfod.archlinux.org
https://debuginfod.elfutils.org";
Re-running ctest produced the same Valgrind startup error.
2.https://bbs.archlinux.org/viewtopic.php?id=286179 is about the same problem.I
tried and found them useless.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to