1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-24 17:01:50 +03:00
This commit is contained in:
Rui Ueyama 2021-03-04 14:09:56 +09:00
parent 0e908f7d8b
commit cc9c23e42b
2 changed files with 45 additions and 1 deletions

View File

@ -30,7 +30,7 @@ int main() {
} }
EOF EOF
cc -fuse-ld=gold -no-pie -o $t/exe $t/b.o $t/a.so clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/b.o $t/a.so
$t/exe | grep -q '3 4 0' $t/exe | grep -q '3 4 0'
echo OK echo OK

44
test/protected.sh Executable file
View File

@ -0,0 +1,44 @@
#!/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 | clang -fuse-ld=gold -shared -fPIC -o $t/a.so -xc -
int foo() __attribute__((visibility("protected")));
int bar() __attribute__((visibility("protected")));
void *baz() __attribute__((visibility("protected")));
int foo() {
return 4;
}
int bar() {
return foo();
}
void *baz() {
return baz;
}
EOF
cat <<EOF | cc -c -o $t/b.o -xc - -fno-PIE
#include <stdio.h>
int foo() {
return 3;
}
int bar();
void *baz();
int main() {
printf("%d %d %d\n", foo(), bar(), baz == baz());
}
EOF
clang -fuse-ld=`pwd`/../mold -no-pie -o $t/exe $t/b.o $t/a.so
$t/exe | grep -q '3 4 0'
echo OK