RFC: Collecting together binary file attributes into a single file.
Joseph S. Myers
joseph@codesourcery.com
Thu Sep 29 15:33:00 GMT 2011
On Thu, 29 Sep 2011, Nick Clifton wrote:
> Hi Richard,
>
> > I don't think it's a good idea to have the attributes of
> > every CPU we support in a single file. That's going to
> > get unmaintainable very quickly.
>
> Really - why ?
>
> These attributes are mostly static. Some new ones might be added from time to
> time, but baring the introduction of new ports I do not see any other changes
> that re likely to happen.
Among other things, it's quite possible that two targets will have names
(defined in their ABIs) that conflict. And the patch appears to be
duplicating the C6X definitions (also present in tic6x-attrs.h for use in
places that want to build an array as well as those just defining an enum)
which is hardly desirable.
If you want a shared header *for ARM EABI attributes*, defining a header
restricted just to the required definitions (and making sure everything
relevant uses it) seems reasonable.
Now, all the definitions get included at once in readelf.c, so any
conflicts would be visible there, but really I don't think that's a good
design. Rather than all those hardcoded switch statements I think it
would be better to have e.g. readelf-arm.c that defines the ARM-specific
functions and data (with readelf.c looking up function pointers in a
structure exported by each architecture's file and identified by the
e_machine value rather than using a switch statement in each place). You
might then have just one array that contains pointers to all the target
structures.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Binutils
mailing list