1 /* NLM (NetWare Loadable Module) support for BFD.
2 Copyright (C) 1993 Free Software Foundation, Inc.
4 Written by Fred Fish @ Cygnus Support
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 /* This file is part of NLM support for BFD, and contains the portions
24 that are common to both the internal and external representations. */
26 /* Semi-portable string concatenation in cpp.
27 The NLM_CAT4 hack is to avoid a problem with some strict ANSI C
28 preprocessors. The problem is, "32_" or "64_" are not a valid
29 preprocessing tokens, and we don't want extra underscores (e.g.,
30 "nlm_32_"). The XNLM_CAT2 macro will cause the inner NLM_CAT macros
31 to be evaluated first, producing still-valid pp-tokens. Then the
32 final concatenation can be done. (Sigh.) */
35 # define NLM_CAT(a,b) a##b
36 # define NLM_CAT3(a,b,c) a##b##c
37 # define NLM_CAT4(a,b,c,d) a##b##c##d
40 # define NLM_CAT(a,b) a##b
41 # define NLM_CAT3(a,b,c) a##b##c
42 # define XNLM_CAT2(a,b) NLM_CAT(a,b)
43 # define NLM_CAT4(a,b,c,d) XNLM_CAT2(NLM_CAT(a,b),NLM_CAT(c,d))
45 # define NLM_CAT(a,b) a/**/b
46 # define NLM_CAT3(a,b,c) a/**/b/**/c
47 # define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d
51 /* If NLM_ARCH_SIZE is not defined, default to 32. NLM_ARCH_SIZE is
52 optionally defined by the application. */
55 # define NLM_ARCH_SIZE 32
58 #if NLM_ARCH_SIZE == 32
59 # define NLM_TARGET_LONG_SIZE 4
60 # define NLM_TARGET_ADDRESS_SIZE 4
61 # define NLM_NAME(x,y) NLM_CAT4(x,32,_,y)
62 # define NLM_HIBIT (((bfd_vma) 1) << 31)
64 #if NLM_ARCH_SIZE == 64
65 # define NLM_TARGET_LONG_SIZE 8
66 # define NLM_TARGET_ADDRESS_SIZE 8
67 # define NLM_NAME(x,y) NLM_CAT4(x,64,_,y)
68 # define NLM_HIBIT (((bfd_vma) 1) << 63)
71 #define NlmNAME(X) NLM_NAME(Nlm,X)
72 #define nlmNAME(X) NLM_NAME(nlm,X)
74 /* Give names to things that should not change. */
76 #define NLM_MAX_DESCRIPTION_LENGTH 127
77 #define NLM_MAX_SCREEN_NAME_LENGTH 71
78 #define NLM_MAX_THREAD_NAME_LENGTH 71
79 #define NLM_MAX_COPYRIGHT_MESSAGE_LENGTH 255
80 #define NLM_OTHER_DATA_LENGTH 400 /* FIXME */
81 #define NLM_OLD_THREAD_NAME_LENGTH 5
82 #define NLM_SIGNATURE_SIZE 24
83 #define NLM_HEADER_VERSION 4
84 #define NLM_MODULE_NAME_SIZE 14
85 #define NLM_DEFAULT_STACKSIZE (8 * 1024)
87 /* Alpha information. This should probably be in a separate Alpha
88 header file, but it can't go in alpha-ext.h because some of it is
89 needed by nlmconv.c. */
91 /* Magic number in Alpha prefix header. */
92 #define NLM32_ALPHA_MAGIC (0x83561840)
94 /* The r_type field in an Alpha reloc is one of the following values. */
95 #define ALPHA_R_IGNORE 0
96 #define ALPHA_R_REFLONG 1
97 #define ALPHA_R_REFQUAD 2
98 #define ALPHA_R_GPREL32 3
99 #define ALPHA_R_LITERAL 4
100 #define ALPHA_R_LITUSE 5
101 #define ALPHA_R_GPDISP 6
102 #define ALPHA_R_BRADDR 7
103 #define ALPHA_R_HINT 8
104 #define ALPHA_R_SREL16 9
105 #define ALPHA_R_SREL32 10
106 #define ALPHA_R_SREL64 11
107 #define ALPHA_R_OP_PUSH 12
108 #define ALPHA_R_OP_STORE 13
109 #define ALPHA_R_OP_PSUB 14
110 #define ALPHA_R_OP_PRSHIFT 15
111 #define ALPHA_R_GPVALUE 16
112 #define ALPHA_R_NW_RELOC 250
114 /* A local reloc, other than ALPHA_R_GPDISP or ALPHA_R_IGNORE, must be
115 against one of these symbol indices. */
116 #define ALPHA_RELOC_SECTION_TEXT 1
117 #define ALPHA_RELOC_SECTION_DATA 3
119 /* An ALPHA_R_NW_RELOC has one of these values in the size field. If
120 it is SETGP, the r_vaddr field holds the GP value to use. If it is
121 LITA, the r_vaddr field holds the address of the .lita section and
122 the r_symndx field holds the size of the .lita section. */
123 #define ALPHA_R_NW_RELOC_SETGP 1
124 #define ALPHA_R_NW_RELOC_LITA 2