bfd: Rename read_{signed,unsigned}_leb128, safe_read_leb128
authorPedro Alves <palves@redhat.com>
Fri, 17 Feb 2017 01:26:11 +0000 (01:26 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 17 Feb 2017 01:26:11 +0000 (01:26 +0000)
Give these bfd-internal symbols with external linkage a _bfd_ prefix
to avoid collisions in the global symbol namespace.

bfd/ChangeLog:
2017-02-17  Pedro Alves  <palves@redhat.com>

* dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
* libbfd.c (read_unsigned_leb128): Rename to ...
(_bfd_read_unsigned_leb128): ... this.
(read_signed_leb128): Rename to ...
(_bfd_read_signed_leb128): ... this.
(safe_read_leb128): Rename to ...
(_bfd_safe_read_leb128): ... this.
* libbfd-in.h (read_unsigned_leb128): Rename to ...
(_bfd_read_unsigned_leb128): ... this.
(read_signed_leb128): Rename to ...
(_bfd_read_signed_leb128): ... this.
(safe_read_leb128): Rename to ...
(_bfd_safe_read_leb128): ... this.
* libbfd.h: Renegerate.

bfd/ChangeLog
bfd/dwarf2.c
bfd/elf-attrs.c
bfd/elf32-nds32.c
bfd/libbfd-in.h
bfd/libbfd.c
bfd/libbfd.h

index 40edca71ff455469669ad1977a0bd99d0b0b5907..34c9bb49e84d891b4feeb6e0e527913afb00c3aa 100644 (file)
@@ -1,3 +1,20 @@
+2017-02-17  Pedro Alves  <palves@redhat.com>
+
+       * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
+       * libbfd.c (read_unsigned_leb128): Rename to ...
+       (_bfd_read_unsigned_leb128): ... this.
+       (read_signed_leb128): Rename to ...
+       (_bfd_read_signed_leb128): ... this.
+       (safe_read_leb128): Rename to ...
+       (_bfd_safe_read_leb128): ... this.
+       * libbfd-in.h (read_unsigned_leb128): Rename to ...
+       (_bfd_read_unsigned_leb128): ... this.
+       (read_signed_leb128): Rename to ...
+       (_bfd_read_signed_leb128): ... this.
+       (safe_read_leb128): Rename to ...
+       (_bfd_safe_read_leb128): ... this.
+       * libbfd.h: Renegerate.
+
 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
index 9bb81264872554d766a47bc1fdf38cb97358d847..25a9ebce7374428c6dce5ecf1bdbcbe8e524dbb8 100644 (file)
@@ -920,15 +920,18 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
       /* Read in abbrev header.  */
       cur_abbrev->number = abbrev_number;
       cur_abbrev->tag = (enum dwarf_tag)
-       safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+       _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read,
+                              FALSE, abbrev_end);
       abbrev_ptr += bytes_read;
       cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr, abbrev_end);
       abbrev_ptr += 1;
 
       /* Now read in declarations.  */
-      abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+      abbrev_name = _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read,
+                                          FALSE, abbrev_end);
       abbrev_ptr += bytes_read;
-      abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+      abbrev_form = _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read,
+                                          FALSE, abbrev_end);
       abbrev_ptr += bytes_read;
 
       while (abbrev_name)
@@ -963,9 +966,11 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
            = (enum dwarf_attribute) abbrev_name;
          cur_abbrev->attrs[cur_abbrev->num_attrs++].form
            = (enum dwarf_form) abbrev_form;
-         abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+         abbrev_name = _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read,
+                                              FALSE, abbrev_end);
          abbrev_ptr += bytes_read;
-         abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+         abbrev_form = _bfd_safe_read_leb128 (abfd, abbrev_ptr, &bytes_read,
+                                              FALSE, abbrev_end);
          abbrev_ptr += bytes_read;
        }
 
