This is the mail archive of the
mailing list for the binutils project.
Re: [patch] Add bfd_target_info function to bfd and unify windres/windmc target information gathering
2009/11/11 Nick Clifton <email@example.com>:
> Hi Kai,
>>> ?+ ? ? const bfd_target * bfd_target_info (const char *target_name, bfd
>>> ?+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int *is_bigendian, int
>>> ?+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const char **def_target_arch);
>>> Assuming that you agree with my suggestion above then I would consider
>>> renaming this function to something like bfd_get_target_info() and
>>> have it return the default target architecture.
>> Hmm, exactly this I wanted to avoid. The architecture detection is a
>> bit costy, so I wanted to have this check optional.
> But the other information returned by this function (endianness, prefix
> character) is easily extracted from the target vector. ?There is no need to
> have a special function to compute it. ?So the real value of this new
> function is costly architecture detection.
Well, this was the reason, why I put the target_name check within this
function. I wanted to avoid multiple patterns of the form
bfd_target *t = bfd_find_target (my_target, NULL);
if (!t) error out
my_store_symbol_prefix = t->symbol_prefix;
As most of the bfd helper macros here depend on an existing bfd *. But
a bfd * is at some points not present (eg windres tool and windmc), so
a function to gather those information by a common function is better
then re-implementing again and again.
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination