aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-open-bfd.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2019-05-29 11:11:37 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2019-05-29 11:11:37 +0200
commit9698cf9b1c485edbbeabc9f65bfd0fdef92e3854 (patch)
tree5dbe117ab7f582cb95faec5ce3b183c7d6397155 /libctf/ctf-open-bfd.c
parent90f879191c1bc8455527f66fb4ab46873aa870aa (diff)
downloadgdb-9698cf9b1c485edbbeabc9f65bfd0fdef92e3854.zip
gdb-9698cf9b1c485edbbeabc9f65bfd0fdef92e3854.tar.gz
gdb-9698cf9b1c485edbbeabc9f65bfd0fdef92e3854.tar.bz2
Fix libctf build on non-ELF targets.
All machinery works as on ELF, except for automatic loading of ELF string and symbol tables in the BFD-style open machinery. * Makefile.def (dependencies): configure-libctf depends on all-bfd and all its deps. * Makefile.in: Regenerated. libctf/ * configure.in: Check for bfd_section_from_elf_index. * configure: Regenerate. * config.h.in [HAVE_BFD_ELF]: Likewise. * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it. abfd is potentially unused now.
Diffstat (limited to 'libctf/ctf-open-bfd.c')
-rw-r--r--libctf/ctf-open-bfd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libctf/ctf-open-bfd.c b/libctf/ctf-open-bfd.c
index d6d442e..5e34d12 100644
--- a/libctf/ctf-open-bfd.c
+++ b/libctf/ctf-open-bfd.c
@@ -119,7 +119,8 @@ ctf_bfdopen (struct bfd *abfd, int *errp)
later. */
ctf_archive_t *
-ctf_bfdopen_ctfsect (struct bfd *abfd, const ctf_sect_t *ctfsect, int *errp)
+ctf_bfdopen_ctfsect (struct bfd *abfd _libctf_unused_,
+ const ctf_sect_t *ctfsect, int *errp)
{
struct ctf_archive *arc = NULL;
ctf_archive_t *arci;
@@ -129,6 +130,7 @@ ctf_bfdopen_ctfsect (struct bfd *abfd, const ctf_sect_t *ctfsect, int *errp)
const char *bfderrstr = NULL;
int is_archive;
+#ifdef HAVE_BFD_ELF
asection *sym_asect;
ctf_sect_t symsect, strsect;
/* TODO: handle SYMTAB_SHNDX. */
@@ -178,6 +180,7 @@ ctf_bfdopen_ctfsect (struct bfd *abfd, const ctf_sect_t *ctfsect, int *errp)
symsectp = &symsect;
}
}
+#endif
if (ctfsect->cts_size > sizeof (uint64_t) &&
((*(uint64_t *) ctfsect->cts_data) == CTFA_MAGIC))
@@ -203,9 +206,11 @@ ctf_bfdopen_ctfsect (struct bfd *abfd, const ctf_sect_t *ctfsect, int *errp)
if (arci)
return arci;
err_free_sym:
+#ifdef HAVE_BFD_ELF
free ((void *) symsect.cts_data);
err_free_str:
free ((void *) strsect.cts_data);
+#endif
err: _libctf_unused_;
if (bfderrstr)
{