12a6b7db3Sskrll /* sysdep.h -- handle host dependencies for the GNU linker 2*f22f0ef4Schristos Copyright (C) 1995-2022 Free Software Foundation, Inc. 32a6b7db3Sskrll 42a6b7db3Sskrll This file is part of the GNU Binutils. 52a6b7db3Sskrll 62a6b7db3Sskrll This program is free software; you can redistribute it and/or modify 72a6b7db3Sskrll it under the terms of the GNU General Public License as published by 82a6b7db3Sskrll the Free Software Foundation; either version 3 of the License, or 92a6b7db3Sskrll (at your option) any later version. 102a6b7db3Sskrll 112a6b7db3Sskrll This program is distributed in the hope that it will be useful, 122a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of 132a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 142a6b7db3Sskrll GNU General Public License for more details. 152a6b7db3Sskrll 162a6b7db3Sskrll You should have received a copy of the GNU General Public License 172a6b7db3Sskrll along with this program; if not, write to the Free Software 182a6b7db3Sskrll Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 192a6b7db3Sskrll MA 02110-1301, USA. */ 202a6b7db3Sskrll 212a6b7db3Sskrll #ifndef LD_SYSDEP_H 222a6b7db3Sskrll #define LD_SYSDEP_H 232a6b7db3Sskrll 2405caefcfSchristos #ifdef PACKAGE 2505caefcfSchristos #error sysdep.h must be included in lieu of config.h 2605caefcfSchristos #endif 2705caefcfSchristos 282a6b7db3Sskrll #include "config.h" 292a6b7db3Sskrll 302a6b7db3Sskrll #include <stdio.h> 31*f22f0ef4Schristos #ifdef HAVE_SYS_TYPES_H 322a6b7db3Sskrll #include <sys/types.h> 33*f22f0ef4Schristos #endif 34*f22f0ef4Schristos #ifdef HAVE_SYS_STAT_H 352a6b7db3Sskrll #include <sys/stat.h> 362a6b7db3Sskrll #endif 372a6b7db3Sskrll #include <stdlib.h> 38*f22f0ef4Schristos #include <string.h> 39*f22f0ef4Schristos #include <stdarg.h> 402a6b7db3Sskrll #ifdef HAVE_UNISTD_H 412a6b7db3Sskrll #include <unistd.h> 422a6b7db3Sskrll #endif 432a6b7db3Sskrll 442a6b7db3Sskrll #ifdef HAVE_REALPATH 452a6b7db3Sskrll # define REALPATH(a,b) realpath (a, b) 462a6b7db3Sskrll #else 472a6b7db3Sskrll # define REALPATH(a,b) NULL 482a6b7db3Sskrll #endif 492a6b7db3Sskrll 502a6b7db3Sskrll #ifdef USE_BINARY_FOPEN 512a6b7db3Sskrll #include "fopen-bin.h" 522a6b7db3Sskrll #else 532a6b7db3Sskrll #include "fopen-same.h" 542a6b7db3Sskrll #endif 552a6b7db3Sskrll 56b3ac4aedSchristos #ifdef HAVE_FCNTL_H 57b3ac4aedSchristos #include <fcntl.h> 58b3ac4aedSchristos #else 59b3ac4aedSchristos #ifdef HAVE_SYS_FILE_H 60b3ac4aedSchristos #include <sys/file.h> 61b3ac4aedSchristos #endif 62b3ac4aedSchristos #endif 63b3ac4aedSchristos 64b3ac4aedSchristos #ifdef HAVE_DLFCN_H 65b3ac4aedSchristos #include <dlfcn.h> 66b3ac4aedSchristos #endif 67b3ac4aedSchristos 68b3ac4aedSchristos #ifndef O_RDONLY 69b3ac4aedSchristos #define O_RDONLY 0 70b3ac4aedSchristos #endif 71b3ac4aedSchristos #ifndef O_WRONLY 72b3ac4aedSchristos #define O_WRONLY 1 73b3ac4aedSchristos #endif 74b3ac4aedSchristos #ifndef O_RDWR 75b3ac4aedSchristos #define O_RDWR 2 76b3ac4aedSchristos #endif 77b3ac4aedSchristos #ifndef O_ACCMODE 78b3ac4aedSchristos #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) 79b3ac4aedSchristos #endif 80b3ac4aedSchristos /* Systems that don't already define this, don't need it. */ 81b3ac4aedSchristos #ifndef O_BINARY 82b3ac4aedSchristos #define O_BINARY 0 83b3ac4aedSchristos #endif 84b3ac4aedSchristos 85b3ac4aedSchristos #ifndef SEEK_SET 86b3ac4aedSchristos #define SEEK_SET 0 87b3ac4aedSchristos #endif 88b3ac4aedSchristos #ifndef SEEK_CUR 89b3ac4aedSchristos #define SEEK_CUR 1 90b3ac4aedSchristos #endif 91b3ac4aedSchristos #ifndef SEEK_END 92b3ac4aedSchristos #define SEEK_END 2 93b3ac4aedSchristos #endif 94b3ac4aedSchristos 952a6b7db3Sskrll #if !HAVE_DECL_ENVIRON 962a6b7db3Sskrll extern char **environ; 972a6b7db3Sskrll #endif 982a6b7db3Sskrll 99*f22f0ef4Schristos #define POISON_BFD_BOOLEAN 1 100*f22f0ef4Schristos 1012a6b7db3Sskrll #endif /* ! defined (LD_SYSDEP_H) */ 102