Utils: Remove the v1 firmware generator code
[gstreamer-omap:sysbios-rpmsg.git] / src / utils.mmap / elfload / arm_dynamic.c
1 /*
2  *  Syslink-IPC for TI OMAP Processors
3  *
4  *  Copyright (c) 2008-2010, Texas Instruments Incorporated
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  *
11  *  *  Redistributions of source code must retain the above copyright
12  *     notice, this list of conditions and the following disclaimer.
13  *
14  *  *  Redistributions in binary form must reproduce the above copyright
15  *     notice, this list of conditions and the following disclaimer in the
16  *     documentation and/or other materials provided with the distribution.
17  *
18  *  *  Neither the name of Texas Instruments Incorporated nor the names of
19  *     its contributors may be used to endorse or promote products derived
20  *     from this software without specific prior written permission.
21  *
22  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 /*****************************************************************************/
35 /* arm_dynamic.c                                                             */
36 /*                                                                           */
37 /* ARM specific dynamic loader functionality.                                */
38 /*****************************************************************************/
39
40 #ifdef ARM_TARGET
41
42 #include "arm_elf32.h"
43 #include "dload.h"
44
45 /*****************************************************************************/
46 /* process_arm_dynamic_tag()                                                 */
47 /*                                                                           */
48 /* Process ARM specific dynamic tags                                         */
49 /*****************************************************************************/
50 BOOL DLDYN_arm_process_dynamic_tag(DLIMP_Dynamic_Module* dyn_module, int i)
51 {
52     switch (dyn_module->dyntab[i].d_tag)
53     {
54         case DT_ARM_SYMTABSZ:
55         {
56             dyn_module->symnum = dyn_module->dyntab[i].d_un.d_val;
57 #if LOADER_DEBUG
58             if (debugging_on)
59                 DLIF_trace("Found symbol table size: %d\n",
60                            dyn_module->symnum);
61 #endif
62             return TRUE;
63         }
64     }
65
66     return FALSE;
67 }
68
69 /*****************************************************************************/
70 /* DLDYN_arm_relocate_dynamic_tag_info()                                     */
71 /*                                                                           */
72 /* Update any target specific dynamic tag values that are associated with    */
73 /* a section address. Return TRUE if the tag value is successfully           */
74 /* updated or if the tag is not associated with a section address, and       */
75 /* FALSE if we can't find the sectoin associated with the tag or if the      */
76 /* tag type is not recognized.                                               */
77 /*                                                                           */
78 /*****************************************************************************/
79 BOOL DLDYN_arm_relocate_dynamic_tag_info(DLIMP_Dynamic_Module *dyn_module,
80                                          int32_t i)
81 {
82     switch (dyn_module->dyntab[i].d_tag)
83     {
84         /*-------------------------------------------------------------------*/
85         /* These tags do not point to sections.                              */
86         /*-------------------------------------------------------------------*/
87         case DT_ARM_RESERVED1:
88         case DT_ARM_SYMTABSZ:
89         case DT_ARM_PREEMPTMAP:
90         case DT_ARM_RESERVED2:
91             return TRUE;
92     }
93
94     DLIF_error(DLET_MISC, "Invalid dynamic tag encountered, %d\n",
95                           (int)dyn_module->dyntab[i].d_tag);
96     return FALSE;
97 }
98
99 /*****************************************************************************/
100 /* arm_process_eiosabi()                                                     */
101 /*                                                                           */
102 /* Process the EI_OSABI value. Verify that the OSABI is supported and set    */
103 /* any variables which depend on the OSABI.                                  */
104 /*****************************************************************************/
105 BOOL DLDYN_arm_process_eiosabi(DLIMP_Dynamic_Module* dyn_module)
106 {
107     /*-----------------------------------------------------------------------*/
108     /* For ARM, the EI_OSABI value must not be set.  The only ARM specific   */
109     /* value is ELFOSABI_ARM_AEABI is for objects which contain symbol       */
110     /* versioning, which we do not support for Baremetal ABI.                */
111     /*-----------------------------------------------------------------------*/
112     if (dyn_module->fhdr.e_ident[EI_OSABI] != ELFOSABI_NONE)
113         return FALSE;
114
115     return TRUE;
116 }
117
118 #endif /* ARM_TARGET */