Subversion Repositories Kolibri OS

Rev

Rev 1905 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1905 serge 1
/*
2
	mangle: support defines for preprocessed assembler
3
 
4
	copyright 1995-2007 by the mpg123 project - free software under the terms of the LGPL 2.1
5
	see COPYING and AUTHORS files in distribution or http://mpg123.org
6
 
7
	This once started out as mangle.h from MPlayer, but you can't really call it derived work... the small part that in principle stems from MPlayer also being not very special (once you decided to use such a header at all, it's quite obvious material).
8
*/
9
 
10
#ifndef __MANGLE_H
11
#define __MANGLE_H
12
 
13
#include "config.h"
3960 Serge 14
#include "intsym.h"
1905 serge 15
 
16
#ifdef CCALIGN
17
#define MOVUAPS movaps
18
#else
19
#define MOVUAPS movups
20
#endif
21
 
3960 Serge 22
/*
23
	ALIGNX: align to X bytes
24
	This differs per compiler/platform in taking the byte count or an exponent for base 2.
25
	A way out is balign, if the assembler supports it (gas extension).
26
*/
27
 
28
#ifdef ASMALIGN_BALIGN
29
 
30
#define ALIGN4  .balign 4
31
#define ALIGN8  .balign 8
32
#define ALIGN16 .balign 16
33
#define ALIGN32 .balign 32
34
 
35
#else
36
 
1905 serge 37
#ifdef ASMALIGN_EXP
38
#define ALIGN4  .align 2
39
#define ALIGN8  .align 3
40
#define ALIGN16 .align 4
41
#define ALIGN32 .align 5
42
#else
3960 Serge 43
#ifdef ASMALIGN_BYTE
1905 serge 44
#define ALIGN4  .align 4
45
#define ALIGN8  .align 8
46
#define ALIGN16 .align 16
47
#define ALIGN32 .align 32
3960 Serge 48
#else
49
#error "Dunno how assembler alignment works. Please specify."
1905 serge 50
#endif
3960 Serge 51
#endif
1905 serge 52
 
3960 Serge 53
#endif
54
 
55
#define MANGLE_MACROCAT_REALLY(a, b) a ## b
56
#define MANGLE_MACROCAT(a, b) MANGLE_MACROCAT_REALLY(a, b)
1905 serge 57
/* Feel free to add more to the list, eg. a.out IMO */
3960 Serge 58
#if defined(__USER_LABEL_PREFIX__)
59
#define ASM_NAME(a) MANGLE_MACROCAT(__USER_LABEL_PREFIX__,a)
60
#define ASM_VALUE(a) MANGLE_MACROCAT($,ASM_NAME(a))
61
#elif defined(__CYGWIN__) || defined(_WIN32) && !defined (_WIN64) || defined(__OS2__) || \
1905 serge 62
   (defined(__OpenBSD__) && !defined(__ELF__)) || defined(__APPLE__)
3960 Serge 63
#define ASM_NAME(a) MANGLE_MACROCAT(_,a)
64
#define ASM_VALUE(a) MANGLE_MACROCAT($_,a)
1905 serge 65
#else
66
#define ASM_NAME(a) a
3960 Serge 67
#define ASM_VALUE(a) MANGLE_MACROCAT($,a)
1905 serge 68
#endif
69
 
70
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)
71
#define COMM(a,b,c) .comm a,b
72
#else
73
#define COMM(a,b,c) .comm a,b,c
74
#endif
75
/* more hacks for macosx; no .bss ... */
76
#ifdef __APPLE__
77
#define BSS .data
78
#else
79
#define BSS .bss
80
#endif
3960 Serge 81
 
82
/* Mark non-executable stack.
83
   It's mainly for GNU on Linux... who else does (not) like this? */
84
#if !defined(__SUNPRO_C) && defined(__linux__) && defined(__ELF__)
85
#define NONEXEC_STACK .section .note.GNU-stack,"",%progbits
86
#else
87
#define NONEXEC_STACK
88
#endif
89
 
1905 serge 90
#endif /* !__MANGLE_H */
91