Do not build libctf for targets that do not use the ELF file format.
top * configure.ac (noconfigdirs): Add libctf if the target does not use the ELF file format. * configure: Regenerate. binutils* configure.ac (LIBCTF): Export. Set to empty for non-ELF based targets. (HAVE_LIBCTF): Define if libctf support is available. * Makefile.am (LIBCTF): Set value to @LIBCTF@. * objdump.c: Make CTF code conditional upon HAVE_LIBCTF being defined. * readelf.c: Likewise. * configure: Regenerate. * Makefile.in: Regenerate. * config.in: Regenerate.
This commit is contained in:
parent
9698cf9b1c
commit
90bd54236c
12 changed files with 202 additions and 13 deletions
|
@ -60,7 +60,9 @@
|
|||
#include "bucomm.h"
|
||||
#include "elfcomm.h"
|
||||
#include "dwarf.h"
|
||||
#ifdef HAVE_LIBCTF
|
||||
#include "ctf-api.h"
|
||||
#endif
|
||||
|
||||
#include "elf/common.h"
|
||||
#include "elf/external.h"
|
||||
|
@ -184,7 +186,9 @@ typedef struct elf_section_list
|
|||
#define DEBUG_DUMP (1 << 2) /* The -w command line switch. */
|
||||
#define STRING_DUMP (1 << 3) /* The -p command line switch. */
|
||||
#define RELOC_DUMP (1 << 4) /* The -R command line switch. */
|
||||
#ifdef HAVE_LIBCTF
|
||||
#define CTF_DUMP (1 << 5) /* The --ctf command line switch. */
|
||||
#endif
|
||||
|
||||
typedef unsigned char dump_type;
|
||||
|
||||
|
@ -251,16 +255,20 @@ static bfd_boolean do_dump = FALSE;
|
|||
static bfd_boolean do_version = FALSE;
|
||||
static bfd_boolean do_histogram = FALSE;
|
||||
static bfd_boolean do_debugging = FALSE;
|
||||
#ifdef HAVE_LIBCTF
|
||||
static bfd_boolean do_ctf = FALSE;
|
||||
#endif
|
||||
static bfd_boolean do_arch = FALSE;
|
||||
static bfd_boolean do_notes = FALSE;
|
||||
static bfd_boolean do_archive_index = FALSE;
|
||||
static bfd_boolean is_32bit_elf = FALSE;
|
||||
static bfd_boolean decompress_dumps = FALSE;
|
||||
|
||||
#ifdef HAVE_LIBCTF
|
||||
static char *dump_ctf_parent_name;
|
||||
static char *dump_ctf_symtab_name;
|
||||
static char *dump_ctf_strtab_name;
|
||||
#endif
|
||||
|
||||
struct group_list
|
||||
{
|
||||
|
@ -4401,10 +4409,12 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
|
|||
#define OPTION_DWARF_DEPTH 514
|
||||
#define OPTION_DWARF_START 515
|
||||
#define OPTION_DWARF_CHECK 516
|
||||
#ifdef HAVE_LIBCTF
|
||||
#define OPTION_CTF_DUMP 517
|
||||
#define OPTION_CTF_PARENT 518
|
||||
#define OPTION_CTF_SYMBOLS 519
|
||||
#define OPTION_CTF_STRINGS 520
|
||||
#endif
|
||||
|
||||
static struct option options[] =
|
||||
{
|
||||
|
@ -4443,11 +4453,13 @@ static struct option options[] =
|
|||
{"dwarf-start", required_argument, 0, OPTION_DWARF_START},
|
||||
{"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK},
|
||||
|
||||
#ifdef HAVE_LIBCTF
|
||||
{"ctf", required_argument, 0, OPTION_CTF_DUMP},
|
||||
|
||||
{"ctf-symbols", required_argument, 0, OPTION_CTF_SYMBOLS},
|
||||
{"ctf-strings", required_argument, 0, OPTION_CTF_STRINGS},
|
||||
{"ctf-parent", required_argument, 0, OPTION_CTF_PARENT},
|
||||
#endif
|
||||
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"wide", no_argument, 0, 'W'},
|
||||
|
@ -4498,6 +4510,7 @@ usage (FILE * stream)
|
|||
--dwarf-depth=N Do not display DIEs at depth N or greater\n\
|
||||
--dwarf-start=N Display DIEs starting with N, at the same depth\n\
|
||||
or deeper\n"));
|
||||
#ifdef HAVE_LIBCTF
|
||||
fprintf (stream, _("\
|
||||
--ctf=<number|name> Display CTF info from section <number|name>\n\
|
||||
--ctf-parent=<number|name>\n\
|
||||
|
@ -4506,6 +4519,7 @@ usage (FILE * stream)
|
|||
Use section <number|name> as the CTF external symtab\n\n\
|
||||
--ctf-strings=<number|name>\n\
|
||||
Use section <number|name> as the CTF external strtab\n\n"));
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_DISASSEMBLY
|
||||
fprintf (stream, _("\
|
||||
|
@ -4734,6 +4748,7 @@ parse_args (Filedata * filedata, int argc, char ** argv)
|
|||
case OPTION_DWARF_CHECK:
|
||||
dwarf_check = TRUE;
|
||||
break;
|
||||
#ifdef HAVE_LIBCTF
|
||||
case OPTION_CTF_DUMP:
|
||||
do_ctf = TRUE;
|
||||
request_dump (filedata, CTF_DUMP);
|
||||
|
@ -4747,6 +4762,7 @@ parse_args (Filedata * filedata, int argc, char ** argv)
|
|||
case OPTION_CTF_PARENT:
|
||||
dump_ctf_parent_name = strdup (optarg);
|
||||
break;
|
||||
#endif
|
||||
case OPTION_DYN_SYMS:
|
||||
do_dyn_syms = TRUE;
|
||||
break;
|
||||
|
@ -13808,10 +13824,11 @@ dump_section_as_bytes (Elf_Internal_Shdr * section,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCTF
|
||||
static ctf_sect_t *
|
||||
shdr_to_ctf_sect (ctf_sect_t *buf, Elf_Internal_Shdr *shdr, Filedata *filedata)
|
||||
{
|
||||
buf->cts_name = SECTION_NAME(shdr);
|
||||
buf->cts_name = SECTION_NAME (shdr);
|
||||
buf->cts_type = shdr->sh_type;
|
||||
buf->cts_flags = shdr->sh_flags;
|
||||
buf->cts_size = shdr->sh_size;
|
||||
|
@ -13964,6 +13981,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
|
|||
free (strdata);
|
||||
return ret;
|
||||
}
|
||||
#endif /* HAVE_LIBCTF */
|
||||
|
||||
static bfd_boolean
|
||||
load_specific_debug_section (enum dwarf_section_display_enum debug,
|
||||
|
@ -14303,11 +14321,13 @@ process_section_contents (Filedata * filedata)
|
|||
res = FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCTF
|
||||
if (dump & CTF_DUMP)
|
||||
{
|
||||
if (! dump_section_as_ctf (section, filedata))
|
||||
res = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check to see if the user requested a
|
||||
|
@ -20187,9 +20207,11 @@ main (int argc, char ** argv)
|
|||
if (cmdline.dump_sects != NULL)
|
||||
free (cmdline.dump_sects);
|
||||
|
||||
#ifdef HAVE_LIBCTF
|
||||
free (dump_ctf_symtab_name);
|
||||
free (dump_ctf_strtab_name);
|
||||
free (dump_ctf_parent_name);
|
||||
#endif
|
||||
|
||||
return err ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue