summaryrefslogtreecommitdiff
path: root/gcc/config/nios2/elf.h
blob: 91d7b862b8e89849fd3b07d5cd2163912714fcaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Definitions of ELF target support for Altera Nios II.
   Copyright (C) 2012-2017 Free Software Foundation, Inc.
   Contributed by Jonah Graham (jgraham@altera.com), 
   Will Reece (wreece@altera.com), and Jeff DaSilva (jdasilva@altera.com).
   Contributed by Mentor Graphics, Inc.

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published
   by the Free Software Foundation; either version 3, or (at your
   option) any later version.

   GCC is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.

   You should have received a copy of the GNU General Public License
   along with GCC; see the file COPYING3.  If not see
   <http://www.gnu.org/licenses/>.  */


/* Specs to support the additional command-line options for Nios II ELF
   toolchains.  */

/* -msmallc chooses an alternate C library.
   -msys-lib= specifies an additional low-level system/hosting library and
   is typically used to suck in a library provided by a HAL BSP.  */
#undef LIB_SPEC
#define LIB_SPEC \
"--start-group %{msmallc: -lsmallc} %{!msmallc: -lc} -lgcc \
 %{msys-lib=*: -l%*} \
 --end-group \
"

/* Linking with -mhal suppresses inclusion of the GCC-provided crt* begin/end
   code.  Normally in this case you also link with -msys-crt0= to specify
   the startup code provided by the HAL BSP instead.  */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC						\
  "%{mhal:"							\
  "%{msys-crt0=*:%*} %{!msys-crt0=*:crt0%O%s} "			\
  "%{msys-crt0=:%eYou need a C startup file for -msys-crt0=};"	\
  ":crti%O%s crtbegin%O%s}"

#undef  ENDFILE_SPEC
#define ENDFILE_SPEC "%{!mhal:crtend%O%s crtn%O%s}"

/* The ELF target doesn't support the Nios II Linux ABI.  */
#define TARGET_LINUX_ABI 0

/* Default -fdelete-null-pointer-checks to off, to prevent the compiler
   from treating accesses to address zero as traps.  On bare-metal Nios II
   targets address zero may legitimately be mapped to memory (e.g., the
   hardware description may specify this as the address of the interrupt
   vector).  Users can override this on the command line to get the
   additional optimizations it enables.  */
#define SUBTARGET_OVERRIDE_OPTIONS 		\
  if (flag_delete_null_pointer_checks < 0)	\
    flag_delete_null_pointer_checks = 0