Back to index

cell-binutils  2.17cvs20070401
nlm.c
Go to the documentation of this file.
00001 /* NLM (NetWare Loadable Module) executable support for BFD.
00002    Copyright 1993, 1994, 2001, 2002, 2003, 2005
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #include "bfd.h"
00022 #include "sysdep.h"
00023 #include "libbfd.h"
00024 #include "libnlm.h"
00025 
00026 /* Make an NLM object.  We just need to allocate the backend
00027    information.  */
00028 
00029 bfd_boolean
00030 nlm_mkobject (bfd * abfd)
00031 {
00032   bfd_size_type amt = sizeof (struct nlm_obj_tdata);
00033 
00034   nlm_tdata (abfd) = bfd_zalloc (abfd, amt);
00035   if (nlm_tdata (abfd) == NULL)
00036     return FALSE;
00037 
00038   if (nlm_architecture (abfd) != bfd_arch_unknown)
00039     bfd_default_set_arch_mach (abfd, nlm_architecture (abfd),
00040                             nlm_machine (abfd));
00041 
00042   /* Since everything is done at close time, do we need any initialization ?  */
00043   return TRUE;
00044 }
00045 
00046 /* Set the architecture and machine for an NLM object.  */
00047 
00048 bfd_boolean
00049 nlm_set_arch_mach (bfd * abfd,
00050                  enum bfd_architecture arch,
00051                  unsigned long machine)
00052 {
00053   bfd_default_set_arch_mach (abfd, arch, machine);
00054   return arch == nlm_architecture (abfd);
00055 }