aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-02-17 01:26:11 +0000
committerPedro Alves <palves@redhat.com>2017-02-17 01:26:11 +0000
commit4265548c65907f095e887148f61af4813b106737 (patch)
tree2a40840e0e87fc63423db4a6e0ec0d9ba483cd52 /bfd
parent2f0d09c823521a0ca734a818c1a71836302c169d (diff)
downloadfsf-binutils-gdb-4265548c65907f095e887148f61af4813b106737.zip
fsf-binutils-gdb-4265548c65907f095e887148f61af4813b106737.tar.gz
fsf-binutils-gdb-4265548c65907f095e887148f61af4813b106737.tar.bz2
bfd: Rename read_{signed,unsigned}_leb128, safe_read_leb128
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog17
-rw-r--r--bfd/dwarf2.c87
-rw-r--r--bfd/elf-attrs.c8
-rw-r--r--bfd/elf32-nds32.c4
-rw-r--r--bfd/libbfd-in.h8
-rw-r--r--bfd/libbfd.c22
-rw-r--r--bfd/libbfd.h8
7 files changed, 99 insertions, 55 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 40edca7..34c9bb4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 9bb8126..25a9ebc 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -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)
{
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index f7bfce9..def1345 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -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;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 3d510a0..9828160 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -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,
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index eb88611..2776d62 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -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);
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 236818e..4a3e4c2 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -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;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 2cbb0b0..3ea747d 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -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);