public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-kbuild@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH] s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36
Date: Thu, 5 Jan 2023 08:57:27 +0100	[thread overview]
Message-ID: <Y7aC50LZK1t8Eysg@osiris> (raw)
In-Reply-To: <20230105031306.1455409-1-masahiroy@kernel.org>

On Thu, Jan 05, 2023 at 12:13:06PM +0900, Masahiro Yamada wrote:
> Nathan Chancellor reports that the s390 vmlinux fails to link with
> GNU ld < 2.36 since commit 99cb0d917ffa ("arch: fix broken BuildID
> for arm64 and riscv").
> 
> It happens for defconfig, or more specifically for CONFIG_EXPOLINE=y.
> 
>   $ s390x-linux-gnu-ld --version | head -n1
>   GNU ld (GNU Binutils for Debian) 2.35.2
>   $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- allnoconfig
>   $ ./scripts/config -e CONFIG_EXPOLINE
>   $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- olddefconfig
>   $ make -s ARCH=s390 CROSS_COMPILE=s390x-linux-gnu-
>   `.exit.text' referenced in section `.s390_return_reg' of drivers/base/dd.o: defined in discarded section `.exit.text' of drivers/base/dd.o
>   make[1]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
>   make: *** [Makefile:1252: vmlinux] Error 2
> 
> arch/s390/kernel/vmlinux.lds.S wants to keep EXIT_TEXT:
> 
>         .exit.text : {
>                 EXIT_TEXT
>         }
> 
> But, at the same time, EXIT_TEXT is thrown away by DISCARD because
> s390 does not define RUNTIME_DISCARD_EXIT.
> 
> I still do not understand why the latter wins after 99cb0d917ffa,
> but defining RUNTIME_DISCARD_EXIT seems correct because the comment
> line in arch/s390/kernel/vmlinux.lds.S says:
> 
>         /*
>          * .exit.text is discarded at runtime, not link time,
>          * to deal with references from __bug_table
>          */
> 
> Nathan also found that binutils commit 21401fc7bf67 ("Duplicate output
> sections in scripts") cured this issue, so we cannot reproduce it with
> binutils 2.36+, but it is better to not rely on it.
> 
> Fixes: 99cb0d917ffa ("arch: fix broken BuildID for arm64 and riscv")
> Link: https://lore.kernel.org/all/Y7Jal56f6UBh1abE@dev-arch.thelio-3990X/
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  arch/s390/kernel/vmlinux.lds.S | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks!

      reply	other threads:[~2023-01-05  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05  3:13 [PATCH] s390: define RUNTIME_DISCARD_EXIT to fix link error with GNU ld < 2.36 Masahiro Yamada
2023-01-05  7:57 ` Heiko Carstens [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=Y7aC50LZK1t8Eysg@osiris \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=svens@linux.ibm.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