1 // Assembly language support for arm CPU.
2 // Bruno Haible 1999-05-29
3 
4 // Copyright (C) 1999-2017 Bruno Haible <bruno@clisp.org>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
18 
19 // In order not to have to maintain several copies of the assembly language
20 // code, we use some macros which expand into the correct syntax.
21 // These macros are:
22 //   C(name)
23 //           This expands to the name of the C variable or function `name'.
24 //           On Unix BSD systems, this prepends an underscore.
25 //   L(label)
26 //           This expands to the name of a local label, having the name `label'.
27 //           On Unix ELF systems, where there is no underscore, names beginning
28 //           with an alphabetic character are automatically exported, so this
29 //           prepends a dot. Note that when defining a label, the `:' must
30 //           be inside the parentheses, not outside, because otherwise some
31 //           ANSI C preprocessor inserts a space between the label and the `:',
32 //           and some assemblers don't like this.
33 //   DECLARE_FUNCTION(name)
34 //           Declare `name' to be a global function. When assembly language
35 //           code is compiled into a shared library, ELF linkers need to know
36 //           which symbols are functions.
37 //   FUNBEGIN(name)
38 //           Start the assembly language code for the C function `name'.
39 //   FUNEND(name)
40 //           End the assembly language code for the C function 'name'.
41 
42 #ifdef ASM_UNDERSCORE
43 #define C(entrypoint) _##entrypoint
44 #define L(label) L##label
45 #else
46 #define C(entrypoint) entrypoint
47 #define L(label) .L##label
48 #endif
49 
50 // When assembly language code is compiled into a shared library, ELF linkers
51 // need to know which symbols are functions.
52 #if defined(__ELF__) || !defined(ASM_UNDERSCORE)
53 #define DECLARE_FUNCTION(name) .type C(name),%function
54 #define FUNEND(name) .size C(name),.-C(name)
55 #else
56 #define DECLARE_FUNCTION(name)
57 #define FUNEND(name)
58 #endif
59 #define FUNBEGIN(name) C(name):
60