#!/bin/bash export LC_ALL=C set -e CC="${CC:-cc}" CXX="${CXX:-c++}" testname=$(basename "$0" .sh) echo -n "Testing $testname ... " cd "$(dirname "$0")"/../.. mold="$(pwd)/mold" t=out/test/elf/$testname mkdir -p $t cat < int main() { printf("Hello world\n"); return 0; } EOF $CC -B. -Wl,-build-id=sha1 $t/a.o -o - > $t/exe chmod 755 $t/exe $t/exe | grep -q 'Hello world' echo OK