Print this page
5261 libm should stop using synonyms.h
5298 fabs is 0-sized, confuses dis(1) and others
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/C/libm.h
+++ new/usr/src/lib/libm/common/C/libm.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 23 */
24 24 /*
25 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 #ifndef _LIBM_H
30 30 #define _LIBM_H
31 31
32 32 #include <sys/isa_defs.h>
33 33
34 34 #ifdef _ASM
35 35 /* BEGIN CSTYLED */
36 36
37 37 /*
38 38 * Disable amd64 assembly code profiling for now.
39 39 */
40 40 #if defined(__amd64)
41 41 #undef PROF
42 42 #endif
43 43
44 44 #include <sys/asm_linkage.h>
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
45 45
46 46 #define NAME(x) x
47 47 #define TEXT .section ".text"
48 48 #define DATA .section ".data"
49 49 #define RO_DATA .section ".rodata"
50 50 #define IDENT(x) .ident x
51 51
52 52 #if defined(__sparc)
53 53
54 54 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
55 - .weak sym; \
56 - .type sym,#stype; \
57 -sym = __/**/sym
55 + .weak __/**/sym; \
56 + .type __/**/sym,#stype; \
57 +__/**/sym = sym
58 58
59 59 #ifndef SET_FILE
60 60 #define SET_FILE(x) \
61 61 .file x
62 62 #endif /* !defined(SET_FILE) */
63 63
64 64 #ifdef PIC
65 65 /*
66 66 * One should *never* pass o7 to PIC_SETUP.
67 67 */
68 68 #define PIC_SETUP(via) \
69 69 9: call 8f; \
70 70 sethi %hi(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
71 71 8: or %via,%lo(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
72 72 add %via,%o7,%via
73 73 /*
74 74 * Must save/restore %o7 in leaf routines; may *not* use jmpl!
75 75 */
76 76 #define PIC_LEAF_SETUP(via) \
77 77 or %g0,%o7,%g1; \
78 78 9: call 8f; \
79 79 sethi %hi(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
80 80 8: or %via,%lo(NAME(_GLOBAL_OFFSET_TABLE_)-(9b-.)),%via; \
81 81 add %via,%o7,%via; \
82 82 or %g0,%g1,%o7
83 83 #ifdef __sparcv9
84 84 #define PIC_SET(via,sym,dst) ldx [%via+sym],%dst
85 85 #else /* defined(__sparcv9) */
86 86 #define PIC_SET(via,sym,dst) ld [%via+sym],%dst
87 87 #endif /* defined(__sparcv9) */
88 88 #else /* defined(PIC) */
89 89 #define PIC_SETUP(via)
90 90 #define PIC_LEAF_SETUP(via)
91 91 #ifdef __sparcv9
92 92 /*
93 93 * g1 is used as scratch register in V9 mode
94 94 */
95 95 #define PIC_SET(via,sym,dst) setx sym,%g1,%dst
96 96 #else /* defined(__sparcv9) */
97 97 #define PIC_SET(via,sym,dst) set sym,%dst
98 98 #endif /* defined(__sparcv9) */
99 99 #endif /* defined(PIC) */
100 100
101 101 /*
102 102 * Workaround for 4337025: MCOUNT in asm_linkage.h does not support __sparcv9
103 103 */
104 104 #if defined(PROF) && defined(__sparcv9)
105 105
106 106 #undef MCOUNT_SIZE
107 107 #undef MCOUNT
108 108
109 109 #if !defined(PIC)
110 110 #define MCOUNT_SIZE (9*4) /* 9 instructions */
111 111 #define MCOUNT(x) \
112 112 save %sp, -SA(MINFRAME), %sp; \
113 113 sethi %hh(.L_/**/x/**/1), %o0; \
114 114 sethi %lm(.L_/**/x/**/1), %o1; \
115 115 or %o0, %hm(.L_/**/x/**/1), %o0; \
116 116 or %o1, %lo(.L_/**/x/**/1), %o1; \
117 117 sllx %o0, 32, %o0; \
118 118 call _mcount; \
119 119 or %o0, %o1, %o0; \
120 120 restore; \
121 121 .common .L_/**/x/**/1, 8, 8
122 122 #elif defined(PIC32)
123 123 #define MCOUNT_SIZE (10*4) /* 10 instructions */
124 124 #define MCOUNT(x) \
125 125 save %sp,-SA(MINFRAME),%sp; \
126 126 1: call .+8; \
127 127 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
128 128 sethi %hi(.L_/**/x/**/1),%o1; \
129 129 add %o0,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
130 130 add %o1,%lo(.L_/**/x/**/1),%o1; \
131 131 add %o0,%o7,%o0; \
132 132 call _mcount; \
133 133 ldx [%o0+%o1],%o0; \
134 134 restore; \
135 135 .common .L_/**/x/**/1,8,8
136 136 #else /* PIC13 */
137 137 #define MCOUNT_SIZE (8*4) /* 8 instructions */
138 138 #define MCOUNT(x) \
139 139 save %sp,-SA(MINFRAME),%sp; \
140 140 1: call .+8; \
141 141 sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
142 142 add %o0,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%o0; \
143 143 add %o0,%o7,%o0; \
↓ open down ↓ |
76 lines elided |
↑ open up ↑ |
144 144 call _mcount; \
145 145 ldx [%o0+%lo(.L_/**/x/**/1)],%o0; \
146 146 restore; \
147 147 .common .L_/**/x/**/1,8,8
148 148 #endif /* !defined(PIC) */
149 149 #endif /* defined(PROF) && defined(__sparcv9) */
150 150
151 151 #elif defined(__x86)
152 152
153 153 #define LIBM_ANSI_PRAGMA_WEAK(sym,stype) \
154 - .weak sym; \
155 - .type sym,@stype; \
156 -sym = __/**/sym
154 + .weak __/**/sym; \
155 + .type __/**/sym,@stype; \
156 +__/**/sym = sym
157 157
158 158 #ifdef PIC
159 159 #if defined(__amd64)
160 160 #define PIC_SETUP(x)
161 161 #define PIC_WRAPUP
162 162 #define PIC_F(x) x@PLT
163 163 #define PIC_G(x) x@GOTPCREL(%rip)
164 164 #define PIC_L(x) x(%rip)
165 165 #define PIC_G_LOAD(insn,sym,dst) \
166 166 movq PIC_G(sym),%dst; \
167 167 insn (%dst),%dst
168 168 #else
169 169 #define PIC_SETUP(label) \
170 170 pushl %ebx; \
171 171 call .label; \
172 172 .label: popl %ebx; \
173 173 addl $_GLOBAL_OFFSET_TABLE_+[.-.label],%ebx
174 174 #define PIC_WRAPUP popl %ebx
175 175 #define PIC_F(x) x@PLT
176 176 #define PIC_G(x) x@GOT(%ebx)
177 177 #define PIC_L(x) x@GOTOFF(%ebx)
178 178 #define PIC_G_LOAD(insn,sym,dst) \
179 179 mov PIC_G(sym),%dst; \
180 180 insn (%dst),%dst
181 181 #endif
182 182 #else /* defined(PIC) */
183 183 #define PIC_SETUP(x)
184 184 #define PIC_WRAPUP
185 185 #define PIC_F(x) x
186 186 #define PIC_G(x) x
187 187 #define PIC_L(x) x
188 188 #define PIC_G_LOAD(insn,sym,dst) insn sym,%dst
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
189 189 #endif /* defined(PIC) */
190 190
191 191 #else
192 192 #error Unknown architecture
193 193 #endif
194 194
195 195 /* END CSTYLED */
196 196 #else /* defined(_ASM) */
197 197
198 198 #include "libm_macros.h"
199 -#include "libm_synonyms.h"
200 199 #include "libm_protos.h"
201 200 #include "libm_inlines.h"
202 201 #include <math.h>
203 202 #if defined(__SUNPRO_C)
204 203 #include <sunmath.h>
205 204 #endif
206 205
207 206 #endif /* defined(_ASM) */
208 207
209 208 #endif /* _LIBM_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX