Blame mpn/x86/darwin.m4

Packit 5c3484
divert(-1)
Packit 5c3484
dnl  Copyright 2007, 2011, 2012, 2014 Free Software Foundation, Inc.
Packit 5c3484
Packit 5c3484
dnl  This file is part of the GNU MP Library.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
dnl  it under the terms of either:
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
dnl      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
dnl      option) any later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or
Packit 5c3484
dnl
Packit 5c3484
dnl    * the GNU General Public License as published by the Free Software
Packit 5c3484
dnl      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
dnl      later version.
Packit 5c3484
dnl
Packit 5c3484
dnl  or both in parallel, as here.
Packit 5c3484
dnl
Packit 5c3484
dnl  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
dnl  for more details.
Packit 5c3484
dnl
Packit 5c3484
dnl  You should have received copies of the GNU General Public License and the
Packit 5c3484
dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
dnl  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
define(`DARWIN')
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Usage LEA(symbol,reg)
Packit 5c3484
dnl  Usage LEAL(symbol_local_to_file,reg)
Packit 5c3484
dnl
Packit 5c3484
dnl  We maintain lists of stuff to append in load_eip and darwin_bd.  The
Packit 5c3484
dnl  `index' stuff is needed to suppress repeated definitions.  To avoid
Packit 5c3484
dnl  getting fooled by "var" and "var1", we add 'bol ' (the end of
Packit 5c3484
dnl  'indirect_symbol') at the beginning and and a newline at the end.  This
Packit 5c3484
dnl  might be a bit fragile.
Packit 5c3484
Packit 5c3484
define(`LEA',
Packit 5c3484
m4_assert_numargs(2)
Packit 5c3484
`ifdef(`PIC',`
Packit 5c3484
ifelse(index(defn(`load_eip'), `$2'),-1,
Packit 5c3484
`m4append(`load_eip',
Packit 5c3484
`	TEXT
Packit 5c3484
	ALIGN(16)
Packit 5c3484
L(movl_eip_`'substr($2,1)):
Packit 5c3484
	movl	(%esp), $2
Packit 5c3484
	ret_internal
Packit 5c3484
')')
Packit 5c3484
ifelse(index(defn(`darwin_bd'), `bol $1
Packit 5c3484
'),-1,
Packit 5c3484
`m4append(`darwin_bd',
Packit 5c3484
`	.section __IMPORT,__pointers,non_lazy_symbol_pointers
Packit 5c3484
L($1`'$non_lazy_ptr):
Packit 5c3484
	.indirect_symbol $1
Packit 5c3484
	.long	 0
Packit 5c3484
')')
Packit 5c3484
	call	L(movl_eip_`'substr($2,1))
Packit 5c3484
	movl	L($1`'$non_lazy_ptr)-.($2), $2
Packit 5c3484
',`
Packit 5c3484
	movl	`$'$1, $2
Packit 5c3484
')')
Packit 5c3484
Packit 5c3484
define(`LEAL',
Packit 5c3484
m4_assert_numargs(2)
Packit 5c3484
`ifdef(`PIC',`
Packit 5c3484
ifelse(index(defn(`load_eip'), `$2'),-1,
Packit 5c3484
`m4append(`load_eip',
Packit 5c3484
`	TEXT
Packit 5c3484
	ALIGN(16)
Packit 5c3484
L(movl_eip_`'substr($2,1)):
Packit 5c3484
	movl	(%esp), $2
Packit 5c3484
	ret_internal
Packit 5c3484
')')
Packit 5c3484
	call	L(movl_eip_`'substr($2,1))
Packit 5c3484
	leal	$1-.($2), $2
Packit 5c3484
',`
Packit 5c3484
	movl	`$'$1, $2
Packit 5c3484
')')
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl ASM_END
Packit 5c3484
Packit 5c3484
define(`ASM_END',`load_eip`'darwin_bd')
Packit 5c3484
Packit 5c3484
define(`load_eip', `')		dnl updated in LEA
Packit 5c3484
define(`darwin_bd', `')		dnl updated in LEA
Packit 5c3484
Packit 5c3484
Packit 5c3484
dnl  Usage: CALL(funcname)
Packit 5c3484
dnl
Packit 5c3484
Packit 5c3484
define(`CALL',
Packit 5c3484
m4_assert_numargs(1)
Packit 5c3484
`call	GSYM_PREFIX`'$1')
Packit 5c3484
Packit 5c3484
undefine(`PIC_WITH_EBX')
Packit 5c3484
Packit 5c3484
divert`'dnl