xine-lib: xine-lib-1.2.12/src/xine-utils/mangle.h Source File

xine-lib 1.2.12

mangle.h
Go to the documentation of this file.
1/*
2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3 * copyright (c) 2008-2010 the xine-project
4 *
5 * This file is part of FFmpeg.
6 *
7 * xine is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * xine is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 */
21
29#ifndef _XINE_MANGLE_H
30#define _XINE_MANGLE_H
31
32#if defined(PIC) && ! defined(__PIC__)
33#define __PIC__
34#endif
35
36// Use rip-relative addressing if compiling PIC code on x86-64.
37#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__DJGPP__) || \
38 defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__))
39# if defined(__MINGW64__)
40# define EXTERN_PREFIX ""
41# else
42# define EXTERN_PREFIX "_"
43# endif
44# if defined(__x86_64__) && defined(__PIC__)
45# define MANGLE(a) EXTERN_PREFIX #a"(%%rip)"
46# else
47# define MANGLE(a) EXTERN_PREFIX #a
48# endif
49#else
50# if defined(__x86_64__) && defined(__PIC__)
51# define MANGLE(a) #a"(%%rip)"
52# elif defined(__APPLE__)
53# define MANGLE(a) "_" #a
54# else
55# define MANGLE(a) #a
56# endif
57#endif
58
59#endif