+2008-01-25 Kai Tietz <kai.tietz@onevision.com>
+
+ * bfd-in.h: Add mingw I64 support.
+ * bfd-in2.h: Regenerated.
+ * bfd.c: (bfd_get_sign_extend_vma): Add pe-x86-64 and pei-x86-64.
+
2008-01-21 Alan Modra <amodra@bigpond.net.au>
PR 4453
/* Main header file for the bfd library -- portable access to object files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Cygnus Support.
#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
#define sprintf_vma(s,x) sprintf (s, "%016llx", x)
#define fprintf_vma(f,x) fprintf (f, "%016llx", x)
#else
+#define sprintf_vma(s,x) sprintf (s, "%016I64x", x)
+#define fprintf_vma(f,x) fprintf (f, "%016I64x", x)
+#endif
+#else
#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
#define fprintf_vma(s,x) \
#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
#define sprintf_vma(s,x) sprintf (s, "%016llx", x)
#define fprintf_vma(f,x) fprintf (f, "%016llx", x)
#else
+#define sprintf_vma(s,x) sprintf (s, "%016I64x", x)
+#define fprintf_vma(f,x) fprintf (f, "%016I64x", x)
+#endif
+#else
#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
#define fprintf_vma(s,x) \
/* Generic BFD library interface and support routines.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Cygnus Support.
if (CONST_STRNEQ (name, "coff-go32")
|| strcmp (name, "pe-i386") == 0
|| strcmp (name, "pei-i386") == 0
+ || strcmp (name, "pe-x86-64") == 0
+ || strcmp (name, "pei-x86-64") == 0
|| strcmp (name, "pe-arm-wince-little") == 0
|| strcmp (name, "pei-arm-wince-little") == 0)
return 1;
+2008-01-25 Kai Tietz <kai.tietz@onevision.com>
+
+ * prdbg.c: Correct formatter style use.
+ * readelf.c: Likewise.
+ * strings.c: Likewise.
+
2008-01-25 Nick Clifton <nickc@redhat.com>
* po/ru.po: Updated Russian translation.
}
static unsigned char *
-read_and_display_attr_value (unsigned long attribute,
- unsigned long form,
+read_and_display_attr_value (unsigned long attribute,
+ unsigned long form,
unsigned char * data,
- unsigned long cu_offset,
- unsigned long pointer_size,
- unsigned long offset_size,
- int dwarf_version,
- debug_info * debug_info_p,
- int do_loc,
- unsigned char * section_start)
+ unsigned long cu_offset,
+ unsigned long pointer_size,
+ unsigned long offset_size,
+ int dwarf_version,
+ debug_info * debug_info_p,
+ int do_loc,
+ struct dwarf_section * section)
{
unsigned long uvalue = 0;
unsigned char *block_start = NULL;
+ unsigned char * orig_data = data;
unsigned int bytes_read;
switch (form)
cu_offset, pointer_size,
offset_size, dwarf_version,
debug_info_p, do_loc,
- section_start);
+ section);
}
switch (form)
case DW_AT_import:
{
- unsigned long abbrev_number;
- abbrev_entry * entry;
-
if (form == DW_FORM_ref1
|| form == DW_FORM_ref2
|| form == DW_FORM_ref4)
uvalue += cu_offset;
- abbrev_number = read_leb128 (section_start + uvalue, NULL, 0);
+ if (uvalue >= section->size)
+ warn (_("Offset %lx used as value for DW_AT_import attribute of DIE at offset %lx is too big.\n"),
+ uvalue, (long int)(orig_data - section->start));
+ else
+ {
+ unsigned long abbrev_number;
+ abbrev_entry * entry;
+
+ abbrev_number = read_leb128 (section->start + uvalue, NULL, 0);
- printf ("[Abbrev Number: %ld", abbrev_number);
- for (entry = first_abbrev; entry != NULL; entry = entry->next)
- if (entry->entry == abbrev_number)
- break;
- if (entry != NULL)
- printf (" (%s)", get_TAG_name (entry->tag));
- printf ("]");
+ printf ("[Abbrev Number: %ld", abbrev_number);
+ for (entry = first_abbrev; entry != NULL; entry = entry->next)
+ if (entry->entry == abbrev_number)
+ break;
+ if (entry != NULL)
+ printf (" (%s)", get_TAG_name (entry->tag));
+ printf ("]");
+ }
}
break;
}
static unsigned char *
-read_and_display_attr (unsigned long attribute,
- unsigned long form,
+read_and_display_attr (unsigned long attribute,
+ unsigned long form,
unsigned char * data,
- unsigned long cu_offset,
- unsigned long pointer_size,
- unsigned long offset_size,
- int dwarf_version,
- debug_info * debug_info_p,
- int do_loc,
- unsigned char * section_start)
+ unsigned long cu_offset,
+ unsigned long pointer_size,
+ unsigned long offset_size,
+ int dwarf_version,
+ debug_info * debug_info_p,
+ int do_loc,
+ struct dwarf_section * section)
{
if (!do_loc)
printf (" %-18s:", get_AT_name (attribute));
data = read_and_display_attr_value (attribute, form, data, cu_offset,
pointer_size, offset_size,
dwarf_version, debug_info_p,
- do_loc, section_start);
+ do_loc, section);
if (!do_loc)
printf ("\n");
return data;
anything to the user. */
static int
-process_debug_info (struct dwarf_section *section, void *file,
+process_debug_info (struct dwarf_section *section,
+ void *file,
int do_loc)
{
unsigned char *start = section->start;
offset_size,
compunit.cu_version,
debug_information + unit,
- do_loc, section->start);
+ do_loc, section);
}
if (entry->children)
return 1;
}
+static debug_info *
+find_debug_info_for_offset (unsigned long offset)
+{
+ unsigned int i;
+
+ if (num_debug_info_entries == DEBUG_INFO_UNAVAILABLE)
+ return NULL;
+
+ for (i = 0; i < num_debug_info_entries; i++)
+ if (debug_information[i].cu_offset == offset)
+ return debug_information + i;
+
+ return NULL;
+}
+
static int
display_debug_pubnames (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED)
unsigned char *start = section->start;
unsigned char *end = start + section->size;
+ /* It does not matter if this load fails,
+ we test for that later on. */
+ load_debug_info (file);
+
printf (_("Contents of the %s section:\n\n"), section->name);
while (start < end)
pubnames.pn_version = byte_get (data, 2);
data += 2;
+
pubnames.pn_offset = byte_get (data, offset_size);
data += offset_size;
+
+ if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
+ && num_debug_info_entries > 0
+ && find_debug_info_for_offset (pubnames.pn_offset) == NULL)
+ warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
+ pubnames.pn_offset, section->name);
+
pubnames.pn_size = byte_get (data, offset_size);
data += offset_size;
pubnames.pn_length);
printf (_(" Version: %d\n"),
pubnames.pn_version);
- printf (_(" Offset into .debug_info section: %ld\n"),
+ printf (_(" Offset into .debug_info section: 0x%lx\n"),
pubnames.pn_offset);
printf (_(" Size of area in .debug_info section: %ld\n"),
pubnames.pn_size);
printf (_("The section %s contains:\n\n"), section->name);
+ /* It does not matter if this load fails,
+ we test for that later on. */
+ load_debug_info (file);
+
while (start < end)
{
unsigned char *hdrptr;
arange.ar_info_offset = byte_get (hdrptr, offset_size);
hdrptr += offset_size;
+ if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
+ && num_debug_info_entries > 0
+ && find_debug_info_for_offset (arange.ar_info_offset) == NULL)
+ warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
+ arange.ar_info_offset, section->name);
+
arange.ar_pointer_size = byte_get (hdrptr, 1);
hdrptr += 1;
printf (_(" Length: %ld\n"), arange.ar_length);
printf (_(" Version: %d\n"), arange.ar_version);
- printf (_(" Offset into .debug_info: %lx\n"), arange.ar_info_offset);
+ printf (_(" Offset into .debug_info: 0x%lx\n"), arange.ar_info_offset);
printf (_(" Pointer Size: %d\n"), arange.ar_pointer_size);
printf (_(" Segment Size: %d\n"), arange.ar_segment_size);
#if BFD_HOST_64BIT_LONG_LONG
else if (sizeof (vma) <= sizeof (unsigned long long))
{
+#ifndef __MSVCRT__
if (hexp)
sprintf (buf, "0x%llx", (unsigned long long) vma);
else if (unsignedp)
sprintf (buf, "%llu", (unsigned long long) vma);
else
sprintf (buf, "%lld", (long long) vma);
+#else
+ if (hexp)
+ sprintf (buf, "0x%I64x", (unsigned long long) vma);
+ else if (unsignedp)
+ sprintf (buf, "%I64u", (unsigned long long) vma);
+ else
+ sprintf (buf, "%I64d", (long long) vma);
+#endif
}
#endif
else
{
struct pr_handle *info = (struct pr_handle *) p;
- fprintf (stderr, "New compilation unit: %s\n", filename);
-
free (info->filename);
/* Should it be relative? best way to do it here?. */
info->filename = strdup (filename);
/* readelf.c -- display contents of an ELF format file
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2008 Free Software Foundation, Inc.
Originally developed by Eric Youngdale <eric@andante.jic.com>
Modifications by Nick Clifton <nickc@redhat.com>
#if BFD_HOST_64BIT_LONG
return nc + printf ("%lx", vma);
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
return nc + printf ("%llx", vma);
+#else
+ return nc + printf ("%I64x", vma);
+#endif
#else
return nc + print_hex_vma (vma);
#endif
#if BFD_HOST_64BIT_LONG
return printf ("%ld", vma);
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
return printf ("%lld", vma);
+#else
+ return printf ("%I64d", vma);
+#endif
#else
return print_dec_vma (vma, 1);
#endif
else
return printf ("%#lx", vma);
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
if (vma <= 99999)
return printf ("%5lld", vma);
else
return printf ("%#llx", vma);
+#else
+ if (vma <= 99999)
+ return printf ("%5I64d", vma);
+ else
+ return printf ("%#I64x", vma);
+#endif
#else
if (vma <= 99999)
return printf ("%5ld", _bfd_int64_low (vma));
#if BFD_HOST_64BIT_LONG
return printf ("%lu", vma);
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
return printf ("%llu", vma);
+#else
+ return printf ("%I64u", vma);
+#endif
#else
return print_dec_vma (vma, 0);
#endif
: "%12.12lx %12.12lx ",
offset, info);
#elif BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
printf (do_wide
? "%16.16llx %16.16llx "
: "%12.12llx %12.12llx ",
offset, info);
+#else
+ printf (do_wide
+ ? "%16.16I64x %16.16I64x "
+ : "%12.12I64x %12.12I64x ",
+ offset, info);
+#endif
#else
printf (do_wide
? "%8.8lx%8.8lx %8.8lx%8.8lx "
if (data < end)
{
+#ifndef __MSVCRT__
printf (" [%6tx] %s\n", data - start, data);
+#else
+ printf (" [%6Ix] %s\n", (size_t) (data - start), data);
+#endif
data += strlen (data);
some_strings_shown = TRUE;
}
/* strings -- print the strings of printable characters in files
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
case 8:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7llo ", (unsigned long long) start);
+ {
+#ifndef __MSVCRT__
+ printf ("%7llo ", (unsigned long long) start);
+#else
+ printf ("%7I64o ", (unsigned long long) start);
+#endif
+ }
else
#elif !BFD_HOST_64BIT_LONG
if (start != (unsigned long) start)
case 10:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7lld ", (unsigned long long) start);
+ {
+#ifndef __MSVCRT__
+ printf ("%7lld ", (unsigned long long) start);
+#else
+ printf ("%7I64d ", (unsigned long long) start);
+#endif
+ }
else
#elif !BFD_HOST_64BIT_LONG
if (start != (unsigned long) start)
case 16:
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
if (sizeof (start) > sizeof (long))
- printf ("%7llx ", (unsigned long long) start);
+ {
+#ifndef __MSVCRT__
+ printf ("%7llx ", (unsigned long long) start);
+#else
+ printf ("%7I64x ", (unsigned long long) start);
+#endif
+ }
else
#elif !BFD_HOST_64BIT_LONG
if (start != (unsigned long) start)
+2008-01-25 Kai Tietz <kai.tietz@onevision.com>
+
+ * read.c: (emit_expr): Correct for mingw use of printf size
+ specifier.
+
2008-01-24 Bob Wilson <bob.wilson@acm.org>
* doc/c-xtensa.texi (Xtensa Syntax): Clarify handling of opcodes that
|| (get & hibit) == 0))
{ /* Leading bits contain both 0s & 1s. */
#if defined (BFD64) && BFD_HOST_64BIT_LONG_LONG
+#ifndef __MSVCRT__
as_warn (_("value 0x%llx truncated to 0x%llx"),
(unsigned long long) get, (unsigned long long) use);
+#else
+ as_warn (_("value 0x%I64x truncated to 0x%I64x"),
+ (unsigned long long) get, (unsigned long long) use);
+#endif
#else
as_warn (_("value 0x%lx truncated to 0x%lx"),
(unsigned long) get, (unsigned long) use);