[Patch]: Improve readelf for ia64/OpenVMS

Nick Clifton nickc@redhat.com
Fri Jun 11 08:36:00 GMT 2010


Hi Tristan,

> This patch makes readelf dumps most of them if the object file is an IA64/OpenVMS file.

A couple of minor niggles:

> -		  error (_("no .dynamic section in the dynamic segment\n"));
> +                  /* A corresponding .dynamic section is expected but on
> +                     IA-64/OpenVMS.  */
> +                  if (!is_ia64_vms ())
> +                    error (_("no .dynamic section in the dynamic segment\n"));

I think that the comment here is incomplete.  Maybe something like:

   /* A corresponding .dynamic section is expected, but
      on IA-64/OpenVMS it is OK for it to be missing.  */



> +  printf (_("\nImage fixups for needed library #%d: %s - ident: %lx\n"),
> +	  (int) fixup->fixup_needed,
> +          fixup->needed < strtab_sz ? strtab + fixup->needed : "???",
> +          (long) fixup->needed_ident);

If a value is out of range then you should let the reader know its exact 
numerical amount as this might help debugging.  Ie I would suggest 
recoding the above as something like this:

   const char * lib_name;

   if (fixup->needed < strtab_sz)
     lib_name = strtab + fixup->needed;
   else
     {
       warn ("corrupt library name index of %lx found in fixup entry",
             fixup->needed);
       lib_name = "???";
     }

   printf (_("\nImage fixups for needed library #%d: %s - ident: %lx\n"),
	  (int) fixup->fixup_needed, lib_name,
           (long) fixup->needed_ident);

Cheers
   Nick




More information about the Binutils mailing list