OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [bfd/] [doc/] [libbfd.texi] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
@section Implementation details
2
 
3
 
4
@subsection Internal functions
5
 
6
 
7
@strong{Description}@*
8
These routines are used within BFD.
9
They are not intended for export, but are documented here for
10
completeness.
11
 
12
@findex bfd_write_bigendian_4byte_int
13
@subsubsection @code{bfd_write_bigendian_4byte_int}
14
@strong{Synopsis}
15
@example
16
bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
17
@end example
18
@strong{Description}@*
19
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
20
endian order regardless of what else is going on.  This is useful in
21
archives.
22
 
23
@findex bfd_put_size
24
@subsubsection @code{bfd_put_size}
25
@findex bfd_get_size
26
@subsubsection @code{bfd_get_size}
27
@strong{Description}@*
28
These macros as used for reading and writing raw data in
29
sections; each access (except for bytes) is vectored through
30
the target format of the BFD and mangled accordingly. The
31
mangling performs any necessary endian translations and
32
removes alignment restrictions.  Note that types accepted and
33
returned by these macros are identical so they can be swapped
34
around in macros---for example, @file{libaout.h} defines @code{GET_WORD}
35
to either @code{bfd_get_32} or @code{bfd_get_64}.
36
 
37
In the put routines, @var{val} must be a @code{bfd_vma}.  If we are on a
38
system without prototypes, the caller is responsible for making
39
sure that is true, with a cast if necessary.  We don't cast
40
them in the macro definitions because that would prevent @code{lint}
41
or @code{gcc -Wall} from detecting sins such as passing a pointer.
42
To detect calling these with less than a @code{bfd_vma}, use
43
@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
44
@example
45
 
46
/* Byte swapping macros for user section data.  */
47
 
48
#define bfd_put_8(abfd, val, ptr) \
49
  ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
50
#define bfd_put_signed_8 \
51
  bfd_put_8
52
#define bfd_get_8(abfd, ptr) \
53
  (*(unsigned char *) (ptr) & 0xff)
54
#define bfd_get_signed_8(abfd, ptr) \
55
  (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
56
 
57
#define bfd_put_16(abfd, val, ptr) \
58
  BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
59
#define bfd_put_signed_16 \
60
  bfd_put_16
61
#define bfd_get_16(abfd, ptr) \
62
  BFD_SEND (abfd, bfd_getx16, (ptr))
63
#define bfd_get_signed_16(abfd, ptr) \
64
  BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
65
 
66
#define bfd_put_32(abfd, val, ptr) \
67
  BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
68
#define bfd_put_signed_32 \
69
  bfd_put_32
70
#define bfd_get_32(abfd, ptr) \
71
  BFD_SEND (abfd, bfd_getx32, (ptr))
72
#define bfd_get_signed_32(abfd, ptr) \
73
  BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
74
 
75
#define bfd_put_64(abfd, val, ptr) \
76
  BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
77
#define bfd_put_signed_64 \
78
  bfd_put_64
79
#define bfd_get_64(abfd, ptr) \
80
  BFD_SEND (abfd, bfd_getx64, (ptr))
81
#define bfd_get_signed_64(abfd, ptr) \
82
  BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
83
 
84
#define bfd_get(bits, abfd, ptr)                       \
85
  ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr)       \
86
   : (bits) == 16 ? bfd_get_16 (abfd, ptr)             \
87
   : (bits) == 32 ? bfd_get_32 (abfd, ptr)             \
88
   : (bits) == 64 ? bfd_get_64 (abfd, ptr)             \
89
   : (abort (), (bfd_vma) - 1))
90
 
91
#define bfd_put(bits, abfd, val, ptr)                  \
92
  ((bits) == 8 ? bfd_put_8  (abfd, val, ptr)           \
93
   : (bits) == 16 ? bfd_put_16 (abfd, val, ptr)                \
94
   : (bits) == 32 ? bfd_put_32 (abfd, val, ptr)                \
95
   : (bits) == 64 ? bfd_put_64 (abfd, val, ptr)                \
96
   : (abort (), (void) 0))
97
 
98
@end example
99
 
100
@findex bfd_h_put_size
101
@subsubsection @code{bfd_h_put_size}
102
@strong{Description}@*
103
These macros have the same function as their @code{bfd_get_x}
104
brethren, except that they are used for removing information
105
for the header records of object files. Believe it or not,
106
some object files keep their header records in big endian
107
order and their data in little endian order.
108
@example
109
 
110
/* Byte swapping macros for file header data.  */
111
 
112
#define bfd_h_put_8(abfd, val, ptr) \
113
  bfd_put_8 (abfd, val, ptr)
114
#define bfd_h_put_signed_8(abfd, val, ptr) \
115
  bfd_put_8 (abfd, val, ptr)
116
#define bfd_h_get_8(abfd, ptr) \
117
  bfd_get_8 (abfd, ptr)
118
#define bfd_h_get_signed_8(abfd, ptr) \
119
  bfd_get_signed_8 (abfd, ptr)
120
 
121
#define bfd_h_put_16(abfd, val, ptr) \
122
  BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
123
#define bfd_h_put_signed_16 \
124
  bfd_h_put_16
125
#define bfd_h_get_16(abfd, ptr) \
126
  BFD_SEND (abfd, bfd_h_getx16, (ptr))
127
#define bfd_h_get_signed_16(abfd, ptr) \
128
  BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
129
 
130
#define bfd_h_put_32(abfd, val, ptr) \
131
  BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
132
#define bfd_h_put_signed_32 \
133
  bfd_h_put_32
134
#define bfd_h_get_32(abfd, ptr) \
135
  BFD_SEND (abfd, bfd_h_getx32, (ptr))
136
#define bfd_h_get_signed_32(abfd, ptr) \
137
  BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
138
 
139
#define bfd_h_put_64(abfd, val, ptr) \
140
  BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
141
#define bfd_h_put_signed_64 \
142
  bfd_h_put_64
143
#define bfd_h_get_64(abfd, ptr) \
144
  BFD_SEND (abfd, bfd_h_getx64, (ptr))
145
#define bfd_h_get_signed_64(abfd, ptr) \
146
  BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
147
 
148
/* Aliases for the above, which should eventually go away.  */
149
 
150
#define H_PUT_64  bfd_h_put_64
151
#define H_PUT_32  bfd_h_put_32
152
#define H_PUT_16  bfd_h_put_16
153
#define H_PUT_8   bfd_h_put_8
154
#define H_PUT_S64 bfd_h_put_signed_64
155
#define H_PUT_S32 bfd_h_put_signed_32
156
#define H_PUT_S16 bfd_h_put_signed_16
157
#define H_PUT_S8  bfd_h_put_signed_8
158
#define H_GET_64  bfd_h_get_64
159
#define H_GET_32  bfd_h_get_32
160
#define H_GET_16  bfd_h_get_16
161
#define H_GET_8   bfd_h_get_8
162
#define H_GET_S64 bfd_h_get_signed_64
163
#define H_GET_S32 bfd_h_get_signed_32
164
#define H_GET_S16 bfd_h_get_signed_16
165
#define H_GET_S8  bfd_h_get_signed_8
166
 
167
 
168
@end example
169
 
170
@findex bfd_log2
171
@subsubsection @code{bfd_log2}
172
@strong{Synopsis}
173
@example
174
unsigned int bfd_log2 (bfd_vma x);
175
@end example
176
@strong{Description}@*
177
Return the log base 2 of the value supplied, rounded up.  E.g., an
178
@var{x} of 1025 returns 11.  A @var{x} of 0 returns 0.
179
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.