Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* Assembler macros for SH.
00002    Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <sysdeps/generic/sysdep.h>
00021 
00022 #ifdef __ASSEMBLER__
00023 
00024 /* Syntactic details of assembler.  */
00025 
00026 #ifdef HAVE_ELF
00027 
00028 #define ALIGNARG(log2) log2
00029 /* For ELF we need the `.type' directive to make shared libs work right.  */
00030 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,@##typearg;
00031 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
00032 
00033 #ifdef SHARED
00034 #define PLTJMP(_x)   _x##@PLT
00035 #else
00036 #define PLTJMP(_x)   _x
00037 #endif
00038 
00039 #else
00040 
00041 #define ALIGNARG(log2) log2
00042 #define ASM_TYPE_DIRECTIVE(name,type)     /* Nothing is specified.  */
00043 #define ASM_SIZE_DIRECTIVE(name)   /* Nothing is specified.  */
00044 
00045 #define PLTJMP(_x)   _x
00046 
00047 #endif
00048 
00049 /* Define an entry point visible from C.  */
00050 #define       ENTRY(name)                                                   \
00051   ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name);                                 \
00052   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function)                         \
00053   .align ALIGNARG(5);                                                       \
00054   C_LABEL(name)                                                             \
00055   cfi_startproc;                                                     \
00056   CALL_MCOUNT
00057 
00058 #undef END
00059 #define END(name)                                                    \
00060   cfi_endproc;                                                              \
00061   ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
00062 
00063 /* If compiled for profiling, call `mcount' at the start of each function.  */
00064 #ifdef PROF
00065 #define CALL_MCOUNT                              \
00066        mov.l  1f,r1;                             \
00067        sts.l  pr,@-r15;                          \
00068        cfi_adjust_cfa_offset (4);                \
00069        cfi_rel_offset (pr, 0);                          \
00070        mova   2f,r0;                             \
00071        jmp    @r1;                               \
00072         lds   r0,pr;                             \
00073        .align 2;                                 \
00074 1:     .long  mcount;                                   \
00075 2:     lds.l  @r15+,pr;                          \
00076        cfi_adjust_cfa_offset (-4);               \
00077        cfi_restore (pr)
00078 
00079 #else
00080 #define CALL_MCOUNT         /* Do nothing.  */
00081 #endif
00082 
00083 #ifdef NO_UNDERSCORES
00084 /* Since C identifiers are not normally prefixed with an underscore
00085    on this system, the asm identifier `syscall_error' intrudes on the
00086    C name space.  Make sure we use an innocuous name.  */
00087 #define       syscall_error __syscall_error
00088 #define mcount              _mcount
00089 #endif
00090 
00091 #endif /* __ASSEMBLER__ */