#!/bin/bash set -e cd $(dirname $0) echo -n "Testing $(basename -s .sh $0) ... " t=$(pwd)/tmp/$(basename -s .sh $0) mkdir -p $t cat < $t/readelf fgrep -q 'Shared library: [libfoo.so]' $t/readelf fgrep -q 'Shared library: [libbar.so]' $t/readelf ../mold -o $t/exe $t/a.o --as-needed $t/b.so $t/c.so readelf --dynamic $t/exe > $t/readelf fgrep -q 'Shared library: [libfoo.so]' $t/readelf ! fgrep -q 'Shared library: [libbar.so]' $t/readelf || false echo OK