blob: aa9498b74df8a015b4a249631390dfdb9aab37ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Test for gcc 'asm goto' support
# Copyright (C) 2010, Jason Baron <jbaron@redhat.com>
TEST=$1
shift
case $TEST in
"goto")
cat << "END" | $@ -x c - -fno-PIE -c -o /dev/null
int main(void)
{
#if defined(__arm__) || defined(__aarch64__)
/*
* Not related to asm goto, but used by jump label
* and broken on some ARM GCC versions (see GCC Bug 48637).
*/
static struct { int dummy; int state; } tp;
asm (".long %c0" :: "i" (&tp.state));
#endif
entry:
asm goto ("" :::: entry);
return 0;
}
END
;;
"goto_output")
cat << "END" | $@ -x c - -c -o /dev/null
int foo(int x) {
asm goto ("": "=r"(x) ::: bar);
return x;
bar: return 0;
}
END
;;
"goto_tied_output")
cat << "END" | $@ -x c - -c -o /dev/null
int foo(int *x) {
asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar);
return *x;
bar: return 0;
}
END
;;
*)
exit -1
;;
esac
|