abi-note.S 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Special .init and .fini section support.
  2. Copyright (C) 1997, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  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. In addition to the permissions in the GNU Lesser General Public
  9. License, the Free Software Foundation gives you unlimited
  10. permission to link the compiled version of this file with other
  11. programs, and to distribute those programs without any restriction
  12. coming from the use of this file. (The Lesser General Public
  13. License restrictions do apply in other respects; for example, they
  14. cover modification of the file, and distribution when not linked
  15. into another program.)
  16. The GNU C Library is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. Lesser General Public License for more details.
  20. You should have received a copy of the GNU Lesser General Public
  21. License along with the GNU C Library; if not, write to the Free
  22. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  23. 02111-1307 USA. */
  24. /* Define an ELF note identifying the operating-system ABI that the
  25. executable was created for. The ELF note information identifies a
  26. particular OS or coordinated development effort within which the
  27. ELF header's e_machine value plus (for dynamically linked programs)
  28. the PT_INTERP dynamic linker name and DT_NEEDED shared library
  29. names fully identify the runtime environment required by an
  30. executable.
  31. The general format of ELF notes is as follows.
  32. Offsets and lengths are bytes or (parenthetical references) to the
  33. values in other fields.
  34. offset length contents
  35. 0 4 length of name
  36. 4 4 length of data
  37. 8 4 note type
  38. 12 (0) vendor name
  39. - null-terminated ASCII string, padded to 4-byte alignment
  40. 12+(0) (4) note data,
  41. The GNU project and cooperating development efforts (including the
  42. Linux community) use note type 1 and a vendor name string of "GNU"
  43. for a note descriptor that indicates ABI requirements. The note data
  44. is four 32-bit words. The first of these is an operating system
  45. number (0=Linux, 1=Hurd, 2=Solaris, ...) and the remaining three
  46. identify the earliest release of that OS that supports this ABI.
  47. See abi-tags (top level) for details. */
  48. #include <features.h>
  49. #include <abi-tag.h> /* OS-specific ABI tag value */
  50. /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose
  51. name begins with `.note' and creates a PT_NOTE program header entry
  52. pointing at it. */
  53. #ifdef __HAVE_ELF__
  54. .section ".note.ABI-tag", "a"
  55. #else
  56. .section .note
  57. #endif
  58. .align 4
  59. .long 1f - 0f /* name length */
  60. .long 3f - 2f /* data length */
  61. .long 1 /* note type */
  62. 0: .asciz "GNU" /* vendor name */
  63. 1: .align 4
  64. 2: .long __ABI_TAG_OS /* note data: the ABI tag */
  65. .long __ABI_TAG_VERSION
  66. 3: .align 4 /* pad out section */