hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the BFD library.
 
Copyright (C) 1991-2016 Free Software Foundation, Inc.
 
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Funding
Free Software", the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below).  A copy of the license is
included in the section entitled "GNU Free Documentation License".
 
(a) The FSF's Front-Cover Text is:
 
A GNU Manual
 
(b) The FSF's Back-Cover Text is:
 
You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Untitled Document: Opening and Closing</title>
 
<meta name="description" content="Untitled Document: Opening and Closing">
<meta name="keywords" content="Untitled Document: Opening and Closing">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="BFD-Index.html#BFD-Index" rel="index" title="BFD Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="BFD-front-end.html#BFD-front-end" rel="up" title="BFD front end">
<link href="Internal.html#Internal" rel="next" title="Internal">
<link href="Architectures.html#Architectures" rel="prev" title="Architectures">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
 
 
</head>
 
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Opening-and-Closing"></a>
<div class="header">
<p>
Next: <a href="Internal.html#Internal" accesskey="n" rel="next">Internal</a>, Previous: <a href="Architectures.html#Architectures" accesskey="p" rel="prev">Architectures</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
 
<div class="example">
<pre class="example">/* Set to N to open the next N BFDs using an alternate id space.  */
extern unsigned int bfd_use_reserved_id;
</pre></div>
<a name="Opening-and-closing-BFDs"></a>
<h3 class="section">2.14 Opening and closing BFDs</h3>
 
 
<a name="Functions-for-opening-and-closing"></a>
<h4 class="subsection">2.14.1 Functions for opening and closing</h4>
 
 
<a name="index-bfd_005ffopen"></a>
<a name="bfd_005ffopen"></a>
<h4 class="subsubsection">2.14.1.1 <code>bfd_fopen</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_fopen (const char *filename, const char *target,
    const char *mode, int fd);
</pre></div>
<p><strong>Description</strong><br>
Open the file <var>filename</var> with the target <var>target</var>.
Return a pointer to the created BFD.  If <var>fd</var> is not -1,
then <code>fdopen</code> is used to open the file; otherwise, <code>fopen</code>
is used.  <var>mode</var> is passed directly to <code>fopen</code> or
<code>fdopen</code>.
</p>
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
</p>
<p>The new BFD is marked as cacheable iff <var>fd</var> is -1.
</p>
<p>If <code>NULL</code> is returned then an error has occured.   Possible errors
are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or
<code>system_call</code> error.
</p>
<p>On error, <var>fd</var> is always closed.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fopenr"></a>
<a name="bfd_005fopenr"></a>
<h4 class="subsubsection">2.14.1.2 <code>bfd_openr</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_openr (const char *filename, const char *target);
</pre></div>
<p><strong>Description</strong><br>
Open the file <var>filename</var> (using <code>fopen</code>) with the target
<var>target</var>.  Return a pointer to the created BFD.
</p>
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
</p>
<p>If <code>NULL</code> is returned then an error has occured.   Possible errors
are <code>bfd_error_no_memory</code>, <code>bfd_error_invalid_target</code> or
<code>system_call</code> error.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005ffdopenr"></a>
<a name="bfd_005ffdopenr"></a>
<h4 class="subsubsection">2.14.1.3 <code>bfd_fdopenr</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
</pre></div>
<p><strong>Description</strong><br>
<code>bfd_fdopenr</code> is to <code>bfd_fopenr</code> much like <code>fdopen</code> is to
<code>fopen</code>.  It opens a BFD on a file already described by the
<var>fd</var> supplied.
</p>
<p>When the file is later <code>bfd_close</code>d, the file descriptor will
be closed.  If the caller desires that this file descriptor be
cached by BFD (opened as needed, closed as needed to free
descriptors for other opens), with the supplied <var>fd</var> used as
an initial file descriptor (but subject to closure at any time),
call bfd_set_cacheable(bfd, 1) on the returned BFD.  The default
is to assume no caching; the file descriptor will remain open
until <code>bfd_close</code>, and will not be affected by BFD operations
on other files.
</p>
<p>Possible errors are <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>.
</p>
<p>On error, <var>fd</var> is closed.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fopenstreamr"></a>
<a name="bfd_005fopenstreamr"></a>
<h4 class="subsubsection">2.14.1.4 <code>bfd_openstreamr</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_openstreamr (const char * filename, const char * target, void * stream);
</pre></div>
<p><strong>Description</strong><br>
Open a BFD for read access on an existing stdio stream.  When
the BFD is passed to <code>bfd_close</code>, the stream will be closed.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fopenr_005fiovec"></a>
<a name="bfd_005fopenr_005fiovec"></a>
<h4 class="subsubsection">2.14.1.5 <code>bfd_openr_iovec</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_openr_iovec (const char *filename, const char *target,
    void *(*open_func) (struct bfd *nbfd,
    void *open_closure),
    void *open_closure,
    file_ptr (*pread_func) (struct bfd *nbfd,
    void *stream,
    void *buf,
    file_ptr nbytes,
    file_ptr offset),
    int (*close_func) (struct bfd *nbfd,
    void *stream),
    int (*stat_func) (struct bfd *abfd,
    void *stream,
    struct stat *sb));