@@ -983,7 +988,8 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
       if ((unsigned int) (abbrev_ptr - stash->dwarf_abbrev_buffer)
          >= stash->dwarf_abbrev_size)
        break;
-      abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end);
+      abbrev_number = _bfd_safe_read_leb128 (abfd, abbrev_ptr,
+                                            &bytes_read, FALSE, abbrev_end);
       abbrev_ptr += bytes_read;
       if (lookup_abbrev (abbrev_number, abbrevs) != NULL)
        break;
@@ -1104,7 +1110,8 @@ read_attribute_value (struct attribute *  attr,
       blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
       if (blk == NULL)
        return NULL;
-      blk->size = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+      blk->size = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                        FALSE, info_ptr_end);
       info_ptr += bytes_read;
       blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size);
       info_ptr += blk->size;
@@ -1133,11 +1140,13 @@ read_attribute_value (struct attribute *  attr,
       attr->u.val = 1;
       break;
     case DW_FORM_sdata:
-      attr->u.sval = safe_read_leb128 (abfd, info_ptr, &bytes_read, TRUE, info_ptr_end);
+      attr->u.sval = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                           TRUE, info_ptr_end);
       info_ptr += bytes_read;
       break;
     case DW_FORM_udata:
-      attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+      attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                          FALSE, info_ptr_end);
       info_ptr += bytes_read;
       break;
     case DW_FORM_ref1:
@@ -1161,11 +1170,13 @@ read_attribute_value (struct attribute *  attr,
       info_ptr += 8;
       break;
     case DW_FORM_ref_udata:
-      attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+      attr->u.val = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                          FALSE, info_ptr_end);
       info_ptr += bytes_read;
       break;
     case DW_FORM_indirect:
-      form = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+      form = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                   FALSE, info_ptr_end);
       info_ptr += bytes_read;
       info_ptr = read_attribute_value (attr, form, unit, info_ptr, info_ptr_end);
       break;
@@ -1918,11 +1929,13 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
 
       table->files[table->num_files].name = cur_file;
       table->files[table->num_files].dir =
-       safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+       _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
       line_ptr += bytes_read;
-      table->files[table->num_files].time = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+      table->files[table->num_files].time
+       = _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
       line_ptr += bytes_read;
-      table->files[table->num_files].size = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+      table->files[table->num_files].size
+       = _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
       line_ptr += bytes_read;
       table->num_files++;
     }
@@ -1986,7 +1999,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
          else switch (op_code)
            {
            case DW_LNS_extended_op:
-             exop_len = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+             exop_len = _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                               FALSE, line_end);
              line_ptr += bytes_read;
              extended_op = read_1_byte (abfd, line_ptr, line_end);
              line_ptr += 1;
@@ -2027,19 +2041,23 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
                    }
                  table->files[table->num_files].name = cur_file;
                  table->files[table->num_files].dir =
-                   safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+                   _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                          FALSE, line_end);
                  line_ptr += bytes_read;
                  table->files[table->num_files].time =
-                   safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+                   _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                          FALSE, line_end);
                  line_ptr += bytes_read;
                  table->files[table->num_files].size =
-                   safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+                   _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                          FALSE, line_end);
                  line_ptr += bytes_read;
                  table->num_files++;
                  break;
                case DW_LNE_set_discriminator:
                  discriminator =
-                   safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+                   _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                          FALSE, line_end);
                  line_ptr += bytes_read;
                  break;
                case DW_LNE_HP_source_file_correlation:
