Handle R_X86_64_64 properly for x32
[deliverable/binutils-gdb.git] / bfd / nlmcode.h
index 4773061138fa91b4283f3e876ac6a5540bd9547e..ba0c9c6c5b291cd1c5bf28f609f9a6e5943a6c20 100644 (file)
@@ -1,6 +1,6 @@
 /* NLM (NetWare Loadable Module) executable support for BFD.
    Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 /* NLM (NetWare Loadable Module) executable support for BFD.
    Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2011  Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, using ELF support as the
    template.
 
    Written by Fred Fish @ Cygnus Support, using ELF support as the
    template.
@@ -9,7 +9,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 
-#include "bfd.h"
 #include "sysdep.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 #include "libnlm.h"
 
 #include "libbfd.h"
 #include "libnlm.h"
 
@@ -138,14 +139,13 @@ add_bfd_section (bfd *abfd,
 {
   asection *newsect;
 
 {
   asection *newsect;
 
-  newsect = bfd_make_section (abfd, name);
+  newsect = bfd_make_section_with_flags (abfd, name, flags);
   if (newsect == NULL)
     return FALSE;
 
   newsect->vma = 0;            /* NLM's are relocatable.  */
   newsect->size = size;
   newsect->filepos = offset;
   if (newsect == NULL)
     return FALSE;
 
   newsect->vma = 0;            /* NLM's are relocatable.  */
   newsect->size = size;
   newsect->filepos = offset;
-  newsect->flags = flags;
   newsect->alignment_power = bfd_log2 ((bfd_vma) 0);   /* FIXME */
 
   return TRUE;
   newsect->alignment_power = bfd_log2 ((bfd_vma) 0);   /* FIXME */
 
   return TRUE;
@@ -175,7 +175,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
        return FALSE;
       if (bfd_seek (abfd, position, SEEK_SET) != 0)
        return FALSE;
        return FALSE;
       if (bfd_seek (abfd, position, SEEK_SET) != 0)
        return FALSE;
-      if (strncmp (tempstr, "VeRsIoN#", 8) == 0)
+      if (CONST_STRNEQ (tempstr, "VeRsIoN#"))
        {
          Nlm_External_Version_Header thdr;
 
        {
          Nlm_External_Version_Header thdr;
 
@@ -197,7 +197,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
          nlm_version_header (abfd)->day =
            get_word (abfd, (bfd_byte *) thdr.day);
        }
          nlm_version_header (abfd)->day =
            get_word (abfd, (bfd_byte *) thdr.day);
        }
-      else if (strncmp (tempstr, "MeSsAgEs", 8) == 0)
+      else if (CONST_STRNEQ (tempstr, "MeSsAgEs"))
        {
          Nlm_External_Extended_Header thdr;
 
        {
          Nlm_External_Extended_Header thdr;
 
@@ -265,7 +265,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
          nlm_extended_header (abfd)->reserved5 =
            get_word (abfd, (bfd_byte *) thdr.reserved5);
        }
          nlm_extended_header (abfd)->reserved5 =
            get_word (abfd, (bfd_byte *) thdr.reserved5);
        }
-      else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
+      else if (CONST_STRNEQ (tempstr, "CoPyRiGhT="))
        {
          amt = sizeof (nlm_copyright_header (abfd)->stamp);
          if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
        {
          amt = sizeof (nlm_copyright_header (abfd)->stamp);
          if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
@@ -281,7 +281,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
                        amt, abfd) != amt)
            return FALSE;
        }
                        amt, abfd) != amt)
            return FALSE;
        }
-      else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
+      else if (CONST_STRNEQ (tempstr, "CuStHeAd"))
        {
          Nlm_External_Custom_Header thdr;
          bfd_size_type hdrLength;
        {
          Nlm_External_Custom_Header thdr;
          bfd_size_type hdrLength;
@@ -346,7 +346,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
          /* If we have found a Cygnus header, process it.  Otherwise,
             just save the associated data without trying to interpret
             it.  */
          /* If we have found a Cygnus header, process it.  Otherwise,
             just save the associated data without trying to interpret
             it.  */
-         if (strncmp (dataStamp, "CyGnUsEx", 8) == 0)
+         if (CONST_STRNEQ (dataStamp, "CyGnUsEx"))
            {
              file_ptr pos;
              bfd_byte *contents;
            {
              file_ptr pos;
              bfd_byte *contents;
@@ -365,7 +365,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd)
              if (bfd_seek (abfd, pos, SEEK_SET) != 0)
                return FALSE;
 
              if (bfd_seek (abfd, pos, SEEK_SET) != 0)
                return FALSE;
 
-             memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8);
+             LITMEMCPY (nlm_cygnus_ext_header (abfd), "CyGnUsEx");
              nlm_cygnus_ext_header (abfd)->offset = dataOffset;
              nlm_cygnus_ext_header (abfd)->length = dataLength;
 
              nlm_cygnus_ext_header (abfd)->offset = dataOffset;
              nlm_cygnus_ext_header (abfd)->length = dataLength;
 
@@ -491,7 +491,7 @@ nlm_object_p (bfd *abfd)
                  NLM_SIGNATURE_SIZE) != 0)
     goto got_wrong_format_error;
 
                  NLM_SIGNATURE_SIZE) != 0)
     goto got_wrong_format_error;
 
