2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
[grub2/jjazz.git] / include / grub / symbol.h
blob6bf512d125e6094a842eef3d9f758c91c269f80b
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2006,2007,2008 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
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
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_SYMBOL_HEADER
20 #define GRUB_SYMBOL_HEADER 1
22 #include <config.h>
24 /* Apple assembler requires local labels to start with a capital L */
25 #define LOCAL(sym) L_ ## sym
27 /* Add an underscore to a C symbol in assembler code if needed. */
28 #ifdef HAVE_ASM_USCORE
29 # define EXT_C(sym) _ ## sym
30 #else
31 # define EXT_C(sym) sym
32 #endif
34 #if defined (APPLE_CC)
35 #define FUNCTION(x) .globl EXT_C(x) ; EXT_C(x):
36 #define VARIABLE(x) .globl EXT_C(x) ; EXT_C(x):
37 #elif ! defined (__CYGWIN__) && ! defined (__MINGW32__)
38 #define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
39 #define VARIABLE(x) .globl EXT_C(x) ; .type EXT_C(x), "object" ; EXT_C(x):
40 #else
41 /* .type not supported for non-ELF targets. XXX: Check this in configure? */
42 #define FUNCTION(x) .globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 32; .endef; EXT_C(x):
43 #define VARIABLE(x) .globl EXT_C(x) ; .def EXT_C(x); .scl 2; .type 0; .endef; EXT_C(x):
44 #endif
46 /* Mark an exported symbol. */
47 #ifndef GRUB_SYMBOL_GENERATOR
48 # define EXPORT_FUNC(x) x
49 # define EXPORT_VAR(x) x
50 #endif /* ! GRUB_SYMBOL_GENERATOR */
52 #endif /* ! GRUB_SYMBOL_HEADER */