linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Fāng-ruì Sòng" <maskray@google.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: linux-riscv@lists.infradead.org,
	Albert Ou <aou@eecs.berkeley.edu>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: Upstream binutils commit a87e1817a435dab6c6c042f9306497c9f13d4236 breaks building the RISC-V vDSO
Date: Tue, 16 Jun 2020 20:34:04 -0700	[thread overview]
Message-ID: <CAFP8O3Kf54SYBKMTQDhJ+UwTate7KDszSGG1MwPJc0kTFhqkWw@mail.gmail.com> (raw)
In-Reply-To: <20200617024228.GA2330477@ubuntu-n2-xlarge-x86>

On Tue, Jun 16, 2020 at 7:42 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Hi Fangrui,
>
> On Fri, Jun 12, 2020 at 08:41:56AM -0700, Fāng-ruì Sòng wrote:
> > On Fri, Jun 12, 2020 at 1:43 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > Hi all,
> > >
> > > Upstream binutils commit a87e1817a4 ("Have the linker fail if any attempt
> > > to link in an executable is made.") causes the RISC-V vDSO to fail to
> > > build properly (it is fixing this bug report:
> > > https://sourceware.org/bugzilla/show_bug.cgi?id=26047):
> > >
> > > $ make -skj"$(nproc)" ARCH=riscv CROSS_COMPILE=riscv64-linux- O=out/riscv distclean defconfig arch/riscv/kernel/vdso/
> > > riscv64-linux-ld: cannot use executable file 'arch/riscv/kernel/vdso/vdso-dummy.o' as input to a link
> > >
> > > I do not really understand what the whole point of the vDSO rule is but
> > > it seems like it should be fixed due to this change. Additionally, the
> > > kernel has generally been getting rid of using $(CC) as a linker,
> > > instead preferring to use $(LD) directly; it would be nice if the RISC-V
> > > vDSO's Makefile could be rewritten to do that.
> > >
> > > See
> > >
> > > fe00e50b2db8 ("ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO")
> > > 691efbedc60d ("arm64: vdso: use $(LD) instead of $(CC) to link VDSO")
> > > 2ff906994b6c ("MIPS: VDSO: Use $(LD) instead of $(CC) to link VDSO")
> > >
> > > for more examples of that. I would take a stab at it myself but this
> > > does not seem like a straight conversion due to the way the VDSOLD rule
> > > is set up.
> > >
> > > Cheers,
> > > Nathan
> >
> > I suggested that GNU ld from 2.35 onwards disallows accepting ET_EXEC
> > as input (https://sourceware.org/bugzilla/show_bug.cgi?id=26047 ). The
> > error message is from the patch.
> > Taking ET_EXEC files as input are usually errors.
> >
> > If we do need to take ET_EXEC as input, we can change e_type in the
> > ELF header to make the file an ET_REL
> >
> > printf '\1' | dd of=${2} conv=notrunc bs=1 seek=16 status=none
> > (See http://git.kernel.org/linus/90ceddcb495008ac8ba7a3dce297841efcd7d584 )
>
> Is there a convenient way to do this in a Makefile? The relevant rule
> is:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/kernel/vdso/Makefile#n63
>
> I am not sure if that is strictly necessary, hence the initial email.
>
> Cheers,
> Nathan

If I understand correctly,

$(obj)/vdso-dummy.o:
...
        printf '\1' | dd of=$@ conv=notrunc bs=1 seek=16 status=none

should fix the issue. The change can be made along with the migration
from $(CC) to $(LD). Hope an arch/riscv maintainer can do this.


  reply	other threads:[~2020-06-17  3:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  8:43 Upstream binutils commit a87e1817a435dab6c6c042f9306497c9f13d4236 breaks building the RISC-V vDSO Nathan Chancellor
2020-06-12 15:41 ` Fāng-ruì Sòng
2020-06-17  2:42   ` Nathan Chancellor
2020-06-17  3:34     ` Fāng-ruì Sòng [this message]
2020-07-16  4:09       ` Nathan Chancellor
2020-07-22 21:50       ` Maciej W. Rozycki

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=CAFP8O3Kf54SYBKMTQDhJ+UwTate7KDszSGG1MwPJc0kTFhqkWw@mail.gmail.com \
    --to=maskray@google.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-riscv@lists.infradead.org \
    --cc=natechancellor@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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 NNTP newsgroup(s).