#!/bin/bash export LC_ALL=C set -e CC="${CC:-cc}" CXX="${CXX:-c++}" GCC="${GCC:-gcc}" GXX="${GXX:-g++}" OBJDUMP="${OBJDUMP:-objdump}" MACHINE="${MACHINE:-$(uname -m)}" testname=$(basename "$0" .sh) echo -n "Testing $testname ... " cd "$(dirname "$0")"/../.. mold="$(pwd)/mold" t=out/test/elf/$testname mkdir -p $t [ $MACHINE = x86_64 ] || { echo skipped; exit; } cat < int main() { printf("Hello world\n"); return 0; } EOF $CC -B. -no-pie -o $t/exe1 $t/a.o -Wl,--image-base=0x8000000 $QEMU $t/exe1 | grep -q 'Hello world' readelf -W --sections $t/exe1 | grep -Eq '.interp\s+PROGBITS\s+0000000008000...\b' cat <