This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Small code refactoring
- From: Cary Coutant <ccoutant at google dot com>
- To: Rafael Espindola <espindola at google dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 12 Feb 2009 15:47:19 -0800
- Subject: Re: [gold][patch] Small code refactoring
- References: <38a0d8450902120336p346b73a7y26a966cdf1eb9056@mail.gmail.com>
> I was playing with gold and found a bit of code duplication. The
> attached patch removes it. I tested this with "make check" in the gold
> directory. Is there some other test I should do?
In general, it's a good idea to test both 32-bit and 64-bit builds,
but this change is small enough that one "make check" is sufficient.
I've occasionally also found bugs only with -g or only with -O, so I
usually test both of those as well. (I even found one that only showed
up with -O2 or -O3, but I'm not so rigorous as to test different opt
levels separately every time.)
> * archive.cc (Archive::get_elf_object_for_member): Update for
> new make_elf_object signature.
> * object.cc (make_elf_object): Rename to make_elf_object2. Make it
> static.
> (make_elf_object): New.
> * object.h (make_elf_object): Update signature.
> * readsyms.cc (Read_symbols::do_read_symbols): Update for
> new make_elf_object signature.
> * testsuite/binary_unittest.cc (Sized_binary_test): Update for
> new make_elf_object signature.
> * testsuite/object_unittest.cc (Sized_object_test): Update for
> new make_elf_object signature.
This looks reasonable to me, but I'm not a big fan of the name
"make_elf_object2". How about calling the new one something like
"recognize_and_make_elf_object"? Maybe Ian will have a better
suggestion.
-cary