-  /* There's no supported way to discover the endianess of an NLM, so test for
+  /* There's no supported way to discover the endianness of an NLM, so test for
      a sane version number after doing byte swapping appropriate for this
      XVEC.  (Hack alert!)  */
   if (i_fxdhdrp->version > 0xFFFF)
      a sane version number after doing byte swapping appropriate for this
      XVEC.  (Hack alert!)  */
   if (i_fxdhdrp->version > 0xFFFF)
@@ -646,7 +646,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
     {
       Nlm_External_Version_Header thdr;
 
     {
       Nlm_External_Version_Header thdr;
 
-      memcpy (thdr.stamp, "VeRsIoN#", 8);
+      LITMEMCPY (thdr.stamp, "VeRsIoN#");
       put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
                (bfd_byte *) thdr.majorVersion);
       put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
       put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
                (bfd_byte *) thdr.majorVersion);
       put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
@@ -673,7 +673,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
     {
       Nlm_External_Copyright_Header thdr;
 
     {
       Nlm_External_Copyright_Header thdr;
 
-      memcpy (thdr.stamp, "CoPyRiGhT=", 10);
+      LITMEMCPY (thdr.stamp, "CoPyRiGhT=");
       amt = sizeof (thdr.stamp);
       if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
        return FALSE;
       amt = sizeof (thdr.stamp);
       if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
        return FALSE;
@@ -695,7 +695,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
     {
       Nlm_External_Extended_Header thdr;
 
     {
       Nlm_External_Extended_Header thdr;
 
-      memcpy (thdr.stamp, "MeSsAgEs", 8);
+      LITMEMCPY (thdr.stamp, "MeSsAgEs");
       put_word (abfd,
                (bfd_vma) nlm_extended_header (abfd)->languageID,
                (bfd_byte *) thdr.languageID);
       put_word (abfd,
                (bfd_vma) nlm_extended_header (abfd)->languageID,
                (bfd_byte *) thdr.languageID);
@@ -798,7 +798,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
 
       ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
                         sizeof (nlm_custom_header (abfd)->dataStamp));
 
       ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
                         sizeof (nlm_custom_header (abfd)->dataStamp));
-      memcpy (thdr.stamp, "CuStHeAd", 8);
+      LITMEMCPY (thdr.stamp, "CuStHeAd");
       hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
                   + nlm_custom_header (abfd)->hdrLength);
       put_word (abfd, hdrLength, thdr.length);
       hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
                   + nlm_custom_header (abfd)->hdrLength);
       put_word (abfd, hdrLength, thdr.length);
@@ -832,14 +832,14 @@ nlm_swap_auxiliary_headers_out (bfd *abfd)
     {
       Nlm_External_Custom_Header thdr;
 
     {
       Nlm_External_Custom_Header thdr;
 
-      memcpy (thdr.stamp, "CuStHeAd", 8);
+      LITMEMCPY (thdr.stamp, "CuStHeAd");
       put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8,
                (bfd_byte *) thdr.length);
       put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset,
                (bfd_byte *) thdr.dataOffset);
       put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length,
                (bfd_byte *) thdr.dataLength);
       put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8,
                (bfd_byte *) thdr.length);
       put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset,
                (bfd_byte *) thdr.dataOffset);
       put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length,
                (bfd_byte *) thdr.dataLength);
-      memcpy (thdr.dataStamp, "CyGnUsEx", 8);
+      LITMEMCPY (thdr.dataStamp, "CyGnUsEx");
       amt = sizeof (thdr);
       if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
        return FALSE;
       amt = sizeof (thdr);
       if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
        return FALSE;
This page took 0.026998 seconds and 4 git commands to generate.