or1k: Add the l.adrp insn and supporting relocations
[deliverable/binutils-gdb.git] / bfd / sysdep.h
CommitLineData
252b5132 1/* sysdep.h -- handle host dependencies for the BFD library
219d1afa 2 Copyright (C) 1995-2018 Free Software Foundation, Inc.
252b5132
RH
3 Written by Cygnus Support.
4
cd123cb7
NC
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
252b5132
RH
21
22#ifndef BFD_SYSDEP_H
23#define BFD_SYSDEP_H
24
df7b86aa
NC
25#ifdef PACKAGE
26#error sysdep.h must be included in lieu of config.h
27#endif
28
252b5132
RH
29#include "config.h"
30
eddc20ad
AM
31#include "ansidecl.h"
32
252b5132
RH
33#ifdef HAVE_STDDEF_H
34#include <stddef.h>
35#endif
36
37#include <stdio.h>
38#include <sys/types.h>
39#include <sys/stat.h>
40
41#include <errno.h>
42#if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
43extern int errno;
44#endif
45
2e0fbf77
JW
46#ifdef STRING_WITH_STRINGS
47#include <string.h>
48#include <strings.h>
49#else
252b5132
RH
50#ifdef HAVE_STRING_H
51#include <string.h>
52#else
53#ifdef HAVE_STRINGS_H
54#include <strings.h>
55#else
56extern char *strchr ();
57extern char *strrchr ();
58#endif
59#endif
2e0fbf77 60#endif
252b5132
RH
61
62#ifdef HAVE_STDLIB_H
63#include <stdlib.h>
64#endif
65
66#ifdef TIME_WITH_SYS_TIME
67#include <sys/time.h>
68#include <time.h>
69#else
70#ifdef HAVE_SYS_TIME_H
71#include <sys/time.h>
72#else
73#include <time.h>
74#endif
75#endif
76
77#ifdef HAVE_UNISTD_H
78#include <unistd.h>
79#endif
80
9d782e8d
MW
81#ifdef HAVE_SYS_RESOURCE_H
82#include <sys/resource.h>
83#endif /* HAVE_SYS_RESOURCE_H */
84
252b5132
RH
85#ifdef USE_BINARY_FOPEN
86#include "fopen-bin.h"
87#else
88#include "fopen-same.h"
89#endif
90
91#ifdef HAVE_FCNTL_H
92#include <fcntl.h>
93#else
94#ifdef HAVE_SYS_FILE_H
95#include <sys/file.h>
96#endif
97#endif
98
99#ifndef O_RDONLY
100#define O_RDONLY 0
101#endif
102#ifndef O_WRONLY
103#define O_WRONLY 1
104#endif
105#ifndef O_RDWR
106#define O_RDWR 2
107#endif
108#ifndef O_ACCMODE
109#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
110#endif
27b07675
AM
111/* Systems that don't already define this, don't need it. */
112#ifndef O_BINARY
113#define O_BINARY 0
114#endif
252b5132
RH
115
116#ifndef SEEK_SET
117#define SEEK_SET 0
118#endif
119#ifndef SEEK_CUR
120#define SEEK_CUR 1
121#endif
122
5af11cab
AM
123#include "filenames.h"
124
d34a2b1d 125#if !HAVE_DECL_FFS
efa9bda4
AL
126extern int ffs (int);
127#endif
128
d34a2b1d 129#if !HAVE_DECL_FREE
efa9bda4
AL
130extern void free ();
131#endif
132
d34a2b1d 133#if !HAVE_DECL_GETENV
efa9bda4 134extern char *getenv ();
252b5132
RH
135#endif
136
d34a2b1d 137#if !HAVE_DECL_MALLOC
252b5132
RH
138extern PTR malloc ();
139#endif
140
d34a2b1d 141#if !HAVE_DECL_REALLOC
252b5132
RH
142extern PTR realloc ();
143#endif
144
be5cacdb 145#if !HAVE_DECL_STPCPY
4a2a2686 146extern char *stpcpy (char *__dest, const char *__src);
be5cacdb
L
147#endif
148
d34a2b1d 149#if !HAVE_DECL_STRSTR
efa9bda4 150extern char *strstr ();
252b5132
RH
151#endif
152
ec7b76fe
JG
153#ifdef HAVE_FTELLO
154#if !HAVE_DECL_FTELLO
155extern off_t ftello (FILE *stream);
156#endif
157#endif
158
159#ifdef HAVE_FTELLO64
160#if !HAVE_DECL_FTELLO64
161extern off64_t ftello64 (FILE *stream);
162#endif
163#endif
164
165#ifdef HAVE_FSEEKO
166#if !HAVE_DECL_FSEEKO
167extern int fseeko (FILE *stream, off_t offset, int whence);
168#endif
169#endif
170
171#ifdef HAVE_FSEEKO64
172#if !HAVE_DECL_FSEEKO64
173extern int fseeko64 (FILE *stream, off64_t offset, int whence);
174#endif
175#endif
176
5a026fc9
NC
177#if !HAVE_DECL_STRNLEN
178size_t strnlen (const char *, size_t);
179#endif
180
ba3ef70e
AM
181/* Define offsetof for those systems which lack it */
182
183#ifndef offsetof
184#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
185#endif
186
252b5132 187#ifdef ENABLE_NLS
6003e27e
AM
188# include <libintl.h>
189/* Note the redefinition of gettext and ngettext here to use PACKAGE.
190
191 This is because the code in this directory is used to build a
192 library which will be linked with code in other directories to form
193 programs. We want to maintain a seperate translation file for this
194 directory however, rather than being forced to merge it with that
195 of any program linked to libbfd. This is a library, so it cannot
196 depend on the catalog currently loaded.
197
198 In order to do this, we have to make sure that when we extract
199 messages we use the BFD domain rather than the domain of the
200 program that included the bfd library, (eg OBJDUMP). Hence we use
201 dgettext (PACKAGE, String) and define PACKAGE to be 'bfd'.
202 (See the code in configure). */
203# undef gettext
204# define gettext(Msgid) dgettext (PACKAGE, Msgid)
205# undef ngettext
206# define ngettext(Msgid1, Msgid2, n) dngettext (PACKAGE, Msgid1, Msgid2, n)
207# define _(String) gettext (String)
208# ifdef gettext_noop
209# define N_(String) gettext_noop (String)
210# else
211# define N_(String) (String)
212# endif
252b5132 213#else
5af11cab
AM
214# define gettext(Msgid) (Msgid)
215# define dgettext(Domainname, Msgid) (Msgid)
216# define dcgettext(Domainname, Msgid, Category) (Msgid)
6003e27e
AM
217# define ngettext(Msgid1, Msgid2, n) \
218 (n == 1 ? Msgid1 : Msgid2)
219# define dngettext(Domainname, Msgid1, Msgid2, n) \
220 (n == 1 ? Msgid1 : Msgid2)
221# define dcngettext(Domainname, Msgid1, Msgid2, n, Category) \
222 (n == 1 ? Msgid1 : Msgid2)
223# define textdomain(Domainname) do {} while (0)
224# define bindtextdomain(Domainname, Dirname) do {} while (0)
5af11cab
AM
225# define _(String) (String)
226# define N_(String) (String)
252b5132
RH
227#endif
228
229#endif /* ! defined (BFD_SYSDEP_H) */
This page took 1.248876 seconds and 4 git commands to generate.