netbsd-elf.h revision 117395
1179407Sobrien/* Common configuration file for NetBSD ELF targets. 2179407Sobrien Copyright (C) 2002 Free Software Foundation, Inc. 3218822Sdim Contributed by Wasabi Systems, Inc. 4179407Sobrien 5179407SobrienThis file is part of GNU CC. 6179407Sobrien 7179407SobrienGNU CC is free software; you can redistribute it and/or modify 8179407Sobrienit under the terms of the GNU General Public License as published by 9179407Sobrienthe Free Software Foundation; either version 2, or (at your option) 10179407Sobrienany later version. 11179407Sobrien 12179407SobrienGNU CC is distributed in the hope that it will be useful, 13179407Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 14179407SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15179407SobrienGNU General Public License for more details. 16179407Sobrien 17179407SobrienYou should have received a copy of the GNU General Public License 18179407Sobrienalong with GNU CC; see the file COPYING. If not, write to 19179407Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 20179407SobrienBoston, MA 02111-1307, USA. */ 21179407Sobrien 22218822Sdim/* TARGET_OS_CPP_BUILTINS() common to all NetBSD ELF targets. */ 23179407Sobrien#define NETBSD_OS_CPP_BUILTINS_ELF() \ 24218822Sdim do \ 25179407Sobrien { \ 26179407Sobrien NETBSD_OS_CPP_BUILTINS_COMMON(); \ 27179407Sobrien builtin_define ("__ELF__"); \ 28179407Sobrien } \ 29179407Sobrien while (0) 30179407Sobrien 31179407Sobrien/* This defines which switch letters take arguments. On NetBSD, most 32179407Sobrien of the normal cases (defined by gcc.c) apply, and we also have -h* 33179407Sobrien and -z* options (for the linker) (coming from SVR4). */ 34179407Sobrien 35179407Sobrien#undef SWITCH_TAKES_ARG 36179407Sobrien#define SWITCH_TAKES_ARG(CHAR) \ 37179407Sobrien (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 38179407Sobrien || (CHAR) == 'h' \ 39179407Sobrien || (CHAR) == 'z' \ 40179407Sobrien || (CHAR) == 'R') 41179407Sobrien 42179407Sobrien 43179407Sobrien/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF. Here we 44179407Sobrien provide support for the special GCC option -static. On ELF 45179407Sobrien targets, we also add the crtbegin.o file, which provides part 46179407Sobrien of the support for getting C++ file-scope static objects 47179407Sobrien constructed before entering "main". */ 48179407Sobrien 49179407Sobrien#define NETBSD_STARTFILE_SPEC \ 50179407Sobrien "%{!shared: \ 51179407Sobrien %{pg:gcrt0%O%s} \ 52179407Sobrien %{!pg: \ 53179407Sobrien %{p:gcrt0%O%s} \ 54179407Sobrien %{!p:crt0%O%s}}} \ 55179407Sobrien %:if-exists(crti%O%s) \ 56179407Sobrien %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \ 57179407Sobrien %{!static: \ 58179407Sobrien %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}" 59179407Sobrien 60179407Sobrien#undef STARTFILE_SPEC 61179407Sobrien#define STARTFILE_SPEC NETBSD_STARTFILE_SPEC 62179407Sobrien 63218822Sdim 64179407Sobrien/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF. Here we 65179407Sobrien add crtend.o, which provides part of the support for getting 66179407Sobrien C++ file-scope static objects deconstructed after exiting "main". */ 67179407Sobrien 68179407Sobrien#define NETBSD_ENDFILE_SPEC \ 69179407Sobrien "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \ 70179407Sobrien %:if-exists(crtn%O%s)" 71179407Sobrien 72179407Sobrien#undef ENDFILE_SPEC 73179407Sobrien#define ENDFILE_SPEC NETBSD_ENDFILE_SPEC 74179407Sobrien 75179407Sobrien/* Provide a LINK_SPEC appropriate for NetBSD ELF. Here we provide 76179407Sobrien support for the special GCC options -assert, -R, -rpath, -shared, 77179407Sobrien -nostdlib, -static, -rdynamic, and -dynamic-linker. 78179407Sobrien 79179407Sobrien Target-specific code can use this in conjunction with any other 80179407Sobrien target-specific LINK_SPEC options. 81179407Sobrien 82179407Sobrien Target-specific code must provide the %(netbsd_entry_point) spec. */ 83179407Sobrien 84179407Sobrien#define NETBSD_LINK_SPEC_ELF \ 85179407Sobrien "%{assert*} %{R*} %{rpath*} \ 86179407Sobrien %{shared:-shared} \ 87179407Sobrien %{!shared: \ 88179407Sobrien -dc -dp \ 89179407Sobrien %{!nostdlib: \ 90179407Sobrien %{!r*: \ 91179407Sobrien %{!e*:-e %(netbsd_entry_point)}}} \ 92179407Sobrien %{!static: \ 93179407Sobrien %{rdynamic:-export-dynamic} \ 94179407Sobrien %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \ 95179407Sobrien %{static:-static}}" 96179407Sobrien