1 /* asm.h -- macros for m68k asm
3 * Copyright (c) 1995, 1996 Cygnus Support
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
18 * XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0-3
19 * XXX The following ifdef magic fixes the problem but results in a warning
20 * XXX when compiling assembly code.
22 #ifndef __USER_LABEL_PREFIX__
23 /* #define __USER_LABEL_PREFIX__ "" /* no underscore for coff */
24 #define __USER_LABEL_PREFIX__ _ /* leading underscore for aout */
27 #ifndef __REGISTER_PREFIX__
28 #define __REGISTER_PREFIX__ /* never has anything prefixed */
33 * some assemblers choke on '#' as an immediate value. As gcc can also
34 * use '&', use that in those cases.
36 #ifndef __IMMEDIATE_PREFIX__
37 #define __IMMEDIATE_PREFIX__ #
40 /* ANSI concatenation macros. */
41 #define CONCAT1(a, b) CONCAT2(a, b)
42 #define CONCAT2(a, b) a ## b
44 /* use the right prefix for global labels. */
45 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__,x)
47 /* use the right prefix for registers. */
48 #define REG(x) CONCAT1 (__REGISTER_PREFIX__,x)
50 /* use the right prefix for immediate values. */
51 #define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__,x)
53 /* use the right prefix for register names */
84 #define fpcr REG (fpcr)
85 #define fpsr REG (fpsr)
88 /* Provide a few macros to allow for PIC code support.
89 * With PIC, data is stored A5 relative so we've got to take a bit of special
90 * care to ensure that all loads of global data is via A5. PIC also requires
91 * jumps and subroutine calls to be PC relative rather than absolute. We cheat
92 * a little on this and in the PIC case, we use short offset branches and
93 * hope that the final object code is within range (which it should be).
97 /* Non PIC (absolute/relocatable) versions */
107 .macro PICLEA sym
, reg
111 .macro PICPEA sym
, areg
117 /* Common for -mid-shared-libary and -msep-data */
127 # if defined(__ID_SHARED_LIBRARY__)
129 /* -mid-shared-library versions */
131 .macro PICLEA sym
, reg
132 movel a5@
(_current_shared_library_a5_offset_
), \reg
133 movel \sym@
GOT(\reg
), \reg
136 .macro PICPEA sym
, areg
137 movel a5@
(_current_shared_library_a5_offset_
), \areg
138 movel \sym@
GOT(\areg
), sp@
-
141 # else /* !__ID_SHARED_LIBRARY__ */
143 /* Versions for -msep-data */
145 .macro PICLEA sym
, reg
146 movel \sym@
GOT(a5
), \reg
149 .macro PICPEA sym
, areg
150 movel \sym@
GOT(a5
), sp@
-
153 # endif /* !__ID_SHARED_LIBRARY__ */