[BACK]Return to link.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/link.h, Revision 1.12

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