Automatic date update in version.in
[deliverable/binutils-gdb.git] / binutils / dlltool.c
index 88ee5a5f1b1640fa7dca2cae1a8eb7ea493f2e17..734c727a065efb8b4d5cde2c64affac47b7694ff 100644 (file)
@@ -1,5 +1,5 @@
 /* dlltool.c -- tool to generate stuff for PE style DLLs
-   Copyright (C) 1995-2017 Free Software Foundation, Inc.
+   Copyright (C) 1995-2020 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
 #include "bucomm.h"
 #include "dlltool.h"
 #include "safe-ctype.h"
+#include "coff-bfd.h"
 
 #include <time.h>
 #include <assert.h>
@@ -436,10 +437,6 @@ static FILE *base_file;
 static const char *mname = "arm";
 #endif
 
-#ifdef DLLTOOL_DEFAULT_ARM_EPOC
-static const char *mname = "arm-epoc";
-#endif
-
 #ifdef DLLTOOL_DEFAULT_ARM_WINCE
 static const char *mname = "arm-wince";
 #endif
@@ -733,17 +730,7 @@ mtable[] =
   }
   ,
   {
-#define MARM_EPOC 9
-    "arm-epoc", ".byte", ".short", ".long", ".asciz", "@",
-    "ldr\tip,[pc]\n\tldr\tpc,[ip]\n\t.long",
-    ".global", ".space", ".align\t2",".align\t4", "",
-    "epoc-pe-arm-little", bfd_arch_arm,
-    arm_jtab, sizeof (arm_jtab), 8,
-    0, 0, 0, 0, 0, 0
-  }
-  ,
-  {
-#define MARM_WINCE 10
+#define MARM_WINCE 9
     "arm-wince", ".byte", ".short", ".long", ".asciz", "@",
     "ldr\tip,[pc]\n\tldr\tpc,[ip]\n\t.long",
     ".global", ".space", ".align\t2",".align\t4", "-mapcs-32",
@@ -753,7 +740,7 @@ mtable[] =
   }
   ,
   {
-#define MX86 11
+#define MX86 10
     "i386:x86-64", ".byte", ".short", ".long", ".asciz", "#",
     "jmp *", ".global", ".space", ".align\t2",".align\t4", "",
     "pe-x86-64",bfd_arch_i386,
@@ -908,7 +895,6 @@ rvaafter (int mach)
     case MMCORE_LE:
     case MMCORE_ELF:
     case MMCORE_ELF_LE:
-    case MARM_EPOC:
     case MARM_WINCE:
       break;
     default:
@@ -934,7 +920,6 @@ rvabefore (int mach)
     case MMCORE_LE:
     case MMCORE_ELF:
     case MMCORE_ELF_LE:
-    case MARM_EPOC:
     case MARM_WINCE:
       return ".rva\t";
     default:
@@ -958,7 +943,6 @@ asm_prefix (int mach, const char *name)
     case MMCORE_LE:
     case MMCORE_ELF:
     case MMCORE_ELF_LE:
-    case MARM_EPOC:
     case MARM_WINCE:
       break;
     case M386:
@@ -1401,7 +1385,7 @@ scan_drectve_symbols (bfd *abfd)
   if (s == NULL)
     return;
 
-  size = bfd_get_section_size (s);
+  size = bfd_section_size (s);
   buf  = xmalloc (size);
 
   bfd_get_section_contents (abfd, s, buf, 0, size);
@@ -2338,7 +2322,7 @@ static sinfo secdata[NSECS] =
   INIT_SEC_DATA (IDATA7, ".idata$7", SEC_HAS_CONTENTS, 2),
   INIT_SEC_DATA (IDATA5, ".idata$5", SEC_HAS_CONTENTS, 2),
   INIT_SEC_DATA (IDATA4, ".idata$4", SEC_HAS_CONTENTS, 2),
-  INIT_SEC_DATA (IDATA6, ".idata$6", SEC_HAS_CONTENTS, 2)
+  INIT_SEC_DATA (IDATA6, ".idata$6", SEC_HAS_CONTENTS, 1)
 };
 
 #else
@@ -2499,11 +2483,9 @@ make_one_lib_file (export_type *exp, int i, int delay)
       if (si->id != i)
        abort ();
       si->sec = bfd_make_section_old_way (abfd, si->name);
-      bfd_set_section_flags (abfd,
-                            si->sec,
-                            si->flags & applicable);
+      bfd_set_section_flags (si->sec, si->flags & applicable);
 
-      bfd_set_section_alignment(abfd, si->sec, si->align);
+      bfd_set_section_alignment (si->sec, si->align);
       si->sec->output_section = si->sec;
       si->sym = bfd_make_empty_symbol(abfd);
       si->sym->name = si->sec->name;
@@ -2543,18 +2525,6 @@ make_one_lib_file (export_type *exp, int i, int delay)
 #endif
       ptrs[oidx++] = exp_label;
     }
-#ifndef DLLTOOL_PPC
-  else
-    {
-      /* PR 20881: Add __nm_<symbol> for the exported library.
-        FIXME: Might be needed for PowerPC, but currently unable to test this.  */
-      exp_label = bfd_make_empty_symbol (abfd);
-      exp_label->name = make_imp_label ("__nm_", exp->name);
-      exp_label->section = secdata[IDATA6].sec;
-      exp_label->flags = BSF_GLOBAL;
-      exp_label->value = 0;
-    }
-#endif
 
   /* Generate imp symbols with one underscore for Microsoft
      compatibility, and with two underscores for backward
@@ -2585,12 +2555,6 @@ make_one_lib_file (export_type *exp, int i, int delay)
   if (create_compat_implib)
     ptrs[oidx++] = iname;
   ptrs[oidx++] = iname2;
-#ifndef DLLTOOL_PPC
-  /* PR 20881:
-     According to pe-dll.c __nm_<symbol> should be add after __imp_<symbol>.  */
-  if (exp->data)
-    ptrs[oidx++] = exp_label;
-#endif
 
   iname_lab_pp = ptrs + oidx;
   ptrs[oidx++] = iname_lab;
