Fix potential use-after-free bugs.
[deliverable/binutils-gdb.git] / ld / sysdep.h
CommitLineData
252b5132 1/* sysdep.h -- handle host dependencies for the GNU linker
aa820537 2 Copyright 1995, 1996, 1997, 1999, 2002, 2003, 2005, 2007
1579bae1 3 Free Software Foundation, Inc.
252b5132 4
f96b4a7b 5 This file is part of the GNU Binutils.
252b5132 6
f96b4a7b 7 This program is free software; you can redistribute it and/or modify
252b5132 8 it under the terms of the GNU General Public License as published by
f96b4a7b
NC
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
252b5132 11
f96b4a7b 12 This program is distributed in the hope that it will be useful,
252b5132
RH
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
f96b4a7b
NC
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 LD_SYSDEP_H
23#define LD_SYSDEP_H
24
252b5132
RH
25#include "config.h"
26
27#include <stdio.h>
28#include <sys/types.h>
29#include <sys/stat.h>
5d3236ee 30#include <stdarg.h>
252b5132
RH
31
32#ifdef HAVE_STRING_H
33#include <string.h>
34#else
35#ifdef HAVE_STRINGS_H
36#include <strings.h>
37#else
38extern char *strchr ();
39extern char *strrchr ();
40#endif
41#endif
42
43#ifdef HAVE_STDLIB_H
44#include <stdlib.h>
45#endif
46
47#ifdef HAVE_UNISTD_H
48#include <unistd.h>
49#endif
50
939ba9d0
NC
51/* for PATH_MAX */
52#ifdef HAVE_LIMITS_H
53#include <limits.h>
54#endif
55/* for MAXPATHLEN */
56#ifdef HAVE_SYS_PARAM_H
57#include <sys/param.h>
58#endif
59#ifdef PATH_MAX
60# define LD_PATHMAX PATH_MAX
61#else
62# ifdef MAXPATHLEN
63# define LD_PATHMAX MAXPATHLEN
64# else
65# define LD_PATHMAX 1024
66# endif
67#endif
68
69#ifdef HAVE_REALPATH
70# define REALPATH(a,b) realpath (a, b)
71#else
72# define REALPATH(a,b) NULL
73#endif
74
5d3236ee
DK
75#ifdef HAVE_UNISTD_H
76#include <unistd.h>
77#endif
78
252b5132
RH
79#ifdef USE_BINARY_FOPEN
80#include "fopen-bin.h"
81#else
82#include "fopen-same.h"
83#endif
84
5d3236ee
DK
85#ifdef HAVE_FCNTL_H
86#include <fcntl.h>
87#else
88#ifdef HAVE_SYS_FILE_H
89#include <sys/file.h>
90#endif
91#endif
92
93/* This is both more precise than and includes HAVE_DLFCN_H. */
94#ifdef ENABLE_PLUGINS
95#include <dlfcn.h>
96#endif
97
98#ifndef O_RDONLY
99#define O_RDONLY 0
100#endif
101#ifndef O_WRONLY
102#define O_WRONLY 1
103#endif
104#ifndef O_RDWR
105#define O_RDWR 2
106#endif
107#ifndef O_ACCMODE
108#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
109#endif
110/* Systems that don't already define this, don't need it. */
111#ifndef O_BINARY
112#define O_BINARY 0
113#endif
114
115#ifndef SEEK_SET
116#define SEEK_SET 0
117#endif
118#ifndef SEEK_CUR
119#define SEEK_CUR 1
120#endif
121#ifndef SEEK_END
122#define SEEK_END 2
123#endif
124
502bdb00 125#if !HAVE_DECL_STRSTR
252b5132
RH
126extern char *strstr ();
127#endif
128
502bdb00 129#if !HAVE_DECL_FREE
252b5132
RH
130extern void free ();
131#endif
132
502bdb00 133#if !HAVE_DECL_GETENV
252b5132
RH
134extern char *getenv ();
135#endif
136
502bdb00 137#if !HAVE_DECL_ENVIRON
252b5132
RH
138extern char **environ;
139#endif
140
141#endif /* ! defined (LD_SYSDEP_H) */
This page took 0.467858 seconds and 4 git commands to generate.