xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/config/nds32/t-nds32 (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1# Rules of libgcc and crtstuff of Andes NDS32 cpu for GNU compiler
2# Copyright (C) 2012-2022 Free Software Foundation, Inc.
3# Contributed by Andes Technology Corporation.
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
22# Note:
23#   Because GCC has its own make rules for crtbegin.o and crtend.o,
24#   we cannot use crtbegin.o and crtend.o rules.
25#   So we create crtbegin1.o and crtend1.o instead.
26#   Make sure the linker script include these two objects
27#   for building .ctors/.dtors sections.
28
29# Use -DCRT_BEGIN to create beginning parts of .init and .fini content
30# Make sure you are building crtbegin1.o with -O0 optimization,
31# otherwise the static function will be optimized out
32crtbegin1.o: $(srcdir)/config/nds32/initfini.c $(GCC_PASSES) $(CONFIG_H)
33	$(GCC_FOR_TARGET) $(INCLUDES) \
34	$(CFLAGS) \
35	-DCRT_BEGIN \
36	-finhibit-size-directive -fno-inline-functions \
37	-O0 -c $(srcdir)/config/nds32/initfini.c -o crtbegin1.o
38
39# Use -DCRT_END to create ending parts of .init and .fini content
40# Make sure you are building crtend1.o with -O0 optimization,
41# otherwise the static function will be optimized out
42crtend1.o: $(srcdir)/config/nds32/initfini.c $(GCC_PASSES) $(CONFIG_H)
43	$(GCC_FOR_TARGET) $(INCLUDES) \
44	$(CFLAGS) \
45	-DCRT_END \
46	-finhibit-size-directive -fno-inline-functions \
47	-O0 -c $(srcdir)/config/nds32/initfini.c -o crtend1.o
48
49# Use this rule if and only if your crt0.o does not come from library
50# Also, be sure to add 'crtzero.o' in extra_parts in libgcc/config.host
51# and change STARTFILE_SPEC in nds32.h
52#
53#crtzero.o: $(srcdir)/config/nds32/crtzero.S $(GCC_PASSES) $(CONFIG_H)
54#	$(GCC_FOR_TARGET) $(INCLUDES) \
55#	-c $(srcdir)/config/nds32/crtzero.S -o crtzero.o
56
57
58# ------------------------------------------------------------------------
59