Use bfd_set_filename more
[deliverable/binutils-gdb.git] / bfd / cofflink.c
index ce41dde9715179089d86aa1c28566e993251e2af..5e02760154306e6a51093ef8a31f21217861a60d 100644 (file)
@@ -1,5 +1,5 @@
 /* COFF specific linker code.
-   Copyright (C) 1994-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994-2019 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -221,7 +221,7 @@ coff_link_check_archive_element (bfd *abfd,
     return TRUE;
   *pneeded = TRUE;
 
-  return coff_link_add_object_symbols (abfd, info);
+  return bfd_link_add_symbols (abfd, info);
 }
 
 /* Add all the symbols from an object file to the hash table.  */
@@ -310,7 +310,9 @@ coff_link_add_symbols (bfd *abfd,
            case COFF_SYMBOL_GLOBAL:
              flags = BSF_EXPORT | BSF_GLOBAL;
              section = coff_section_from_bfd_index (abfd, sym.n_scnum);
-             if (! obj_pe (abfd))
+             if (discarded_section (section))
+               section = bfd_und_section_ptr;
+             else if (! obj_pe (abfd))
                value -= section->vma;
              break;
 
@@ -327,6 +329,8 @@ coff_link_add_symbols (bfd *abfd,
            case COFF_SYMBOL_PE_SECTION:
              flags = BSF_SECTION_SYM | BSF_GLOBAL;
              section = coff_section_from_bfd_index (abfd, sym.n_scnum);
+             if (discarded_section (section))
+               section = bfd_und_section_ptr;
              break;
            }
 
@@ -349,7 +353,7 @@ coff_link_add_symbols (bfd *abfd,
                      && (*sym_hash)->root.type != bfd_link_hash_undefined
                      && (*sym_hash)->root.type != bfd_link_hash_undefweak)
                    _bfd_error_handler
-                     (_("Warning: symbol `%s' is both section and non-section"),
+                     (_("warning: symbol `%s' is both section and non-section"),
                       name);
 
                  addit = FALSE;
@@ -451,7 +455,7 @@ coff_link_add_symbols (bfd *abfd,
                                   || BTYPE (sym.n_type) == T_NULL)))
                        _bfd_error_handler
                          /* xgettext: c-format */
-                         (_("Warning: type of symbol `%s' changed"
+                         (_("warning: type of symbol `%s' changed"
                             " from %d to %d in %pB"),
                           name, (*sym_hash)->type, sym.n_type, abfd);
 
@@ -1839,7 +1843,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 
            case C_FCN:
              if (obj_pe (input_bfd)
-                 && strcmp (isym.n_name, ".bf") != 0
+                 && memcmp (isym.n_name, ".bf", sizeof ".bf") != 0
                  && isym.n_scnum > 0)
                {
                  /* For PE, .lf and .ef get their value left alone,
@@ -3080,7 +3084,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
       if (sec != NULL && discarded_section (sec))
        {
          _bfd_clear_contents (howto, input_bfd, input_section,
-                              contents + (rel->r_vaddr - input_section->vma));
+                              contents, rel->r_vaddr - input_section->vma);
          continue;
        }
 
This page took 0.02452 seconds and 4 git commands to generate.