</pre></div>
<p><strong>Description</strong><br>
Create and return a BFD backed by a read-only <var>stream</var>.
The <var>stream</var> is created using <var>open_func</var>, accessed using
<var>pread_func</var> and destroyed using <var>close_func</var>.
</p>
<p>Calls <code>bfd_find_target</code>, so <var>target</var> is interpreted as by
that function.
</p>
<p>Calls <var>open_func</var> (which can call <code>bfd_zalloc</code> and
<code>bfd_get_filename</code>) to obtain the read-only stream backing
the BFD.  <var>open_func</var> either succeeds returning the
non-<code>NULL</code> <var>stream</var>, or fails returning <code>NULL</code>
(setting <code>bfd_error</code>).
</p>
<p>Calls <var>pread_func</var> to request <var>nbytes</var> of data from
<var>stream</var> starting at <var>offset</var> (e.g., via a call to
<code>bfd_read</code>).  <var>pread_func</var> either succeeds returning the
number of bytes read (which can be less than <var>nbytes</var> when
end-of-file), or fails returning -1 (setting <code>bfd_error</code>).
</p>
<p>Calls <var>close_func</var> when the BFD is later closed using
<code>bfd_close</code>.  <var>close_func</var> either succeeds returning 0, or
fails returning -1 (setting <code>bfd_error</code>).
</p>
<p>Calls <var>stat_func</var> to fill in a stat structure for bfd_stat,
bfd_get_size, and bfd_get_mtime calls.  <var>stat_func</var> returns 0
on success, or returns -1 on failure (setting <code>bfd_error</code>).
</p>
<p>If <code>bfd_openr_iovec</code> returns <code>NULL</code> then an error has
occurred.  Possible errors are <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code> and <code>bfd_error_system_call</code>.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fopenw"></a>
<a name="bfd_005fopenw"></a>
<h4 class="subsubsection">2.14.1.6 <code>bfd_openw</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_openw (const char *filename, const char *target);
</pre></div>
<p><strong>Description</strong><br>
Create a BFD, associated with file <var>filename</var>, using the
file format <var>target</var>, and return a pointer to it.
</p>
<p>Possible errors are <code>bfd_error_system_call</code>, <code>bfd_error_no_memory</code>,
<code>bfd_error_invalid_target</code>.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fclose"></a>
<a name="bfd_005fclose"></a>
<h4 class="subsubsection">2.14.1.7 <code>bfd_close</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean bfd_close (bfd *abfd);
</pre></div>
<p><strong>Description</strong><br>
Close a BFD. If the BFD was open for writing, then pending
operations are completed and the file written out and closed.
If the created file is executable, then <code>chmod</code> is called
to mark it as such.
</p>
<p>All memory attached to the BFD is released.
</p>
<p>The file descriptor associated with the BFD is closed (even
if it was passed in to BFD by <code>bfd_fdopenr</code>).
</p>
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
</p>
<a name="index-bfd_005fclose_005fall_005fdone"></a>
<a name="bfd_005fclose_005fall_005fdone"></a>
<h4 class="subsubsection">2.14.1.8 <code>bfd_close_all_done</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean bfd_close_all_done (bfd *);
</pre></div>
<p><strong>Description</strong><br>
Close a BFD.  Differs from <code>bfd_close</code> since it does not
complete any pending operations.  This routine would be used
if the application had just used BFD for swapping and didn&rsquo;t
want to use any of the writing code.
</p>
<p>If the created file is executable, then <code>chmod</code> is called
to mark it as such.
</p>
<p>All memory attached to the BFD is released.
</p>
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
</p>
<a name="index-bfd_005fcreate"></a>
<a name="bfd_005fcreate"></a>
<h4 class="subsubsection">2.14.1.9 <code>bfd_create</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd *bfd_create (const char *filename, bfd *templ);
</pre></div>
<p><strong>Description</strong><br>
Create a new BFD in the manner of <code>bfd_openw</code>, but without
opening a file. The new BFD takes the target from the target
used by <var>templ</var>. The format is always set to <code>bfd_object</code>.
</p>
<p>A copy of the <var>filename</var> argument is stored in the newly created
BFD.  It can be accessed via the bfd_get_filename() macro.
</p>
<a name="index-bfd_005fmake_005fwritable"></a>
<a name="bfd_005fmake_005fwritable"></a>
<h4 class="subsubsection">2.14.1.10 <code>bfd_make_writable</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean bfd_make_writable (bfd *abfd);
</pre></div>
<p><strong>Description</strong><br>
Takes a BFD as created by <code>bfd_create</code> and converts it
into one like as returned by <code>bfd_openw</code>.  It does this
by converting the BFD to BFD_IN_MEMORY.  It&rsquo;s assumed that
you will call <code>bfd_make_readable</code> on this bfd later.
</p>
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
</p>
<a name="index-bfd_005fmake_005freadable"></a>
<a name="bfd_005fmake_005freadable"></a>
<h4 class="subsubsection">2.14.1.11 <code>bfd_make_readable</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean bfd_make_readable (bfd *abfd);
</pre></div>
<p><strong>Description</strong><br>
Takes a BFD as created by <code>bfd_create</code> and
<code>bfd_make_writable</code> and converts it into one like as
returned by <code>bfd_openr</code>.  It does this by writing the
contents out to the memory buffer, then reversing the
direction.
</p>
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok, otherwise <code>FALSE</code>.
</p>
<a name="index-bfd_005falloc"></a>
<a name="bfd_005falloc"></a>
<h4 class="subsubsection">2.14.1.12 <code>bfd_alloc</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
</pre></div>
<p><strong>Description</strong><br>
Allocate a block of <var>wanted</var> bytes of memory attached to
<code>abfd</code> and return a pointer to it.
</p>
<a name="index-bfd_005falloc2"></a>
<a name="bfd_005falloc2"></a>
<h4 class="subsubsection">2.14.1.13 <code>bfd_alloc2</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
</pre></div>
<p><strong>Description</strong><br>
Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each
of memory attached to <code>abfd</code> and return a pointer to it.
</p>
<a name="index-bfd_005fzalloc"></a>
<a name="bfd_005fzalloc"></a>
<h4 class="subsubsection">2.14.1.14 <code>bfd_zalloc</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">void *bfd_zalloc (bfd *abfd, bfd_size_type wanted);
</pre></div>
<p><strong>Description</strong><br>
Allocate a block of <var>wanted</var> bytes of zeroed memory
attached to <code>abfd</code> and return a pointer to it.
</p>
<a name="index-bfd_005fzalloc2"></a>
<a name="bfd_005fzalloc2"></a>
<h4 class="subsubsection">2.14.1.15 <code>bfd_zalloc2</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size);
</pre></div>
<p><strong>Description</strong><br>
Allocate a block of <var>nmemb</var> elements of <var>size</var> bytes each
of zeroed memory attached to <code>abfd</code> and return a pointer to it.
</p>
<a name="index-bfd_005fcalc_005fgnu_005fdebuglink_005fcrc32"></a>
<a name="bfd_005fcalc_005fgnu_005fdebuglink_005fcrc32"></a>
<h4 class="subsubsection">2.14.1.16 <code>bfd_calc_gnu_debuglink_crc32</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">unsigned long bfd_calc_gnu_debuglink_crc32
   (unsigned long crc, const unsigned char *buf, bfd_size_type len);
