netbsd-elf.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Common configuration file for NetBSD ELF targets.
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Contributed by Wasabi Systems, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. /* TARGET_OS_CPP_BUILTINS() common to all NetBSD ELF targets. */
  17. #define NETBSD_OS_CPP_BUILTINS_ELF() \
  18. do \
  19. { \
  20. NETBSD_OS_CPP_BUILTINS_COMMON(); \
  21. } \
  22. while (0)
  23. /* Provide a STARTFILE_SPEC appropriate for NetBSD ELF. Here we
  24. provide support for the special GCC option -static. On ELF
  25. targets, we also add the crtbegin.o file, which provides part
  26. of the support for getting C++ file-scope static objects
  27. constructed before entering "main". */
  28. #define NETBSD_STARTFILE_SPEC \
  29. "%{!shared: \
  30. %{pg:gcrt0%O%s} \
  31. %{!pg: \
  32. %{p:gcrt0%O%s} \
  33. %{!p:crt0%O%s}}} \
  34. %:if-exists(crti%O%s) \
  35. %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
  36. %{!static: \
  37. %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
  38. #undef STARTFILE_SPEC
  39. #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
  40. /* Provide an ENDFILE_SPEC appropriate for NetBSD ELF. Here we
  41. add crtend.o, which provides part of the support for getting
  42. C++ file-scope static objects deconstructed after exiting "main". */
  43. #define NETBSD_ENDFILE_SPEC \
  44. "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
  45. %:if-exists(crtn%O%s)"
  46. #undef ENDFILE_SPEC
  47. #define ENDFILE_SPEC NETBSD_ENDFILE_SPEC
  48. /* Provide a LINK_SPEC appropriate for NetBSD ELF. Here we provide
  49. support for the special GCC options -assert, -R, -rpath, -shared,
  50. -nostdlib, -static, -rdynamic, and -dynamic-linker.
  51. Target-specific code can use this in conjunction with any other
  52. target-specific LINK_SPEC options.
  53. Target-specific code must provide the %(netbsd_entry_point) spec. */
  54. #define NETBSD_LINK_SPEC_ELF \
  55. "%{assert*} %{R*} %{rpath*} \
  56. %{shared:-shared} \
  57. %{!shared: \
  58. -dc -dp \
  59. %{!nostdlib: \
  60. %{!r: \
  61. %{!e*:-e %(netbsd_entry_point)}}} \
  62. %{!static: \
  63. %{rdynamic:-export-dynamic} \
  64. -dynamic-linker /usr/libexec/ld.elf_so} \
  65. %{static:-static}}"
  66. /* Use --as-needed -lgcc_s for eh support. */
  67. #ifdef HAVE_LD_AS_NEEDED
  68. #define USE_LD_AS_NEEDED 1
  69. #endif