Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* Copyright 2001 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Alexandre Oliva <aoliva@redhat.com>.
00004    Based on ../i386/sysdep.h.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public License as
00008    published by the Free Software Foundation; either version 2 of the
00009    License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public
00017    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00018    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.  */
00020 
00021 #include <sysdeps/generic/sysdep.h>
00022 
00023 #ifdef __ASSEMBLER__
00024 
00025 /* Syntactic details of assembler.  */
00026 
00027 #ifdef HAVE_ELF
00028 /* For ELF we need the `.type' directive to make shared libs work right.  */
00029 #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
00030 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
00031 
00032 /* In ELF C symbols are asm symbols.  */
00033 #undef NO_UNDERSCORES
00034 #define NO_UNDERSCORES
00035 #else
00036 #define ASM_TYPE_DIRECTIVE(name,type)     /* Nothing is specified.  */
00037 #define ASM_SIZE_DIRECTIVE(name)   /* Nothing is specified.  */
00038 #endif
00039 
00040 /* Define an entry point visible from C.  */
00041 #define       ENTRY(name)                                                   \
00042   ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name);                                 \
00043   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)                        \
00044   C_LABEL(name)                                                             \
00045   CALL_MCOUNT
00046 
00047 #undef END
00048 #define END(name)                                                    \
00049   ASM_SIZE_DIRECTIVE(name)                                           \
00050 
00051 /* If compiled for profiling, call `mcount' at the start of each function.  */
00052 #ifdef PROF
00053 /* The mcount code relies on a normal frame pointer being on the stack
00054    to locate our caller, so push one just for its benefit.  */
00055 #define CALL_MCOUNT \
00056   movm [a3],(sp); mov sp,a3; add -12,sp; \
00057   call JUMPTARGET(mcount),[],0; add 12,sp; movm (sp),[a3];
00058 #else
00059 #define CALL_MCOUNT         /* Do nothing.  */
00060 #endif
00061 
00062 #ifdef NO_UNDERSCORES
00063 /* Since C identifiers are not normally prefixed with an underscore
00064    on this system, the asm identifier `syscall_error' intrudes on the
00065    C name space.  Make sure we use an innocuous name.  */
00066 #define       syscall_error __syscall_error
00067 #define mcount              _mcount
00068 #endif
00069 
00070 #undef JUMPTARGET
00071 #ifdef PIC
00072 #define JUMPTARGET(name)    name##@PLT
00073 #else
00074 #define JUMPTARGET(name)    name
00075 #endif
00076 
00077 /* Local label name for asm code. */
00078 #ifndef L
00079 #define L(name)             name
00080 #endif
00081 
00082 #endif /* __ASSEMBLER__ */