2006-09-09 21:09:37 +00:00
|
|
|
/*
|
|
|
|
* mangle.h - This file has some CPP macros to deal with different symbol
|
2003-02-14 21:27:25 +00:00
|
|
|
* mangling across binary formats.
|
2006-09-09 21:09:37 +00:00
|
|
|
*
|
2003-02-14 21:27:25 +00:00
|
|
|
* (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net>
|
2006-09-09 21:09:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2003-02-14 21:27:25 +00:00
|
|
|
|
|
|
|
#ifndef __MANGLE_H
|
|
|
|
#define __MANGLE_H
|
|
|
|
|
|
|
|
/* Feel free to add more to the list, eg. a.out IMO */
|
2004-12-18 03:07:15 +00:00
|
|
|
/* Use rip-relative addressing if compiling PIC code on x86-64. */
|
2003-03-31 01:49:18 +00:00
|
|
|
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
|
2003-02-14 21:27:25 +00:00
|
|
|
(defined(__OpenBSD__) && !defined(__ELF__))
|
2004-12-18 03:07:15 +00:00
|
|
|
#if defined(ARCH_X86_64) && defined(PIC)
|
|
|
|
#define MANGLE(a) "_" #a"(%%rip)"
|
|
|
|
#else
|
2003-02-14 21:27:25 +00:00
|
|
|
#define MANGLE(a) "_" #a
|
2004-12-18 03:07:15 +00:00
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if defined(ARCH_X86_64) && defined(PIC)
|
|
|
|
#define MANGLE(a) #a"(%%rip)"
|
2006-03-06 22:06:33 +00:00
|
|
|
#elif defined(CONFIG_DARWIN)
|
|
|
|
#define MANGLE(a) "_" #a
|
2003-02-14 21:27:25 +00:00
|
|
|
#else
|
|
|
|
#define MANGLE(a) #a
|
|
|
|
#endif
|
2004-12-18 03:07:15 +00:00
|
|
|
#endif
|
2003-02-14 21:27:25 +00:00
|
|
|
|
|
|
|
#endif /* !__MANGLE_H */
|
|
|
|
|