Back to index

cell-binutils  2.17cvs20070401
common.h
Go to the documentation of this file.
00001 /* NLM (NetWare Loadable Module) support for BFD.
00002    Copyright 1993, 2001 Free Software Foundation, Inc.
00003 
00004    Written by Fred Fish @ Cygnus Support
00005 
00006 This file is part of BFD, the Binary File Descriptor library.
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 
00023 /* This file is part of NLM support for BFD, and contains the portions
00024    that are common to both the internal and external representations. */
00025 
00026 /* If NLM_ARCH_SIZE is not defined, default to 32.  NLM_ARCH_SIZE is
00027    optionally defined by the application. */
00028 
00029 #ifndef NLM_ARCH_SIZE
00030 #  define NLM_ARCH_SIZE                   32
00031 #endif
00032 
00033 /* Due to horrible details of ANSI macro expansion, we can't use CONCAT4
00034    for NLM_NAME.  CONCAT2 is used in BFD_JUMP_TABLE macros, and some of
00035    them will expand to tokens that themselves are macros defined in terms
00036    of NLM_NAME.  If NLM_NAME were defined using CONCAT4 (which is itself
00037    defined in bfd-in.h using CONCAT2), ANSI preprocessor rules say that
00038    the CONCAT2 within NLM_NAME should not be expanded.
00039    So use another name.  */
00040 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
00041 #ifdef SABER
00042 #define NLM_CAT4(a,b,c,d) a##b##c##d
00043 #else
00044 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
00045    The problem is, "32_" is not a valid preprocessing token, and we don't
00046    want extra underscores (e.g., "nlm_32_").  The NLM_XCAT2 macro will
00047    cause the inner CAT2 macros to be evaluated first, producing
00048    still-valid pp-tokens.  Then the final concatenation can be done.  */
00049 #define NLM_CAT2(a,b)         a##b
00050 #define NLM_XCAT2(a,b)        NLM_CAT2(a,b)
00051 #define NLM_CAT4(a,b,c,d) NLM_XCAT2(NLM_CAT2(a,b),NLM_CAT2(c,d))
00052 #endif
00053 #else
00054 #define NLM_CAT4(a,b,c,d) abcd
00055 #endif
00056 
00057 #if NLM_ARCH_SIZE == 32
00058 #  define NLM_TARGET_LONG_SIZE            4
00059 #  define NLM_TARGET_ADDRESS_SIZE  4
00060 #  define NLM_NAME(x,y)                   NLM_CAT4(x,32,_,y)
00061 #  define NLM_HIBIT                (((bfd_vma) 1) << 31)
00062 #endif
00063 #if NLM_ARCH_SIZE == 64
00064 #  define NLM_TARGET_LONG_SIZE            8
00065 #  define NLM_TARGET_ADDRESS_SIZE  8
00066 #  define NLM_NAME(x,y)                   NLM_CAT4(x,64,_,y)
00067 #  define NLM_HIBIT                (((bfd_vma) 1) << 63)
00068 #endif
00069 
00070 #define NlmNAME(X)          NLM_NAME(Nlm,X)
00071 #define nlmNAME(X)          NLM_NAME(nlm,X)
00072 
00073 /* Give names to things that should not change. */
00074 
00075 #define NLM_MAX_DESCRIPTION_LENGTH        127
00076 #define NLM_MAX_SCREEN_NAME_LENGTH        71
00077 #define NLM_MAX_THREAD_NAME_LENGTH        71
00078 #define NLM_MAX_COPYRIGHT_MESSAGE_LENGTH  255
00079 #define NLM_OTHER_DATA_LENGTH                    400           /* FIXME */
00080 #define NLM_OLD_THREAD_NAME_LENGTH        5
00081 #define NLM_SIGNATURE_SIZE                24
00082 #define NLM_HEADER_VERSION                4
00083 #define NLM_MODULE_NAME_SIZE                     14
00084 #define NLM_DEFAULT_STACKSIZE                    (8 * 1024)
00085 
00086 /* Alpha information.  This should probably be in a separate Alpha
00087    header file, but it can't go in alpha-ext.h because some of it is
00088    needed by nlmconv.c.  */
00089 
00090 /* Magic number in Alpha prefix header.  */
00091 #define NLM32_ALPHA_MAGIC (0x83561840)
00092 
00093 /* The r_type field in an Alpha reloc is one of the following values.  */
00094 #define ALPHA_R_IGNORE             0
00095 #define ALPHA_R_REFLONG            1
00096 #define ALPHA_R_REFQUAD            2
00097 #define ALPHA_R_GPREL32            3
00098 #define ALPHA_R_LITERAL            4
00099 #define ALPHA_R_LITUSE             5
00100 #define ALPHA_R_GPDISP             6
00101 #define ALPHA_R_BRADDR             7
00102 #define ALPHA_R_HINT        8
00103 #define ALPHA_R_SREL16             9
00104 #define ALPHA_R_SREL32             10
00105 #define ALPHA_R_SREL64             11
00106 #define ALPHA_R_OP_PUSH            12
00107 #define ALPHA_R_OP_STORE       13
00108 #define ALPHA_R_OP_PSUB            14
00109 #define ALPHA_R_OP_PRSHIFT     15
00110 #define ALPHA_R_GPVALUE            16
00111 #define ALPHA_R_NW_RELOC      250
00112 
00113 /* A local reloc, other than ALPHA_R_GPDISP or ALPHA_R_IGNORE, must be
00114    against one of these symbol indices.  */
00115 #define ALPHA_RELOC_SECTION_TEXT   1
00116 #define ALPHA_RELOC_SECTION_DATA   3
00117 
00118 /* An ALPHA_R_NW_RELOC has one of these values in the size field.  If
00119    it is SETGP, the r_vaddr field holds the GP value to use.  If it is
00120    LITA, the r_vaddr field holds the address of the .lita section and
00121    the r_symndx field holds the size of the .lita section.  */
00122 #define ALPHA_R_NW_RELOC_SETGP     1
00123 #define ALPHA_R_NW_RELOC_LITA      2