source: trunk/libs/newlib/src/libgloss/sparc_leon/asm-leon/elfmacro.h @ 656

Last change on this file since 656 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2011 Aeroflex Gaisler
3 *
4 * BSD license:
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25
26#ifndef _INCLUDE_LEON_ELFMACRO_h
27#define _INCLUDE_LEON_ELFMACRO_h
28
29#ifdef __ASSEMBLER__
30#define _TEXT_SEG_ALIGN 4
31#define _LIBLEONBARE_TEXT_SEG_START \
32        .text ; .balign _TEXT_SEG_ALIGN
33#define FUNC_BEGIN(func)        func:
34#define FUNC_END(func)          .size   func, . - func
35
36#define GTEXT(sym) sym  ;  .type   sym,@function
37#define GDATA(sym) sym  ;  .type   sym,@object
38
39#define FUNC_EXPORT(func)       .globl  GTEXT(func)
40#define DATA_EXPORT(var)        .globl  GDATA(var)
41
42#define FUNC_IMPORT(func)       .extern FUNC(func)
43#define DATA_IMPORT(var)        .extern var
44#endif
45
46#ifndef weak_alias
47/* Define ALIASNAME as a weak alias for NAME. */
48#  define weak_alias(name, aliasname) _weak_alias (name, aliasname)
49#  define _weak_alias(name, aliasname) \
50      extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
51#endif
52
53#ifndef strong_alias
54/* Define ALIASNAME as a strong alias for NAME.  */
55# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
56# define _strong_alias(name, aliasname) \
57  extern __typeof (name) aliasname __attribute__ ((alias (#name)));
58#endif
59
60#ifndef __ASSEMBLER__
61typedef int (*initcall_t) (void);
62extern initcall_t __leonbare_initcall_start;
63extern initcall_t __leonbare_initcall_end;
64
65#endif
66
67#if __GNUC_MINOR__ >= 3
68# define __attribute_used__     __attribute__((__used__))
69#else
70# define __attribute_used__     __attribute__((__unused__))
71#endif
72
73#define __define_initcall(level,fn) \
74        static initcall_t __initcall_##fn __attribute_used__ \
75        __attribute__((__section__(".initcall" level ".init"))) = fn
76
77#define libc_initcall(fn)               __define_initcall("1",fn)
78
79#endif /* !_INCLUDE_LEON_STACK_h */
Note: See TracBrowser for help on using the repository browser.