150472Speter/* sysdep.h -- handle host dependencies for the GNU linker
237Srgrimes   Copyright (C) 1995-2022 Free Software Foundation, Inc.
378822Snik
450203Srgrimes   This file is part of the GNU Binutils.
537Srgrimes
639161Sobrien   This program is free software; you can redistribute it and/or modify
739490Sobrien   it under the terms of the GNU General Public License as published by
88571Srgrimes   the Free Software Foundation; either version 3 of the License, or
92878Srgrimes   (at your option) any later version.
1072515Sru
1172515Sru   This program is distributed in the hope that it will be useful,
128571Srgrimes   but WITHOUT ANY WARRANTY; without even the implied warranty of
132878Srgrimes   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
148571Srgrimes   GNU General Public License for more details.
158571Srgrimes
1672515Sru   You should have received a copy of the GNU General Public License
172878Srgrimes   along with this program; if not, write to the Free Software
1872515Sru   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
1972515Sru   MA 02110-1301, USA.  */
202878Srgrimes
2172515Sru#ifndef LD_SYSDEP_H
222878Srgrimes#define LD_SYSDEP_H
2372515Sru
2472515Sru#ifdef PACKAGE
252878Srgrimes#error sysdep.h must be included in lieu of config.h
262878Srgrimes#endif
2772515Sru
2872515Sru#include "config.h"
2972515Sru
3045173Sasami#include <stdio.h>
3172515Sru#ifdef HAVE_SYS_TYPES_H
3272515Sru#include <sys/types.h>
332878Srgrimes#endif
3472515Sru#ifdef HAVE_SYS_STAT_H
3572515Sru#include <sys/stat.h>
3672515Sru#endif
3772515Sru#include <stdlib.h>
3850296Srgrimes#include <string.h>
392878Srgrimes#include <stdarg.h>
4072515Sru#ifdef HAVE_UNISTD_H
4123120Smpp#include <unistd.h>
4272515Sru#endif
432878Srgrimes
442878Srgrimes#ifdef HAVE_REALPATH
4580516Smarkm# define REALPATH(a,b) realpath (a, b)
4680516Smarkm#else
4780516Smarkm# define REALPATH(a,b) NULL
4880516Smarkm#endif
4939490Sobrien
502878Srgrimes#ifdef USE_BINARY_FOPEN
5141855Speter#include "fopen-bin.h"
522878Srgrimes#else
5312388Sache#include "fopen-same.h"
542878Srgrimes#endif
5539490Sobrien
562878Srgrimes#ifdef HAVE_FCNTL_H
5739490Sobrien#include <fcntl.h>
582878Srgrimes#else
5941855Speter#ifdef HAVE_SYS_FILE_H
602878Srgrimes#include <sys/file.h>
6172515Sru#endif
6241855Speter#endif
632878Srgrimes
6472515Sru#ifdef HAVE_DLFCN_H
6541855Speter#include <dlfcn.h>
662878Srgrimes#endif
6741855Speter
682878Srgrimes#ifndef O_RDONLY
6950296Srgrimes#define O_RDONLY 0
7050296Srgrimes#endif
7141855Speter#ifndef O_WRONLY
7250296Srgrimes#define O_WRONLY 1
7350296Srgrimes#endif
742878Srgrimes#ifndef O_RDWR
7572515Sru#define O_RDWR 2
7672515Sru#endif
778571Srgrimes#ifndef O_ACCMODE
788571Srgrimes#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
792878Srgrimes#endif
808571Srgrimes/* Systems that don't already define this, don't need it.  */
812878Srgrimes#ifndef O_BINARY
828571Srgrimes#define O_BINARY 0
832878Srgrimes#endif
848571Srgrimes
852878Srgrimes#ifndef SEEK_SET
868571Srgrimes#define SEEK_SET 0
872878Srgrimes#endif
882878Srgrimes#ifndef SEEK_CUR
892878Srgrimes#define SEEK_CUR 1
902878Srgrimes#endif
9172515Sru#ifndef SEEK_END
922878Srgrimes#define SEEK_END 2
9372515Sru#endif
9472515Sru
958571Srgrimes#if !HAVE_DECL_ENVIRON
962878Srgrimesextern char **environ;
9741855Speter#endif
988571Srgrimes
99949Snate#define POISON_BFD_BOOLEAN 1
100
101#endif /* ! defined (LD_SYSDEP_H) */
102