xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/nios2/elf.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1 /* Definitions of ELF target support for Altera Nios II.
2    Copyright (C) 2012-2020 Free Software Foundation, Inc.
3    Contributed by Jonah Graham (jgraham@altera.com),
4    Will Reece (wreece@altera.com), and Jeff DaSilva (jdasilva@altera.com).
5    Contributed by Mentor Graphics, Inc.
6 
7    This file is part of GCC.
8 
9    GCC is free software; you can redistribute it and/or modify it
10    under the terms of the GNU General Public License as published
11    by the Free Software Foundation; either version 3, or (at your
12    option) any later version.
13 
14    GCC is distributed in the hope that it will be useful, but WITHOUT
15    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17    License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with GCC; see the file COPYING3.  If not see
21    <http://www.gnu.org/licenses/>.  */
22 
23 
24 /* Specs to support the additional command-line options for Nios II ELF
25    toolchains.  */
26 
27 /* -msmallc chooses an alternate C library.
28    -msys-lib= specifies an additional low-level system/hosting library and
29    is typically used to suck in a library provided by a HAL BSP.  */
30 #undef LIB_SPEC
31 #define LIB_SPEC \
32 "--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \
33  %{msys-lib=*: -l%*} \
34  --end-group \
35 "
36 
37 /* Linking with -mhal suppresses inclusion of the GCC-provided crt* begin/end
38    code.  Normally in this case you also link with -msys-crt0= to specify
39    the startup code provided by the HAL BSP instead.  */
40 #undef STARTFILE_SPEC
41 #define STARTFILE_SPEC						\
42   "%{mhal:"							\
43   "%{msys-crt0=*:%*} %{!msys-crt0=*:crt0%O%s} "			\
44   "%{msys-crt0=:%eYou need a C startup file for -msys-crt0=};"	\
45   ":crti%O%s crtbegin%O%s}"
46 
47 #undef  ENDFILE_SPEC
48 #define ENDFILE_SPEC "%{!mhal:crtend%O%s crtn%O%s}"
49 
50 /* The ELF target doesn't support the Nios II Linux ABI.  */
51 #define TARGET_LINUX_ABI 0
52 
53 /* Default -fdelete-null-pointer-checks to off, to prevent the compiler
54    from treating accesses to address zero as traps.  On bare-metal Nios II
55    targets address zero may legitimately be mapped to memory (e.g., the
56    hardware description may specify this as the address of the interrupt
57    vector).  Users can override this on the command line to get the
58    additional optimizations it enables.  */
59 #define SUBTARGET_OVERRIDE_OPTIONS 		\
60   if (flag_delete_null_pointer_checks < 0)	\
61     flag_delete_null_pointer_checks = 0
62