summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf-bfd.h4
-rw-r--r--bfd/elf-strtab.c19
3 files changed, 29 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 42300c111a6..420b13dd101 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+ * elf-strtab.c (_bfd_elf_strtab_len): New.
+ (_bfd_elf_strtab_str): Likewise.
+ * bfd-elf.h: Declare them.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
* elf-bfd.h (bfd_elf_get_str_section): Add.
* elf.c (bfd_elf_get_str_section): No longer static.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index a9e2d3eeaf1..4240d97a429 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2252,8 +2252,12 @@ extern void _bfd_elf_strtab_restore
(struct elf_strtab_hash *, void *);
extern bfd_size_type _bfd_elf_strtab_size
(struct elf_strtab_hash *);
+extern bfd_size_type _bfd_elf_strtab_len
+ (struct elf_strtab_hash *);
extern bfd_size_type _bfd_elf_strtab_offset
(struct elf_strtab_hash *, size_t);
+extern const char * _bfd_elf_strtab_str
+ (struct elf_strtab_hash *, size_t idx, size_t *offset);
extern bfd_boolean _bfd_elf_strtab_emit
(bfd *, struct elf_strtab_hash *);
extern void _bfd_elf_strtab_finalize
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index ec9002fae7b..cc1dcb3f50a 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -271,6 +271,12 @@ _bfd_elf_strtab_size (struct elf_strtab_hash *tab)
}
bfd_size_type
+_bfd_elf_strtab_len (struct elf_strtab_hash *tab)
+{
+ return tab->size;
+}
+
+bfd_size_type
_bfd_elf_strtab_offset (struct elf_strtab_hash *tab, size_t idx)
{
struct elf_strtab_hash_entry *entry;
@@ -285,6 +291,19 @@ _bfd_elf_strtab_offset (struct elf_strtab_hash *tab, size_t idx)
return tab->array[idx]->u.index;
}
+const char *
+_bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx,
+ bfd_size_type *offset)
+{
+ if (idx == 0)
+ return 0;
+ BFD_ASSERT (idx < tab->size);
+ BFD_ASSERT (tab->sec_size);
+ if (offset)
+ *offset = tab->array[idx]->u.index;
+ return tab->array[idx]->root.string;
+}
+
bfd_boolean
_bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
{