[PATCH] bfd: tweak SET_ARCH_MACH of aout-cris.c

Hans-Peter Nilsson hp@bitrange.com
Fri May 8 22:18:16 GMT 2020


On Thu, 7 May 2020, Hans-Peter Nilsson wrote:
> On Thu, 7 May 2020, Gunther Nikl wrote:
>
> > Hans-Peter Nilsson <hp@bitrange.com>:
> > >
> > > On Thu, 7 May 2020, Gunther Nikl wrote:
> > > >
> > > > A last question if you don't mind: there is a comment in set_sizes
> > > > in front of line setting the relocation entry size. Since you had
> > > > to add a case of bfd_arch_cris to "NAME (aout, machine_type)"
> > > > adding such a case to "NAME (aout, set_arch_mach)" to use the
> > > > generic set_sizes does not sound that bad. At least for me the
> > > > machine_type function is also about target-specific things.
> > >
> > > I didn't see a question there.  Were the comments unclear?
> > > I think I understand them.
> >
> > The question is: why is adding the bfd_arch_cris case in "NAME (aout,
> > machine_type)" ok,
>
> Where is that?  (If you mistype something, I likely cannot
> autocorrect.)

Oh, in aoutx.h.  Please excuse my blindness, don't forget it's
about 20-25 years since I browsed the a.out parts.

> > but extending the reloc case in "NAME (aout,
> > set_arch_mach)" is not?

(Also in aoutx.h)

I see.  One is a designated place where you're *expected* to add
a blurb for your machine, the other is a random place not every
port has to edit and where I found a cleaner way than to IMHO
uglify generic code with another target special-case.  Sure, a
hair-thin difference, but still.  About the same reason you
don't #ifdef AOUT_CRIS all over generic code just because you
need something to be different for your port, but instead either
use an existing mechanism or add a mechanism, hook, or ehatever
you call it, and use that.  That said, both places should
perhaps be better replaced by something that was easier on your
eyes.

That answer will probably go for most other "why did you do X
back then" cases.  Also, sometimes the code could have looked
different back then; some hook that should have been used didn't
exist at the time or whatever.

brgds, H-P


More information about the Binutils mailing list