base/asm-common.h: Add a macro for setting the types of data symbols.
[catacomb] / base / asm-common.h
1 /// -*- mode: asm; asm-comment-char: ?/ -*-
2 ///
3 /// Common definitions for asesembler source files
4 ///
5 /// (c) 2015 Straylight/Edgeware
6 ///
7
8 ///----- Licensing notice ---------------------------------------------------
9 ///
10 /// This file is part of Catacomb.
11 ///
12 /// Catacomb is free software; you can redistribute it and/or modify
13 /// it under the terms of the GNU Library General Public License as
14 /// published by the Free Software Foundation; either version 2 of the
15 /// License, or (at your option) any later version.
16 ///
17 /// Catacomb is distributed in the hope that it will be useful,
18 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 /// GNU Library General Public License for more details.
21 ///
22 /// You should have received a copy of the GNU Library General Public
23 /// License along with Catacomb; if not, write to the Free
24 /// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 /// MA 02111-1307, USA.
26
27 #ifndef CATACOMB_ASM_COMMON_H
28 #define CATACOMB_ASM_COMMON_H
29
30 ///--------------------------------------------------------------------------
31 /// General definitions.
32
33 // Preprocessor hacks.
34 #define STRINGY(x) _STRINGY(x, y)
35 #define _STRINGY(x) #x
36 #define GLUE(x, y) _GLUE(x, y)
37 #define _GLUE(x, y) x##y
38 #define _EMPTY
39
40 // Some useful variables.
41 .L$_subsec = 0
42
43 // Literal pools done the hard way.
44 #define _LIT .text .L$_subsec + 1
45 #define _ENDLIT .text .L$_subsec
46 #define _LTORG .L$_subsec = .L$_subsec + 2; .text .L$_subsec
47
48 // ELF section types.
49 #if __ELF__
50 # if CPUFAM_ARMEL
51 # define _SECTTY(ty) %ty
52 # else
53 # define _SECTTY(ty) @ty
54 # endif
55 #endif
56
57 // Section selection.
58 #define TEXT .text .L$_subsec
59 #if ABI_WIN
60 # define RODATA .section .rdata, "dr"
61 #elif __ELF__
62 # define RODATA .section .rodata, "a", _SECTTY(progbits)
63 #else
64 # define RODATA TEXT
65 #endif
66 #define DATA .data
67
68 // Announcing an internal function.
69 #define INTFUNC(name) \
70 TYPE_FUNC(name); \
71 .macro ENDFUNC; _ENDFUNC(name); .endm; \
72 .L$_prologue_p = 0; .L$_frameptr_p = 0; \
73 FUNC_PREHOOK(name); \
74 name: \
75 FUNC_POSTHOOK(name)
76
77 // Announcing an external function.
78 #define FUNC(name) \
79 .globl F(name); \
80 INTFUNC(F(name))
81
82 // Marking the end of a function.
83 #define _ENDFUNC(name) \
84 .if ~ .L$_prologue_p; .error "Missing `endprologue'"; .endif; \
85 .if .L$_frameptr_p; .purgem dropfp; .endif; \
86 .purgem ENDFUNC; \
87 SIZE_OBJ(name); \
88 ENDFUNC_HOOK(name); \
89 _LTORG
90
91 // Make a helper function, if necessary.
92 #define AUXFN(name) \
93 .ifndef .L$_auxfn_def.name; \
94 .text 7128; \
95 .macro _ENDAUXFN; _ENDAUXFN_TAIL(name); .endm; \
96 FUNC_PREHOOK(name); \
97 name:
98 #define _ENDAUXFN_TAIL(name) \
99 .purgem _ENDAUXFN; \
100 .text .L$_subsec; \
101 .L$_auxfn_def.name = 1
102 #define ENDAUXFN _ENDAUXFN; .endif
103
104 ///--------------------------------------------------------------------------
105 /// ELF-specific hacking.
106
107 #if __ELF__
108
109 // Special arrangements for position-independent code.
110 #if __PIC__ || __PIE__
111 # define WANT_PIC 1
112 #endif
113
114 // Additional symbol metadata.
115 #define TYPE_FUNC(name) .type name, STT_FUNC
116 #define TYPE_OBJ(name) .type name, STT_OBJECT
117 #define SIZE_OBJ(name) .size name, . - name
118
119 #endif
120
121 ///--------------------------------------------------------------------------
122 /// Windows-specific hacking.
123
124 #if ABI_WIN
125
126 // Function names need decorating on 32-bit i386.
127 #if CPUFAM_X86
128 # define F(name) _##name
129 #endif
130
131 #endif
132
133 ///--------------------------------------------------------------------------
134 /// x86- and amd64-specific hacking.
135 ///
136 /// It's (slightly) easier to deal with both of these in one go.
137
138 #if CPUFAM_X86 || CPUFAM_AMD64
139
140 // Word size.
141 #if CPUFAM_X86
142 # define WORDSZ 4
143 #endif
144 #if CPUFAM_AMD64
145 # define WORDSZ 8
146 #endif
147
148 // Set the function hooks.
149 #define FUNC_PREHOOK(_) .balign 16
150
151 // On Windows, arrange to install stack-unwinding data.
152 #if CPUFAM_AMD64 && ABI_WIN
153 # define FUNC_POSTHOOK(name) .seh_proc name
154 # define ENDFUNC_HOOK(_) .seh_endproc
155 // Procedures are expected to invoke `.seh_setframe' if necessary, and
156 // `.seh_pushreg' and friends, and `.seh_endprologue'.
157 #endif
158
159 #if __ELF__
160 # define FUNC_POSTHOOK(_) .cfi_startproc
161 # define ENDFUNC_HOOK(_) .cfi_endproc
162 #endif
163
164 // Don't use the wretched AT&T syntax. It's festooned with pointless
165 // punctuation, and all of the data movement is backwards. Ugh!
166 .intel_syntax noprefix
167
168 // Call external subroutine at ADDR, possibly via PLT.
169 .macro callext addr
170 #if WANT_PIC
171 call \addr@PLT
172 #else
173 call \addr
174 #endif
175 .endm
176
177 // Do I need to arrange a spare GOT register?
178 #if WANT_PIC && CPUFAM_X86
179 # define NEED_GOT 1
180 #endif
181 #define GOTREG ebx // Not needed in AMD64 so don't care.
182
183 // Maybe load GOT address into GOT.
184 .macro ldgot got=GOTREG
185 #if WANT_PIC && CPUFAM_X86
186 AUXFN(_ldgot.\got)
187 mov \got, [esp]
188 ret
189 ENDAUXFN
190 call _ldgot.\got
191 add \got, offset _GLOBAL_OFFSET_TABLE_
192 #endif
193 .endm
194
195 // Load address of external symbol ADDR into REG, maybe using GOT.
196 .macro leaext reg, addr, got=GOTREG
197 #if WANT_PIC
198 # if CPUFAM_X86
199 mov \reg, [\got + \addr@GOT]
200 # endif
201 # if CPUFAM_AMD64
202 mov \reg, \addr@GOTPCREL[rip]
203 # endif
204 #else
205 # if CPUFAM_X86
206 mov \reg, offset \addr
207 # endif
208 # if CPUFAM_AMD64
209 lea \reg, \addr[rip]
210 # endif
211 #endif
212 .endm
213
214 // Address expression (possibly using a base register, and a displacement)
215 // referring to ADDR, which is within our module, maybe using GOT.
216 #define INTADDR(...) INTADDR__0(__VA_ARGS__, GOTREG, dummy)
217 #define INTADDR__0(addr, got, ...) INTADDR__1(addr, got)
218 #if CPUFAM_AMD64
219 # define INTADDR__1(addr, got) addr + rip
220 #elif WANT_PIC
221 # define INTADDR__1(addr, got) got + addr@GOTOFF
222 #else
223 # define INTADDR__1(addr, got) addr
224 #endif
225
226 // Permutations for SIMD instructions. SHUF(A, B, C, D) is an immediate,
227 // suitable for use in `pshufd' or `shufpd', which copies element A
228 // (0 <= A < 4) of the source to element 0 of the destination, element B to
229 // element 1, element C to element 2, and element D to element 3.
230 #define SHUF(a, b, c, d) ((a) + 4*(b) + 16*(c) + 64*(d))
231
232 // Map register names to their individual pieces.
233
234 // Apply decoration decor to (internal) register name reg of type ty.
235 //
236 // See `R_...' for internal register names. Decorations are as follows.
237 //
238 // b low byte (e.g., `al', `r8b')
239 // h high byte (e.g., `ah')
240 // w word (e.g., `ax', `r8w')
241 // d doubleword (e.g., `eax', `r8d')
242 // q quadword (e.g., `rax', `r8')
243 // r whole register (doubleword on x86, quadword on amd64)
244 //
245 // And types are as follows.
246 //
247 // abcd the four traditional registers `a', `b', `c', `d'
248 // xp the four pointer registers `si', `di', `bp', `sp'
249 // ip the instruction pointer `ip'
250 // rn the AMD64 numbered registers `r8'--`r15'
251 #define _DECOR(ty, decor, reg) _DECOR_##ty##_##decor(reg)
252
253 // Internal macros: _DECOR_ty_decor(reg) applies decoration decor to
254 // (internal) register name reg of type ty.
255
256 #define _DECOR_abcd_b(reg) reg##l
257 #define _DECOR_abcd_h(reg) reg##h
258 #define _DECOR_abcd_w(reg) reg##x
259 #define _DECOR_abcd_d(reg) e##reg##x
260 #if CPUFAM_AMD64
261 # define _DECOR_abcd_q(reg) r##reg##x
262 #endif
263
264 #define _DECOR_xp_w(reg) reg
265 #define _DECOR_xp_d(reg) e##reg
266 #if CPUFAM_AMD64
267 # define _DECOR_xp_b(reg) reg##l
268 # define _DECOR_xp_q(reg) r##reg
269 #endif
270
271 #define _DECOR_ip_w(reg) reg
272 #define _DECOR_ip_d(reg) e##reg
273 #if CPUFAM_AMD64
274 # define _DECOR_ip_q(reg) r##reg
275 #endif
276
277 #if CPUFAM_AMD64
278 # define _DECOR_rn_b(reg) reg##b
279 # define _DECOR_rn_w(reg) reg##w
280 # define _DECOR_rn_d(reg) reg##d
281 # define _DECOR_rn_q(reg) reg
282 # define _DECOR_rn_r(reg) reg
283 #endif
284
285 #define _DECOR_mem_b(addr) byte ptr addr
286 #define _DECOR_mem_w(addr) word ptr addr
287 #define _DECOR_mem_d(addr) dword ptr addr
288 #if CPUFAM_AMD64
289 # define _DECOR_mem_q(addr) qword ptr addr
290 #endif
291
292 #define _DECOR_imm_b(imm) byte imm
293 #define _DECOR_imm_w(imm) word imm
294 #define _DECOR_imm_d(imm) dword imm
295 #if CPUFAM_AMD64
296 # define _DECOR_imm_q(imm) qword imm
297 #endif
298
299 #if CPUFAM_X86
300 # define _DECOR_abcd_r(reg) e##reg##x
301 # define _DECOR_xp_r(reg) e##reg
302 # define _DECOR_ip_r(reg) e##reg
303 # define _DECOR_mem_r(addr) dword ptr addr
304 # define _DECOR_imm_r(imm) dword imm
305 #endif
306 #if CPUFAM_AMD64
307 # define _DECOR_abcd_r(reg) r##reg##x
308 # define _DECOR_xp_r(reg) r##reg
309 # define _DECOR_ip_r(reg) r##reg
310 # define _DECOR_mem_r(addr) qword ptr addr
311 # define _DECOR_imm_r(imm) qword imm
312 #endif
313
314 // R_r(decor) applies decoration decor to register r, which is an internal
315 // register name. The internal register names are: `ip', `a', `b', `c', `d',
316 // `si', `di', `bp', `sp', `r8'--`r15'.
317 #define R_nil(decor) nil
318 #define R_ip(decor) _DECOR(ip, decor, ip)
319 #define R_a(decor) _DECOR(abcd, decor, a)
320 #define R_b(decor) _DECOR(abcd, decor, b)
321 #define R_c(decor) _DECOR(abcd, decor, c)
322 #define R_d(decor) _DECOR(abcd, decor, d)
323 #define R_si(decor) _DECOR(xp, decor, si)
324 #define R_di(decor) _DECOR(xp, decor, di)
325 #define R_bp(decor) _DECOR(xp, decor, bp)
326 #define R_sp(decor) _DECOR(xp, decor, sp)
327 #if CPUFAM_AMD64
328 # define R_r8(decor) _DECOR(rn, decor, r8)
329 # define R_r9(decor) _DECOR(rn, decor, r9)
330 # define R_r10(decor) _DECOR(rn, decor, r10)
331 # define R_r11(decor) _DECOR(rn, decor, r11)
332 # define R_r12(decor) _DECOR(rn, decor, r12)
333 # define R_r13(decor) _DECOR(rn, decor, r13)
334 # define R_r14(decor) _DECOR(rn, decor, r14)
335 # define R_r15(decor) _DECOR(rn, decor, r15)
336 #endif
337
338 // Refer to an in-memory datum of the type implied by decor residing at
339 // address addr (which should supply its own square-brackets).
340 #define MEM(decor, addr) _DECOR(mem, decor, addr)
341
342 // Refer to an immediate datum of the type implied by decor.
343 #define IMM(decor, imm) _DECOR(mem, decor, imm)
344
345 // Applies decoration decor to assembler-level register name reg.
346 #define _REGFORM(reg, decor) _GLUE(_REGFORM_, reg)(decor)
347
348 // Internal macros: _REGFORM_r(decor) applies decoration decor to an
349 // assembler-level register name, in place of any decoration that register
350 // name has already.
351
352 #define _REGFORM_nil(decor) R_nil(decor)
353
354 #define _REGFORM_ip(decor) R_ip(decor)
355 #define _REGFORM_eip(decor) R_ip(decor)
356
357 #define _REGFORM_a(decor) R_a(decor)
358 #define _REGFORM_al(decor) R_a(decor)
359 #define _REGFORM_ah(decor) R_a(decor)
360 #define _REGFORM_ax(decor) R_a(decor)
361 #define _REGFORM_eax(decor) R_a(decor)
362
363 #define _REGFORM_b(decor) R_b(decor)
364 #define _REGFORM_bl(decor) R_b(decor)
365 #define _REGFORM_bh(decor) R_b(decor)
366 #define _REGFORM_bx(decor) R_b(decor)
367 #define _REGFORM_ebx(decor) R_b(decor)
368
369 #define _REGFORM_c(decor) R_c(decor)
370 #define _REGFORM_cl(decor) R_c(decor)
371 #define _REGFORM_ch(decor) R_c(decor)
372 #define _REGFORM_cx(decor) R_c(decor)
373 #define _REGFORM_ecx(decor) R_c(decor)
374
375 #define _REGFORM_d(decor) R_d(decor)
376 #define _REGFORM_dl(decor) R_d(decor)
377 #define _REGFORM_dh(decor) R_d(decor)
378 #define _REGFORM_dx(decor) R_d(decor)
379 #define _REGFORM_edx(decor) R_d(decor)
380
381 #define _REGFORM_si(decor) R_si(decor)
382 #define _REGFORM_sil(decor) R_si(decor)
383 #define _REGFORM_esi(decor) R_si(decor)
384
385 #define _REGFORM_di(decor) R_di(decor)
386 #define _REGFORM_dil(decor) R_di(decor)
387 #define _REGFORM_edi(decor) R_di(decor)
388
389 #define _REGFORM_bp(decor) R_bp(decor)
390 #define _REGFORM_bpl(decor) R_bp(decor)
391 #define _REGFORM_ebp(decor) R_bp(decor)
392
393 #define _REGFORM_sp(decor) R_sp(decor)
394 #define _REGFORM_spl(decor) R_sp(decor)
395 #define _REGFORM_esp(decor) R_sp(decor)
396
397 #if CPUFAM_AMD64
398
399 # define _REGFORM_rip(decor) R_ip(decor)
400 # define _REGFORM_rsp(decor) R_sp(decor)
401 # define _REGFORM_rbp(decor) R_bp(decor)
402 # define _REGFORM_rdi(decor) R_di(decor)
403 # define _REGFORM_rsi(decor) R_si(decor)
404 # define _REGFORM_rdx(decor) R_d(decor)
405 # define _REGFORM_rcx(decor) R_c(decor)
406 # define _REGFORM_rbx(decor) R_b(decor)
407 # define _REGFORM_rax(decor) R_a(decor)
408
409 # define _REGFORM_r8(decor) R_r8(decor)
410 # define _REGFORM_r8b(decor) R_r8(decor)
411 # define _REGFORM_r8w(decor) R_r8(decor)
412 # define _REGFORM_r8d(decor) R_r8(decor)
413
414 # define _REGFORM_r9(decor) R_r9(decor)
415 # define _REGFORM_r9b(decor) R_r9(decor)
416 # define _REGFORM_r9w(decor) R_r9(decor)
417 # define _REGFORM_r9d(decor) R_r9(decor)
418
419 # define _REGFORM_r10(decor) R_r10(decor)
420 # define _REGFORM_r10b(decor) R_r10(decor)
421 # define _REGFORM_r10w(decor) R_r10(decor)
422 # define _REGFORM_r10d(decor) R_r10(decor)
423
424 # define _REGFORM_r11(decor) R_r11(decor)
425 # define _REGFORM_r11b(decor) R_r11(decor)
426 # define _REGFORM_r11w(decor) R_r11(decor)
427 # define _REGFORM_r11d(decor) R_r11(decor)
428
429 # define _REGFORM_r12(decor) R_r12(decor)
430 # define _REGFORM_r12b(decor) R_r12(decor)
431 # define _REGFORM_r12w(decor) R_r12(decor)
432 # define _REGFORM_r12d(decor) R_r12(decor)
433
434 # define _REGFORM_r13(decor) R_r13(decor)
435 # define _REGFORM_r13b(decor) R_r13(decor)
436 # define _REGFORM_r13w(decor) R_r13(decor)
437 # define _REGFORM_r13d(decor) R_r13(decor)
438
439 # define _REGFORM_r14(decor) R_r14(decor)
440 # define _REGFORM_r14b(decor) R_r14(decor)
441 # define _REGFORM_r14w(decor) R_r14(decor)
442 # define _REGFORM_r14d(decor) R_r14(decor)
443
444 # define _REGFORM_r15(decor) R_r15(decor)
445 # define _REGFORM_r15b(decor) R_r15(decor)
446 # define _REGFORM_r15w(decor) R_r15(decor)
447 # define _REGFORM_r15d(decor) R_r15(decor)
448
449 #endif
450
451 // Macros for converting register names.
452 #define BYTE(reg) _REGFORM(reg, b)
453 #define HIBYTE(reg) _REGFORM(reg, h)
454 #define WORD(reg) _REGFORM(reg, w)
455 #define DWORD(reg) _REGFORM(reg, d)
456 #if CPUFAM_AMD64
457 # define QWORD(reg) _REGFORM(reg, q)
458 #endif
459 #define WHOLE(reg) _REGFORM(reg, r)
460
461 // Macros for some common registers.
462 #define AX R_a(r)
463 #define BX R_b(r)
464 #define CX R_c(r)
465 #define DX R_d(r)
466 #define SI R_si(r)
467 #define DI R_di(r)
468 #define BP R_bp(r)
469 #define SP R_sp(r)
470
471 // Stack management and unwinding.
472 .macro setfp fp=BP, offset=0
473 .if \offset == 0
474 mov \fp, SP
475 #if __ELF__
476 .cfi_def_cfa_register \fp
477 #endif
478 #if ABI_WIN && CPUFAM_AMD64
479 .seh_setframe \fp, 0
480 #endif
481 .else
482 lea \fp, [SP + \offset]
483 #if __ELF__
484 .cfi_def_cfa_register \fp
485 .cfi_adjust_cfa_offset -\offset
486 #endif
487 #if ABI_WIN && CPUFAM_AMD64
488 .seh_setframe \fp, \offset
489 #endif
490 .endif
491 .L$_frameptr_p = -1
492 .macro dropfp; _dropfp \fp, \offset; .endm
493 .endm
494
495 .macro _dropfp fp, offset=0
496 .if \offset == 0
497 mov SP, \fp
498 #if __ELF__
499 .cfi_def_cfa_register SP
500 #endif
501 .else
502 lea SP, [\fp - \offset]
503 #if __ELF__
504 .cfi_def_cfa_register SP
505 .cfi_adjust_cfa_offset +\offset
506 #endif
507 .endif
508 .L$_frameptr_p = 0
509 .purgem dropfp
510 .endm
511
512 .macro stalloc n
513 sub SP, \n
514 #if __ELF__
515 .cfi_adjust_cfa_offset +\n
516 #endif
517 #if ABI_WIN && CPUFAM_AMD64
518 .seh_stackalloc \n
519 #endif
520 .endm
521
522 .macro stfree n
523 add SP, \n
524 #if __ELF__
525 .cfi_adjust_cfa_offset -\n
526 #endif
527 .endm
528
529 .macro pushreg r
530 push \r
531 #if __ELF__
532 .cfi_adjust_cfa_offset +WORDSZ
533 .cfi_rel_offset \r, 0
534 #endif
535 #if ABI_WIN && CPUFAM_AMD64
536 .seh_pushreg \r
537 #endif
538 .endm
539
540 .macro popreg r
541 pop \r
542 #if __ELF__
543 .cfi_adjust_cfa_offset -WORDSZ
544 .cfi_restore \r
545 #endif
546 .endm
547
548 .macro savexmm r, offset
549 movdqa [SP + \offset], \r
550 #if ABI_WIN && CPUFAM_AMD64
551 .seh_savexmm \r, \offset
552 #endif
553 .endm
554
555 .macro rstrxmm r, offset
556 movdqa \r, [SP + \offset]
557 .endm
558
559 .macro endprologue
560 #if ABI_WIN && CPUFAM_AMD64
561 .seh_endprologue
562 #endif
563 .L$_prologue_p = -1
564 .endm
565
566 #endif
567
568 ///--------------------------------------------------------------------------
569 /// ARM-specific hacking.
570
571 #if CPUFAM_ARMEL
572
573 // ARM/Thumb mode things. Use ARM by default.
574 #define ARM .arm; .L$_pcoff = 8
575 #define THUMB .thumb; .L$_pcoff = 4
576 ARM
577
578 // Set the function hooks.
579 #define FUNC_PREHOOK(_) .balign 4; .fnstart
580 #define ENDFUNC_HOOK(_) .fnend; .ltorg
581
582 // Call external subroutine at ADDR, possibly via PLT.
583 .macro callext addr, cond=
584 #if WANT_PIC
585 bl\cond \addr(PLT)
586 #else
587 bl\cond \addr
588 #endif
589 .endm
590
591 // Do I need to arrange a spare GOT register?
592 #if WANT_PIC
593 # define NEED_GOT 1
594 #endif
595 #define GOTREG r9
596
597 // Maybe load GOT address into GOT.
598 .macro ldgot cond=, got=GOTREG
599 #if WANT_PIC
600 ldr\cond \got, .L$_ldgot$\@
601 .L$_ldgot_pc$\@:
602 add\cond \got, pc, \got
603 _LIT
604 .balign 4
605 .L$_ldgot$\@:
606 .word _GLOBAL_OFFSET_TABLE_ - .L$_ldgot_pc$\@ - .L$_pcoff
607 _ENDLIT
608 #endif
609 .endm
610
611 // Load address of external symbol ADDR into REG, maybe using GOT.
612 .macro leaext reg, addr, cond=, got=GOTREG
613 #if WANT_PIC
614 ldr\cond \reg, .L$_leaext$\@
615 ldr\cond \reg, [\got, \reg]
616 _LIT
617 .balign 4
618 .L$_leaext$\@:
619 .word \addr(GOT)
620 _ENDLIT
621 #else
622 ldr\cond \reg, =\addr
623 #endif
624 .endm
625
626 // Load address of external symbol ADDR into REG directly.
627 .macro leaextq reg, addr, cond=
628 #if WANT_PIC
629 ldr\cond \reg, .L$_leaextq$\@
630 .L$_leaextq_pc$\@:
631 .if .L$_pcoff == 8
632 ldr\cond \reg, [pc, \reg]
633 .else
634 add\cond \reg, pc
635 ldr\cond \reg, [\reg]
636 .endif
637 _LIT
638 .balign 4
639 .L$_leaextq$\@:
640 .word \addr(GOT_PREL) + (. - .L$_leaextq_pc$\@ - .L$_pcoff)
641 _ENDLIT
642 #else
643 ldr\cond \reg, =\addr
644 #endif
645 .endm
646
647 .macro vzero vz=q15
648 // Set VZ (default q15) to zero.
649 vmov.u32 \vz, #0
650 .endm
651
652 .macro vshl128 vd, vn, nbit, vz=q15
653 // Set VD to VN shifted left by NBIT. Assume VZ (default q15) is
654 // all-bits-zero. NBIT must be a multiple of 8.
655 .if \nbit&3 != 0
656 .error "shift quantity must be whole number of bytes"
657 .endif
658 vext.8 \vd, \vz, \vn, #16 - (\nbit >> 3)
659 .endm
660
661 .macro vshr128 vd, vn, nbit, vz=q15
662 // Set VD to VN shifted right by NBIT. Assume VZ (default q15) is
663 // all-bits-zero. NBIT must be a multiple of 8.
664 .if \nbit&3 != 0
665 .error "shift quantity must be whole number of bytes"
666 .endif
667 vext.8 \vd, \vn, \vz, #\nbit >> 3
668 .endm
669
670 // Apply decoration decor to register name reg.
671 #define _REGFORM(reg, decor) _GLUE(_REGFORM_, reg)(decor)
672
673 // Internal macros: `_REGFORM_r(decor)' applies decoration decor to register
674 // name r.
675
676 #define _REGFORM_nil(decor) nil
677
678 #define _REGFORM_s0(decor) _DECOR(s, decor, 0)
679 #define _REGFORM_s1(decor) _DECOR(s, decor, 1)
680 #define _REGFORM_s2(decor) _DECOR(s, decor, 2)
681 #define _REGFORM_s3(decor) _DECOR(s, decor, 3)
682 #define _REGFORM_s4(decor) _DECOR(s, decor, 4)
683 #define _REGFORM_s5(decor) _DECOR(s, decor, 5)
684 #define _REGFORM_s6(decor) _DECOR(s, decor, 6)
685 #define _REGFORM_s7(decor) _DECOR(s, decor, 7)
686 #define _REGFORM_s8(decor) _DECOR(s, decor, 8)
687 #define _REGFORM_s9(decor) _DECOR(s, decor, 9)
688 #define _REGFORM_s10(decor) _DECOR(s, decor, 10)
689 #define _REGFORM_s11(decor) _DECOR(s, decor, 11)
690 #define _REGFORM_s12(decor) _DECOR(s, decor, 12)
691 #define _REGFORM_s13(decor) _DECOR(s, decor, 13)
692 #define _REGFORM_s14(decor) _DECOR(s, decor, 14)
693 #define _REGFORM_s15(decor) _DECOR(s, decor, 15)
694 #define _REGFORM_s16(decor) _DECOR(s, decor, 16)
695 #define _REGFORM_s17(decor) _DECOR(s, decor, 17)
696 #define _REGFORM_s18(decor) _DECOR(s, decor, 18)
697 #define _REGFORM_s19(decor) _DECOR(s, decor, 19)
698 #define _REGFORM_s20(decor) _DECOR(s, decor, 20)
699 #define _REGFORM_s21(decor) _DECOR(s, decor, 21)
700 #define _REGFORM_s22(decor) _DECOR(s, decor, 22)
701 #define _REGFORM_s23(decor) _DECOR(s, decor, 23)
702 #define _REGFORM_s24(decor) _DECOR(s, decor, 24)
703 #define _REGFORM_s25(decor) _DECOR(s, decor, 25)
704 #define _REGFORM_s26(decor) _DECOR(s, decor, 26)
705 #define _REGFORM_s27(decor) _DECOR(s, decor, 27)
706 #define _REGFORM_s28(decor) _DECOR(s, decor, 28)
707 #define _REGFORM_s29(decor) _DECOR(s, decor, 29)
708 #define _REGFORM_s30(decor) _DECOR(s, decor, 30)
709 #define _REGFORM_s31(decor) _DECOR(s, decor, 31)
710
711 #define _REGFORM_d0(decor) _DECOR(d, decor, 0)
712 #define _REGFORM_d1(decor) _DECOR(d, decor, 1)
713 #define _REGFORM_d2(decor) _DECOR(d, decor, 2)
714 #define _REGFORM_d3(decor) _DECOR(d, decor, 3)
715 #define _REGFORM_d4(decor) _DECOR(d, decor, 4)
716 #define _REGFORM_d5(decor) _DECOR(d, decor, 5)
717 #define _REGFORM_d6(decor) _DECOR(d, decor, 6)
718 #define _REGFORM_d7(decor) _DECOR(d, decor, 7)
719 #define _REGFORM_d8(decor) _DECOR(d, decor, 8)
720 #define _REGFORM_d9(decor) _DECOR(d, decor, 9)
721 #define _REGFORM_d10(decor) _DECOR(d, decor, 10)
722 #define _REGFORM_d11(decor) _DECOR(d, decor, 11)
723 #define _REGFORM_d12(decor) _DECOR(d, decor, 12)
724 #define _REGFORM_d13(decor) _DECOR(d, decor, 13)
725 #define _REGFORM_d14(decor) _DECOR(d, decor, 14)
726 #define _REGFORM_d15(decor) _DECOR(d, decor, 15)
727 #define _REGFORM_d16(decor) _DECOR(d, decor, 16)
728 #define _REGFORM_d17(decor) _DECOR(d, decor, 17)
729 #define _REGFORM_d18(decor) _DECOR(d, decor, 18)
730 #define _REGFORM_d19(decor) _DECOR(d, decor, 19)
731 #define _REGFORM_d20(decor) _DECOR(d, decor, 20)
732 #define _REGFORM_d21(decor) _DECOR(d, decor, 21)
733 #define _REGFORM_d22(decor) _DECOR(d, decor, 22)
734 #define _REGFORM_d23(decor) _DECOR(d, decor, 23)
735 #define _REGFORM_d24(decor) _DECOR(d, decor, 24)
736 #define _REGFORM_d25(decor) _DECOR(d, decor, 25)
737 #define _REGFORM_d26(decor) _DECOR(d, decor, 26)
738 #define _REGFORM_d27(decor) _DECOR(d, decor, 27)
739 #define _REGFORM_d28(decor) _DECOR(d, decor, 28)
740 #define _REGFORM_d29(decor) _DECOR(d, decor, 29)
741 #define _REGFORM_d30(decor) _DECOR(d, decor, 30)
742 #define _REGFORM_d31(decor) _DECOR(d, decor, 31)
743
744 #define _REGFORM_q0(decor) _DECOR(q, decor, 0)
745 #define _REGFORM_q1(decor) _DECOR(q, decor, 1)
746 #define _REGFORM_q2(decor) _DECOR(q, decor, 2)
747 #define _REGFORM_q3(decor) _DECOR(q, decor, 3)
748 #define _REGFORM_q4(decor) _DECOR(q, decor, 4)
749 #define _REGFORM_q5(decor) _DECOR(q, decor, 5)
750 #define _REGFORM_q6(decor) _DECOR(q, decor, 6)
751 #define _REGFORM_q7(decor) _DECOR(q, decor, 7)
752 #define _REGFORM_q8(decor) _DECOR(q, decor, 8)
753 #define _REGFORM_q9(decor) _DECOR(q, decor, 9)
754 #define _REGFORM_q10(decor) _DECOR(q, decor, 10)
755 #define _REGFORM_q11(decor) _DECOR(q, decor, 11)
756 #define _REGFORM_q12(decor) _DECOR(q, decor, 12)
757 #define _REGFORM_q13(decor) _DECOR(q, decor, 13)
758 #define _REGFORM_q14(decor) _DECOR(q, decor, 14)
759 #define _REGFORM_q15(decor) _DECOR(q, decor, 15)
760
761 // `_LOPART(n)' and `_HIPART(n)' return the numbers of the register halves of
762 // register n, i.e., 2*n and 2*n + 1 respectively.
763 #define _LOPART(n) _GLUE(_LOPART_, n)
764 #define _HIPART(n) _GLUE(_HIPART_, n)
765
766 // Internal macros: `_LOPART_n' and `_HIPART_n' return the numbers of the
767 // register halves of register n, i.e., 2*n and 2*n + 1 respectively.
768
769 #define _LOPART_0 0
770 #define _HIPART_0 1
771 #define _LOPART_1 2
772 #define _HIPART_1 3
773 #define _LOPART_2 4
774 #define _HIPART_2 5
775 #define _LOPART_3 6
776 #define _HIPART_3 7
777 #define _LOPART_4 8
778 #define _HIPART_4 9
779 #define _LOPART_5 10
780 #define _HIPART_5 11
781 #define _LOPART_6 12
782 #define _HIPART_6 13
783 #define _LOPART_7 14
784 #define _HIPART_7 15
785 #define _LOPART_8 16
786 #define _HIPART_8 17
787 #define _LOPART_9 18
788 #define _HIPART_9 19
789 #define _LOPART_10 20
790 #define _HIPART_10 21
791 #define _LOPART_11 22
792 #define _HIPART_11 23
793 #define _LOPART_12 24
794 #define _HIPART_12 25
795 #define _LOPART_13 26
796 #define _HIPART_13 27
797 #define _LOPART_14 28
798 #define _HIPART_14 29
799 #define _LOPART_15 30
800 #define _HIPART_15 31
801
802 // Return the register number of the pair containing register n, i.e.,
803 // floor(n/2).
804 #define _PAIR(n) _GLUE(_PAIR_, n)
805
806 // Internal macros: `_PAIR_n' returns the register number of the pair
807 // containing register n, i.e., floor(n/2).
808 #define _PAIR_0 0
809 #define _PAIR_1 0
810 #define _PAIR_2 1
811 #define _PAIR_3 1
812 #define _PAIR_4 2
813 #define _PAIR_5 2
814 #define _PAIR_6 3
815 #define _PAIR_7 3
816 #define _PAIR_8 4
817 #define _PAIR_9 4
818 #define _PAIR_10 5
819 #define _PAIR_11 5
820 #define _PAIR_12 6
821 #define _PAIR_13 6
822 #define _PAIR_14 7
823 #define _PAIR_15 7
824 #define _PAIR_16 8
825 #define _PAIR_17 8
826 #define _PAIR_18 9
827 #define _PAIR_19 9
828 #define _PAIR_20 10
829 #define _PAIR_21 10
830 #define _PAIR_22 11
831 #define _PAIR_23 11
832 #define _PAIR_24 12
833 #define _PAIR_25 12
834 #define _PAIR_26 13
835 #define _PAIR_27 13
836 #define _PAIR_28 14
837 #define _PAIR_29 14
838 #define _PAIR_30 15
839 #define _PAIR_31 15
840
841 // Apply decoration decor to register number n of type ty. Decorations are
842 // as follows.
843 //
844 // decor types meaning
845 // Q s, d the NEON qN register containing this one
846 // D s the NEON dN register containing this one
847 // D0 q the low 64-bit half of this one
848 // D1 q the high 64-bit half of this one
849 // S0 d, q the first 32-bit piece of this one
850 // S1 d, q the second 32-bit piece of this one
851 // S2 q the third 32-bit piece of this one
852 // S3 q the fourth 32-bit piece of this one
853 // Bn q the nth byte of this register, as a scalar
854 // Hn q the nth halfword of this register, as a scalar
855 // Wn q the nth word of this register, as a scalar
856 #define _DECOR(ty, decor, n) _DECOR_##ty##_##decor(n)
857
858 // Internal macros: `_DECOR_ty_decor(n)' applies decoration decor to register
859 // number n of type ty.
860
861 #define _DECOR_s_Q(n) GLUE(q, _PAIR(_PAIR(n)))
862 #define _DECOR_s_D(n) GLUE(d, _PAIR(n))
863
864 #define _DECOR_d_Q(n) GLUE(q, _PAIR(n))
865 #define _DECOR_d_S0(n) GLUE(s, _LOPART(n))
866 #define _DECOR_d_S1(n) GLUE(s, _LOPART(n))
867
868 #define _DECOR_q_D0(n) GLUE(d, _LOPART(n))
869 #define _DECOR_q_D1(n) GLUE(d, _HIPART(n))
870 #define _DECOR_q_S0(n) GLUE(s, _LOPART(_LOPART(n)))
871 #define _DECOR_q_S1(n) GLUE(s, _HIPART(_LOPART(n)))
872 #define _DECOR_q_S2(n) GLUE(s, _LOPART(_HIPART(n)))
873 #define _DECOR_q_S3(n) GLUE(s, _HIPART(_HIPART(n)))
874 #define _DECOR_q_W0(n) GLUE(d, _LOPART(n))[0]
875 #define _DECOR_q_W1(n) GLUE(d, _LOPART(n))[1]
876 #define _DECOR_q_W2(n) GLUE(d, _HIPART(n))[0]
877 #define _DECOR_q_W3(n) GLUE(d, _HIPART(n))[1]
878 #define _DECOR_q_H0(n) GLUE(d, _LOPART(n))[0]
879 #define _DECOR_q_H1(n) GLUE(d, _LOPART(n))[1]
880 #define _DECOR_q_H2(n) GLUE(d, _LOPART(n))[2]
881 #define _DECOR_q_H3(n) GLUE(d, _LOPART(n))[3]
882 #define _DECOR_q_H4(n) GLUE(d, _HIPART(n))[0]
883 #define _DECOR_q_H5(n) GLUE(d, _HIPART(n))[1]
884 #define _DECOR_q_H6(n) GLUE(d, _HIPART(n))[2]
885 #define _DECOR_q_H7(n) GLUE(d, _HIPART(n))[3]
886 #define _DECOR_q_B0(n) GLUE(d, _LOPART(n))[0]
887 #define _DECOR_q_B1(n) GLUE(d, _LOPART(n))[1]
888 #define _DECOR_q_B2(n) GLUE(d, _LOPART(n))[2]
889 #define _DECOR_q_B3(n) GLUE(d, _LOPART(n))[3]
890 #define _DECOR_q_B4(n) GLUE(d, _LOPART(n))[4]
891 #define _DECOR_q_B5(n) GLUE(d, _LOPART(n))[5]
892 #define _DECOR_q_B6(n) GLUE(d, _LOPART(n))[6]
893 #define _DECOR_q_B7(n) GLUE(d, _LOPART(n))[7]
894 #define _DECOR_q_B8(n) GLUE(d, _HIPART(n))[0]
895 #define _DECOR_q_B9(n) GLUE(d, _HIPART(n))[1]
896 #define _DECOR_q_B10(n) GLUE(d, _HIPART(n))[2]
897 #define _DECOR_q_B11(n) GLUE(d, _HIPART(n))[3]
898 #define _DECOR_q_B12(n) GLUE(d, _HIPART(n))[4]
899 #define _DECOR_q_B13(n) GLUE(d, _HIPART(n))[5]
900 #define _DECOR_q_B14(n) GLUE(d, _HIPART(n))[6]
901 #define _DECOR_q_B15(n) GLUE(d, _HIPART(n))[7]
902
903 // Macros for navigating the NEON register hierarchy.
904 #define S0(reg) _REGFORM(reg, S0)
905 #define S1(reg) _REGFORM(reg, S1)
906 #define S2(reg) _REGFORM(reg, S2)
907 #define S3(reg) _REGFORM(reg, S3)
908 #define D(reg) _REGFORM(reg, D)
909 #define D0(reg) _REGFORM(reg, D0)
910 #define D1(reg) _REGFORM(reg, D1)
911 #define Q(reg) _REGFORM(reg, Q)
912
913 // Macros for indexing quadword registers.
914 #define QB(reg, i) _REGFORM(reg, B##i)
915 #define QH(reg, i) _REGFORM(reg, H##i)
916 #define QW(reg, i) _REGFORM(reg, W##i)
917
918 // Macros for converting vldm/vstm ranges.
919 #define QQ(qlo, qhi) D0(qlo)-D1(qhi)
920
921 // Stack management and unwinding.
922 .macro setfp fp=r11, offset=0
923 .if \offset == 0
924 mov \fp, sp
925 .setfp \fp, sp
926 .else
927 add \fp, sp, #\offset
928 .setfp \fp, sp, #\offset
929 .endif
930 .macro dropfp; _dropfp \fp, \offset; .endm
931 .L$_frameptr_p = -1
932 .endm
933
934 .macro _dropfp fp, offset=0
935 .if \offset == 0
936 mov sp, \fp
937 .else
938 sub sp, \fp, #\offset
939 .endif
940 .purgem dropfp
941 .L$_frameptr_p = 0
942 .endm
943
944 .macro stalloc n
945 sub sp, sp, #\n
946 .pad #\n
947 .endm
948
949 .macro stfree n
950 add sp, sp, #\n
951 .pad #-\n
952 .endm
953
954 .macro pushreg rr:vararg
955 push {\rr}
956 .save {\rr}
957 .endm
958
959 .macro popreg rr:vararg
960 pop {\rr}
961 .endm
962
963 .macro pushvfp rr:vararg
964 vstmdb sp!, {\rr}
965 .vsave {\rr}
966 .endm
967
968 .macro popvfp rr:vararg
969 vldmia sp!, {\rr}
970 .endm
971
972 .macro endprologue
973 .endm
974
975 // No need for prologue markers on ARM.
976 #define FUNC_POSTHOOK(_) .L$_prologue_p = -1
977
978 #endif
979
980 ///--------------------------------------------------------------------------
981 /// AArch64-specific hacking.
982
983 #if CPUFAM_ARM64
984
985 // Set the function hooks.
986 #define FUNC_PREHOOK(_) .balign 4
987 #define FUNC_POSTHOOK(_) .cfi_startproc; .L$_prologue_p = -1
988 #define ENDFUNC_HOOK(_) .cfi_endproc
989
990 // Call external subroutine at ADDR, possibly via PLT.
991 .macro callext addr
992 bl \addr
993 .endm
994
995 // Load address of external symbol ADDR into REG.
996 .macro leaext reg, addr
997 #if WANT_PIC
998 adrp \reg, :got:\addr
999 ldr \reg, [\reg, #:got_lo12:\addr]
1000 #else
1001 adrp \reg, \addr
1002 add \reg, \reg, #:lo12:\addr
1003 #endif
1004 .endm
1005
1006 .macro vzero vz=v31
1007 // Set VZ (default v31) to zero.
1008 dup \vz\().4s, wzr
1009 .endm
1010
1011 .macro vshl128 vd, vn, nbit, vz=v31
1012 // Set VD to VN shifted left by NBIT. Assume VZ (default v31) is
1013 // all-bits-zero. NBIT must be a multiple of 8.
1014 .if \nbit&3 != 0
1015 .error "shift quantity must be whole number of bytes"
1016 .endif
1017 ext \vd\().16b, \vz\().16b, \vn\().16b, #16 - (\nbit >> 3)
1018 .endm
1019
1020 .macro vshr128 vd, vn, nbit, vz=v31
1021 // Set VD to VN shifted right by NBIT. Assume VZ (default v31) is
1022 // all-bits-zero. NBIT must be a multiple of 8.
1023 .if \nbit&3 != 0
1024 .error "shift quantity must be whole number of bytes"
1025 .endif
1026 ext \vd\().16b, \vn\().16b, \vz\().16b, #\nbit >> 3
1027 .endm
1028
1029 // Stack management and unwinding.
1030 .macro setfp fp=x29, offset=0
1031 // If you're just going through the motions with a fixed-size stack frame,
1032 // then you want to say `add x29, sp, #OFFSET' directly, which will avoid
1033 // pointlessly restoring sp later.
1034 .if \offset == 0
1035 mov \fp, sp
1036 .cfi_def_cfa_register \fp
1037 .else
1038 add \fp, sp, #\offset
1039 .cfi_def_cfa_register \fp
1040 .cfi_adjust_cfa_offset -\offset
1041 .endif
1042 .macro dropfp; _dropfp \fp, \offset; .endm
1043 .L$_frameptr_p = -1
1044 .endm
1045
1046 .macro _dropfp fp, offset=0
1047 .if \offset == 0
1048 mov sp, \fp
1049 .cfi_def_cfa_register sp
1050 .else
1051 sub sp, \fp, #\offset
1052 .cfi_def_cfa_register sp
1053 .cfi_adjust_cfa_offset +\offset
1054 .endif
1055 .purgem dropfp
1056 .L$_frameptr_p = 0
1057 .endm
1058
1059 .macro stalloc n
1060 sub sp, sp, #\n
1061 .cfi_adjust_cfa_offset +\n
1062 .endm
1063
1064 .macro stfree n
1065 add sp, sp, #\n
1066 .cfi_adjust_cfa_offset -\n
1067 .endm
1068
1069 .macro pushreg x, y=nil
1070 .ifeqs "\y", "nil"
1071 str \x, [sp, #-16]!
1072 .cfi_adjust_cfa_offset +16
1073 .cfi_rel_offset \x, 0
1074 .else
1075 stp \x, \y, [sp, #-16]!
1076 .cfi_adjust_cfa_offset +16
1077 .cfi_rel_offset \x, 0
1078 .cfi_rel_offset \y, 8
1079 .endif
1080 .endm
1081
1082 .macro popreg x, y=nil
1083 .ifeqs "\y", "nil"
1084 ldr \x, [sp], #16
1085 .cfi_restore \x
1086 .cfi_adjust_cfa_offset -16
1087 .else
1088 ldp \x, \y, [sp], #16
1089 .cfi_restore \x
1090 .cfi_restore \y
1091 .cfi_adjust_cfa_offset -16
1092 .endif
1093 .endm
1094
1095 .macro savereg x, y, z=nil
1096 .ifeqs "\z", "nil"
1097 str \x, [sp, \y]
1098 .cfi_rel_offset \x, \y
1099 .else
1100 stp \x, \y, [sp, #\z]
1101 .cfi_rel_offset \x, \z
1102 .cfi_rel_offset \y, \z + 8
1103 .endif
1104 .endm
1105
1106 .macro rstrreg x, y, z=nil
1107 .ifeqs "\z", "nil"
1108 ldr \x, [sp, \y]
1109 .cfi_restore \x
1110 .else
1111 ldp \x, \y, [sp, #\z]
1112 .cfi_restore \x
1113 .cfi_restore \y
1114 .endif
1115 .endm
1116
1117 .macro endprologue
1118 .endm
1119
1120 // cmov RD, RN, CC: set RD to RN if CC is satisfied, otherwise do nothing
1121 .macro cmov rd, rn, cc
1122 csel \rd, \rn, \rd, \cc
1123 .endm
1124
1125 // Notational improvement: write `csel.CC' etc., rather than `csel ..., CC'.
1126 #define _COND(_) \
1127 _(eq) _(ne) _(cs) _(cc) _(vs) _(vc) _(mi) _(pl) \
1128 _(ge) _(lt) _(gt) _(le) _(hi) _(ls) _(al) _(nv) \
1129 _(hs) _(lo)
1130 #define _INST(_) \
1131 _(ccmp) _(ccmn) \
1132 _(csel) _(cmov) \
1133 _(csinc) _(cinc) _(cset) \
1134 _(csneg) _(cneg) \
1135 _(csinv) _(cinv) _(csetm)
1136 #define _CONDVAR(cc) _definstvar cc;
1137 #define _INSTVARS(inst) \
1138 .macro _definstvar cc; \
1139 .macro inst.\cc args:vararg; inst \args, \cc; .endm; \
1140 .endm; \
1141 _COND(_CONDVAR); \
1142 .purgem _definstvar;
1143 _INST(_INSTVARS)
1144 #undef _COND
1145 #undef _INST
1146 #undef _CONDVAR
1147 #undef _INSTVARS
1148
1149 // Flag bits for `ccmp' and friends.
1150 #define CCMP_N 8
1151 #define CCMP_Z 4
1152 #define CCMP_C 2
1153 #define CCMP_V 1
1154
1155 // Flag settings for satisfying conditions.
1156 #define CCMP_MI CCMP_N
1157 #define CCMP_PL 0
1158 #define CCMP_EQ CCMP_Z
1159 #define CCMP_NE 0
1160 #define CCMP_CS CCMP_C
1161 #define CCMP_HS CCMP_C
1162 #define CCMP_CC 0
1163 #define CCMP_LO 0
1164 #define CCMP_VS CCMP_V
1165 #define CCMP_VC 0
1166 #define CCMP_HI CCMP_C
1167 #define CCMP_LS 0
1168 #define CCMP_LT CCMP_N
1169 #define CCMP_GE 0
1170 #define CCMP_LE CCMP_N
1171 #define CCMP_GT 0
1172
1173 #endif
1174
1175 ///--------------------------------------------------------------------------
1176 /// Final stuff.
1177
1178 // Default values for the various hooks.
1179 #ifndef FUNC_PREHOOK
1180 # define FUNC_PREHOOK(_)
1181 #endif
1182 #ifndef FUNC_POSTHOOK
1183 # define FUNC_POSTHOOK(_)
1184 #endif
1185 #ifndef ENDFUNC_HOOK
1186 # define ENDFUNC_HOOK(_)
1187 #endif
1188
1189 #ifndef F
1190 # ifdef SYM_USCORE
1191 # define F(name) _##name
1192 # else
1193 # define F(name) name
1194 # endif
1195 #endif
1196
1197 #ifndef TYPE_FUNC
1198 # define TYPE_FUNC(name)
1199 #endif
1200 #ifndef TYPE_OBJ
1201 # define TYPE_OBJ(name)
1202 #endif
1203 #ifndef SIZE_OBJ
1204 # define SIZE_OBJ(name)
1205 #endif
1206
1207 #if __ELF__ && !defined(FORCE_EXECUTABLE_STACK)
1208 .pushsection .note.GNU-stack, "", _SECTTY(progbits)
1209 .popsection
1210 #endif
1211
1212 ///----- That's all, folks --------------------------------------------------
1213
1214 #endif