Make the assembler generate an error if there is an attempt to define a section with...
[deliverable/binutils-gdb.git] / bfd / reloc16.c
index 4e3107fb937d434cded6aec6c5e1c4a3bedc3b41..9373f38a25351fbdec9e4aa5b5907da2650e3ab8 100644 (file)
@@ -1,6 +1,5 @@
 /* 8 and 16 bit COFF relocation functions, for BFD.
 /* 8 and 16 bit COFF relocation functions, for BFD.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
-   2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -23,8 +22,7 @@
 
 /* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.  */
 
 
 /* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.  */
 
-/* These routines are used by coff-h8300 and coff-z8k to do
-   relocation.
+/* These routines are used by coff-z8k to do relocation.
 
    FIXME: This code should be rewritten to support the new COFF
    linker.  Basically, they need to deal with COFF relocs rather than
 
    FIXME: This code should be rewritten to support the new COFF
    linker.  Basically, they need to deal with COFF relocs rather than
 #include "libcoff.h"
 
 bfd_vma
 #include "libcoff.h"
 
 bfd_vma
-bfd_coff_reloc16_get_value (reloc, link_info, input_section)
-     arelent *reloc;
-     struct bfd_link_info *link_info;
-     asection *input_section;
+bfd_coff_reloc16_get_value (arelent *reloc,
+                           struct bfd_link_info *link_info,
+                           asection *input_section)
 {
   bfd_vma value;
   asymbol *symbol = *(reloc->sym_ptr_ptr);
 {
   bfd_vma value;
   asymbol *symbol = *(reloc->sym_ptr_ptr);
@@ -76,13 +73,15 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section)
       else if (h != (struct bfd_link_hash_entry *) NULL
               && h->type == bfd_link_hash_common)
        value = h->u.c.size;
       else if (h != (struct bfd_link_hash_entry *) NULL
               && h->type == bfd_link_hash_common)
        value = h->u.c.size;
+      else if (h != (struct bfd_link_hash_entry *) NULL
+              && h->type == bfd_link_hash_undefweak)
+       /* This is a GNU extension.  */
+       value = 0;
       else
        {
       else
        {
-         if (!((*link_info->callbacks->undefined_symbol)
-               (link_info, bfd_asymbol_name (symbol),
-                input_section->owner, input_section, reloc->address,
-                TRUE)))
-           abort ();
+         (*link_info->callbacks->undefined_symbol)
+           (link_info, bfd_asymbol_name (symbol),
+            input_section->owner, input_section, reloc->address, TRUE);
          value = 0;
        }
     }
          value = 0;
        }
     }
@@ -100,11 +99,10 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section)
 }
 
 void
 }
 
 void
-bfd_perform_slip (abfd, slip, input_section, value)
-     bfd *abfd;
-     unsigned int slip;
-     asection *input_section;
-     bfd_vma value;
+bfd_perform_slip (bfd *abfd,
+                 unsigned int slip,
+                 asection *input_section,
+                 bfd_vma value)
 {
   asymbol **s;
 
 {
   asymbol **s;
 
@@ -139,11 +137,10 @@ bfd_perform_slip (abfd, slip, input_section, value)
 }
 
 bfd_boolean
 }
 
 bfd_boolean
-bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
-     bfd *abfd;
-     asection *input_section;
-     struct bfd_link_info *link_info;
-     bfd_boolean *again;
+bfd_coff_reloc16_relax_section (bfd *abfd,
+                               asection *input_section,
+                               struct bfd_link_info *link_info,
+                               bfd_boolean *again)
 {
   /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = input_section->owner;
 {
   /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = input_section->owner;
@@ -153,6 +150,10 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
   arelent **reloc_vector = NULL;
   long reloc_count;
 
   arelent **reloc_vector = NULL;
   long reloc_count;
 
+  if (bfd_link_relocatable (link_info))
+    (*link_info->callbacks->einfo)
+      (_("%P%F: --relax and -r may not be used together\n"));
+
   /* We only do global relaxation once.  It is not safe to do it multiple
      times (see discussion of the "shrinks" array below).  */
   *again = FALSE;
   /* We only do global relaxation once.  It is not safe to do it multiple
      times (see discussion of the "shrinks" array below).  */
   *again = FALSE;
@@ -239,18 +240,13 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
 }
 
 bfd_byte *
 }
 
 bfd_byte *
-bfd_coff_reloc16_get_relocated_section_contents (in_abfd,
-                                                link_info,
-                                                link_order,
-                                                data,
-                                                relocatable,
-                                                symbols)
-     bfd *in_abfd;
-     struct bfd_link_info *link_info;
-     struct bfd_link_order *link_order;
-     bfd_byte *data;
-     bfd_boolean relocatable;
-     asymbol **symbols;
+bfd_coff_reloc16_get_relocated_section_contents
+  (bfd *in_abfd,
+   struct bfd_link_info *link_info,
+   struct bfd_link_order *link_order,
+   bfd_byte *data,
+   bfd_boolean relocatable,
+   asymbol **symbols)
 {
   /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = link_order->u.indirect.section->owner;
 {
   /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = link_order->u.indirect.section->owner;
This page took 0.024802 seconds and 4 git commands to generate.