Tidy bfdio to consistenly use containing archive
[deliverable/binutils-gdb.git] / bfd / bfd.c
index 88f0862d568f00b001c64017e9d6ebb436d9af28..851710401e036fa79d9d08844adcf2b392cbfec5 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -74,8 +74,9 @@ CODE_FRAGMENT
 .     least-recently-used list of BFDs.  *}
 .  struct bfd *lru_prev, *lru_next;
 .
-.  {* When a file is closed by the caching routines, BFD retains
-.     state information on the file here...  *}
+.  {* Track current file position (or current buffer offset for
+.     in-memory BFDs).  When a file is closed by the caching routines,
+.     BFD retains state information on the file here.  *}
 .  ufile_ptr where;
 .
 .  {* File modified time, if mtime_set is TRUE.  *}
@@ -304,21 +305,15 @@ CODE_FRAGMENT
 .    {
 .      struct aout_data_struct *aout_data;
 .      struct artdata *aout_ar_data;
-.      struct _oasys_data *oasys_obj_data;
-.      struct _oasys_ar_data *oasys_ar_data;
 .      struct coff_tdata *coff_obj_data;
 .      struct pe_tdata *pe_obj_data;
 .      struct xcoff_tdata *xcoff_obj_data;
 .      struct ecoff_tdata *ecoff_obj_data;
-.      struct ieee_data_struct *ieee_data;
-.      struct ieee_ar_data_struct *ieee_ar_data;
 .      struct srec_data_struct *srec_data;
 .      struct verilog_data_struct *verilog_data;
 .      struct ihex_data_struct *ihex_data;
 .      struct tekhex_data_struct *tekhex_data;
 .      struct elf_obj_tdata *elf_obj_data;
-.      struct nlm_obj_tdata *nlm_obj_data;
-.      struct bout_data_struct *bout_data;
 .      struct mmo_data_struct *mmo_data;
 .      struct sun_core_struct *sun_core_data;
 .      struct sco5_core_struct *sco5_core_data;
@@ -451,28 +446,28 @@ static bfd_error_type input_error = bfd_error_no_error;
 
 const char *const bfd_errmsgs[] =
 {
-  N_("No error"),
-  N_("System call error"),
-  N_("Invalid bfd target"),
-  N_("File in wrong format"),
-  N_("Archive object file in wrong format"),
-  N_("Invalid operation"),
-  N_("Memory exhausted"),
-  N_("No symbols"),
-  N_("Archive has no index; run ranlib to add one"),
-  N_("No more archived files"),
-  N_("Malformed archive"),
+  N_("no error"),
+  N_("system call error"),
+  N_("invalid bfd target"),
+  N_("file in wrong format"),
+  N_("archive object file in wrong format"),
+  N_("invalid operation"),
+  N_("memory exhausted"),
+  N_("no symbols"),
+  N_("archive has no index; run ranlib to add one"),
+  N_("no more archived files"),
+  N_("malformed archive"),
   N_("DSO missing from command line"),
-  N_("File format not recognized"),
-  N_("File format is ambiguous"),
-  N_("Section has no contents"),
-  N_("Nonrepresentable section on output"),
-  N_("Symbol needs debug section which does not exist"),
-  N_("Bad value"),
-  N_("File truncated"),
-  N_("File too big"),
-  N_("Error reading %s: %s"),
-  N_("#<Invalid error code>")
+  N_("file format not recognized"),
+  N_("file format is ambiguous"),
+  N_("section has no contents"),
+  N_("nonrepresentable section on output"),
+  N_("symbol needs debug section which does not exist"),
+  N_("bad value"),
+  N_("file truncated"),
+  N_("file too big"),
+  N_("error reading %s: %s"),
+  N_("#<invalid error code>")
 };
 
 /*
@@ -649,10 +644,7 @@ union _bfd_doprnt_args
 };
 
 /* This macro and _bfd_doprnt taken from libiberty _doprnt.c, tidied a
-   little and extended to handle '%pA', '%pB' and positional parameters.
-   'L' as a modifer for integer formats is used for bfd_vma and
-   bfd_size_type args, which vary in size depending on BFD
-   configuration.  */
+   little and extended to handle '%pA', '%pB' and positional parameters.  */
 
 #define PRINT_TYPE(TYPE, FIELD) \
   do                                                           \
@@ -800,21 +792,6 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
                  PRINT_TYPE (int, i);
                else
                  {
-                   /* L modifier for bfd_vma or bfd_size_type may be
-                      either long long or long.  */
-                   if (ptr[-2] == 'L')
-                     {
-                       sptr[-2] = 'l';
-                       if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
-                         wide_width = 1;
-                       else
-                         {
-                           sptr[-1] = 'l';
-                           *sptr++ = ptr[-1];
-                           *sptr = '\0';
-                         }
-                     }
-
                    switch (wide_width)
                      {
                      case 0:
@@ -1051,12 +1028,6 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
                  arg_type = Int;
                else
                  {
-                   if (ptr[-2] == 'L')
-                     {
-                       if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
-                         wide_width = 1;
-                     }
-
                    switch (wide_width)
                      {
                      case 0:
@@ -1117,14 +1088,6 @@ _bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
   return arg_count;
 }
 
-/* This is the default routine to handle BFD error messages.
-   Like fprintf (stderr, ...), but also handles some extra format specifiers.
-
-   %pA section name from section.  For group components, prints group name too.
-   %pB file name from bfd.  For archive components, prints archive too.
-
-   Beware: Only supports a maximum of 9 format arguments.  */
-
 static void
 error_handler_internal (const char *fmt, va_list ap)
 {
@@ -1186,6 +1149,26 @@ error_handler_internal (const char *fmt, va_list ap)
 
 static bfd_error_handler_type _bfd_error_internal = error_handler_internal;
 
+/*
+FUNCTION
+       _bfd_error_handler
+
+SYNOPSIS
+       void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
+
+DESCRIPTION
+       This is the default routine to handle BFD error messages.
+       Like fprintf (stderr, ...), but also handles some extra format
+       specifiers.
+
+       %pA section name from section.  For group components, prints
+       group name too.
+       %pB file name from bfd.  For archive components, prints
+       archive too.
+
+       Beware: Only supports a maximum of 9 format arguments.
+*/
+
 void
 _bfd_error_handler (const char *fmt, ...)
 {
@@ -2162,7 +2145,7 @@ FUNCTION
        bfd_emul_get_commonpagesize
 
 SYNOPSIS
-       bfd_vma bfd_emul_get_commonpagesize (const char *);
+       bfd_vma bfd_emul_get_commonpagesize (const char *, bfd_boolean);
 
 DESCRIPTION
        Returns the common page size, in bytes, as determined by
@@ -2173,15 +2156,22 @@ RETURNS
 */
 
 bfd_vma
-bfd_emul_get_commonpagesize (const char *emul)
+bfd_emul_get_commonpagesize (const char *emul, bfd_boolean relro)
 {
   const bfd_target *target;
 
   target = bfd_find_target (emul, NULL);
   if (target != NULL
       && target->flavour == bfd_target_elf_flavour)
-    return xvec_get_elf_backend_data (target)->commonpagesize;
+    {
+      const struct elf_backend_data *bed;
 
+      bed = xvec_get_elf_backend_data (target);
+      if (relro)
+       return bed->relropagesize;
+      else
+       return bed->commonpagesize;
+    }
   return 0;
 }
 
This page took 0.037626 seconds and 4 git commands to generate.