testrun_on_self_exe ${abs_top_builddir}/src/elfclassify --loadable
testrun_on_self_exe ${abs_top_builddir}/src/elfclassify --not-shared
-testrun ${abs_top_builddir}/src/elfclassify --not-shared $self_test_files_obj
-testrun ${abs_top_builddir}/src/elfclassify --not-executable $self_test_files_obj
+# Check if the object files are actually ELF files (could be bitcode lto)
+if ${abs_top_builddir}/src/elfclassify -v --elf $self_test_files_obj; then
+ testrun ${abs_top_builddir}/src/elfclassify --not-shared $self_test_files_obj
+ testrun ${abs_top_builddir}/src/elfclassify --not-executable $self_test_files_obj
+else
+ echo "*** Skipping testing not ELF files $self_test_files_obj"
+fi
for self_file in $ET_REL $ET_EXEC $ET_DYN; do
# --dynamic doesn't make sense for ET_REL.
if ! test "$what_arg" = "--dynamic" -a "$self_file" = "$ET_REL"; then
- testrun ${abs_top_builddir}/src/nm $what_arg $format_arg $out_arg $self_file > /dev/null
+ if is_obj_bitcode "$self_file"; then
+ echo "*** skipping bitcode file $self_file"
+ else
+ testrun ${abs_top_builddir}/src/nm $what_arg $format_arg $out_arg $self_file > /dev/null
+ fi
fi
done
done
# Only really makes sense for ET_REL files, but try all, just to check
# it also works if we keep the order for the allocated sections.
for file in $self_test_files; do
- test_reverse_self $file
+ if is_obj_bitcode "$file"; then
+ echo "*** skipping bitcode file $file"
+ else
+ test_reverse_self $file
+ fi
done
exit 0
# Copy ET_REL file for self-test and make sure to run with/without
# elf section compression.
+if is_obj_bitcode ${abs_top_builddir}/src/strip.o; then
+ echo "*** skipping bitcode file"
+ exit $runtest_status
+fi
tempfiles strip-uncompressed.o strip-compressed.o
testrun ${abs_top_builddir}/src/elfcompress -o strip-uncompressed.o -t none \
${abs_top_builddir}/src/strip.o
# A random ET_REL file
input=${abs_top_builddir}/tests/elfstrmerge.o
+if is_obj_bitcode "$input"; then
+ echo "*** skipping bitcode file $self_file"
+ exit 0
+fi
merged=merged.elf
stripped=${merged}.stripped
debugfile=${merged}.debug
echo "runtest $infile"
+ if is_obj_bitcode "$infile"; then
+ echo "*** skipping bitcode file $infile"
+ return
+ fi
+
rm -f $outfile1 $debugfile1 $outfile2 $debugfile2
testrun ${abs_top_builddir}/src/strip -o $outfile1 -f $debugfile1 $infile ||
#! /bin/sh
# Copyright (C) 2005-2015, 2017 Red Hat, Inc.
+# Copyright (C) 2026 Mark J. Wielaard <mark@klomp.org>
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
echo "$*" | sed "${program_transform_name}"
}
+is_obj_bitcode()
+{
+ bcfile="$1"
+ BC=$(od -An -tx2 -N2 "$bcfile" | sed -e 's/^[[:space:]]*//')
+ if [ "'$BC'" = "'4342'" ]; then return 0; else return 1; fi
+}
+
self_test_files_exe=`echo ${abs_top_builddir}/src/addr2line \
${abs_top_builddir}/src/elfclassify \
${abs_top_builddir}/src/stack \
exit_status=0
for file in $self_test_files; do
+ if is_obj_bitcode "$file"; then
+ echo "*** skipping bitcode file in $* $file"
+ else
testrun $* $file \
|| { echo "*** failure in $* $file"; exit_status=1; }
+ fi
done
# Only exit if something failed
exit_status=0
for file in $self_test_files_obj; do
+ if is_obj_bitcode "$file"; then
+ echo "*** skipping bitcode file in $* $file"
+ else
testrun $* $file \
|| { echo "*** failure in $* $file"; exit_status=1; }
+ fi
done
# Only exit if something failed
exit_status=0
for file in $self_test_files; do
+ if is_obj_bitcode "$file"; then
+ echo "*** skipping bitcode file in $* $file"
+ else
tempfiles ${file}z
testrun ${abs_top_builddir}/src/elfcompress -f -q -o ${file}z ${file}
testrun ${abs_top_builddir}/src/elfcompress -f -q --name='.s??tab' ${file}z
testrun $* ${file}z \
|| { echo "*** failure in $* ${file}z"; exit_status=1; }
+ fi
done
# Only exit if something failed
exit_status=0
for file in $self_test_files; do
+ if is_obj_bitcode "$file"; then
+ echo "*** skipping bitcode file in $* $file"
+ else
testrun $* $file > /dev/null \
|| { echo "*** failure in $* $file"; exit_status=1; }
+ fi
done
# Only exit if something failed