netbsd-elf.h revision 169689
1235911Smav/* Common configuration file for NetBSD ELF targets. 2235911Smav Copyright (C) 2002 Free Software Foundation, Inc. 3235911Smav Contributed by Wasabi Systems, Inc. 4235911Smav 5235911SmavThis file is part of GCC. 6235911Smav 7235911SmavGCC is free software; you can redistribute it and/or modify 8235911Smavit under the terms of the GNU General Public License as published by 9235911Smavthe Free Software Foundation; either version 2, or (at your option) 10235911Smavany later version. 11235911Smav 12235911SmavGCC is distributed in the hope that it will be useful, 13235911Smavbut WITHOUT ANY WARRANTY; without even the implied warranty of 14235911SmavMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15235911SmavGNU General Public License for more details. 16235911Smav 17235911SmavYou should have received a copy of the GNU General Public License 18235911Smavalong with GCC; see the file COPYING. If not, write to 19235911Smavthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20235911SmavBoston, MA 02110-1301, USA. */ 21235911Smav 22235911Smav/* TARGET_OS_CPP_BUILTINS() common to all NetBSD ELF targets. */ 23235911Smav#define NETBSD_OS_CPP_BUILTINS_ELF() \ 24235911Smav do \ 25235911Smav { \ 26235911Smav NETBSD_OS_CPP_BUILTINS_COMMON(); \ 27235911Smav } \ 28235911Smav while (0) 29235911Smav 30235911Smav/* This defines which switch letters take arguments. On NetBSD, most 31235911Smav of the normal cases (defined by gcc.c) apply, and we also have -h* 32235911Smav and -z* options (for the linker) (coming from SVR4). */ 33235911Smav 34235911Smav#undef SWITCH_TAKES_ARG 35235911Smav#define SWITCH_TAKES_ARG(CHAR) \ 36235911Smav (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 37235911Smav || (CHAR) == 'h' \ 38235911Smav || (CHAR) == 'z' \ 39235911Smav || (CHAR) == 'R') 40235911Smav 41235911Smav 42235911Smav/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF. Here we 43235911Smav provide support for the special GCC option -static. On ELF 44235911Smav targets, we also add the crtbegin.o file, which provides part 45235911Smav of the support for getting C++ file-scope static objects 46235911Smav constructed before entering "main". */ 47235911Smav 48235911Smav#define NETBSD_STARTFILE_SPEC \ 49235911Smav "%{!shared: \ 50235911Smav %{pg:gcrt0%O%s} \ 51235911Smav %{!pg: \ 52235911Smav %{p:gcrt0%O%s} \ 53235911Smav %{!p:crt0%O%s}}} \ 54235911Smav %:if-exists(crti%O%s) \ 55235911Smav %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \ 56235911Smav %{!static: \ 57235911Smav %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}" 58235911Smav 59235911Smav#undef STARTFILE_SPEC 60235911Smav#define STARTFILE_SPEC NETBSD_STARTFILE_SPEC 61235911Smav 62235911Smav 63235911Smav/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF. Here we 64235911Smav add crtend.o, which provides part of the support for getting 65235911Smav C++ file-scope static objects deconstructed after exiting "main". */ 66235911Smav 67235911Smav#define NETBSD_ENDFILE_SPEC \ 68235911Smav "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \ 69235911Smav %:if-exists(crtn%O%s)" 70235911Smav 71235911Smav#undef ENDFILE_SPEC 72235911Smav#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC 73235911Smav 74235911Smav/* Provide a LINK_SPEC appropriate for NetBSD ELF. Here we provide 75235911Smav support for the special GCC options -assert, -R, -rpath, -shared, 76235911Smav -nostdlib, -static, -rdynamic, and -dynamic-linker. 77235911Smav 78235911Smav Target-specific code can use this in conjunction with any other 79235911Smav target-specific LINK_SPEC options. 80235911Smav 81235911Smav Target-specific code must provide the %(netbsd_entry_point) spec. */ 82235911Smav 83235911Smav#define NETBSD_LINK_SPEC_ELF \ 84235911Smav "%{assert*} %{R*} %{rpath*} \ 85235911Smav %{shared:-shared} \ 86235911Smav %{!shared: \ 87235911Smav -dc -dp \ 88235911Smav %{!nostdlib: \ 89235911Smav %{!r*: \ 90235911Smav %{!e*:-e %(netbsd_entry_point)}}} \ 91235911Smav %{!static: \ 92235911Smav %{rdynamic:-export-dynamic} \ 93235911Smav %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \ 94235911Smav %{static:-static}}" 95235911Smav