public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Gunther Nikl <gnikl@justmail.de>
To: Hans-Peter Nilsson <hp@bitrange.com>
Cc: binutils <binutils@sourceware.org>
Subject: Re: [PATCH] bfd: tweak SET_ARCH_MACH of aout-cris.c
Date: Wed, 13 May 2020 20:43:50 +0200	[thread overview]
Message-ID: <20200513204350.00002fc0@justmail.de> (raw)
In-Reply-To: <alpine.BSF.2.20.16.2005081751230.46137@arjuna.pair.com>

Hans-Peter Nilsson <hp@bitrange.com> wrote:
> 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.

Don't worry. I know very well that this is old code. When reading the
submission mails for the CRIS port you wrote that the port was from the
1992 time frame. Thats pretty old by now :)

> > > 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.

Thank you for these insights. I agree that target specific settings
should be in a target file. In this case I would probably have chosen
the easy way and modified the generic code since it already had such
target dependent code. What I have learned while studying the sources:
most of the time fixes/improvements are done to generic code which all
users of tht code get for free. A copy in another file is easily
overlooked.

> 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.

Regards,
Gunther

      reply	other threads:[~2020-05-13 18:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 20:12 Gunther Nikl
2020-05-04 15:08 ` Nick Clifton
2020-05-04 18:55   ` Gunther Nikl
2020-05-05  9:30     ` Nick Clifton
2020-05-06  1:31   ` Hans-Peter Nilsson
2020-05-06 18:10     ` Gunther Nikl
2020-05-06 18:50       ` Hans-Peter Nilsson
2020-05-07 19:32         ` Gunther Nikl
2020-05-07 19:52           ` Hans-Peter Nilsson
2020-05-07 20:05             ` Gunther Nikl
2020-05-07 21:01               ` Hans-Peter Nilsson
2020-05-08 22:18                 ` Hans-Peter Nilsson
2020-05-13 18:43                   ` Gunther Nikl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200513204350.00002fc0@justmail.de \
    --to=gnikl@justmail.de \
    --cc=binutils@sourceware.org \
    --cc=hp@bitrange.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).