1/* Copyright (C) 2015-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include "tst-protected1mod.h"
19
20int protected1 = 3;
21static int expected_protected1 = 3;
22int protected2 = 4;
23static int expected_protected2 = 4;
24int protected3 = 5;
25static int expected_protected3 = 5;
26
27asm (".protected protected1");
28asm (".protected protected2");
29asm (".protected protected3");
30
31void
32set_protected1a (int i)
33{
34 protected1 = i;
35 set_expected_protected1 (i);
36}
37
38void
39set_expected_protected1 (int i)
40{
41 expected_protected1 = i;
42}
43
44int *
45protected1a_p (void)
46{
47 return &protected1;
48}
49
50int
51check_protected1 (void)
52{
53 return protected1 == expected_protected1;
54}
55
56void
57set_protected2 (int i)
58{
59 protected2 = i;
60 expected_protected2 = i;
61}
62
63int
64check_protected2 (void)
65{
66 return protected2 == expected_protected2;
67}
68
69void
70set_expected_protected3a (int i)
71{
72 expected_protected3 = i;
73}
74
75void
76set_protected3a (int i)
77{
78 protected3 = i;
79 set_expected_protected3a (i);
80}
81
82int
83check_protected3a (void)
84{
85 return protected3 == expected_protected3;
86}
87
88int *
89protected3a_p (void)
90{
91 return &protected3;
92}
93

source code of glibc/elf/tst-protected1moda.c