</pre></div>
<p><strong>Description</strong><br>
Computes a CRC value as used in the .gnu_debuglink section.
Advances the previously computed <var>crc</var> value by computing
and adding in the crc32 for <var>len</var> bytes of <var>buf</var>.
</p>
<p><strong>Returns</strong><br>
Return the updated CRC32 value.
</p>
<a name="index-bfd_005fget_005fdebug_005flink_005finfo"></a>
<a name="bfd_005fget_005fdebug_005flink_005finfo"></a>
<h4 class="subsubsection">2.14.1.17 <code>bfd_get_debug_link_info</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out);
</pre></div>
<p><strong>Description</strong><br>
Fetch the filename and CRC32 value for any separate debuginfo
associated with <var>abfd</var>.  Return NULL if no such info found,
otherwise return filename and update <var>crc32_out</var>.  The
returned filename is allocated with <code>malloc</code>; freeing it
is the responsibility of the caller.
</p>
<a name="index-bfd_005fget_005falt_005fdebug_005flink_005finfo"></a>
<a name="bfd_005fget_005falt_005fdebug_005flink_005finfo"></a>
<h4 class="subsubsection">2.14.1.18 <code>bfd_get_alt_debug_link_info</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">char *bfd_get_alt_debug_link_info (bfd * abfd,
    bfd_size_type *buildid_len,
    bfd_byte **buildid_out);
