]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-mpx-sigsegv.c
x86: Turn PLT32 to PC32 only for PC-relative relocations
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-mpx-sigsegv.c
1 /* Copyright (C) 2015-2024 Free Software Foundation, Inc.
2
3 Contributed by Intel Corp. <walfred.tedeschi@intel.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #define OUR_SIZE 5
19
20 int gx[OUR_SIZE];
21 int ga[OUR_SIZE];
22 int gb[OUR_SIZE];
23 int gc[OUR_SIZE];
24 int gd[OUR_SIZE];
25
26 int
27 bp1 (int value)
28 {
29 return 1;
30 }
31
32 int
33 bp2 (int value)
34 {
35 return 1;
36 }
37
38 void
39 upper (int * p, int * a, int * b, int * c, int * d, int len)
40 {
41 int value;
42 value = *(p + len);
43 value = *(a + len);
44 value = *(b + len);
45 value = *(c + len);
46 value = *(d + len);
47 }
48
49 void
50 lower (int * p, int * a, int * b, int * c, int * d, int len)
51 {
52 int value;
53 value = *(p - len);
54 value = *(a - len);
55 value = *(b - len);
56 value = *(c - len);
57 bp2 (value);
58 value = *(d - len);
59 }
60
61 int
62 main (void)
63 {
64 int sx[OUR_SIZE];
65 int sa[OUR_SIZE];
66 int sb[OUR_SIZE];
67 int sc[OUR_SIZE];
68 int sd[OUR_SIZE];
69 int *x, *a, *b, *c, *d;
70
71 x = calloc (OUR_SIZE, sizeof (int));
72 a = calloc (OUR_SIZE, sizeof (int));
73 b = calloc (OUR_SIZE, sizeof (int));
74 c = calloc (OUR_SIZE, sizeof (int));
75 d = calloc (OUR_SIZE, sizeof (int));
76
77 upper (x, a, b, c, d, OUR_SIZE + 2);
78 upper (sx, sa, sb, sc, sd, OUR_SIZE + 2);
79 upper (gx, ga, gb, gc, gd, OUR_SIZE + 2);
80 lower (x, a, b, c, d, 1);
81 lower (sx, sa, sb, sc, sd, 1);
82 bp1 (*x);
83 lower (gx, ga, gb, gc, gd, 1);
84
85 free (x);
86 free (a);
87 free (b);
88 free (c);
89 free (d);
90
91 return 0;
92 }