Utils: Update the firmware to carry section physical addresses
[gstreamer-omap:sysbios-rpmsg.git] / src / utils / elfload / include / c60_elf32.h
1 /*
2  *  c60_elf32.h
3  *
4  *  C6x-specific data structures for 32-bit ELF object format files.
5  *
6  *  Copyright (C) 2009 Texas Instruments Incorporated
7  *  All rights reserved.
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *
13  *  *  Redistributions of source code must retain the above copyright
14  *     notice, this list of conditions and the following disclaimer.
15  *
16  *  *  Redistributions in binary form must reproduce the above copyright
17  *     notice, this list of conditions and the following disclaimer in the
18  *     documentation and/or other materials provided with the
19  *     distribution.
20  *
21  *  *  Neither the name of Texas Instruments Incorporated nor the names of
22  *     its contributors may be used to endorse or promote products derived
23  *     from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37
38 #ifndef C60_ELF32_H
39 #define C60_ELF32_H
40
41 #include "elf32.h"
42
43 /*---------------------------------------------------------------------------*/
44 /* C6x specific EI_OSABI values                                              */
45 /*---------------------------------------------------------------------------*/
46 enum
47 {
48    ELFOSABI_C6000_ELFABI = 64,  /* C6X Baremetal OSABI                */
49    ELFOSABI_C6000_LINUX  = 65   /* C6X Linux OSABI                    */
50 };
51
52 /*---------------------------------------------------------------------------*/
53 /* File Header Flags (value of "e_flags")                                    */
54 /*---------------------------------------------------------------------------*/
55 enum
56 {
57    EF_C6000_REL = 0x01        /* Contains static relocations. A ET_EXEC or  */
58                               /* ET_DYN file w/ this flag set can be        */
59                               /* treated as ET_REL during static linking.   */
60 };
61
62 /*---------------------------------------------------------------------------*/
63 /* Segment Types (value of "p_type")                                         */
64 /*---------------------------------------------------------------------------*/
65 enum
66 {
67    PT_C6000_PHATTRS    = 0x70000000     /* Extended Program Header Attributes*/
68 };
69
70 /*---------------------------------------------------------------------------*/
71 /* C6x specific section types                                                */
72 /*---------------------------------------------------------------------------*/
73 enum
74 {
75
76    /*------------------------------------------------------------------------*/
77    /* Section types defined by the C6x ELFABI.                               */
78    /* Note: ABI defined section type should be named SHT_C6000_xxx           */
79    /*------------------------------------------------------------------------*/
80    SHT_C6000_UNWIND     = 0x70000001,   /* Exception Index Table             */
81    SHT_C6000_PREEMPTMAP = 0x70000002,   /* Pre-emption Map                   */
82
83    SHT_C6000_ATTRIBUTES = 0x70000003,   /* Obj File Compatability Attributes */
84
85    /*------------------------------------------------------------------------*/
86    /* The following section types are not part of C6x ABI. As per the ABI,   */
87    /* the processor specific values not defined in the ABI are reserved for  */
88    /* future use. Here we reserve the range 0x7F000000 through 0x7FFFFFFFF   */
89    /* for the TI specific processor section types.                           */
90    /* Note: TI specific section type should be named SHT_TI_xxx              */
91    /*------------------------------------------------------------------------*/
92    SHT_TI_ICODE         = 0x7F000000,   /* ICODE representation              */
93    SHT_TI_XREF          = 0x7F000001,   /* Symbol cross reference            */
94    SHT_TI_HANDLER       = 0x7F000002,   /* Handler function table            */
95    SHT_TI_INITINFO      = 0x7F000003,   /* Info for C auto-init of variables */
96    SHT_TI_PHATTRS       = 0x7F000004    /* Extended Program Header Attributes*/
97 };
98
99 /*****************************************************************************/
100 /* C6x-Specific Dynamic Array Tags (C6x ELF ABI Section ??? - AEGUPD)        */
101 /* NOTE:                                                                     */
102 /*     As per GABI a tag whose value is even number indicates a dynamic tag  */
103 /*     that uses d_ptr. Odd number indicates the use of d_val or doesn't use */
104 /*     neither d_val nor d_ptr.                                              */
105 /*****************************************************************************/
106 enum
107 {
108    /*------------------------------------------------------------------------*/
109    /* OSABI specific tags:                                                   */
110    /*          From 0x6000000D thru 0x6FFFF000                               */
111    /*------------------------------------------------------------------------*/
112    DT_C6000_GSYM_OFFSET   = 0x6000000D,  /* d_val    -- OSABI Specific    -- */
113    DT_C6000_GSTR_OFFSET   = 0x6000000F,  /* d_val    -- OSABI Specific    -- */
114
115    /*------------------------------------------------------------------------*/
116    /* Processor specific tags:                                               */
117    /*          From 0x70000000 thru 0x7FFFFFFF                               */
118    /*------------------------------------------------------------------------*/
119    DT_C6000_DSBT_BASE     = 0x70000000,  /* d_ptr    -- Platform Specific -- */
120    DT_C6000_DSBT_SIZE     = 0x70000001,  /* d_val    -- Platform Specific -- */
121    DT_C6000_PREEMPTMAP    = 0x70000002,  /* d_ptr    -- Platform Specific -- */
122    DT_C6000_DSBT_INDEX    = 0x70000003   /* d_val    -- Platform Specific -- */
123 };
124
125 /*---------------------------------------------------------------------------*/
126 /* C6x Dynamic Relocation Types                                              */
127 /*---------------------------------------------------------------------------*/
128 typedef enum
129 {
130    R_C6000_NONE           = 0,
131    R_C6000_ABS32          = 1,
132    R_C6000_ABS16          = 2,
133    R_C6000_ABS8           = 3,
134    R_C6000_PCR_S21        = 4,
135    R_C6000_PCR_S12        = 5,
136    R_C6000_PCR_S10        = 6,
137    R_C6000_PCR_S7         = 7,
138    R_C6000_ABS_S16        = 8,
139    R_C6000_ABS_L16        = 9,
140    R_C6000_ABS_H16        = 10,
141    R_C6000_SBR_U15_B      = 11,
142    R_C6000_SBR_U15_H      = 12,
143    R_C6000_SBR_U15_W      = 13,
144    R_C6000_SBR_S16        = 14,
145    R_C6000_SBR_L16_B      = 15,
146    R_C6000_SBR_L16_H      = 16,
147    R_C6000_SBR_L16_W      = 17,
148    R_C6000_SBR_H16_B      = 18,
149    R_C6000_SBR_H16_H      = 19,
150    R_C6000_SBR_H16_W      = 20,
151    R_C6000_SBR_GOT_U15_W  = 21,
152    R_C6000_SBR_GOT_L16_W  = 22,
153    R_C6000_SBR_GOT_H16_W  = 23,
154    R_C6000_DSBT_INDEX     = 24,
155    R_C6000_PREL31         = 25,
156    R_C6000_COPY           = 26
157 }C60_RELOC_TYPE;
158
159 #endif /* C60_ELF32_H */