xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/x86/darwin.m4 (revision b83ebeba7f767758d2778bb0f9d7a76534253621)
1divert(-1)
2dnl  Copyright 2007, 2011, 2012 Free Software Foundation, Inc.
3dnl
4dnl  This file is part of the GNU MP Library.
5dnl
6dnl  The GNU MP Library is free software; you can redistribute it and/or
7dnl  modify it under the terms of the GNU Lesser General Public License as
8dnl  published by the Free Software Foundation; either version 3 of the
9dnl  License, or (at your option) any later version.
10dnl
11dnl  The GNU MP Library is distributed in the hope that it will be useful,
12dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14dnl  Lesser General Public License for more details.
15dnl
16dnl  You should have received a copy of the GNU Lesser General Public License
17dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
18
19define(`DARWIN')
20
21
22dnl  Usage LEA(symbol,reg)
23dnl
24dnl  We maintain lists of stuff to append in load_eip and darwin_bd.  The
25dnl  `index' stuff is needed to suppress repeated definitions.  To avoid
26dnl  getting fooled by "var" and "var1", we add 'bol ' (the end of
27dnl  'indirect_symbol') at the beginning and and a newline at the end.  This
28dnl  might be a bit fragile.
29
30define(`LEA',
31m4_assert_numargs(2)
32`ifdef(`PIC',`
33ifelse(index(defn(`load_eip'), `$2'),-1,
34`m4append(`load_eip',
35`L(movl_eip_`'substr($2,1)):
36	movl	(%esp), $2
37	ret_internal
38')')
39ifelse(index(defn(`darwin_bd'), `bol $1
40'),-1,
41`m4append(`darwin_bd',
42`	.section __IMPORT,__pointers,non_lazy_symbol_pointers
43L($1`'$non_lazy_ptr):
44	.indirect_symbol $1
45	.long	 0
46')')
47	call	L(movl_eip_`'substr($2,1))
48	movl	L($1`'$non_lazy_ptr)-.($2), $2
49',`
50	movl	`$'$1, $2
51')')
52
53
54dnl EPILOGUE_cpu
55
56define(`EPILOGUE_cpu',`load_eip`'darwin_bd')
57
58define(`load_eip', `')		dnl updated in LEA
59define(`darwin_bd', `')		dnl updated in LEA
60
61
62dnl  Usage: CALL(funcname)
63dnl
64
65define(`CALL',
66m4_assert_numargs(1)
67`call	GSYM_PREFIX`'$1')
68
69undefine(`PIC_WITH_EBX')
70
71divert`'dnl
72