mirror of
https://github.com/rui314/mold.git
synced 2024-10-04 16:48:04 +03:00
bb5a596bc5
We unset `LANG`, but it looks like `LC_ALL` takes precedence over `LANG`, so we should set `LC_ALL` to `C`. Reported at https://github.com/rui314/mold/pull/385
50 lines
955 B
Bash
Executable File
50 lines
955 B
Bash
Executable File
#!/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
|
|
|
|
echo 'int main() {}' | $CC -m32 -o $t/exe -xc - >& /dev/null \
|
|
|| { echo skipped; exit; }
|
|
|
|
cat <<EOF | $CC -m32 -c -o $t/a.o -xc -
|
|
char hello[] = "Hello world";
|
|
EOF
|
|
|
|
mkdir -p $t/lib32
|
|
$CC -m32 -shared -o $t/lib32/libfoo.so $t/a.o
|
|
|
|
cat <<EOF | $CC -c -o $t/d.o -xc -
|
|
char hello[] = "Hello world";
|
|
EOF
|
|
|
|
mkdir -p $t/lib64
|
|
$CC -shared -o $t/lib64/libfoo.so $t/d.o
|
|
|
|
cat <<EOF | $CC -c -o $t/e.o -xc -
|
|
#include <stdio.h>
|
|
|
|
extern char hello[];
|
|
|
|
int main() {
|
|
printf("%s\n", hello);
|
|
}
|
|
EOF
|
|
|
|
mkdir -p $t/script
|
|
echo 'GROUP(libfoo.so)' > $t/script/libfoo.so
|
|
|
|
$CC -B. -o $t/exe -L$t/lib32 -L$t/lib64 -lfoo $t/e.o -Wl,-rpath $t/lib64 \
|
|
>& $t/log
|
|
|
|
grep -q 'lib32/libfoo.so: skipping incompatible file' $t/log
|
|
$t/exe | grep -q 'Hello world'
|
|
|
|
echo OK
|