@@ -2857,7 +2821,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
            arelent *imglue, *ba_rel, *ea_rel, *pea_rel;
 
            /* Alignment must be set to 2**2 or you get extra stuff.  */
-           bfd_set_section_alignment(abfd, sec, 2);
+           bfd_set_section_alignment (sec, 2);
 
            si->size = 4 * 5;
            si->data = xmalloc (si->size);
@@ -2943,8 +2907,8 @@ make_one_lib_file (export_type *exp, int i, int delay)
       {
        sinfo *si = secdata + i;
 
-       bfd_set_section_size (abfd, si->sec, si->size);
-       bfd_set_section_vma (abfd, si->sec, vma);
+       bfd_set_section_size (si->sec, si->size);
+       bfd_set_section_vma (si->sec, vma);
       }
   }
   /* Write them out.  */
@@ -3539,7 +3503,8 @@ identify_dll_for_implib (void)
   search_data.symname = "__NULL_IMPORT_DESCRIPTOR";
   search_data.found = FALSE;
 
-  bfd_init ();
+  if (bfd_init () != BFD_INIT_MAGIC)
+    fatal (_("fatal error: libbfd ABI mismatch"));
 
   abfd = bfd_openr (identify_imp_name, 0);
   if (abfd == NULL)
@@ -3725,7 +3690,7 @@ identify_search_section (bfd * abfd, asection * section, void * obj)
   if (ms_style && ((section->flags & SEC_DATA) == 0))
     return;
 
-  if ((datasize = bfd_section_size (abfd, section)) == 0)
+  if ((datasize = bfd_section_size (section)) == 0)
     return;
 
   data = (bfd_byte *) xmalloc (datasize + 1);
This page took 0.027247 seconds and 4 git commands to generate.