File tree Expand file tree Collapse file tree 6 files changed +17
-13
lines changed Expand file tree Collapse file tree 6 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror dist-bzip2 foreign color-tests parallel-t
66AC_CONFIG_MACRO_DIR ( [ m4] )
77
88AC_CHECK_TOOL ( [ STRIP] , [ strip] )
9+ # Those are only used in tests, hence we gracefully degrate if they are not found.
10+ AC_CHECK_TOOL ( [ OBJDUMP] , [ objdump] , [ objdump] )
11+ AC_CHECK_TOOL ( [ OBJCOPY] , [ objcopy] , [ objcopy] )
12+ AC_CHECK_TOOL ( [ READELF] , [ readelf] , [ readelf] )
913
1014AM_PROG_CC_C_O
1115AC_PROG_CXX
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ TESTS = $(src_TESTS) $(build_TESTS)
5252
5353EXTRA_DIST = no-rpath-prebuild $(src_TESTS ) no-rpath-prebuild.sh invalid-elf endianness empty-note
5454
55- TESTS_ENVIRONMENT = PATCHELF_DEBUG=1
55+ TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 OBJDUMP= $( OBJDUMP ) READELF= $( READELF )
5656
5757$(no_rpath_arch_TESTS ) : no-rpath-prebuild.sh
5858 @ln -s $< $@
Original file line number Diff line number Diff line change 11#! /bin/sh -e
22SCRATCH=scratch/$( basename $0 .sh)
3+ READELF=${READELF:- readelf}
34
45rm -rf ${SCRATCH}
56mkdir -p ${SCRATCH}
67
78cp libsimple.so ${SCRATCH} /
89
910# check there is no DT_DEBUG tag
10- debugTag=$( readelf -d ${SCRATCH} /libsimple.so)
11+ debugTag=$( $READELF -d ${SCRATCH} /libsimple.so)
1112echo " .dynamic before: $debugTag "
1213if echo " $debugTag " | grep -q DEBUG; then
1314 echo " failed --add-debug-tag test. Expected no line with (DEBUG), got: $debugTag "
1819../src/patchelf --add-debug-tag ${SCRATCH} /libsimple.so
1920
2021# check there is DT_DEBUG tag
21- debugTag=$( readelf -d ${SCRATCH} /libsimple.so)
22+ debugTag=$( $READELF -d ${SCRATCH} /libsimple.so)
2223echo " .dynamic before: $debugTag "
2324if ! echo " $debugTag " | grep -q DEBUG; then
2425 echo " failed --add-debug-tag test. Expected line with (DEBUG), got: $debugTag "
Original file line number Diff line number Diff line change 11#! /bin/sh -e
22SCRATCH=scratch/$( basename $0 .sh)
3-
4- if ! command -v readelf > /dev/null; then
5- echo " No readelf found; skip test"
6- exit 0
7- fi
3+ READELF=${READELF:- readelf}
84
95rm -rf " ${SCRATCH} "
106mkdir -p " ${SCRATCH} "
Original file line number Diff line number Diff line change 11#! /bin/sh -e
22SCRATCH=scratch/$( basename $0 .sh)
3+ OBJDUMP=${OBJDDUMP:- objdump}
34
45rm -rf ${SCRATCH}
56mkdir -p ${SCRATCH}
@@ -13,7 +14,7 @@ doit() {
1314}
1415
1516expect () {
16- out=$( echo $( objdump -x $SCRATCHFILE | grep PATH) )
17+ out=$( echo $( $OBJDUMP -x $SCRATCHFILE | grep PATH) )
1718
1819 if [ " $out " != " $* " ]; then
1920 echo " Expected '$* ' but got '$out '"
Original file line number Diff line number Diff line change 11#! /bin/sh -e
22
3- if ! objdump -p main | grep -q MIPS_RLD_MAP_REL; then
3+ SCRATCH=scratch/$( basename $0 .sh)
4+ OBJDUMP=${OBJDUMP:- objdump}
5+ OBJCOPY=${OBJCOPY:- objcopy}
6+
7+ if ! $OBJDUMP -p main | grep -q MIPS_RLD_MAP_REL; then
48 echo " No MIPS_RLD_MAP_REL dynamic section entry, skipping"
59 exit 0
610fi
711
8- SCRATCH=scratch/$( basename $0 .sh)
9-
1012rm -rf ${SCRATCH}
1113mkdir -p ${SCRATCH}
1214mkdir -p ${SCRATCH} /libsA
@@ -17,7 +19,7 @@ cp libfoo.so ${SCRATCH}/libsA/
1719cp libbar.so ${SCRATCH} /libsB/
1820
1921# break the main executable by removing .rld_map section
20- objcopy --remove-section .rld_map ${SCRATCH} /main
22+ ${OBJCOPY} --remove-section .rld_map ${SCRATCH} /main
2123
2224oldRPath=$( ../src/patchelf --print-rpath ${SCRATCH} /main)
2325if test -z " $oldRPath " ; then oldRPath=" /oops" ; fi
You can’t perform that action at this time.
0 commit comments