[PATCH v2] gas: add --reloc-section-sym={all, internal, none} option for ELF

Fangrui Song i@maskray.me
Wed Feb 25 06:20:46 GMT 2026


On Tue, Feb 24, 2026 at 8:08 PM Hans-Peter Nilsson <hp@bitrange.com> wrote:
>
> On Tue, 24 Feb 2026, Fangrui Song wrote:
>
> > equ-reloc on 45 targets
>
> > SKIP  (1):  mmix-mmixware:no-results
>
> Huh?  Oh right, the proc is_elf_format gate returns false for
> mmix; not specifically, but by default, target tuple not ending
> in *elf and such.  The object format is indeed ELF64 but the
> default output format for the linker is mmo, so perhaps best
> left as-is or else more work needs to be done.
>
> In case anyone wondered about that.
>
> brgds, H-P

OK. I don't know what MMO is.  I think mmix-* tests are disabled due
to `proc is_elf_format` (binutils/testsuite/lib/binutils-common.exp)



test_pattern="$1"
srcdir="${2:-$(cd "$(dirname "$0")" && pwd)}"
buildroot="${srcdir}/out/cross"
jobs="${JOBS:-$(nproc)}"

# Every architecture referenced in elf.exp, mapped to a concrete
--target triplet.
# This covers the istarget checks, switch cases, setup_xfail lists, and
# the redef/equ-reloc exclusion block.
targets=(
  aarch64-linux-gnu alpha-linux-gnu am33_2.0-linux-gnu arc-linux-gnu
  arm-linux-gnueabi avr-elf bfin-elf cr16-elf cris-linux-gnu crx-elf
  csky-linux-gnu frv-linux-gnu h8300-elf hppa-linux-gnu i686-linux-gnu
  ia64-linux-gnu iq2000-elf kvx-linux-gnu loongarch64-linux-gnu m32r-linux-gnu
  m68hc11-elf m68k-linux-gnu mips64-linux-gnu mmix-mmixware mn10200-elf
  msp430-elf nds32le-linux-gnu or1k-linux-gnu ppc64-linux-gnu pru-elf
  riscv64-linux-gnu rl78-elf rx-elf s390x-linux-gnu score-elf sh-linux-gnu
  sparc64-linux-gnu tic6x-elf v850-elf vax-linux-gnu visium-elf
  x86_64-linux-gnu xgate-elf xtensa-elf z8k-elf
)

pass=()
fail=()
xfail=()
skip=()

Then I run:

pass=()
fail=()
xfail=()
skip=()

for target in "${targets[@]}"; do
  dir="${buildroot}/${target}"
  echo "================================================================"
  echo "=== ${target}"
  echo "================================================================"

  # Configure if needed.
  if [ ! -f "${dir}/Makefile" ]; then
    mkdir -p "${dir}"
    if ! (cd "${dir}" && "${srcdir}/configure" --target="${target}" \
      --disable-gdb --disable-ld --disable-gold --disable-gprofng \
      --disable-libctf --disable-sim --disable-readline \
      --disable-libdecnumber > configure.log 2>&1); then
      echo "*** CONFIGURE FAILED: ${target}"
      skip+=("${target}")
      continue
    fi
  fi

  # Build gas and objdump (needed by tests).
  make -C "${dir}" -j "${jobs}" all-gas configure-binutils >
"${dir}/build.log" 2>&1 \
    && make -C "${dir}/binutils" -j "${jobs}" objdump >> "${dir}/build.log" 2>&1
  if [ $? -ne 0 ]; then
    tail -5 "${dir}/build.log"
    echo "*** BUILD FAILED: ${target}"
    fail+=("${target}:build")
    continue
  fi

  # Run the specified tests.
  make -C "${dir}" check-gas RUNTESTFLAGS="elf.exp=${test_pattern}" >
"${dir}/test.log" 2>&1 || true

  # Check results from the log.
  logfile="${dir}/gas/testsuite/gas.log"
  our_fail=$(grep -cE '^FAIL:' "${logfile}" 2>/dev/null || true)
  our_xfail=$(grep -cE '^XFAIL:' "${logfile}" 2>/dev/null || true)
  our_pass=$(grep -cE '^X?PASS:' "${logfile}" 2>/dev/null || true)
  grep -E '^(X?PASS|X?FAIL):' "${logfile}" 2>/dev/null || true

  if [ "${our_fail}" -gt 0 ]; then
    fail+=("${target}")
  elif [ "${our_xfail}" -gt 0 ]; then
    xfail+=("${target}")
  elif [ "${our_pass}" -gt 0 ]; then
    pass+=("${target}")
  else
    skip+=("${target}:no-results")
  fi
done

echo "================================================================"
echo "=== SUMMARY"
echo "================================================================"
echo "PASS  (${#pass[@]}):  ${pass[*]:-}"
echo "XFAIL (${#xfail[@]}): ${xfail[*]:-}"
echo "FAIL  (${#fail[@]}):  ${fail[*]:-}"
echo "SKIP  (${#skip[@]}):  ${skip[*]:-}"

─% du -sh out/cross/
3.8G    out/cross/

% ls out/cross/
aarch64-linux-gnu   arc-linux-gnu      bfin-elf        crx-elf
h8300-elf       ia64-linux-gnu  loongarch64-linux-gnu  m68k-linux-gnu
  mn10200-elf  nds32le-linux-gnu  ppc64-linux-gnu    rl78-elf
score-elf          tic6x-elf      visium-elf        xtensa-elf
alpha-linux-gnu     arm-linux-gnueabi  cr16-elf        csky-linux-gnu
hppa-linux-gnu  iq2000-elf      m32r-linux-gnu
mips64-linux-gnu  msp430-elf   or1k-elf           pru-elf
rx-elf           sh-linux-gnu       v850-elf       x86_64-linux-gnu
z8k-elf
am33_2.0-linux-gnu  avr-elf            cris-linux-gnu  frv-linux-gnu
i686-linux-gnu  kvx-linux-gnu   m68hc11-elf            mmix-mmixware
  nds32le-elf  or1k-linux-gnu     riscv64-linux-gnu  s390x-linux-gnu
sparc64-linux-gnu  vax-linux-gnu  xgate-elf


I noticed that RUNTESTFLAGS="elf.exp=${test_pattern}" did not properly
skip some tests, so I created
https://sourceware.org/pipermail/binutils/2026-February/148353.html
[PATCH] gas/testsuite: add runtest_file_p filtering to run_list_test
and run_elf_list_test


More information about the Binutils mailing list