Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* NLM (NetWare Loadable Module) executable support for BFD. |
3db64b00 | 2 | Copyright 1993, 1994, 2001, 2002, 2003, 2005, 2007 |
7920ce38 | 3 | Free Software Foundation, Inc. |
252b5132 | 4 | |
7920ce38 | 5 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 6 | |
7920ce38 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 |
7920ce38 | 10 | (at your option) any later version. |
252b5132 | 11 | |
7920ce38 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 | |
7920ce38 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. */ | |
252b5132 | 21 | |
252b5132 | 22 | #include "sysdep.h" |
3db64b00 | 23 | #include "bfd.h" |
252b5132 RH |
24 | #include "libbfd.h" |
25 | #include "libnlm.h" | |
26 | ||
27 | /* Make an NLM object. We just need to allocate the backend | |
28 | information. */ | |
29 | ||
b34976b6 | 30 | bfd_boolean |
7920ce38 | 31 | nlm_mkobject (bfd * abfd) |
252b5132 | 32 | { |
dc810e39 | 33 | bfd_size_type amt = sizeof (struct nlm_obj_tdata); |
7920ce38 NC |
34 | |
35 | nlm_tdata (abfd) = bfd_zalloc (abfd, amt); | |
252b5132 | 36 | if (nlm_tdata (abfd) == NULL) |
b34976b6 | 37 | return FALSE; |
252b5132 RH |
38 | |
39 | if (nlm_architecture (abfd) != bfd_arch_unknown) | |
40 | bfd_default_set_arch_mach (abfd, nlm_architecture (abfd), | |
41 | nlm_machine (abfd)); | |
42 | ||
7920ce38 | 43 | /* Since everything is done at close time, do we need any initialization ? */ |
b34976b6 | 44 | return TRUE; |
252b5132 RH |
45 | } |
46 | ||
47 | /* Set the architecture and machine for an NLM object. */ | |
48 | ||
b34976b6 | 49 | bfd_boolean |
7920ce38 NC |
50 | nlm_set_arch_mach (bfd * abfd, |
51 | enum bfd_architecture arch, | |
52 | unsigned long machine) | |
252b5132 RH |
53 | { |
54 | bfd_default_set_arch_mach (abfd, arch, machine); | |
55 | return arch == nlm_architecture (abfd); | |
56 | } |