1  #include <stdio.h>
       2  
       3  #include "protected-func-1.h"
       4  
       5  protected_func_type protected_func_1a_ptr = protected_func_1a;
       6  protected_func_type protected_func_1b_ptr = protected_func_1b;
       7  
       8  int
       9  protected_func_1b (void)
      10  {
      11    return 3;
      12  }
      13  
      14  int
      15  main (void)
      16  {
      17    int res = 0;
      18  
      19    protected_func_1a ();
      20    protected_func_1b ();
      21  
      22    /* Check if we get the same address for the protected function symbol.  */
      23    if (protected_func_1a_ptr != protected_func_1a_p ())
      24      {
      25        puts ("'protected_func_1a' in main and shared library doesn't have same address");
      26        res = 1;
      27      }
      28  
      29    /* Check if we get the different addresses for the protected function
      30       symbol.  */
      31    if (protected_func_1b_ptr == protected_func_1b_p ())
      32      {
      33        puts ("'protected_func_1b' in main and shared library has same address");
      34        res = 1;
      35      }
      36  
      37    if (!res)
      38      puts ("PASS");
      39  
      40    return res;
      41  }