1# GCC Makefile fragment for Synopsys DesignWare ARC
2
3# Copyright (C) 2007-2020 Free Software Foundation, Inc.
4# Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
5#              on behalf of Synopsys Inc.
6
7# This file is part of GCC.
8
9# GCC is free software; you can redistribute it and/or modify it under the
10# terms of the GNU General Public License as published by the Free Software
11# Foundation; either version 3, or (at your option) any later version.
12
13# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16# details.
17
18# You should have received a copy of the GNU General Public License along
19# with GCC; see the file COPYING3.  If not see
20# <http://www.gnu.org/licenses/>.
21
22CROSS_LIBGCC1 = libgcc1-asm.a
23LIB1ASMSRC = arc/lib1funcs.S
24LIB1ASMFUNCS = _mulsi3 _umulsidi3  _umulsi3_highpart _muldi3 \
25  _udivsi3 _divsi3 _umodsi3 _modsi3 \
26  _divmod_tools _clzsi2 \
27  _millicodethunk_st _millicodethunk_ld _millicodethunk_ret \
28  _adddf3 _muldf3 _addsf3 _mulsf3 _divsf3 _divdf3 _truncdfsf2 _extendsfdf2 \
29  _eqdf2 _eqsf2 _gedf2 _gesf2 _gtdf2 _gtsf2 _uneqdf2 _uneqsf2 _ordsf2 _orddf2 \
30  _fixdfsi _fixsfsi _floatsidf _floatsisf _fixunsdfsi _floatunsidf
31
32#LIBGCC2_CFLAGS = -g1 -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS)
33
34# For floating-point emulation, we mostly use hand-coded assembly.
35# We use fp-bit.c for debugging purposes, and some parts of it
36# as a fallback for hardware configurations for which the hand-coded
37# assembly support is incomplete, i.e., where there is no NORM and/or no
38# supported multiply instruction.  Using floating point on such a
39# configuration is generally inadvisable, but we got to provide support
40# somehow so that we can run the testsuites.
41# fp-hack.h / dp-hack.h take care of slecting the parts that are needed,
42# and (for debugging) of renaming functions so that they can be
43# used in an asm wrapper.
44
45LIB2ADD = fp-bit.c dp-bit.c
46LIB2ADD += $(srcdir)/config/arc/lib2funcs.c
47
48dp-bit.c: $(srcdir)/fp-bit.c
49	echo '#ifndef __big_endian__' > dp-bit.c
50	echo '#endif' >> dp-bit.c
51	echo '#include "fp-bit.h"' >> dp-bit.c
52	echo '#include "config/arc/dp-hack.h"' >> dp-bit.c
53	grep -v 'include.*fp-bit.h' $(srcdir)/fp-bit.c >> dp-bit.c
54
55fp-bit.c: $(srcdir)/fp-bit.c
56	echo '#define FLOAT' > fp-bit.c
57	echo '#ifndef __big_endian__' >> fp-bit.c
58	echo '#endif' >> fp-bit.c
59	echo '#include "config/arc/fp-hack.h"' >> fp-bit.c
60	cat $(srcdir)/fp-bit.c >> fp-bit.c
61
62# .init/.fini section routines
63
64crttls.o: $(srcdir)/config/arc/crttls.S
65	$(crt_compile) -c -x assembler-with-cpp $<
66