symbol.h 2.22 KB
Newer Older
okuji's avatar
okuji committed
1
/*
2
 *  GRUB  --  GRand Unified Bootloader
3
 *  Copyright (C) 1999,2000,2001,2002,2006,2007,2008,2009  Free Software Foundation, Inc.
okuji's avatar
okuji committed
4
 *
5
 *  GRUB is free software: you can redistribute it and/or modify
okuji's avatar
okuji committed
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation, either version 3 of the License, or
okuji's avatar
okuji committed
8 9
 *  (at your option) any later version.
 *
10
 *  GRUB is distributed in the hope that it will be useful,
okuji's avatar
okuji committed
11 12 13 14 15
 *  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
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
okuji's avatar
okuji committed
17 18
 */

19 20
#ifndef GRUB_SYMBOL_HEADER
#define GRUB_SYMBOL_HEADER	1
okuji's avatar
okuji committed
21 22 23

#include <config.h>

24 25 26
/* Apple assembler requires local labels to start with a capital L */
#define LOCAL(sym)	L_ ## sym

okuji's avatar
okuji committed
27
/* Add an underscore to a C symbol in assembler code if needed. */
28
#ifndef GRUB_UTIL
29

30 31 32 33 34 35
#ifdef __APPLE__
#define MACRO_DOLLAR(x) $$ ## x
#else
#define MACRO_DOLLAR(x) $ ## x
#endif

36
#if HAVE_ASM_USCORE
37
#ifdef ASM_FILE
okuji's avatar
okuji committed
38 39
# define EXT_C(sym)	_ ## sym
#else
40 41 42
# define EXT_C(sym)	"_" sym
#endif
#else
okuji's avatar
okuji committed
43 44 45
# define EXT_C(sym)	sym
#endif

46 47 48 49
#ifdef __arm__
#define END .end
#endif

50
#if defined (__APPLE__)
51 52
#define FUNCTION(x)	.globl EXT_C(x) ; EXT_C(x):
#define VARIABLE(x)	.globl EXT_C(x) ; EXT_C(x):
53 54 55 56
#elif defined (__CYGWIN__) || defined (__MINGW32__)
/* .type not supported for non-ELF targets.  XXX: Check this in configure? */
#define FUNCTION(x)	.globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 32; .endef; EXT_C(x):
#define VARIABLE(x)	.globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 0; .endef; EXT_C(x):
57 58 59
#elif defined (__arm__)
#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), %function ; EXT_C(x):
#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), %object ; EXT_C(x):
60
#else
61 62
#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), @object ; EXT_C(x):
63
#endif
64
#endif
okuji's avatar
okuji committed
65 66

/* Mark an exported symbol.  */
67 68 69 70
#ifndef GRUB_SYMBOL_GENERATOR
# define EXPORT_FUNC(x)	x
# define EXPORT_VAR(x)	x
#endif /* ! GRUB_SYMBOL_GENERATOR */
okuji's avatar
okuji committed
71

72
#endif /* ! GRUB_SYMBOL_HEADER */