@@ -2068,12 +2086,14 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
            case DW_LNS_advance_pc:
              if (lh.maximum_ops_per_insn == 1)
                address += (lh.minimum_instruction_length
-                           * safe_read_leb128 (abfd, line_ptr, &bytes_read,
-                                               FALSE, line_end));
+                           * _bfd_safe_read_leb128 (abfd, line_ptr,
+                                                    &bytes_read,
+                                                    FALSE, line_end));
              else
                {
-                 bfd_vma adjust = safe_read_leb128 (abfd, line_ptr, &bytes_read,
-                                                    FALSE, line_end);
+                 bfd_vma adjust = _bfd_safe_read_leb128 (abfd, line_ptr,
+                                                         &bytes_read,
+                                                         FALSE, line_end);
                  address = ((op_index + adjust) / lh.maximum_ops_per_insn
                             * lh.minimum_instruction_length);
                  op_index = (op_index + adjust) % lh.maximum_ops_per_insn;
@@ -2081,7 +2101,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
              line_ptr += bytes_read;
              break;
            case DW_LNS_advance_line:
-             line += safe_read_leb128 (abfd, line_ptr, &bytes_read, TRUE, line_end);
+             line += _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                            TRUE, line_end);
              line_ptr += bytes_read;
              break;
            case DW_LNS_set_file:
@@ -2090,7 +2111,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
 
                /* The file and directory tables are 0
                   based, the references are 1 based.  */
-               file = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+               file = _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                             FALSE, line_end);
                line_ptr += bytes_read;
                if (filename)
                  free (filename);
@@ -2098,7 +2120,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
                break;
              }
            case DW_LNS_set_column:
-             column = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+             column = _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                             FALSE, line_end);
              line_ptr += bytes_read;
              break;
            case DW_LNS_negate_stmt:
@@ -2128,7 +2151,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
              /* Unknown standard opcode, ignore it.  */
              for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
                {
-                 (void) safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end);
+                 (void) _bfd_safe_read_leb128 (abfd, line_ptr, &bytes_read,
+                                               FALSE, line_end);
                  line_ptr += bytes_read;
                }
              break;
@@ -2562,7 +2586,8 @@ find_abstract_instance_name (struct comp_unit *unit,
       info_ptr_end = unit->end_ptr;
     }
 
-  abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+  abbrev_number = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                        FALSE, info_ptr_end);
   info_ptr += bytes_read;
 
   if (abbrev_number)
@@ -2702,7 +2727,8 @@ scan_unit_for_symbols (struct comp_unit *unit)
       if (info_ptr >= info_ptr_end)
        goto fail;
 
-      abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end);
+      abbrev_number = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                            FALSE, info_ptr_end);
       info_ptr += bytes_read;
 
       if (! abbrev_number)
@@ -3018,7 +3044,8 @@ parse_comp_unit (struct dwarf2_debug *stash,
   if (! abbrevs)
     return NULL;
 
-  abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, end_ptr);
+  abbrev_number = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read,
+                                        FALSE, end_ptr);
   info_ptr += bytes_read;
   if (! abbrev_number)
     {
index f7bfce91c253bcd17e9e3e623fa46af6b38122c3..def1345eeb00396decdca83cf56b40e19736e379 100644 (file)
@@ -493,7 +493,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
              bfd_vma subsection_len;
              bfd_byte *end;
 
-             tag = safe_read_leb128 (abfd, p, &n, FALSE, p_end);
+             tag = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, p_end);
              p += n;
              if (p < p_end - 4)
                subsection_len = bfd_get_32 (abfd, p);
