1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 18:40:59 +03:00
mold/test/canonical-plt.sh

28 lines
421 B
Bash
Raw Normal View History

2021-03-01 17:33:53 +03:00
#!/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 <<EOF | cc -o $t/a.so -fPIC -shared -xc -
void *foo() {
return foo;
}
EOF
cat <<EOF | cc -o $t/b.o -c -xc - -fno-PIC
#include <stdio.h>
void *foo();
int main() {
printf("%d\n", foo == foo());
}
EOF
clang -fuse-ld=`pwd`/../mold -o $t/exe $t/a.so $t/b.o
2021-03-02 14:24:31 +03:00
$t/exe | grep -q 1
2021-03-01 17:33:53 +03:00
echo OK