1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

root/trunk/ld/ld_symbols.h @ 2676

Revision 2676, 3.8 KB (checked in by kaiwang27, 17 months ago)

Add support for creating ".gnu.version_r" section.

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*-
2 * Copyright (c) 2010-2012 Kai Wang
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id$
27 */
28
29struct ld_symver_verdef;
30
31struct ld_symbol {
32        char *lsb_name;                 /* symbol name */
33        uint64_t lsb_nameindex;         /* symbol name index */
34        char *lsb_ver;                  /* symbol version */
35        char *lsb_longname;             /* symbol name+version (as hash key)*/
36        uint64_t lsb_size;              /* symbol size */
37        uint64_t lsb_value;             /* symbol value */
38        uint16_t lsb_shndx;             /* symbol index */
39        struct ld_script_variable *lsb_var; /* associated ldscript variable */
40        unsigned char lsb_bind;         /* symbol binding */
41        unsigned char lsb_type;         /* symbol type */
42        unsigned char lsb_other;        /* symbol visibility */
43        unsigned char lsb_default;      /* symbol is default/only version */
44        unsigned char lsb_provide;      /* provide symbol */
45        unsigned char lsb_provide_refed; /* provide symbol is referenced */
46        unsigned char lsb_import;       /* symbol is a import symbol */
47        struct ld_symver_verdef *lsb_vd; /* version definition */
48        struct ld_symbol *lsb_prev;     /* symbol resolved by this symbol */
49        struct ld_symbol *lsb_ref;      /* this symbol resolves to ... */
50        struct ld_input *lsb_input;     /* containing input object */
51        struct ld_output_section *lsb_preset_os; /* Preset output section */
52        UT_hash_handle hh;              /* hash handle */
53        UT_hash_handle hhi;             /* hash handle (input object) */
54        UT_hash_handle hhimp;           /* hash handle (import) */
55        UT_hash_handle hhexp;           /* hash handle (export) */
56        STAILQ_ENTRY(ld_symbol) lsb_next; /* next symbol */
57        STAILQ_ENTRY(ld_symbol) lsb_dyn;  /* next dynamic symbol */
58};
59
60STAILQ_HEAD(ld_symbol_head, ld_symbol);
61
62struct ld_symbol_table {
63        void *sy_buf;
64        size_t sy_cap;
65        size_t sy_size;
66        size_t sy_first_nonlocal;
67        size_t sy_write_pos;
68};
69
70struct ld_symbol_defver {
71        char *dv_name;
72        char *dv_longname;
73        char *dv_ver;
74        UT_hash_handle hh;
75};
76
77void    ld_symbols_add_extern(struct ld *, char *);
78void    ld_symbols_add_variable(struct ld *, struct ld_script_variable *,
79    unsigned, unsigned);
80void    ld_symbols_add_internal(struct ld *, const char *, uint64_t, uint64_t,
81    uint16_t, unsigned char, unsigned char, unsigned char,
82    struct ld_output_section *);
83void    ld_symbols_build_symtab(struct ld *);
84void    ld_symbols_cleanup(struct ld *);
85void    ld_symbols_create_dynsym(struct ld *);
86void    ld_symbols_finalize_dynsym(struct ld *);
87int     ld_symbols_get_value(struct ld *, char *, uint64_t *);
88int     ld_symbols_get_value_from_input(struct ld_input *, char *, uint64_t *);
89int     ld_symbols_get_value_from_input_local(struct ld_input *, char *,
90    uint64_t *);
91void    ld_symbols_resolve(struct ld *);
92void    ld_symbols_update(struct ld *);
Note: See TracBrowser for help on using the browser.