xref: /netbsd/external/lgpl3/gmp/dist/mpn/powerpc32/elf.m4 (revision 21c03f4c)
1divert(-1)
2dnl  m4 macros for powerpc32 GNU/Linux assembly.
3
4dnl  Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
5
6dnl  This file is part of the GNU MP Library.
7dnl
8dnl  The GNU MP Library is free software; you can redistribute it and/or modify
9dnl  it under the terms of either:
10dnl
11dnl    * the GNU Lesser General Public License as published by the Free
12dnl      Software Foundation; either version 3 of the License, or (at your
13dnl      option) any later version.
14dnl
15dnl  or
16dnl
17dnl    * the GNU General Public License as published by the Free Software
18dnl      Foundation; either version 2 of the License, or (at your option) any
19dnl      later version.
20dnl
21dnl  or both in parallel, as here.
22dnl
23dnl  The GNU MP Library is distributed in the hope that it will be useful, but
24dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26dnl  for more details.
27dnl
28dnl  You should have received copies of the GNU General Public License and the
29dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
30dnl  see https://www.gnu.org/licenses/.
31
32define(`ASM_START',`')
33
34dnl  Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
35dnl          EPILOGUE_cpu(GSYM_PREFIX`'foo)
36dnl
37
38define(`PROLOGUE_cpu',
39m4_assert_numargs_range(1,2)
40`ifelse(`$2',toc,,
41`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
42	.section	".text"
43	.align	3
44	.globl	$1
45	.type	$1, @function
46$1:')
47
48define(`EPILOGUE_cpu',
49m4_assert_numargs(1)
50`	.size	$1, .-$1')
51
52define(`LEA',
53m4_assert_numargs(2)
54`ifdef(`PIC',`
55	mflr	r0
56	bcl	20, 31, 1f
571:	mflr	$1
58	addis	$1, $1, (_GLOBAL_OFFSET_TABLE_-1b)@ha
59	addi	$1, $1, (_GLOBAL_OFFSET_TABLE_-1b)@l
60	mtlr	r0
61	lwz	$1, $2@got($1)
62',`
63	lis	$1, $2@ha
64	la	$1, $2@l($1)
65')')
66
67
68define(`LEAL',
69m4_assert_numargs(2)
70`LEA($1,$2)')
71
72
73define(`EXTERN',
74m4_assert_numargs(1)
75`dnl')
76
77define(`DEF_OBJECT',
78m4_assert_numargs_range(1,2)
79`
80	.section	.rodata
81	ALIGN(ifelse($#,1,2,$2))
82	.type	$1, @object
83$1:
84')
85
86define(`END_OBJECT',
87m4_assert_numargs(1)
88`	.size	$1, .-$1')
89
90define(`ASM_END', `dnl')
91
92ifdef(`PIC',`
93define(`PIC_SLOW')')
94
95dnl  64-bit "long long" parameters are put in an even-odd pair, skipping an
96dnl  even register if that was in turn.  I wish somebody could explain why that
97dnl  is a good idea.
98define(`BROKEN_LONGLONG_PARAM')
99
100divert
101