Update SPARC divrem generation to match output.
[glibc.git] / sysdeps / sparc / sparc32 / Makefile
blobeb0438ae5097b3d33a2e8c2df772ab0ef16d754e
1 # Copyright (C) 1991-2017 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
18 ifeq ($(subdir),gnulib)
19 sysdep_routines = dotmul umul $(divrem) alloca
20 endif # gnulib
22 # We distribute these files, even though they are generated,
23 # so as to avoid the need for a functioning m4 to build the library.
24 divrem := sdiv udiv rem urem
26 +divrem-NAME-sdiv := div
27 +divrem-NAME-udiv := udiv
28 +divrem-NAME-rem := rem
29 +divrem-NAME-urem := urem
30 +divrem-NAME = $(+divrem-NAME-$(basename $(notdir $@)))
31 +divrem-OP-div := div
32 +divrem-OP-udiv := div
33 +divrem-OP-rem := rem
34 +divrem-OP-urem := rem
35 +divrem-S-div := true
36 +divrem-S-rem := true
37 +divrem-S-udiv := false
38 +divrem-S-urem := false
39 $(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S): $(sysdep_dir)/sparc/sparc32/divrem.m4
40 (echo -n "define(NAME,\`.$(+divrem-NAME)')"; \
41 echo -n " define(OP,\`$(+divrem-OP-$(+divrem-NAME))')"; \
42 echo -n " define(S,\`$(+divrem-S-$(+divrem-NAME))')"; \
43 echo " /* This file is generated from divrem.m4; DO NOT EDIT! */"; \
44 cat $<) | $(M4) > $@-tmp
45 # Make it unwritable so noone will edit it by mistake.
46 -chmod a-w $@-tmp
47 mv -f $@-tmp $@
49 sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S)
51 # libgcc __divdi3 and __moddi3 uses .udiv and since it is also exported by
52 # libc.so linker will create PLTs for the symbol. To avoid it we strong alias
53 # the exported libc one to __wrap_.udiv and use linker option --wrap to make any
54 # call to .udiv to call the wrapper symbol.
55 libc.so-gnulib += -Wl,--wrap=.udiv