arm: PR gas/25472 Enable DSP instructions with +mve
[binutils-gdb.git] / bfd / coff-bfd.c
blobdba5e677a0faa3d588d7d818a3fa1dfa64931d7a
1 /* BFD COFF interfaces used outside of BFD.
2 Copyright (C) 1990-2020 Free Software Foundation, Inc.
3 Written by Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
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.
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
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 #include "sysdep.h"
23 #include "bfd.h"
24 #include "libbfd.h"
25 #include "coff/internal.h"
26 #include "libcoff.h"
28 /* Return the COFF syment for a symbol. */
30 bfd_boolean
31 bfd_coff_get_syment (bfd *abfd,
32 asymbol *symbol,
33 struct internal_syment *psyment)
35 coff_symbol_type *csym;
37 csym = coff_symbol_from (symbol);
38 if (csym == NULL || csym->native == NULL
39 || ! csym->native->is_sym)
41 bfd_set_error (bfd_error_invalid_operation);
42 return FALSE;
45 *psyment = csym->native->u.syment;
47 if (csym->native->fix_value)
48 psyment->n_value = psyment->n_value -
49 (bfd_hostptr_t) obj_raw_syments (abfd);
51 /* FIXME: We should handle fix_line here. */
53 return TRUE;
56 /* Return the COFF auxent for a symbol. */
58 bfd_boolean
59 bfd_coff_get_auxent (bfd *abfd,
60 asymbol *symbol,
61 int indx,
62 union internal_auxent *pauxent)
64 coff_symbol_type *csym;
65 combined_entry_type *ent;
67 csym = coff_symbol_from (symbol);
69 if (csym == NULL
70 || csym->native == NULL
71 || ! csym->native->is_sym
72 || indx >= csym->native->u.syment.n_numaux)
74 bfd_set_error (bfd_error_invalid_operation);
75 return FALSE;
78 ent = csym->native + indx + 1;
80 BFD_ASSERT (! ent->is_sym);
81 *pauxent = ent->u.auxent;
83 if (ent->fix_tag)
84 pauxent->x_sym.x_tagndx.l =
85 ((combined_entry_type *) pauxent->x_sym.x_tagndx.p
86 - obj_raw_syments (abfd));
88 if (ent->fix_end)
89 pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
90 ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
91 - obj_raw_syments (abfd));
93 if (ent->fix_scnlen)
94 pauxent->x_csect.x_scnlen.l =
95 ((combined_entry_type *) pauxent->x_csect.x_scnlen.p
96 - obj_raw_syments (abfd));
98 return TRUE;