1 // Assembly language support for m68k 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 // SunOS, NetBSD, OpenBSD, Linux/a.out 44 #define C(entrypoint) _##entrypoint 45 #define L(label) L##label 46 #else 47 // SVR4, A/UX, AMIX, Atari, Linux/ELF 48 #define C(entrypoint) entrypoint 49 #define L(label) .L##label 50 #endif 51 52 // When assembly language code is compiled into a shared library, ELF linkers 53 // need to know which symbols are functions. 54 #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ELF__) || defined(__svr4__) 55 #define DECLARE_FUNCTION(name) .type C(name),@function 56 #define FUNEND(name) .size C(name),.-C(name) 57 #else 58 #define DECLARE_FUNCTION(name) 59 #define FUNEND(name) 60 #endif 61 #define FUNBEGIN(name) C(name): 62