hidden_test_main.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* hidden_test_main.c -- test hidden and internal symbols
  2. Copyright (C) 2009-2015 Free Software Foundation, Inc.
  3. Written by Cary Coutant <ccoutant@google.com>
  4. This file is part of gold.
  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. This program 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
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA.
  17. This is a test of symbols of various visibilities in the main program
  18. and attempts to reference those symbols from a shared library.
  19. The linker should issue an error message for references to hidden
  20. and internal symbols. */
  21. extern void lib1 (void);
  22. void main_default (void);
  23. void main_hidden (void);
  24. void main_internal (void);
  25. void main_protected (void);
  26. void __attribute__((visibility ("default")))
  27. main_default (void)
  28. {
  29. }
  30. void __attribute__((visibility ("hidden")))
  31. main_hidden (void)
  32. {
  33. }
  34. void __attribute__((visibility ("internal")))
  35. main_internal (void)
  36. {
  37. }
  38. void __attribute__((visibility ("protected")))
  39. main_protected (void)
  40. {
  41. }
  42. int
  43. main (int argc __attribute__ ((unused)),
  44. char** argv __attribute__ ((unused)))
  45. {
  46. lib1 ();
  47. return 0;
  48. }