OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [services/] [loader/] [current/] [include/] [ppc_elf.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_LOADER_PPC_ELF_H
2
#define CYGONCE_LOADER_PPC_ELF_H
3
 
4
//==========================================================================
5
//
6
//      ppc_elf.h
7
//
8
//      PowerPC specific ELF file format support
9
//
10
//==========================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    nickg
46
// Contributors: nickg
47
// Date:         2000-11-20
48
// Purpose:      Define PowerPC ELF support
49
// Description:  This file contains definitions for configuring the dynamic
50
//               loader to deal with the PowerPC specific parts of the ELF
51
//               file format.
52
//              
53
// Usage:
54
//              #include <cyg/loader/ppc_elf.h>
55
//              ...
56
//              
57
//
58
//####DESCRIPTIONEND####
59
//
60
//==========================================================================
61
 
62
#include <pkgconf/system.h>
63
#include <pkgconf/hal.h>
64
 
65
#if defined(CYGPKG_HAL_POWERPC)
66
 
67
#ifndef CYG_LOADER_DYNAMIC_LD
68
 
69
#include <cyg/infra/cyg_type.h>
70
 
71
//--------------------------------------------------------------------------
72
// Basic definitions
73
 
74
#define CYG_ELF_MACHINE     EM_PPC
75
 
76
//--------------------------------------------------------------------------
77
// Relocation types
78
// Taken from binutils/include/elf/ppc.h - not currently sure which
79
// of these are actually used in executables.
80
 
81
 
82
#define R_PPC_NONE                      0
83
#define R_PPC_ADDR32                    1
84
#define R_PPC_ADDR24                    2
85
#define R_PPC_ADDR16                    3
86
#define R_PPC_ADDR16_LO                 4
87
#define R_PPC_ADDR16_HI                 5
88
#define R_PPC_ADDR16_HA                 6
89
#define R_PPC_ADDR14                    7
90
#define R_PPC_ADDR14_BRTAKEN            8
91
#define R_PPC_ADDR14_BRNTAKEN           9
92
#define R_PPC_REL24                     10
93
#define R_PPC_REL14                     11
94
#define R_PPC_REL14_BRTAKEN             12
95
#define R_PPC_REL14_BRNTAKEN            13
96
#define R_PPC_GOT16                     14
97
#define R_PPC_GOT16_LO                  15
98
#define R_PPC_GOT16_HI                  16
99
#define R_PPC_GOT16_HA                  17
100
#define R_PPC_PLTREL24                  18
101
#define R_PPC_COPY                      19
102
#define R_PPC_GLOB_DAT                  20
103
#define R_PPC_JMP_SLOT                  21
104
#define R_PPC_RELATIVE                  22
105
#define R_PPC_LOCAL24PC                 23
106
#define R_PPC_UADDR32                   24
107
#define R_PPC_UADDR16                   25
108
#define R_PPC_REL32                     26
109
#define R_PPC_PLT32                     27
110
#define R_PPC_PLTREL32                  28
111
#define R_PPC_PLT16_LO                  29
112
#define R_PPC_PLT16_HI                  30
113
#define R_PPC_PLT16_HA                  31
114
#define R_PPC_SDAREL16                  32
115
#define R_PPC_SECTOFF                   33
116
#define R_PPC_SECTOFF_LO                34
117
#define R_PPC_SECTOFF_HI                35
118
#define R_PPC_SECTOFF_HA                36
119
 
120
/* The remaining relocs are from the Embedded ELF ABI, and are not
121
   in the SVR4 ELF ABI.  */
122
#define R_PPC_EMB_NADDR32               101
123
#define R_PPC_EMB_NADDR16               102
124
#define R_PPC_EMB_NADDR16_LO            103
125
#define R_PPC_EMB_NADDR16_HI            104
126
#define R_PPC_EMB_NADDR16_HA            105
127
#define R_PPC_EMB_SDAI16                106
128
#define R_PPC_EMB_SDA2I16               107
129
#define R_PPC_EMB_SDA2REL               108
130
#define R_PPC_EMB_SDA21                 109
131
#define R_PPC_EMB_MRKREF                110
132
#define R_PPC_EMB_RELSEC16              111
133
#define R_PPC_EMB_RELST_LO              112
134
#define R_PPC_EMB_RELST_HI              113
135
#define R_PPC_EMB_RELST_HA              114
136
#define R_PPC_EMB_BIT_FLD               115
137
#define R_PPC_EMB_RELSDA                116
138
 
139
  /* These are GNU extensions to enable C++ vtable garbage collection.  */
140
#define R_PPC_GNU_VTINHERIT             253
141
#define R_PPC_GNU_VTENTRY               254
142
 
143
/* This is a phony reloc to handle any old fashioned TOC16 references
144
   that may still be in object files.  */
145
#define R_PPC_TOC16                     255
146
 
147
 
148
//--------------------------------------------------------------------------
149
// Processor specific customization class for Cyg_LoadObject class.
150
 
151
#ifdef __cplusplus
152
 
153
class Cyg_LoadObject_Proc :
154
      public Cyg_LoadObject_Base
155
{
156
 public:
157
 
158
    inline Cyg_LoadObject_Proc()
159
        : Cyg_LoadObject_Base()
160
        {
161
        };
162
 
163
    inline Cyg_LoadObject_Proc( Cyg_LoaderStream& stream,
164
                    cyg_uint32 mode,
165
                    Cyg_LoaderMemAlloc *mem )
166
        : Cyg_LoadObject_Base( stream, mode, mem )
167
        {
168
        };
169
 
170
    inline ~Cyg_LoadObject_Proc() {};
171
 
172
    cyg_code apply_rel( unsigned char type, Elf32_Word sym, Elf32_Addr offset );
173
 
174
    cyg_code apply_rela( unsigned char type, Elf32_Word sym,
175
                         Elf32_Addr offset, Elf32_Sword addend );
176
};
177
 
178
//--------------------------------------------------------------------------
179
 
180
inline cyg_code Cyg_LoadObject_Proc::apply_rel( unsigned char type,
181
                                                Elf32_Word sym,
182
                                                Elf32_Addr offset )
183
{
184
    return 0;
185
}
186
 
187
inline cyg_code Cyg_LoadObject_Proc::apply_rela( unsigned char type,
188
                                                 Elf32_Word sym,
189
                                                 Elf32_Addr offset,
190
                                                 Elf32_Sword addend )
191
{
192
    return 0; // CYG_LOADERR_INVALID_RELOC;
193
}
194
 
195
//--------------------------------------------------------------------------
196
 
197
externC void abort() CYGBLD_ATTRIB_WEAK;
198
 
199
externC void abort() { for(;;); }
200
 
201
externC int strcmp(const char *a, const char *b) CYGBLD_ATTRIB_WEAK;
202
 
203
externC int strcmp(const char *a, const char *b) { return a==b; }
204
 
205
externC unsigned int strlen(const char *a) CYGBLD_ATTRIB_WEAK;
206
 
207
externC unsigned int strlen(const char *a) { return 1; }
208
 
209
//--------------------------------------------------------------------------
210
 
211
#endif // __cplusplus
212
 
213
#else // CYG_LOADER_DYNAMIC_LD
214
 
215
//--------------------------------------------------------------------------
216
 
217
#define CYG_LOADER_DYNAMIC_PREFIX                                               \
218
        OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")     \
219
        OUTPUT_ARCH("powerpc")
220
 
221
/* Adjust the address for the data segment.  We want to adjust up to
222
   the same address within the page on the next page up.  */
223
#define CYG_LOADER_DYNAMIC_DATA_ALIGN                   \
224
        . = ALIGN(0x1000) + (. & (0x1000 - 1));
225
 
226
//--------------------------------------------------------------------------
227
 
228
#endif // CYG_LOADER_DYNAMIC_LD
229
 
230
#endif // defined(CYGPKG_HAL_POWERPC) && __cplusplus
231
 
232
//--------------------------------------------------------------------------
233
#endif // ifndef CYGONCE_LOADER_PPC_ELF_H
234
// End of ppc_elf.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.