@@ -517,13 +517,13 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
                    {
                      int type;
 
-                     tag = safe_read_leb128 (abfd, p, &n, FALSE, end);
+                     tag = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
                      p += n;
                      type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
                      switch (type & (ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL))
                        {
                        case ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL:
-                         val = safe_read_leb128 (abfd, p, &n, FALSE, end);
+                         val = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
                          p += n;
                          bfd_elf_add_obj_attr_int_string (abfd, vendor, tag,
                                                           val, (char *) p);
@@ -535,7 +535,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
                          p += strlen ((char *)p) + 1;
                          break;
                        case ATTR_TYPE_FLAG_INT_VAL:
-                         val = safe_read_leb128 (abfd, p, &n, FALSE, end);
+                         val = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
                          p += n;
                          bfd_elf_add_obj_attr_int (abfd, vendor, tag, val);
                          break;
index 3d510a0d54557f401519a69f7ea1c555050a1710..982816089e5c927406041e0b891dd6b6aa735dd4 100644 (file)
@@ -8696,8 +8696,8 @@ nds32_elf_relax_delete_blanks (bfd *abfd, asection *sec,
              unsigned long before, between;
              bfd_byte *endp, *p;
 
-             val = read_unsigned_leb128 (abfd, contents + irel->r_offset,
-                                         &len);
+             val = _bfd_read_unsigned_leb128 (abfd, contents + irel->r_offset,
+                                              &len);
 
              before = get_nds32_elf_blank_total (&blank_t, irel->r_addend, 0);
              between = get_nds32_elf_blank_total (&blank_t,
index eb8861191ac26893ab338c7d3f5d60ac150543ff..2776d6270004366a41fb0b9380bb5dcbc44a5780 100644 (file)
@@ -851,7 +851,7 @@ extern void bfd_section_already_linked_table_traverse
   (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
                    void *), void *);
 
-extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
-extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
-extern bfd_vma safe_read_leb128 (bfd *, bfd_byte *, unsigned int *,
-                                bfd_boolean, const bfd_byte * const);
+extern bfd_vma _bfd_read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_signed_vma _bfd_read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_vma _bfd_safe_read_leb128 (bfd *, bfd_byte *, unsigned int *,
+                                     bfd_boolean, const bfd_byte * const);
index 236818ec8fd60a4c9a566b94ad1cee12302aedad..4a3e4c20aeeabbb0e2257025fc9af9943156e969 100644 (file)
@@ -954,9 +954,9 @@ warn_deprecated (const char *what,
 /* Helper function for reading uleb128 encoded data.  */
 
 bfd_vma
-read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
-                     bfd_byte *buf,
-                     unsigned int *bytes_read_ptr)
+_bfd_read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+                          bfd_byte *buf,
+                          unsigned int *bytes_read_ptr)
 {
   bfd_vma result;
   unsigned int num_read;
@@ -985,11 +985,11 @@ read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
    No bytes will be read at address END or beyond.  */
 
 bfd_vma
-safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
-                 bfd_byte *data,
-                 unsigned int *length_return,
-                 bfd_boolean sign,
-                 const bfd_byte * const end)
+_bfd_safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+                      bfd_byte *data,
+                      unsigned int *length_return,
+                      bfd_boolean sign,
+                      const bfd_byte * const end)
 {
   bfd_vma result = 0;
   unsigned int num_read = 0;
@@ -1021,9 +1021,9 @@ safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
 /* Helper function for reading sleb128 encoded data.  */
 
 bfd_signed_vma
-read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
-                   bfd_byte *buf,
-                   unsigned int *bytes_read_ptr)
+_bfd_read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
+                        bfd_byte *buf,
+                        unsigned int *bytes_read_ptr)
 {
   bfd_vma result;
   unsigned int shift;
index 2cbb0b053897cbe524ac7f13f48701a3fb9dfc20..3ea747d2be300f533728faf5e7b6afda54eeffb0 100644 (file)
@@ -856,10 +856,10 @@ extern void bfd_section_already_linked_table_traverse
   (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
                    void *), void *);
 
-extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
-extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
-extern bfd_vma safe_read_leb128 (bfd *, bfd_byte *, unsigned int *,
-                                bfd_boolean, const bfd_byte * const);
+extern bfd_vma _bfd_read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_signed_vma _bfd_read_signed_leb128 (bfd *, bfd_byte *, unsigned int *);
+extern bfd_vma _bfd_safe_read_leb128 (bfd *, bfd_byte *, unsigned int *,
+                                     bfd_boolean, const bfd_byte * const);
 /* Extracted from libbfd.c.  */
 bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
 
This page took 0.035986 seconds and 4 git commands to generate.