gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / format.c
CommitLineData
252b5132 1/* Generic BFD support for file formats.
b3adc24a 2 Copyright (C) 1990-2020 Free Software Foundation, Inc.
252b5132
RH
3 Written by Cygnus Support.
4
ed781d5d 5 This file is part of BFD, the Binary File Descriptor library.
252b5132 6
ed781d5d
NC
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
cd123cb7 9 the Free Software Foundation; either version 3 of the License, or
ed781d5d 10 (at your option) any later version.
252b5132 11
ed781d5d
NC
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
252b5132 16
ed781d5d
NC
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
cd123cb7
NC
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
21
252b5132
RH
22
23/*
24SECTION
25 File formats
26
27 A format is a BFD concept of high level file contents type. The
3fde5a36 28 formats supported by BFD are:
252b5132
RH
29
30 o <<bfd_object>>
31
32 The BFD may contain data, symbols, relocations and debug info.
33
34 o <<bfd_archive>>
35
36 The BFD contains other BFDs and an optional index.
37
38 o <<bfd_core>>
39
40 The BFD contains the result of an executable core dump.
41
1b74d094
BW
42SUBSECTION
43 File format functions
252b5132
RH
44*/
45
252b5132 46#include "sysdep.h"
3db64b00 47#include "bfd.h"
252b5132
RH
48#include "libbfd.h"
49
50/* IMPORT from targets.c. */
51extern const size_t _bfd_target_vector_entries;
52
53/*
54FUNCTION
55 bfd_check_format
56
57SYNOPSIS
ed781d5d 58 bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
252b5132
RH
59
60DESCRIPTION
61 Verify if the file attached to the BFD @var{abfd} is compatible
62 with the format @var{format} (i.e., one of <<bfd_object>>,
63 <<bfd_archive>> or <<bfd_core>>).
64
65 If the BFD has been set to a specific target before the
66 call, only the named target and format combination is
67 checked. If the target has not been set, or has been set to
68 <<default>>, then all the known target backends is
69 interrogated to determine a match. If the default target
70 matches, it is used. If not, exactly one target must recognize
71 the file, or an error results.
72
b34976b6 73 The function returns <<TRUE>> on success, otherwise <<FALSE>>
3fde5a36 74 with one of the following error codes:
252b5132
RH
75
76 o <<bfd_error_invalid_operation>> -
77 if <<format>> is not one of <<bfd_object>>, <<bfd_archive>> or
78 <<bfd_core>>.
79
80 o <<bfd_error_system_call>> -
81 if an error occured during a read - even some file mismatches
82 can cause bfd_error_system_calls.
83
84 o <<file_not_recognised>> -
85 none of the backends recognised the file format.
86
87 o <<bfd_error_file_ambiguously_recognized>> -
88 more than one backend recognised the file format.
89*/
90
b34976b6 91bfd_boolean
c58b9523 92bfd_check_format (bfd *abfd, bfd_format format)
252b5132
RH
93{
94 return bfd_check_format_matches (abfd, format, NULL);
95}
96
c9ba0c87
AM
97struct bfd_preserve
98{
99 void *marker;
100 void *tdata;
101 flagword flags;
102 const struct bfd_arch_info *arch_info;
103 struct bfd_section *sections;
104 struct bfd_section *section_last;
105 unsigned int section_count;
7cf7fcc8 106 unsigned int section_id;
c9ba0c87 107 struct bfd_hash_table section_htab;
5d9bbb73 108 const struct bfd_build_id *build_id;
f5714099 109 bfd_cleanup cleanup;
c9ba0c87
AM
110};
111
112/* When testing an object for compatibility with a particular target
113 back-end, the back-end object_p function needs to set up certain
114 fields in the bfd on successfully recognizing the object. This
115 typically happens in a piecemeal fashion, with failures possible at
116 many points. On failure, the bfd is supposed to be restored to its
117 initial state, which is virtually impossible. However, restoring a
118 subset of the bfd state works in practice. This function stores
119 the subset. */
120
121static bfd_boolean
f5714099
AM
122bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve,
123 bfd_cleanup cleanup)
c9ba0c87
AM
124{
125 preserve->tdata = abfd->tdata.any;
126 preserve->arch_info = abfd->arch_info;
127 preserve->flags = abfd->flags;
128 preserve->sections = abfd->sections;
129 preserve->section_last = abfd->section_last;
130 preserve->section_count = abfd->section_count;
7cf7fcc8 131 preserve->section_id = _bfd_section_id;
c9ba0c87
AM
132 preserve->section_htab = abfd->section_htab;
133 preserve->marker = bfd_alloc (abfd, 1);
5d9bbb73 134 preserve->build_id = abfd->build_id;
f5714099 135 preserve->cleanup = cleanup;
c9ba0c87
AM
136 if (preserve->marker == NULL)
137 return FALSE;
138
139 return bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc,
140 sizeof (struct section_hash_entry));
141}
142
143/* Clear out a subset of BFD state. */
144
145static void
cb001c0d 146bfd_reinit (bfd *abfd, unsigned int section_id, bfd_cleanup cleanup)
c9ba0c87 147{
cb001c0d
AM
148 _bfd_section_id = section_id;
149 if (cleanup)
150 cleanup (abfd);
c9ba0c87
AM
151 abfd->tdata.any = NULL;
152 abfd->arch_info = &bfd_default_arch_struct;
153 abfd->flags &= BFD_FLAGS_SAVED;
154 bfd_section_list_clear (abfd);
155}
156
157/* Restores bfd state saved by bfd_preserve_save. */
158
f5714099 159static bfd_cleanup
c9ba0c87
AM
160bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve)
161{
162 bfd_hash_table_free (&abfd->section_htab);
163
164 abfd->tdata.any = preserve->tdata;
165 abfd->arch_info = preserve->arch_info;
166 abfd->flags = preserve->flags;
167 abfd->section_htab = preserve->section_htab;
168 abfd->sections = preserve->sections;
169 abfd->section_last = preserve->section_last;
170 abfd->section_count = preserve->section_count;
7cf7fcc8 171 _bfd_section_id = preserve->section_id;
5d9bbb73 172 abfd->build_id = preserve->build_id;
c9ba0c87
AM
173
174 /* bfd_release frees all memory more recently bfd_alloc'd than
175 its arg, as well as its arg. */
176 bfd_release (abfd, preserve->marker);
177 preserve->marker = NULL;
f5714099 178 return preserve->cleanup;
c9ba0c87
AM
179}
180
181/* Called when the bfd state saved by bfd_preserve_save is no longer
182 needed. */
183
184static void
185bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
186{
f5714099
AM
187 if (preserve->cleanup)
188 {
189 /* Run the cleanup, assuming that all it will need is the
190 tdata at the time the cleanup was returned. */
191 void *tdata = abfd->tdata.any;
192 abfd->tdata.any = preserve->tdata;
193 preserve->cleanup (abfd);
194 abfd->tdata.any = tdata;
195 }
c9ba0c87
AM
196 /* It would be nice to be able to free more memory here, eg. old
197 tdata, but that's not possible since these blocks are sitting
198 inside bfd_alloc'd memory. The section hash is on a separate
199 objalloc. */
200 bfd_hash_table_free (&preserve->section_htab);
201 preserve->marker = NULL;
202}
203
252b5132
RH
204/*
205FUNCTION
206 bfd_check_format_matches
207
208SYNOPSIS
c58b9523
AM
209 bfd_boolean bfd_check_format_matches
210 (bfd *abfd, bfd_format format, char ***matching);
252b5132
RH
211
212DESCRIPTION
b34976b6 213 Like <<bfd_check_format>>, except when it returns FALSE with
252b5132
RH
214 <<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
215 case, if @var{matching} is not NULL, it will be filled in with
216 a NULL-terminated list of the names of the formats that matched,
217 allocated with <<malloc>>.
218 Then the user may choose a format and try again.
219
220 When done with the list that @var{matching} points to, the caller
3fde5a36 221 should free it.
252b5132
RH
222*/
223
b34976b6 224bfd_boolean
c58b9523 225bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
252b5132
RH
226{
227 extern const bfd_target binary_vec;
64bfc258
JM
228#if BFD_SUPPORTS_PLUGINS
229 extern const bfd_target plugin_vec;
230#endif
08f74004
AM
231 const bfd_target * const *target;
232 const bfd_target **matching_vector = NULL;
0aabe54e
AM
233 const bfd_target *save_targ, *right_targ, *ar_right_targ, *match_targ;
234 int match_count, best_count, best_match;
3619ad04 235 int ar_match_index;
7cf7fcc8 236 unsigned int initial_section_id = _bfd_section_id;
ea933f17 237 struct bfd_preserve preserve, preserve_match;
cb001c0d 238 bfd_cleanup cleanup = NULL;
252b5132 239
5a1dcb7e
AM
240 if (matching != NULL)
241 *matching = NULL;
242
3619ad04 243 if (!bfd_read_p (abfd)
cea4409c 244 || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
1d713d9e
NC
245 {
246 bfd_set_error (bfd_error_invalid_operation);
b34976b6 247 return FALSE;
1d713d9e 248 }
252b5132
RH
249
250 if (abfd->format != bfd_unknown)
b34976b6 251 return abfd->format == format;
252b5132 252
5a1dcb7e 253 if (matching != NULL || *bfd_associated_vector != NULL)
252b5132 254 {
986f0783 255 size_t amt;
dc810e39 256
08f74004 257 amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries;
a50b1753 258 matching_vector = (const bfd_target **) bfd_malloc (amt);
252b5132 259 if (!matching_vector)
b34976b6 260 return FALSE;
252b5132 261 }
3fde5a36 262
1d713d9e 263 /* Presume the answer is yes. */
252b5132 264 abfd->format = format;
c9ba0c87 265 save_targ = abfd->xvec;
ea933f17
AM
266
267 preserve_match.marker = NULL;
f5714099 268 if (!bfd_preserve_save (abfd, &preserve, NULL))
ea933f17 269 goto err_ret;
252b5132
RH
270
271 /* If the target type was explicitly specified, just check that target. */
1d713d9e
NC
272 if (!abfd->target_defaulted)
273 {
dc810e39 274 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
5a1dcb7e 275 goto err_ret;
3fde5a36 276
cb001c0d 277 cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
3fde5a36 278
cb001c0d 279 if (cleanup)
5a1dcb7e 280 goto ok_ret;
1d713d9e
NC
281
282 /* For a long time the code has dropped through to check all
283 targets if the specified target was wrong. I don't know why,
284 and I'm reluctant to change it. However, in the case of an
285 archive, it can cause problems. If the specified target does
286 not permit archives (e.g., the binary target), then we should
287 not allow some other target to recognize it as an archive, but
288 should instead allow the specified target to recognize it as an
289 object. When I first made this change, it broke the PE target,
290 because the specified pei-i386 target did not recognize the
291 actual pe-i386 archive. Since there may be other problems of
292 this sort, I changed this test to check only for the binary
293 target. */
294 if (format == bfd_archive && save_targ == &binary_vec)
5a1dcb7e 295 goto err_unrecog;
1d713d9e
NC
296 }
297
c9ba0c87
AM
298 /* Since the target type was defaulted, check them all in the hope
299 that one will be uniquely recognized. */
300 right_targ = NULL;
301 ar_right_targ = NULL;
302 match_targ = NULL;
303 best_match = 256;
304 best_count = 0;
305 match_count = 0;
306 ar_match_index = _bfd_target_vector_entries;
307
1d713d9e
NC
308 for (target = bfd_target_vector; *target != NULL; target++)
309 {
ea933f17 310 void **high_water;
3fde5a36 311
999d6dff
AM
312 /* The binary target matches anything, so don't return it when
313 searching. Don't match the plugin target if we have another
314 alternative since we want to properly set the input format
315 before allowing a plugin to claim the file. Also, don't
316 check the default target twice. */
25bbc984 317 if (*target == &binary_vec
999d6dff
AM
318#if BFD_SUPPORTS_PLUGINS
319 || (match_count != 0 && *target == &plugin_vec)
320#endif
7cf7fcc8 321 || (!abfd->target_defaulted && *target == save_targ))
1d713d9e 322 continue;
3fde5a36 323
c9ba0c87
AM
324 /* If we already tried a match, the bfd is modified and may
325 have sections attached, which will confuse the next
326 _bfd_check_format call. */
cb001c0d 327 bfd_reinit (abfd, initial_section_id, cleanup);
ea933f17
AM
328 /* Free bfd_alloc memory too. If we have matched and preserved
329 a target then the high water mark is that much higher. */
330 if (preserve_match.marker)
331 high_water = &preserve_match.marker;
332 else
333 high_water = &preserve.marker;
334 bfd_release (abfd, *high_water);
335 *high_water = bfd_alloc (abfd, 1);
c9ba0c87
AM
336
337 /* Change BFD's target temporarily. */
338 abfd->xvec = *target;
3fde5a36 339
dc810e39 340 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
5a1dcb7e 341 goto err_ret;
3fde5a36 342
cb001c0d
AM
343 cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
344 if (cleanup)
c9ba0c87 345 {
cb001c0d 346 int match_priority = abfd->xvec->match_priority;
64bfc258
JM
347#if BFD_SUPPORTS_PLUGINS
348 /* If this object can be handled by a plugin, give that the
349 lowest priority; objects both handled by a plugin and
350 with an underlying object format will be claimed
351 separately by the plugin. */
352 if (*target == &plugin_vec)
353 match_priority = (*target)->match_priority;
354#endif
355
89d7b8aa
AM
356 if (abfd->format != bfd_archive
357 || (bfd_has_map (abfd)
358 && bfd_get_error () != bfd_error_wrong_object_format))
0aabe54e 359 {
89d7b8aa
AM
360 /* If this is the default target, accept it, even if
361 other targets might match. People who want those
362 other targets have to set the GNUTARGET variable. */
cb001c0d 363 if (abfd->xvec == bfd_default_vector[0])
89d7b8aa
AM
364 goto ok_ret;
365
366 if (matching_vector)
cb001c0d 367 matching_vector[match_count] = abfd->xvec;
89d7b8aa
AM
368 match_count++;
369
64bfc258 370 if (match_priority < best_match)
89d7b8aa 371 {
64bfc258 372 best_match = match_priority;
89d7b8aa
AM
373 best_count = 0;
374 }
7cf7fcc8
AM
375 if (match_priority <= best_match)
376 {
377 /* This format checks out as ok! */
cb001c0d 378 right_targ = abfd->xvec;
7cf7fcc8
AM
379 best_count++;
380 }
89d7b8aa
AM
381 }
382 else
383 {
384 /* An archive with no armap or objects of the wrong
385 type. We want this target to match if we get no
386 better matches. */
387 if (ar_right_targ != bfd_default_vector[0])
388 ar_right_targ = *target;
389 if (matching_vector)
390 matching_vector[ar_match_index] = *target;
391 ar_match_index++;
0aabe54e 392 }
c9ba0c87 393
ea933f17
AM
394 if (preserve_match.marker == NULL)
395 {
cb001c0d 396 match_targ = abfd->xvec;
f5714099 397 if (!bfd_preserve_save (abfd, &preserve_match, cleanup))
ea933f17 398 goto err_ret;
f5714099 399 cleanup = NULL;
ea933f17 400 }
89d7b8aa 401 }
1d713d9e 402 }
3fde5a36 403
0aabe54e
AM
404 if (best_count == 1)
405 match_count = 1;
406
3619ad04
AM
407 if (match_count == 0)
408 {
409 /* Try partial matches. */
410 right_targ = ar_right_targ;
ed781d5d 411
3619ad04
AM
412 if (right_targ == bfd_default_vector[0])
413 {
414 match_count = 1;
415 }
416 else
417 {
418 match_count = ar_match_index - _bfd_target_vector_entries;
ed781d5d 419
5a1dcb7e 420 if (matching_vector && match_count > 1)
ed781d5d
NC
421 memcpy (matching_vector,
422 matching_vector + _bfd_target_vector_entries,
423 sizeof (*matching_vector) * match_count);
08f74004
AM
424 }
425 }
426
03ae2d5e
AM
427 /* We have more than one equally good match. If any of the best
428 matches is a target in config.bfd targ_defvec or targ_selvecs,
429 choose it. */
5a1dcb7e 430 if (match_count > 1)
08f74004
AM
431 {
432 const bfd_target * const *assoc = bfd_associated_vector;
433
434 while ((right_targ = *assoc++) != NULL)
435 {
436 int i = match_count;
437
438 while (--i >= 0)
03ae2d5e
AM
439 if (matching_vector[i] == right_targ
440 && right_targ->match_priority <= best_match)
08f74004
AM
441 break;
442
443 if (i >= 0)
444 {
445 match_count = 1;
446 break;
3619ad04
AM
447 }
448 }
449 }
450
03ae2d5e
AM
451 /* We still have more than one equally good match, and at least some
452 of the targets support match priority. Choose the first of the
453 best matches. */
033539e2 454 if (matching_vector && match_count > 1 && best_count != match_count)
03ae2d5e
AM
455 {
456 int i;
457
458 for (i = 0; i < match_count; i++)
459 {
460 right_targ = matching_vector[i];
461 if (right_targ->match_priority <= best_match)
462 break;
463 }
464 match_count = 1;
465 }
466
c9ba0c87
AM
467 /* There is way too much undoing of half-known state here. We
468 really shouldn't iterate on live bfd's. Note that saving the
469 whole bfd and restoring it would be even worse; the first thing
470 you notice is that the cached bfd file position gets out of sync. */
ea933f17 471 if (preserve_match.marker != NULL)
f5714099 472 cleanup = bfd_preserve_restore (abfd, &preserve_match);
c9ba0c87 473
1d713d9e
NC
474 if (match_count == 1)
475 {
0aabe54e
AM
476 abfd->xvec = right_targ;
477 /* If we come out of the loop knowing that the last target that
478 matched is the one we want, then ABFD should still be in a usable
ea933f17
AM
479 state (except possibly for XVEC). This is not just an
480 optimisation. In the case of plugins a match against the
481 plugin target can result in the bfd being changed such that
482 it no longer matches the plugin target, nor will it match
483 RIGHT_TARG again. */
0aabe54e
AM
484 if (match_targ != right_targ)
485 {
cb001c0d 486 bfd_reinit (abfd, initial_section_id, cleanup);
ea933f17 487 bfd_release (abfd, preserve.marker);
0aabe54e
AM
488 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
489 goto err_ret;
cb001c0d
AM
490 cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
491 BFD_ASSERT (cleanup != NULL);
0aabe54e 492 }
3fde5a36 493
0aabe54e 494 ok_ret:
26ae6d5e
DJ
495 /* If the file was opened for update, then `output_has_begun'
496 some time ago when the file was created. Do not recompute
497 sections sizes or alignments in _bfd_set_section_contents.
498 We can not set this flag until after checking the format,
499 because it will interfere with creation of BFD sections. */
500 if (abfd->direction == both_direction)
501 abfd->output_has_begun = TRUE;
502
c9594989 503 free (matching_vector);
ea933f17
AM
504 if (preserve_match.marker != NULL)
505 bfd_preserve_finish (abfd, &preserve_match);
506 bfd_preserve_finish (abfd, &preserve);
c9ba0c87
AM
507
508 /* File position has moved, BTW. */
509 return TRUE;
252b5132 510 }
252b5132 511
252b5132
RH
512 if (match_count == 0)
513 {
5a1dcb7e 514 err_unrecog:
252b5132 515 bfd_set_error (bfd_error_file_not_recognized);
5a1dcb7e 516 err_ret:
1039fd9a
AM
517 if (cleanup)
518 cleanup (abfd);
5a1dcb7e
AM
519 abfd->xvec = save_targ;
520 abfd->format = bfd_unknown;
c9594989 521 free (matching_vector);
ea933f17
AM
522 if (preserve_match.marker != NULL)
523 bfd_preserve_finish (abfd, &preserve_match);
524 bfd_preserve_restore (abfd, &preserve);
5a1dcb7e 525 return FALSE;
252b5132 526 }
3619ad04 527
c9ba0c87
AM
528 /* Restore original target type and format. */
529 abfd->xvec = save_targ;
530 abfd->format = bfd_unknown;
5a1dcb7e
AM
531 bfd_set_error (bfd_error_file_ambiguously_recognized);
532
533 if (matching)
534 {
535 *matching = (char **) matching_vector;
536 matching_vector[match_count] = NULL;
537 /* Return target names. This is a little nasty. Maybe we
538 should do another bfd_malloc? */
539 while (--match_count >= 0)
3619ad04 540 {
5a1dcb7e
AM
541 const char *name = matching_vector[match_count]->name;
542 *(const char **) &matching_vector[match_count] = name;
3619ad04
AM
543 }
544 }
c9594989 545 else
9d78076e 546 free (matching_vector);
1039fd9a
AM
547 if (cleanup)
548 cleanup (abfd);
ea933f17
AM
549 if (preserve_match.marker != NULL)
550 bfd_preserve_finish (abfd, &preserve_match);
551 bfd_preserve_restore (abfd, &preserve);
b34976b6 552 return FALSE;
252b5132
RH
553}
554
555/*
556FUNCTION
557 bfd_set_format
558
559SYNOPSIS
ed781d5d 560 bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
252b5132
RH
561
562DESCRIPTION
563 This function sets the file format of the BFD @var{abfd} to the
564 format @var{format}. If the target set in the BFD does not
565 support the format requested, the format is invalid, or the BFD
566 is not open for writing, then an error occurs.
252b5132
RH
567*/
568
b34976b6 569bfd_boolean
c58b9523 570bfd_set_format (bfd *abfd, bfd_format format)
252b5132 571{
3619ad04 572 if (bfd_read_p (abfd)
cea4409c 573 || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
1d713d9e
NC
574 {
575 bfd_set_error (bfd_error_invalid_operation);
b34976b6 576 return FALSE;
1d713d9e 577 }
252b5132
RH
578
579 if (abfd->format != bfd_unknown)
b34976b6 580 return abfd->format == format;
252b5132 581
1d713d9e 582 /* Presume the answer is yes. */
252b5132
RH
583 abfd->format = format;
584
1d713d9e
NC
585 if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd)))
586 {
587 abfd->format = bfd_unknown;
b34976b6 588 return FALSE;
1d713d9e 589 }
252b5132 590
b34976b6 591 return TRUE;
252b5132
RH
592}
593
252b5132
RH
594/*
595FUNCTION
596 bfd_format_string
597
598SYNOPSIS
ed781d5d 599 const char *bfd_format_string (bfd_format format);
252b5132
RH
600
601DESCRIPTION
602 Return a pointer to a const string
603 <<invalid>>, <<object>>, <<archive>>, <<core>>, or <<unknown>>,
604 depending upon the value of @var{format}.
605*/
606
3619ad04 607const char *
c58b9523 608bfd_format_string (bfd_format format)
252b5132 609{
c58b9523
AM
610 if (((int) format < (int) bfd_unknown)
611 || ((int) format >= (int) bfd_type_end))
252b5132 612 return "invalid";
3fde5a36 613
1d713d9e
NC
614 switch (format)
615 {
616 case bfd_object:
7dee875e 617 return "object"; /* Linker/assembler/compiler output. */
3fde5a36 618 case bfd_archive:
1d713d9e 619 return "archive"; /* Object archive file. */
3fde5a36 620 case bfd_core:
1d713d9e 621 return "core"; /* Core dump. */
3fde5a36 622 default:
1d713d9e
NC
623 return "unknown";
624 }
252b5132 625}
This page took 1.067553 seconds and 4 git commands to generate.