This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH]: Add format attributes and fix exposed bugs
- From: Ian Lance Taylor <ian at airs dot com>
- To: "Kaveh R. Ghazi" <ghazi at caipclassic dot rutgers dot edu>
- Cc: binutils at sourceware dot org
- Date: 20 Jun 2005 19:34:56 -0400
- Subject: Re: [PATCH]: Add format attributes and fix exposed bugs
- References: <200506161443.j5GEhAGa016852@caipclassic.rutgers.edu>
"Kaveh R. Ghazi" <ghazi@caipclassic.rutgers.edu> writes:
> @@ -2353,7 +2353,7 @@ elf_xtensa_relocate_section (bfd *output
> error_message = vsprint_msg (error_message, ": %s",
> strlen (name) + 2, name);
> else
> - error_message = vsprint_msg (error_message, ": (%s+0x%x)",
> + error_message = vsprint_msg (error_message, ": (%s+0x%lx)",
> strlen (name) + 22,
> name, rel->r_addend);
Note that rel->r_addend has type bfd_vma, and thus neither %x nor %lx
is correct. Correctness requires using bfd_sprintf_vma, or, simpler,
casting the argument to vsprint_msg. Casting is always safe because
in the context of an Xtensa ELF file, the r_addend value has only 32
significant bits.
> @@ -237,11 +237,11 @@ print_insn_ia64 (bfd_vma memaddr, struct
> if (str)
> (*info->fprintf_func) (info->stream, "%s", str);
> else if (odesc->flags & IA64_OPND_FLAG_DECIMAL_SIGNED)
> - (*info->fprintf_func) (info->stream, "%lld", value);
> + (*info->fprintf_func) (info->stream, "%lld", (long long) value);
> else if (odesc->flags & IA64_OPND_FLAG_DECIMAL_UNSIGNED)
> - (*info->fprintf_func) (info->stream, "%llu", value);
> + (*info->fprintf_func) (info->stream, "%llu", (long long) value);
> else
> - (*info->fprintf_func) (info->stream, "0x%llx", value);
> + (*info->fprintf_func) (info->stream, "0x%llx", (long long) value);
> break;
>
> case IA64_OPND_CLASS_REL:
I'm not convinced that it is OK to use 'long long' here. Maybe all
ia64 compilers support long long, though.
In general, the patch looks good, although I didn't look at every
single case.
Ian