This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add bfd_target_info function to bfd and unify windres/windmc target information gathering


2009/11/11 Nick Clifton <nickc@redhat.com>:
> Hi Kai,
>
>>> ?+ ? ? const bfd_target * bfd_target_info (const char *target_name, bfd
>>> *abfd,
>>> ?+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int *is_bigendian, int
>>> *underscoring,
>>> ?+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 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.
>
> Cheers
> ?Nick
>
>
>

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.

Cheers,
Kai
-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]