mirror of
https://github.com/rui314/mold.git
synced 2024-10-04 00:31:41 +03:00
27 lines
502 B
Bash
Executable File
27 lines
502 B
Bash
Executable File
#!/bin/bash
|
|
. $(dirname $0)/common.inc
|
|
|
|
cat <<EOF | $CC -fcommon -xc -c -o $t/a.o - -Wa,--elf-stt-common=yes 2> /dev/null || skip
|
|
int foo;
|
|
int bar;
|
|
int baz = 42;
|
|
EOF
|
|
|
|
cat <<EOF | $CC -fcommon -xc -c -o $t/b.o - -Wa,--elf-stt-common=yes
|
|
#include <stdio.h>
|
|
|
|
int foo;
|
|
int bar = 5;
|
|
int baz;
|
|
|
|
int main() {
|
|
printf("%d %d %d\n", foo, bar, baz);
|
|
}
|
|
EOF
|
|
|
|
$CC -B. -o $t/exe $t/a.o $t/b.o -Wl,--fatal-warnings
|
|
$QEMU $t/exe | grep -q '0 5 42'
|
|
|
|
readelf --sections $t/exe > $t/log
|
|
grep -q '.common .*NOBITS' $t/log
|