aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/functions.sh
blob: 89d996a52a23a7b4b75ed8285fec2efa431f46fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
CC="${CC:-gcc} ${LINKOPTS}"
CCLINK=${CCLINK:-${CC} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
CXX="${CXX:-g++} ${LINKOPTS}"
CXXLINK=${CXXLINK:-${CXX} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
PRELINK=${PRELINK:-../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]` --rtld=../src/rtld/prelink-rtld}

# force deterministic timestamps to make double prelinking
# to produce unmodified binary.
PRELINK_TIMESTAMP=${PRELINK_TIMESTAMP:-12345678}
export PRELINK_TIMESTAMP

LDD=${LDD:-../src/rtld/prelink-rtld}
STRIP=${STRIP:-strip}
HOST_CC=${HOST_CC:-$CC}
READELF=${READELF:-readelf}
RUN=${RUN:-env}
RUN_HOST=${RUN_HOST:-env}
srcdir=${srcdir:-`dirname $0`}
savelibs() {
  for i in $LIBS $BINS; do cp -p $i $i.orig; done
}
comparelibs() {
  for i in $LIBS $BINS; do
    cp -p $i $i.new
    echo $PRELINK -u $i.new
    $RUN_HOST $PRELINK -u $i.new || exit
    cmp -s $i.orig $i.new || exit
    rm -f $i.new
    echo $PRELINK -y $i \> $i.new
    $RUN_HOST $PRELINK -y $i > $i.new || exit
    cmp -s $i.orig $i.new || exit
    rm -f $i.new
  done
}