This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Adding visualization of jumps to objdump's disassembly output
- From: Tom Tromey <tom at tromey dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sourceware dot org, tstroege at gmx dot de
- Date: Wed, 08 Jan 2020 12:34:05 -0700
- Subject: Re: RFC: Adding visualization of jumps to objdump's disassembly output
- References: <87o8vfruyf.fsf@redhat.com>
>>>>> "Nick" == Nick Clifton <nickc@redhat.com> writes:
Nick> I am posting the patch here as I would very much like to see it added
Nick> before the 2.34 branch is cut, but I wanted more pairs of eyes than
Nick> just mine to have a look over it. So - does anyone have any concerns
Nick> or issues with the patch ?
Is there any way to put this into libopcodes or BFD, rather than binutils?
I think it would make a nice addition to gdb's "disassemble" command.
Nick> +#if 1
Nick> +/* Very simple hash function to map any address to an 8 bit value. The main
Nick> + purpose of this is to generate all colors in the case the input addresses
Nick> + are all even or divisible by 4 or 8 or follow some other pattern. */
Nick> +
Nick> +static uint8_t
Nick> +hash_address (bfd_vma address)
Nick> +{
Nick> + bfd_vma result = address;
Nick> +
Nick> + result += result << 5;
Nick> + result ^= result >> 7;
Nick> +
Nick> + return result % 256;
Nick> +}
Nick> +#else
Nick> +/* This code was taken from:
Nick> + https://en.wikipedia.org/wiki/Jenkins_hash_function
Nick> + TODO: Does this work with the GPL? */
I think this should be resolved before checking it in. If it's just a
generic hash function you need, there's one in hashtab.c though.
thanks,
Tom