xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/frv/linux.h (revision 2dd295436a0082eb4f8d294f4aa73c223413d0f2)
1 /* Target macros for the FRV Linux port of GCC.
2    Copyright (C) 1999-2020 Free Software Foundation, Inc.
3    Contributed by Red Hat Inc.
4 
5    This file is part of GCC.
6 
7    GCC is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published
9    by the Free Software Foundation; either version 3, or (at your
10    option) any later version.
11 
12    GCC is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15    License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with GCC; see the file COPYING3.  If not see
19    <http://www.gnu.org/licenses/>.  */
20 
21 #ifndef __FRV_LINUX_H__
22 #define __FRV_LINUX_H__
23 
24 #undef SUBTARGET_DRIVER_SELF_SPECS
25 #define SUBTARGET_DRIVER_SELF_SPECS \
26   "%{!mno-fdpic:-mfdpic}",
27 
28 #undef STARTFILE_SPEC
29 #define STARTFILE_SPEC \
30   "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
31    crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
32 
33 #undef ENDFILE_SPEC
34 #define ENDFILE_SPEC \
35   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
36 
37 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
38 
39 #undef LINK_SPEC
40 #define LINK_SPEC "\
41   %{mfdpic: -m elf32frvfd -z text} %{shared} %{pie} \
42   %{!shared: %{!static: \
43    %{rdynamic:-export-dynamic} \
44    -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
45    %{static}}"
46 
47 /* Support for compile-time default CPU.  */
48 #define OPTION_DEFAULT_SPECS \
49   {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }
50 
51 /* Define OS-specific predefined preprocessor macros.  */
52 #define TARGET_OS_CPP_BUILTINS()	\
53   do {					\
54     builtin_define ("__gnu_linux__");	\
55     builtin_define_std ("linux");	\
56     builtin_define_std ("unix");	\
57     builtin_assert ("system=linux");	\
58   } while (0)
59 
60 #define HAS_INIT_SECTION 1
61 #define INIT_SECTION_ASM_OP	"\t.section .init,\"ax\""
62 #define FINI_SECTION_ASM_OP	"\t.section .fini,\"ax\""
63 
64 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
65 asm (SECTION_OP); \
66 asm ("ldi.p @(fp,4), gr15 ! call " #FUNC); \
67 asm (TEXT_SECTION_ASM_OP);
68 
69 #undef INVOKE__main
70 
71 #undef Twrite
72 #define Twrite __write
73 
74 #endif /* __FRV_LINUX_H__ */
75