mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 00:52:16 +08:00
2009-02-03 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/9784 * NEWS: Mention --prefix=PREFIX and --prefix-strip=LEVEL. * doc/binutils.texi: Document --prefix=PREFIX and --prefix-strip=LEVEL. * objdump.c: Include "filenames.h". (prefix): New. (prefix_strip): Likewise. (prefix_length): Likewise. (usage): Add --prefix=PREFIX and --prefix-strip=LEVEL. (option_values): Add OPTION_PREFIX and OPTION_PREFIX_STRIP. (long_options): Likewise. (show_line): Handle prefix and prefix_strip. (main): Handle OPTION_PREFIX and OPTION_PREFIX_STRIP. * readelf.c (PATH_MAX): Moved to ... * sysdep.h: Here.
This commit is contained in:
@ -1,3 +1,24 @@
|
|||||||
|
2009-02-03 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR binutils/9784
|
||||||
|
* NEWS: Mention --prefix=PREFIX and --prefix-strip=LEVEL.
|
||||||
|
|
||||||
|
* doc/binutils.texi: Document --prefix=PREFIX and
|
||||||
|
--prefix-strip=LEVEL.
|
||||||
|
|
||||||
|
* objdump.c: Include "filenames.h".
|
||||||
|
(prefix): New.
|
||||||
|
(prefix_strip): Likewise.
|
||||||
|
(prefix_length): Likewise.
|
||||||
|
(usage): Add --prefix=PREFIX and --prefix-strip=LEVEL.
|
||||||
|
(option_values): Add OPTION_PREFIX and OPTION_PREFIX_STRIP.
|
||||||
|
(long_options): Likewise.
|
||||||
|
(show_line): Handle prefix and prefix_strip.
|
||||||
|
(main): Handle OPTION_PREFIX and OPTION_PREFIX_STRIP.
|
||||||
|
|
||||||
|
* readelf.c (PATH_MAX): Moved to ...
|
||||||
|
* sysdep.h: Here.
|
||||||
|
|
||||||
2009-01-31 Alan Modra <amodra@bigpond.net.au>
|
2009-01-31 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* NEWS: Mention --as-needed change.
|
* NEWS: Mention --as-needed change.
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
latter case the library is not linked if it is found in a DT_NEEDED
|
latter case the library is not linked if it is found in a DT_NEEDED
|
||||||
entry of one of the libraries already linked.
|
entry of one of the libraries already linked.
|
||||||
|
|
||||||
|
* Added --prefix=PREFIX and --prefix-strip=LEVEL switches to objdump to
|
||||||
|
add absolute paths for -S.
|
||||||
|
|
||||||
* Add new option --use-nul-prefixed-import-tables to dlltool to allow fall-
|
* Add new option --use-nul-prefixed-import-tables to dlltool to allow fall-
|
||||||
back to old import table generation with null element prefix.
|
back to old import table generation with null element prefix.
|
||||||
|
|
||||||
|
@ -1614,6 +1614,8 @@ objdump [@option{-a}|@option{--archive-headers}]
|
|||||||
[@option{--[no-]show-raw-insn}]
|
[@option{--[no-]show-raw-insn}]
|
||||||
[@option{--adjust-vma=}@var{offset}]
|
[@option{--adjust-vma=}@var{offset}]
|
||||||
[@option{--special-syms}]
|
[@option{--special-syms}]
|
||||||
|
[@option{--prefix=}@var{prefix}]
|
||||||
|
[@option{--prefix-strip=}@var{level}]
|
||||||
[@option{-V}|@option{--version}]
|
[@option{-V}|@option{--version}]
|
||||||
[@option{-H}|@option{--help}]
|
[@option{-H}|@option{--help}]
|
||||||
@var{objfile}@dots{}
|
@var{objfile}@dots{}
|
||||||
@ -1936,6 +1938,16 @@ non-empty sections are displayed.
|
|||||||
Display source code intermixed with disassembly, if possible. Implies
|
Display source code intermixed with disassembly, if possible. Implies
|
||||||
@option{-d}.
|
@option{-d}.
|
||||||
|
|
||||||
|
@item --prefix=@var{prefix}
|
||||||
|
@cindex Add prefix to absolute paths
|
||||||
|
Specify @var{prefix} to add to the absolute paths when used with
|
||||||
|
@option{-S}.
|
||||||
|
|
||||||
|
@item --prefix-strip=@var{level}
|
||||||
|
@cindex Strip absolute paths
|
||||||
|
Indicate how many initial directory names to strip off the hardwired
|
||||||
|
absolute paths. It has no effect without @option{--prefix=}@var{prefix}.
|
||||||
|
|
||||||
@item --show-raw-insn
|
@item --show-raw-insn
|
||||||
When disassembling instructions, print the instruction in hex as well as
|
When disassembling instructions, print the instruction in hex as well as
|
||||||
in symbolic form. This is the default except when
|
in symbolic form. This is the default except when
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include "dis-asm.h"
|
#include "dis-asm.h"
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
#include "demangle.h"
|
#include "demangle.h"
|
||||||
|
#include "filenames.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "budbg.h"
|
#include "budbg.h"
|
||||||
|
|
||||||
@ -111,6 +112,9 @@ static int dump_special_syms = 0; /* --special-syms */
|
|||||||
static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
|
static bfd_vma adjust_section_vma = 0; /* --adjust-vma */
|
||||||
static int file_start_context = 0; /* --file-start-context */
|
static int file_start_context = 0; /* --file-start-context */
|
||||||
static bfd_boolean display_file_offsets;/* -F */
|
static bfd_boolean display_file_offsets;/* -F */
|
||||||
|
static const char *prefix; /* --prefix */
|
||||||
|
static int prefix_strip; /* --prefix-strip */
|
||||||
|
static size_t prefix_length;
|
||||||
|
|
||||||
/* Pointer to an array of section names provided by
|
/* Pointer to an array of section names provided by
|
||||||
one or more "-j secname" command line options. */
|
one or more "-j secname" command line options. */
|
||||||
@ -231,6 +235,8 @@ usage (FILE *stream, int status)
|
|||||||
--[no-]show-raw-insn Display hex alongside symbolic disassembly\n\
|
--[no-]show-raw-insn Display hex alongside symbolic disassembly\n\
|
||||||
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\
|
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n\
|
||||||
--special-syms Include special symbols in symbol dumps\n\
|
--special-syms Include special symbols in symbol dumps\n\
|
||||||
|
--prefix=PREFIX Add PREFIX to absolute paths for -S\n\
|
||||||
|
--prefix-strip=LEVEL Strip initial directory names for -S\n\
|
||||||
\n"));
|
\n"));
|
||||||
list_supported_targets (program_name, stream);
|
list_supported_targets (program_name, stream);
|
||||||
list_supported_architectures (program_name, stream);
|
list_supported_architectures (program_name, stream);
|
||||||
@ -248,6 +254,8 @@ enum option_values
|
|||||||
OPTION_ENDIAN=150,
|
OPTION_ENDIAN=150,
|
||||||
OPTION_START_ADDRESS,
|
OPTION_START_ADDRESS,
|
||||||
OPTION_STOP_ADDRESS,
|
OPTION_STOP_ADDRESS,
|
||||||
|
OPTION_PREFIX,
|
||||||
|
OPTION_PREFIX_STRIP,
|
||||||
OPTION_ADJUST_VMA
|
OPTION_ADJUST_VMA
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -293,6 +301,8 @@ static struct option long_options[]=
|
|||||||
{"target", required_argument, NULL, 'b'},
|
{"target", required_argument, NULL, 'b'},
|
||||||
{"version", no_argument, NULL, 'V'},
|
{"version", no_argument, NULL, 'V'},
|
||||||
{"wide", no_argument, NULL, 'w'},
|
{"wide", no_argument, NULL, 'w'},
|
||||||
|
{"prefix", required_argument, NULL, OPTION_PREFIX},
|
||||||
|
{"prefix-strip", required_argument, NULL, OPTION_PREFIX_STRIP},
|
||||||
{0, no_argument, 0, 0}
|
{0, no_argument, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1190,6 +1200,7 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
|||||||
const char *filename;
|
const char *filename;
|
||||||
const char *functionname;
|
const char *functionname;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
|
bfd_boolean reloc;
|
||||||
|
|
||||||
if (! with_line_numbers && ! with_source_code)
|
if (! with_line_numbers && ! with_source_code)
|
||||||
return;
|
return;
|
||||||
@ -1203,6 +1214,44 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
|||||||
if (functionname != NULL && *functionname == '\0')
|
if (functionname != NULL && *functionname == '\0')
|
||||||
functionname = NULL;
|
functionname = NULL;
|
||||||
|
|
||||||
|
if (filename
|
||||||
|
&& IS_ABSOLUTE_PATH (filename)
|
||||||
|
&& prefix)
|
||||||
|
{
|
||||||
|
char *path_up;
|
||||||
|
const char *fname = filename;
|
||||||
|
char *path = (char *) alloca (prefix_length + PATH_MAX + 1);
|
||||||
|
|
||||||
|
if (prefix_length)
|
||||||
|
memcpy (path, prefix, prefix_length);
|
||||||
|
path_up = path + prefix_length;
|
||||||
|
|
||||||
|
/* Build relocated filename, stripping off leading directories
|
||||||
|
from the initial filename if requested. */
|
||||||
|
if (prefix_strip > 0)
|
||||||
|
{
|
||||||
|
int level = 0;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
/* Skip selected directory levels. */
|
||||||
|
for (s = fname + 1; *s != '\0' && level < prefix_strip; s++)
|
||||||
|
if (IS_DIR_SEPARATOR(*s))
|
||||||
|
{
|
||||||
|
fname = s;
|
||||||
|
level++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update complete filename. */
|
||||||
|
strncpy (path_up, fname, PATH_MAX);
|
||||||
|
path_up[PATH_MAX] = '\0';
|
||||||
|
|
||||||
|
filename = path;
|
||||||
|
reloc = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reloc = FALSE;
|
||||||
|
|
||||||
if (with_line_numbers)
|
if (with_line_numbers)
|
||||||
{
|
{
|
||||||
if (functionname != NULL
|
if (functionname != NULL
|
||||||
@ -1226,7 +1275,11 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset)
|
|||||||
p = *pp;
|
p = *pp;
|
||||||
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
if (reloc)
|
||||||
|
filename = xstrdup (filename);
|
||||||
p = update_source_path (filename);
|
p = update_source_path (filename);
|
||||||
|
}
|
||||||
|
|
||||||
if (p != NULL && line != p->last_line)
|
if (p != NULL && line != p->last_line)
|
||||||
{
|
{
|
||||||
@ -3161,6 +3214,18 @@ main (int argc, char **argv)
|
|||||||
if ((start_address != (bfd_vma) -1) && stop_address <= start_address)
|
if ((start_address != (bfd_vma) -1) && stop_address <= start_address)
|
||||||
fatal (_("error: the stop address should be after the start address"));
|
fatal (_("error: the stop address should be after the start address"));
|
||||||
break;
|
break;
|
||||||
|
case OPTION_PREFIX:
|
||||||
|
prefix = optarg;
|
||||||
|
prefix_length = strlen (prefix);
|
||||||
|
/* Remove an unnecessary trailing '/' */
|
||||||
|
while (IS_DIR_SEPARATOR (prefix[prefix_length - 1]))
|
||||||
|
prefix_length--;
|
||||||
|
break;
|
||||||
|
case OPTION_PREFIX_STRIP:
|
||||||
|
prefix_strip = atoi (optarg);
|
||||||
|
if (prefix_strip < 0)
|
||||||
|
fatal (_("error: prefix strip must be non-negative"));
|
||||||
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
if (strcmp (optarg, "B") == 0)
|
if (strcmp (optarg, "B") == 0)
|
||||||
endian = BFD_ENDIAN_BIG;
|
endian = BFD_ENDIAN_BIG;
|
||||||
|
@ -50,25 +50,6 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For PATH_MAX. */
|
|
||||||
#ifdef HAVE_LIMITS_H
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
|
||||||
/* For MAXPATHLEN. */
|
|
||||||
# ifdef HAVE_SYS_PARAM_H
|
|
||||||
# include <sys/param.h>
|
|
||||||
# endif
|
|
||||||
# ifndef PATH_MAX
|
|
||||||
# ifdef MAXPATHLEN
|
|
||||||
# define PATH_MAX MAXPATHLEN
|
|
||||||
# else
|
|
||||||
# define PATH_MAX 1024
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __GNUC__ >= 2
|
#if __GNUC__ >= 2
|
||||||
/* Define BFD64 here, even if our default architecture is 32 bit ELF
|
/* Define BFD64 here, even if our default architecture is 32 bit ELF
|
||||||
as this will allow us to read in and parse 64bit and 32bit ELF files.
|
as this will allow us to read in and parse 64bit and 32bit ELF files.
|
||||||
|
@ -174,4 +174,23 @@ void *alloca ();
|
|||||||
/* Used by ar.c and objcopy.c. */
|
/* Used by ar.c and objcopy.c. */
|
||||||
#define BUFSIZE 8192
|
#define BUFSIZE 8192
|
||||||
|
|
||||||
|
/* For PATH_MAX. */
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PATH_MAX
|
||||||
|
/* For MAXPATHLEN. */
|
||||||
|
# ifdef HAVE_SYS_PARAM_H
|
||||||
|
# include <sys/param.h>
|
||||||
|
# endif
|
||||||
|
# ifndef PATH_MAX
|
||||||
|
# ifdef MAXPATHLEN
|
||||||
|
# define PATH_MAX MAXPATHLEN
|
||||||
|
# else
|
||||||
|
# define PATH_MAX 1024
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _BIN_SYSDEP_H */
|
#endif /* _BIN_SYSDEP_H */
|
||||||
|
Reference in New Issue
Block a user