All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Joel Stanley <joel@jms.id.au>
Cc: openrisc@lists.librecores.org, nicolas@debian.org
Subject: Re: Link failure with Debian toolchain
Date: Sat, 28 May 2022 07:38:06 +0900	[thread overview]
Message-ID: <YpFSzpl5fdq7O3pk@antec> (raw)
In-Reply-To: <CACPK8XcBRtd+RFhXaR-B3wbeM1gsmCW3hgRp_uwS0-g-oCWniw@mail.gmail.com>

Hi Joel,

On Thu, May 26, 2022 at 11:26:45PM +0000, Joel Stanley wrote:
> Hi Stafford,
> 
> I'm not sure if you were aware, but Debian now has a or1k cross compile:
> 
> $ apt policy gcc-or1k-elf
> gcc-or1k-elf:
>   Installed: 12.1.0-2+1.0.2
> $ apt policy binutils-or1k-elf
> binutils-or1k-elf:
>   Installed: 2.38-2+1.0.3

I didn't know about this. but it looks right.

> I've used it to build a mork1x litex soc so I think it works in some
> situations at least.
> 
> I was trying to build your latest Linux kernel changes, applied on top
> of v5.18, however the bug reproduces with plain v5.18.
> 
> $ CROSS_COMPILE=or1k-elf- ARCH=openrisc make O=or1k or1klitex_defconfig
> $ CROSS_COMPILE=or1k-elf- ARCH=openrisc make O=or1k -j8

This looks good too. What is the meaning of O=or1k? I never have used that
before.

> This fails at the link step:
> 
>   LD      vmlinux.o
> + or1k-elf-ld -r -o vmlinux.o --whole-archive
> arch/openrisc/kernel/head.o init/built-in.a usr/built-in.a
> arch/openrisc/built-in.a kernel/built-in.a certs/built-in.a
> mm/built-in.a fs/built-in.a ipc/built-in.a security/built-in.a
> crypto/built-in.a block/built-in.a lib/built-in.a drivers/built-in.a
> sound/built-in.a net/built-in.a virt/built-in.a --no-whole-archive
> --start-group lib/lib.a /usr/lib/gcc/or1k-elf/12/libgcc.a --end-group
> or1k-elf-ld: /usr/lib/gcc/or1k-elf/12/libgcc.a: error adding symbols:
> archive has no index; run ranlib to add one
> 
> The libgcc.a appears to have the expected files inside it.
> 
> I tried running ar -a libgcc.a, and that changed the error to look like this:
> 
> or1k-elf-ld: init/main.o: in function `do_one_initcall':
> main.c:(.init.text+0x12ec): undefined reference to `__muldi3'
> main.c:(.init.text+0x12ec): relocation truncated to fit:
> R_OR1K_INSN_REL_26 against undefined symbol `__muldi3'
> 
> With a lot more undefined reference errors for __muldi3, __ashldi3,
> and __lshrdi3.

This seems to mean that the builtins for 64-bit ops are not being found. So
something is wrong with libgcc symbols.  Maybe something strange with the
multilib args used when building the toolchain.

I'll have a look at it. It would be nice if I can used this toolchain for my CI.

-Stafford
> I'm not sure if this is a toolchain error or a kernel one. The kernel
> appears to be doing the right thing.
> 
> I've cc'd Nicholas who is the Debian maintainer for the package in
> case he has any ideas.
> 
> Cheers,
> 
> Joel

  reply	other threads:[~2022-05-27 22:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26 23:26 Link failure with Debian toolchain Joel Stanley
2022-05-27 22:38 ` Stafford Horne [this message]
2022-05-28  9:51   ` Nicolas Boulenguez
2022-05-30  8:27     ` Joel Stanley
2022-06-02  4:52       ` Joel Stanley
2022-06-02 20:01         ` Stafford Horne
2022-05-30  7:59   ` Joel Stanley

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=YpFSzpl5fdq7O3pk@antec \
    --to=shorne@gmail.com \
    --cc=joel@jms.id.au \
    --cc=nicolas@debian.org \
    --cc=openrisc@lists.librecores.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.