source: rtems-tools/rtemstoolkit/elftoolchain/libelf/_libelf_config.h @ dfc5994

4.104.115
Last change on this file since dfc5994 was dfc5994, checked in by Chris Johns <chrisj@…>, on 03/17/15 at 10:37:43

elftoolchain: Add support for Cygwin.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/*-
2 * Copyright (c) 2008-2011 Joseph Koshy
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: _libelf_config.h 2032 2011-10-23 09:07:00Z jkoshy $
27 */
28
29#ifdef __FreeBSD__
30
31#define LIBELF_VCSID(ID)        __FBSDID(ID)
32
33/*
34 * Define LIBELF_{ARCH,BYTEORDER,CLASS} based on the machine architecture.
35 * See also: <machine/elf.h>.
36 */
37
38#if     defined(__amd64__)
39
40#define LIBELF_ARCH             EM_X86_64
41#define LIBELF_BYTEORDER        ELFDATA2LSB
42#define LIBELF_CLASS            ELFCLASS64
43
44#elif   defined(__arm__)
45
46#define LIBELF_ARCH             EM_ARM
47#if     defined(__ARMEB__)      /* Big-endian ARM. */
48#define LIBELF_BYTEORDER        ELFDATA2MSB
49#else
50#define LIBELF_BYTEORDER        ELFDATA2LSB
51#endif
52#define LIBELF_CLASS            ELFCLASS32
53
54#elif   defined(__i386__)
55
56#define LIBELF_ARCH             EM_386
57#define LIBELF_BYTEORDER        ELFDATA2LSB
58#define LIBELF_CLASS            ELFCLASS32
59
60#elif   defined(__ia64__)
61
62#define LIBELF_ARCH             EM_IA_64
63#define LIBELF_BYTEORDER        ELFDATA2LSB
64#define LIBELF_CLASS            ELFCLASS64
65
66#elif   defined(__mips__)
67
68#define LIBELF_ARCH             EM_MIPS
69#if     defined(__MIPSEB__)
70#define LIBELF_BYTEORDER        ELFDATA2MSB
71#else
72#define LIBELF_BYTEORDER        ELFDATA2LSB
73#endif
74#define LIBELF_CLASS            ELFCLASS32
75
76#elif   defined(__powerpc__)
77
78#define LIBELF_ARCH             EM_PPC
79#define LIBELF_BYTEORDER        ELFDATA2MSB
80#define LIBELF_CLASS            ELFCLASS32
81
82#elif   defined(__sparc__)
83
84#define LIBELF_ARCH             EM_SPARCV9
85#define LIBELF_BYTEORDER        ELFDATA2MSB
86#define LIBELF_CLASS            ELFCLASS64
87
88#else
89#error  Unknown FreeBSD architecture.
90#endif
91#endif  /* __FreeBSD__ */
92
93
94#ifdef __NetBSD__
95
96#include <machine/elf_machdep.h>
97
98#define LIBELF_VCSID(ID)        __RCSID(ID)
99
100#if     !defined(ARCH_ELFSIZE)
101#error  ARCH_ELFSIZE is not defined.
102#endif
103
104#if     ARCH_ELFSIZE == 32
105#define LIBELF_ARCH             ELF32_MACHDEP_ID
106#define LIBELF_BYTEORDER        ELF32_MACHDEP_ENDIANNESS
107#define LIBELF_CLASS            ELFCLASS32
108#define Elf_Note                Elf32_Nhdr
109#else
110#define LIBELF_ARCH             ELF64_MACHDEP_ID
111#define LIBELF_BYTEORDER        ELF64_MACHDEP_ENDIANNESS
112#define LIBELF_CLASS            ELFCLASS64
113#define Elf_Note                Elf64_Nhdr
114#endif
115
116#endif  /* __NetBSD__ */
117
118#ifdef __APPLE__
119
120#define LIBELF_VCSID(ID)
121
122#if     defined(__amd64__)
123
124#define LIBELF_ARCH             EM_X86_64
125#define LIBELF_BYTEORDER        ELFDATA2LSB
126#define LIBELF_CLASS            ELFCLASS64
127
128#elif   defined(__i386__)
129
130#define LIBELF_ARCH             EM_386
131#define LIBELF_BYTEORDER        ELFDATA2LSB
132#define LIBELF_CLASS            ELFCLASS32
133
134#else
135#error  Unknown Apple architecture.
136#endif
137
138#define roundup2        roundup
139
140#endif  /* __APPLE__ */
141
142/*
143 * GNU & Linux compatibility.
144 *
145 * `__linux__' is defined in an environment runs the Linux kernel and glibc.
146 * `__GNU__' is defined in an environment runs a GNU kernel (Hurd) and glibc.
147 * `__GLIBC__' is defined for an environment that runs glibc over a non-GNU
148 *     kernel such as GNU/kFreeBSD.
149 */
150
151#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
152
153#if defined(__linux__)
154
155#include "native-elf-format.h"
156
157#define LIBELF_CLASS            ELFTC_CLASS
158#define LIBELF_ARCH             ELFTC_ARCH
159#define LIBELF_BYTEORDER        ELFTC_BYTEORDER
160
161#endif  /* defined(__linux__) */
162
163#define LIBELF_VCSID(ID)
164
165#if     LIBELF_CLASS == ELFCLASS32
166#define Elf_Note                Elf32_Nhdr
167#elif   LIBELF_CLASS == ELFCLASS64
168#define Elf_Note                Elf64_Nhdr
169#else
170#error  LIBELF_CLASS needs to be one of ELFCLASS32 or ELFCLASS64
171#endif
172
173#define roundup2        roundup
174
175#endif /* defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) */
176
177#if defined(__WIN32__) || defined(__CYGWIN__)
178
179#define LIBELF_VCSID(ID)
180
181#if     defined(__amd64__)
182
183#define LIBELF_ARCH             EM_X86_64
184#define LIBELF_BYTEORDER        ELFDATA2LSB
185#define LIBELF_CLASS            ELFCLASS64
186
187#elif   defined(__i386__)
188
189#define LIBELF_ARCH             EM_386
190#define LIBELF_BYTEORDER        ELFDATA2LSB
191#define LIBELF_CLASS            ELFCLASS32
192
193#else
194#error  Unknown Apple architecture.
195#endif
196
197#endif  /* __APPLE__ */
Note: See TracBrowser for help on using the repository browser.