* hppa.c (hppa_object_setup): Get rid of all knowledge of stabs
[deliverable/binutils-gdb.git] / bfd / seclet.c
index e03048847e0a39f8b10347513af1cd50c4c4fc98..9da4eb0fa9a0a4e14b548f7712f182b35889445f 100644 (file)
@@ -1,3 +1,23 @@
+/* seclet.c
+   Copyright (C) 1992 Free Software Foundation, Inc.
+   Written by Cygnus Support.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
 /* This module is part of BFD */
 
 
@@ -52,15 +72,19 @@ extern bfd_error_vector_type bfd_error_vector;
 
 
 void
-DEFUN(rel,(abfd, seclet, output_section),
+DEFUN(rel,(abfd, seclet, output_section, data),
       bfd *abfd AND
       bfd_seclet_type *seclet AND
-      asection *output_section)
+      asection *output_section AND
+      PTR data)
 {
-  bfd_byte *data;
-  if (output_section->flags & SEC_HAS_CONTENTS )
+
+  if (output_section->flags & SEC_HAS_CONTENTS 
+      && !(output_section->flags & SEC_NEVER_LOAD)
+      && (output_section->flags & SEC_LOAD)
+      && seclet->size)
   {
-    data = bfd_get_relocated_section_contents(abfd, seclet);
+    data = (PTR) bfd_get_relocated_section_contents(abfd, seclet, data);
     if(bfd_set_section_contents(abfd,
                                output_section,
                                data,
@@ -73,22 +97,23 @@ DEFUN(rel,(abfd, seclet, output_section),
 }
 
 void
-DEFUN(seclet_dump_seclet,(abfd, seclet, section),
+DEFUN(seclet_dump_seclet,(abfd, seclet, section, data),
       bfd *abfd AND
       bfd_seclet_type *seclet AND
-      asection *section)
+      asection *section AND
+      PTR data)
 {
   switch (seclet->type) 
   {
    case bfd_indirect_seclet:
     /* The contents of this section come from another one somewhere
        else */
-    rel(abfd, seclet, section);
+    rel(abfd, seclet, section, data);
     break;
    case bfd_fill_seclet:
     /* Fill in the section with us */
    {
-     char *d = malloc(seclet->size);
+     char *d = bfd_xmalloc(seclet->size);
      unsigned int i;
      for (i =0;  i < seclet->size; i+=2) {
        d[i] = seclet->u.fill.value >> 8;
@@ -106,8 +131,9 @@ DEFUN(seclet_dump_seclet,(abfd, seclet, section),
 }
 
 void
-DEFUN(seclet_dump,(abfd),
-      bfd *abfd)
+DEFUN(seclet_dump,(abfd, data),
+      bfd *abfd AND
+      PTR data)
 {
   /* Write all the seclets on the bfd out, relocate etc according to the
      rules */
@@ -118,7 +144,7 @@ DEFUN(seclet_dump,(abfd),
     bfd_seclet_type *p = o->seclets_head;
     while (p != (bfd_seclet_type *)NULL) 
     {
-      seclet_dump_seclet(abfd, p, o);
+      seclet_dump_seclet(abfd, p, o, data);
       p = p ->next;
     }
     o = o->next;
This page took 0.025416 seconds and 4 git commands to generate.