1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 00:31:41 +03:00
mold/test/arch-x86_64-z-ibtplt.sh
2024-08-14 16:23:25 +09:00

28 lines
463 B
Bash
Executable File

#!/bin/bash
. $(dirname $0)/common.inc
cat <<EOF | $CC -fPIC -o $t/a.o -c -xc -
#include <stdio.h>
void hello() { printf("Hello"); }
void world() { printf("world"); }
EOF
$CC -B. -o $t/b.so -shared $t/a.o -Wl,-z,ibtplt
cat <<EOF | $CC -o $t/c.o -c -xc -
#include <stdio.h>
void hello();
void world();
int main() {
hello();
printf(" ");
world();
printf("\n");
}
EOF
$CC -B. -o $t/exe $t/c.o $t/b.so -Wl,-z,ibtplt
$QEMU $t/exe | grep -q 'Hello world'