1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 00:31:41 +03:00
mold/test/defsym-lto.sh
2024-09-02 14:58:30 +09:00

22 lines
328 B
Bash
Executable File

#!/bin/bash
. $(dirname $0)/common.inc
test_cflags -flto || skip
cat <<EOF | $CC -flto -fPIC -o $t/a.o -c -xc -
#include <stdio.h>
extern void live_func();
void dead_func() {
printf("OK\n");
}
int main() {
live_func();
}
EOF
$CC -B. -flto -o $t/exe $t/a.o -Wl,-defsym,live_func=dead_func
$QEMU $t/exe | grep -q "^OK$"