strange OS dependent behavior of bfd_get_flavour()

Peng Yu pengyu.ut@gmail.com
Fri Apr 30 15:18:43 GMT 2021


> Because you didn't call bfd_check_format.

Why is it necessary? The format information can not be derived from
the input file? If the input has all the info, why not just let
bfd_openr() to retrieve what the format is. This requirement seems to
be counterintuitive. Although it can be said as a "feature", this
feature is not very nice. If I were designing it, I wouldn't design it
in a way so that bfd_check_format() must be called first.

https://www.quora.com/What-is-the-difference-between-a-bug-and-a-feature

If bfd_check_format() is always required to be called before
bfd_get_flavour(), then there should be an error returned if
bfd_check_format() is not called before bfd_get_flavour().

Nevertheless, something is undocumented. This makes libbfd clumsy to use.

-- 
Regards,
Peng


More information about the Binutils mailing list