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

root/trunk/ld/ld_output.h @ 2548

Revision 2548, 3.7 KB (checked in by kaiwang27, 20 months ago)

Add support for dumping the input section wildcard patterns.

  • 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) 2011,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
29enum ld_output_element_type {
30        OET_ASSERT,
31        OET_ASSIGN,
32        OET_DATA,
33        OET_ENTRY,
34        OET_INPUT_SECTION_LIST,
35        OET_KEYWORD,
36        OET_OUTPUT_SECTION,
37        OET_OVERLAY,
38};
39
40struct ld_output_element {
41        enum ld_output_element_type oe_type; /* output element type */
42        uint64_t oe_off;                /* output element offset */
43        void *oe_entry;                 /* output element */
44        void *oe_islist;                /* input section list */
45        unsigned char oe_insec;         /* element inside SECTIONS */
46        STAILQ_ENTRY(ld_output_element) oe_next; /* next element */
47};
48
49STAILQ_HEAD(ld_output_element_head, ld_output_element);
50
51struct ld_output_section {
52        Elf_Scn *os_scn;                /* output section descriptor */
53        char *os_name;                  /* output section name */
54        uint64_t os_addr;               /* output section vma */
55        uint64_t os_lma;                /* output section lma */
56        uint64_t os_off;                /* output section offset */
57        uint64_t os_size;               /* output section size */
58        uint64_t os_align;              /* output section alignment */
59        uint64_t os_flags;              /* output section flags */
60        uint64_t os_type;               /* output section type */
61        unsigned os_empty;              /* output section is empty */
62        struct ld_script_sections_output *os_ldso;
63                                        /* output section descriptor */
64        struct ld_output_element *os_pe;    /* parent element */
65        struct ld_output_element_head os_e; /* list of child elements */
66        STAILQ_ENTRY(ld_output_section) os_next; /* next output section */
67        UT_hash_handle hh;              /* hash handle */
68};
69
70STAILQ_HEAD(ld_output_section_head, ld_output_section);
71
72struct ld_output {
73        int lo_fd;                       /* output file descriptor */
74        Elf *lo_elf;                     /* output ELF descriptor */
75        int lo_ec;                       /* output object elf class */
76        int lo_endian;                   /* outout object endianess */
77        int lo_osabi;                    /* output object osabi */
78        unsigned lo_phdr_num;            /* num of phdrs */
79        unsigned lo_phdr_note;           /* create PT_NOTE */
80        struct ld_output_element_head lo_oelist; /* output element list */
81        struct ld_output_section_head lo_oslist; /* output section list */
82        struct ld_output_section *lo_ostbl; /* output section hash table */
83};
84
85struct ld_output_section *ld_output_alloc_section(struct ld *, const char *,
86    struct ld_output_section *);
87void    ld_output_create(struct ld *);
88struct ld_output_element *ld_output_create_element(struct ld *,
89    struct ld_output_element_head *, enum ld_output_element_type, void *,
90    struct ld_output_element *);
91void    ld_output_format(struct ld *, char *, char *, char *);
92void    ld_output_init(struct ld *);
93void    ld_output_write(struct ld *);
Note: See TracBrowser for help on using the browser.