Re: Optimise away eh_frame advance_loc 0
[deliverable/binutils-gdb.git] / gdb / xcoffread.c
index 2fa27066539caad2597bda37ac5942e13430db6e..bc4877389b0f1ce7e0c84388298cdb1c2df39180 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/file.h>
 #endif
 #include <sys/stat.h>
+#include <algorithm>
 
 #include "coff/internal.h"
 #include "libcoff.h"           /* FIXME, internal data from BFD */
@@ -234,8 +235,6 @@ static void read_xcoff_symtab (struct objfile *, struct partial_symtab *);
 static void add_stab_to_list (char *, struct pending_stabs **);
 #endif
 
-static int compare_lte (const void *, const void *);
-
 static struct linetable *arrange_linetable (struct linetable *);
 
 static void record_include_end (struct coff_symbol *);
@@ -407,18 +406,6 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
 /* *INDENT-ON* */
 
 
-
-/* compare line table entry addresses.  */
-
-static int
-compare_lte (const void *lte1p, const void *lte2p)
-{
-  struct linetable_entry *lte1 = (struct linetable_entry *) lte1p;
-  struct linetable_entry *lte2 = (struct linetable_entry *) lte2p;
-
-  return lte1->pc - lte2->pc;
-}
-
 /* Given a line table with function entries are marked, arrange its
    functions in ascending order and strip off function entry markers
    and return it in a newly created table.  If the old one is good
@@ -471,8 +458,9 @@ arrange_linetable (struct linetable *oldLineTb)
       return oldLineTb;
     }
   else if (function_count > 1)
-    qsort (fentry, function_count,
-          sizeof (struct linetable_entry), compare_lte);
+    std::sort (fentry, fentry + function_count,
+              [] (const linetable_entry &lte1, const linetable_entry& lte2)
+               { return lte1.pc < lte2.pc; });
 
   /* Allocate a new line table.  */
   newLineTb = (struct linetable *)
@@ -1166,7 +1154,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
             c_type value of main symbol table will be set only in case of
             C_EXT/C_HIDEEXT/C_WEAKEXT storage class symbols.
             Bit 10 of type is set if symbol is a function, ie the value is set
-            to 32(0x20). So we need to read the first function auxiliay entry
+            to 32(0x20). So we need to read the first function auxiliary entry
             which contains the size. */
          if (cs->c_naux > 1 && ISFCN (cs->c_type))
          {
@@ -1184,7 +1172,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
            continue;
          }
          /* Read the csect auxiliary header, which is always the last by
-            onvention. */
+            convention. */
          bfd_coff_swap_aux_in (abfd,
                               raw_auxptr
                               + ((coff_data (abfd)->local_symesz)
@@ -1576,7 +1564,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
   initialize_objfile_symbol (sym);
 
   /* default assumptions */
-  SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
+  SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off);
   SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
   SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile);
 
@@ -1674,7 +1662,9 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
                               cs->c_name, 0, 0, objfile);
          if (sym != NULL)
            {
-             SYMBOL_VALUE_ADDRESS (sym) += static_block_base;
+             SET_SYMBOL_VALUE_ADDRESS (sym,
+                                       SYMBOL_VALUE_ADDRESS (sym)
+                                       + static_block_base);
              SYMBOL_SECTION (sym) = static_block_section;
            }
          return sym;
This page took 0.025991 seconds and 4 git commands to generate.