</pre></div>
<p><strong>Description</strong><br>
Fetch the filename and BuildID value for any alternate debuginfo
associated with <var>abfd</var>.  Return NULL if no such info found,
otherwise return filename and update <var>buildid_len</var> and
<var>buildid_out</var>.  The returned filename and build_id are
allocated with <code>malloc</code>; freeing them is the
responsibility of the caller.
</p>
<a name="index-separate_005fdebug_005ffile_005fexists"></a>
<a name="separate_005fdebug_005ffile_005fexists"></a>
<h4 class="subsubsection">2.14.1.19 <code>separate_debug_file_exists</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean separate_debug_file_exists
   (char *name, unsigned long crc32);
</pre></div>
<p><strong>Description</strong><br>
Checks to see if <var>name</var> is a file and if its contents
match <var>crc32</var>.
</p>
<a name="index-separate_005falt_005fdebug_005ffile_005fexists"></a>
<a name="separate_005falt_005fdebug_005ffile_005fexists"></a>
<h4 class="subsubsection">2.14.1.20 <code>separate_alt_debug_file_exists</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean separate_alt_debug_file_exists
   (char *name, unsigned long crc32);
</pre></div>
<p><strong>Description</strong><br>
Checks to see if <var>name</var> is a file and if its BuildID
matches <var>buildid</var>.
</p>
<a name="index-find_005fseparate_005fdebug_005ffile"></a>
<a name="find_005fseparate_005fdebug_005ffile"></a>
<h4 class="subsubsection">2.14.1.21 <code>find_separate_debug_file</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">char *find_separate_debug_file (bfd *abfd);
</pre></div>
<p><strong>Description</strong><br>
Searches <var>abfd</var> for a section called <var>section_name</var> which
is expected to contain a reference to a file containing separate
debugging information.  The function scans various locations in
the filesystem, including the file tree rooted at
<var>debug_file_directory</var>, and returns the first matching
filename that it finds.  If <var>check_crc</var> is TRUE then the
contents of the file must also match the CRC value contained in
<var>section_name</var>.  Returns NULL if no valid file could be found.
</p>
<a name="index-bfd_005ffollow_005fgnu_005fdebuglink"></a>
<a name="bfd_005ffollow_005fgnu_005fdebuglink"></a>
<h4 class="subsubsection">2.14.1.22 <code>bfd_follow_gnu_debuglink</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
</pre></div>
<p><strong>Description</strong><br>
Takes a BFD and searches it for a .gnu_debuglink section.  If this
section is found, it examines the section for the name and checksum
of a &rsquo;.debug&rsquo; file containing auxiliary debugging information.  It
then searches the filesystem for this .debug file in some standard
locations, including the directory tree rooted at <var>dir</var>, and if
found returns the full filename.
</p>
<p>If <var>dir</var> is NULL, it will search a default path configured into
libbfd at build time.  [XXX this feature is not currently
implemented].
</p>
<p><strong>Returns</strong><br>
<code>NULL</code> on any errors or failure to locate the .debug file,
otherwise a pointer to a heap-allocated string containing the
filename.  The caller is responsible for freeing this string.
</p>
<a name="index-bfd_005ffollow_005fgnu_005fdebugaltlink"></a>
<a name="bfd_005ffollow_005fgnu_005fdebugaltlink"></a>
<h4 class="subsubsection">2.14.1.23 <code>bfd_follow_gnu_debugaltlink</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir);
</pre></div>
<p><strong>Description</strong><br>
Takes a BFD and searches it for a .gnu_debugaltlink section.  If this
section is found, it examines the section for the name of a file
containing auxiliary debugging information.  It then searches the
filesystem for this file in a set of standard locations, including
the directory tree rooted at <var>dir</var>, and if found returns the
full filename.
</p>
<p>If <var>dir</var> is NULL, it will search a default path configured into
libbfd at build time.  [FIXME: This feature is not currently
implemented].
</p>
<p><strong>Returns</strong><br>
<code>NULL</code> on any errors or failure to locate the debug file,
otherwise a pointer to a heap-allocated string containing the
filename.  The caller is responsible for freeing this string.
</p>
<a name="index-bfd_005fcreate_005fgnu_005fdebuglink_005fsection"></a>
<a name="bfd_005fcreate_005fgnu_005fdebuglink_005fsection"></a>
<h4 class="subsubsection">2.14.1.24 <code>bfd_create_gnu_debuglink_section</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">struct bfd_section *bfd_create_gnu_debuglink_section
   (bfd *abfd, const char *filename);
