Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2020 18:22:39 +0100
From:      Alexander Richardson <arichardson@freebsd.org>
To:        rgrimes@freebsd.org
Cc:        Warner Losh <imp@bsdimp.com>, src-committers <src-committers@freebsd.org>,  svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r365836 - head/share/mk
Message-ID:  <CA%2BZ_v8reonS-euCGxyAhp1R1N%2BP62gJSjMa-kPJAfamvf%2BGuvQ@mail.gmail.com>
In-Reply-To: <202009171705.08HH5CtE014644@gndrsh.dnsmgr.net>
References:  <CANCZdfqUZRPbbZRsEvVa_rdx0%2BYou9LVihatKZSTTdouaRzKWQ@mail.gmail.com> <202009171705.08HH5CtE014644@gndrsh.dnsmgr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 17 Sep 2020 at 18:05, Rodney W. Grimes
<freebsd@gndrsh.dnsmgr.net> wrote:
>
> > On Thu, Sep 17, 2020 at 9:39 AM Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
> >
> > > Alex Richardson wrote in
> > >  <202009171507.08HF7Qns080555@repo.freebsd.org>:
> > >  |Author: arichardson
> > >  |Date: Thu Sep 17 15:07:25 2020
> > >  |New Revision: 365836
> > >  |URL: https://svnweb.freebsd.org/changeset/base/365836
> > >  |
> > >  |Log:
> > >  |  Stop using lorder and ranlib when building libraries
> > >  |
> > >  |  Use of ranlib or lorder is no longer necessary with current linkers
> > >  |  (probably anything newer than ~1990) and ar's ability to create an
> > > object
> > >  |  index and symbol table in the archive.
> > >  |  Currently the build system uses lorder+tsort to sort the .o files in
> > >  |  dependency order so that a single-pass linker can use them. However,
> > >  |  we can use the -s flag to ar to add an index to the .a file which makes
> > >  |  lorder unnecessary.
> > >  |  Running ar -s is equivalent to running ranlib afterwards, so we can
> > > also
> > >  |  skip the ranlib invocation.
> > >
> > > That ranlib thing yes (for long indeed), but i have vague memories
> > > that the tsort/lorder ordering was also meant to keep the things
> > > which heavily interdepend nearby each other.  (Luckily Linux
> > > always had at least tsort available.)
> > > This no longer matters for all the platforms FreeBSD supports?
> > >
> >
> > tsort has no notion of how dependent the modules are, just an order that
> > allows a single pass through the .a file (otherwise you'd need to list the
> > .a file multiple times on the command line absent ranlib). That's the
> > original purpose of tsort. tsort, lsort, and ranlib all arrived in 7th
> > edition unix on a PDP-11, where size was more important than proximity to
> > locations (modulo overlays, which this doesn't affect at all).
> >
> > There were some issues of long vs short jumps on earlier architectures that
> > this helped (since you could only jump 16MB, for example). However, there
> > were workarounds for this issue on those platforms too. And if you have a
> > program that this does make a difference, then you can still use
> > tsort/lorder. They are still in the system.
> >
> > I doubt you could measure a difference here today. I doubt, honestly, that
> > anybody will notice at all.
>
> The x86 archicture has relative jmps of differning lengths, even in long mode
> there is support for rel8 and rel32.

However, unless you have linker relaxations (e.g. RISC-V) the compiler
has to emit the large size anyway since the linker won't replace a
32-bit immediate with an 8-bit one since that changes all later
offsets.

Alex



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BZ_v8reonS-euCGxyAhp1R1N%2BP62gJSjMa-kPJAfamvf%2BGuvQ>