1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/macho/hello.sh

24 lines
384 B
Bash
Raw Normal View History

2021-09-08 13:15:12 +03:00
#!/bin/bash
set -e
cd $(dirname $0)
mold=`pwd`/../../ld64.mold
echo -n "Testing $(basename -s .sh $0) ... "
2021-10-04 12:57:26 +03:00
t=$(pwd)/../../out/test/macho/$(basename -s .sh $0)
2021-09-08 13:15:12 +03:00
mkdir -p $t
2021-10-04 11:35:53 +03:00
cat <<EOF | cc -o $t/a.o -c -xc -
#include <stdio.h>
2021-10-04 12:57:26 +03:00
void hello() {
2021-10-04 11:35:53 +03:00
printf("Hello world\n");
}
2021-10-04 12:57:26 +03:00
int main() {
hello();
}
2021-10-04 11:35:53 +03:00
EOF
clang -fuse-ld=$mold -o $t/hello $t/a.o
2021-09-28 15:55:37 +03:00
$t/hello | grep -q 'Hello world'
2021-09-08 13:15:12 +03:00
echo OK