</pre></div>
<p><strong>Description</strong><br>
Takes a <var>BFD</var> and adds a .gnu_debuglink section to it.  The section is sized
to be big enough to contain a link to the specified <var>filename</var>.
</p>
<p><strong>Returns</strong><br>
A pointer to the new section is returned if all is ok.  Otherwise <code>NULL</code> is
returned and bfd_error is set.
</p>
<a name="index-bfd_005ffill_005fin_005fgnu_005fdebuglink_005fsection"></a>
<a name="bfd_005ffill_005fin_005fgnu_005fdebuglink_005fsection"></a>
<h4 class="subsubsection">2.14.1.25 <code>bfd_fill_in_gnu_debuglink_section</code></h4>
<p><strong>Synopsis</strong>
</p><div class="example">
<pre class="example">bfd_boolean bfd_fill_in_gnu_debuglink_section
   (bfd *abfd, struct bfd_section *sect, const char *filename);
</pre></div>
<p><strong>Description</strong><br>
Takes a <var>BFD</var> and containing a .gnu_debuglink section <var>SECT</var>
and fills in the contents of the section to contain a link to the
specified <var>filename</var>.  The filename should be relative to the
current directory.
</p>
<p><strong>Returns</strong><br>
<code>TRUE</code> is returned if all is ok.  Otherwise <code>FALSE</code> is returned
and bfd_error is set.
</p>
 
<hr>
<div class="header">
<p>
Next: <a href="Internal.html#Internal" accesskey="n" rel="next">Internal</a>, Previous: <a href="Architectures.html#Architectures" accesskey="p" rel="prev">Architectures</a>, Up: <a href="BFD-front-end.html#BFD-front-end" accesskey="u" rel="up">BFD front end</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="BFD-Index.html#BFD-Index" title="Index" rel="index">Index</a>]</p>
</div>
 
 
 
</body>
</html>