sysdep.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* sysdep.h -- handle host dependencies for the GNU linker
  2. Copyright (C) 1995-2022 Free Software Foundation, Inc.
  3. This file is part of the GNU Binutils.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #ifndef LD_SYSDEP_H
  17. #define LD_SYSDEP_H
  18. #ifdef PACKAGE
  19. #error sysdep.h must be included in lieu of config.h
  20. #endif
  21. #include "config.h"
  22. #include <stdio.h>
  23. #ifdef HAVE_SYS_TYPES_H
  24. #include <sys/types.h>
  25. #endif
  26. #ifdef HAVE_SYS_STAT_H
  27. #include <sys/stat.h>
  28. #endif
  29. #include <stdlib.h>
  30. #include <string.h>
  31. #include <stdarg.h>
  32. #ifdef HAVE_UNISTD_H
  33. #include <unistd.h>
  34. #endif
  35. #ifdef HAVE_REALPATH
  36. # define REALPATH(a,b) realpath (a, b)
  37. #else
  38. # define REALPATH(a,b) NULL
  39. #endif
  40. #ifdef USE_BINARY_FOPEN
  41. #include "fopen-bin.h"
  42. #else
  43. #include "fopen-same.h"
  44. #endif
  45. #ifdef HAVE_FCNTL_H
  46. #include <fcntl.h>
  47. #else
  48. #ifdef HAVE_SYS_FILE_H
  49. #include <sys/file.h>
  50. #endif
  51. #endif
  52. #ifdef HAVE_DLFCN_H
  53. #include <dlfcn.h>
  54. #endif
  55. #ifndef O_RDONLY
  56. #define O_RDONLY 0
  57. #endif
  58. #ifndef O_WRONLY
  59. #define O_WRONLY 1
  60. #endif
  61. #ifndef O_RDWR
  62. #define O_RDWR 2
  63. #endif
  64. #ifndef O_ACCMODE
  65. #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
  66. #endif
  67. /* Systems that don't already define this, don't need it. */
  68. #ifndef O_BINARY
  69. #define O_BINARY 0
  70. #endif
  71. #ifndef SEEK_SET
  72. #define SEEK_SET 0
  73. #endif
  74. #ifndef SEEK_CUR
  75. #define SEEK_CUR 1
  76. #endif
  77. #ifndef SEEK_END
  78. #define SEEK_END 2
  79. #endif
  80. #if !HAVE_DECL_ENVIRON
  81. extern char **environ;
  82. #endif
  83. #define POISON_BFD_BOOLEAN 1
  84. #endif /* ! defined (LD_SYSDEP_H) */