Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
5.2 KiB

25 years ago
23 years ago
23 years ago
23 years ago
  1. /* $OpenBSD: link.h,v 1.14 2004/01/22 21:48:02 espie Exp $ */
  2. /* $NetBSD: link.h,v 1.10 1996/01/09 00:00:11 pk Exp $ */
  3. /*
  4. * Copyright (c) 1993 Paul Kranenburg
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. All advertising materials mentioning features or use of this software
  16. * must display the following acknowledgement:
  17. * This product includes software developed by Paul Kranenburg.
  18. * 4. The name of the author may not be used to endorse or promote products
  19. * derived from this software without specific prior written permission
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  22. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  23. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  25. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  30. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. #ifndef _LINK_H_
  33. #define _LINK_H_
  34. #ifdef __ELF__
  35. #include <link_elf.h>
  36. #else
  37. #include <link_aout.h>
  38. #endif
  39. /*
  40. * A `Shared Object Descriptor' describes a shared object that is needed
  41. * to complete the link edit process of the object containing it.
  42. * A list of such objects (chained through `sod_next') is pointed at
  43. * by `sdt_sods' in the section_dispatch_table structure.
  44. */
  45. struct sod { /* Shared Object Descriptor */
  46. long sod_name; /* name (relative to load address) */
  47. unsigned int sod_library : 1,/* Searched for by library rules */
  48. sod_reserved : 31;
  49. short sod_major; /* major version number */
  50. short sod_minor; /* minor version number */
  51. long sod_next; /* next sod */
  52. };
  53. /*
  54. * `Shared Object Map's are used by the run-time link editor (ld.so) to
  55. * keep track of all shared objects loaded into a process' address space.
  56. * These structures are only used at run-time and do not occur within
  57. * the text or data segment of an executable or shared library.
  58. */
  59. struct so_map { /* Shared Object Map */
  60. caddr_t som_addr; /* Address at which object mapped */
  61. char *som_path; /* Path to mmap'ed file */
  62. struct so_map *som_next; /* Next map in chain */
  63. struct sod *som_sod; /* Sod responsible for this map */
  64. caddr_t som_sodbase; /* Base address of this sod */
  65. unsigned int som_write : 1; /* Text is currently writable */
  66. struct _dynamic *som_dynamic; /* _dynamic structure */
  67. caddr_t som_spd; /* Private data */
  68. };
  69. /*
  70. * Debug rendezvous struct. Pointer to this is set up in the
  71. * target code pointed by the DT_DEBUG tag. If it is
  72. * defined.
  73. */
  74. struct r_debug {
  75. int r_version; /* Protocol version. */
  76. struct link_map *r_map; /* Head of list of loaded objects. */
  77. /*
  78. * This is the address of a function internal to the run-time linker,
  79. * that will always be called when the linker begins to map in a
  80. * library or unmap it, and again when the mapping change is complete.
  81. * The debugger can set a breakpoint at this address if it wants to
  82. * notice shared object mapping changes.
  83. */
  84. unsigned long r_brk;
  85. enum {
  86. /*
  87. * This state value describes the mapping change taking place
  88. * when the `r_brk' address is called.
  89. */
  90. RT_CONSISTENT, /* Mapping change is complete. */
  91. RT_ADD, /* Adding a new object. */
  92. RT_DELETE /* Removing an object mapping. */
  93. } r_state;
  94. unsigned long r_ldbase; /* Base address the linker is loaded at. */
  95. };
  96. /*
  97. * Maximum number of recognized shared object version numbers.
  98. */
  99. #define MAXDEWEY 8
  100. /*
  101. * Header of the hints file.
  102. */
  103. struct hints_header {
  104. long hh_magic;
  105. #define HH_MAGIC 011421044151
  106. long hh_version; /* Interface version number */
  107. #define LD_HINTS_VERSION_1 1
  108. #define LD_HINTS_VERSION_2 2
  109. long hh_hashtab; /* Location of hash table */
  110. long hh_nbucket; /* Number of buckets in hashtab */
  111. long hh_strtab; /* Location of strings */
  112. long hh_strtab_sz; /* Size of strings */
  113. long hh_ehints; /* End of hints (max offset in file) */
  114. long hh_dirlist; /* Colon-separated list of srch dirs */
  115. };
  116. #define HH_BADMAG(hdr) ((hdr).hh_magic != HH_MAGIC)
  117. /*
  118. * Hash table element in hints file.
  119. */
  120. struct hints_bucket {
  121. /* namex and pathx are indices into the string table */
  122. int hi_namex; /* Library name */
  123. int hi_pathx; /* Full path */
  124. int hi_dewey[MAXDEWEY]; /* The versions */
  125. int hi_ndewey; /* Number of version numbers */
  126. #define hi_major hi_dewey[0]
  127. #define hi_minor hi_dewey[1]
  128. int hi_next; /* Next in this bucket */
  129. };
  130. #define _PATH_LD_HINTS "/var/run/ld.so.hints"
  131. #endif /* _LINK_H_ */