(root)/
glibc-2.38/
elf/
tst-protected1moda.c
       1  /* Copyright (C) 2015-2023 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  
      20  int protected1 = 3;
      21  static int expected_protected1 = 3;
      22  int protected2 = 4;
      23  static int expected_protected2 = 4;
      24  int protected3 = 5;
      25  static int expected_protected3 = 5;
      26  
      27  asm (".protected protected1");
      28  asm (".protected protected2");
      29  asm (".protected protected3");
      30  
      31  void
      32  set_protected1a (int i)
      33  {
      34    protected1 = i;
      35    set_expected_protected1 (i);
      36  }
      37  
      38  void
      39  set_expected_protected1 (int i)
      40  {
      41    expected_protected1 = i;
      42  }
      43  
      44  int *
      45  protected1a_p (void)
      46  {
      47    return &protected1;
      48  }
      49  
      50  int
      51  check_protected1 (void)
      52  {
      53    return protected1 == expected_protected1;
      54  }
      55  
      56  void
      57  set_protected2 (int i)
      58  {
      59    protected2 = i;
      60    expected_protected2 = i;
      61  }
      62  
      63  int
      64  check_protected2 (void)
      65  {
      66    return protected2 == expected_protected2;
      67  }
      68  
      69  void
      70  set_expected_protected3a (int i)
      71  {
      72    expected_protected3 = i;
      73  }
      74  
      75  void
      76  set_protected3a (int i)
      77  {
      78    protected3 = i;
      79    set_expected_protected3a (i);
      80  }
      81  
      82  int
      83  check_protected3a (void)
      84  {
      85    return protected3 == expected_protected3;
      86  }
      87  
      88  int *
      89  protected3a_p (void)
      90  {
      91    return &protected3;
      92  }