diff mbox series

binutils-testsuite: Set CC_FOR_TARGET and CXX_FOR_TARGET in site.exp

Message ID 20260901123949.1932035-1-Hemanth.KumarMD@windriver.com
State Under Review
Headers show
Series binutils-testsuite: Set CC_FOR_TARGET and CXX_FOR_TARGET in site.exp | expand

Commit Message

Hemanth Kumar M D Sept. 1, 2026, 12:39 p.m. UTC
From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>

The recipe calls runtest directly, bypassing upstream's Makefile which
normally passes CC_FOR_TARGET/CXX_FOR_TARGET to the test harness.
Without them, dejagnu falls back to find_gcc() returning the bare
compiler name without --sysroot.

On ARM, ld-selective/selective.exp calls $CC_FOR_TARGET directly to
query -print-libgcc-file-name. Without --sysroot, OE's poisoned
cross-gcc cannot locate libgcc.a, failing selective1/2/3.

Set CC_FOR_TARGET/CXX_FOR_TARGET the same way CC/CXX already are.

Tested on qemuarm:

 ld:
  +--------------+--------+--------+------+
  | Result       | Before | After  | Diff |
  +--------------+--------+--------+------+
  | PASS         | 1173   | 1879   | +706 |
  | FAIL         | 3      | 0      | -3   |
  | XFAIL        | 8      | 57     | +49  |
  | XPASS        | 0      | 6      | +6   |
  | UNTESTED     | 22     | 4      | -18  |
  | UNSUPPORTED  | 153    | 417    | +264 |
  +--------------+--------+--------+------+

selective1/2/3 are ARM-specific and are fixed here. The larger
test-count increase is not ARM-specific: CC_FOR_TARGET without --sysroot
made check_compiler_available fail, silently skipping many sub-tests
across all architectures. With the fix those tests run. Upstream bug
tracking the silent skipping:
https://sourceware.org/bugzilla/show_bug.cgi?id=34580

[YOCTO #16342]

Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
---
 meta/recipes-devtools/binutils/binutils-testsuite_2.47.bb | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/binutils/binutils-testsuite_2.47.bb b/meta/recipes-devtools/binutils/binutils-testsuite_2.47.bb
index 5369333434..2219da7c7a 100644
--- a/meta/recipes-devtools/binutils/binutils-testsuite_2.47.bb
+++ b/meta/recipes-devtools/binutils/binutils-testsuite_2.47.bb
@@ -51,6 +51,8 @@  python check_prepare() {
         content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
         content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
         content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
+        content.append(d.expand('set CC_FOR_TARGET "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
+        content.append(d.expand('set CXX_FOR_TARGET "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
         content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
         content.append(d.expand('set LD "${TARGET_PREFIX}ld ${TUNE_LDARGS}"'))
         content.append(d.expand('set LDFLAGS_FOR_TARGET "${TUNE_LDARGS}"'))