linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test
Date: Sun, 25 Apr 2021 06:13:13 +0900	[thread overview]
Message-ID: <CAK7LNATgbzTBCrDaD3HhUQv=W3wLOKq3_iOiKM3CNEB4B=qh6Q@mail.gmail.com> (raw)
In-Reply-To: <20210422201914.3682494-1-nathan@kernel.org>

On Fri, Apr 23, 2021 at 5:19 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Normally, invocations of $(HOSTCC) include $(KBUILD_HOSTLDFLAGS), which
> in turn includes $(HOSTLDFLAGS), which allows users to pass in their own
> flags when linking. However, the 'has_libelf' test does not, meaning
> that if a user requests a specific linker via HOSTLDFLAGS=-fuse-ld=...,
> it is not respected and the build might error.
>
> For example, if a user building with clang wants to use all of the LLVM
> tools without any GNU tools, they might remove all of the GNU tools from
> their system or PATH then build with
>
> $ make HOSTLDFLAGS=-fuse-ld=lld LLVM=1 LLVM_IAS=1
>
> which says use all of the LLVM tools, the integrated assembler, and
> ld.lld for linking host executables. Without this change, the build will
> error because $(HOSTCC) uses its default linker, rather than the one
> requested via -fuse-ld=..., which is GNU ld in clang's case in a default
> configuration.
>
> error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please
> install libelf-dev, libelf-devel or elfutils-libelf-devel
> make[1]: *** [Makefile:1260: prepare-objtool] Error 1
>
> Add $(KBUILD_HOSTLDFLAGS) to the 'has_libelf' test so that the linker
> choice is respected.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/479
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---

I applied this since the MW is opening shortly.

However, I believe the right thing to do is
to kill the pointless check entirely.




>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index bc19584fee59..1535b32c8baa 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1092,7 +1092,7 @@ export mod_sign_cmd
>  HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
>
>  has_libelf = $(call try-run,\
> -               echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
> +               echo "int main() {}" | $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
>
>  ifdef CONFIG_STACK_VALIDATION
>    ifeq ($(has_libelf),1)
>
> base-commit: bf05bf16c76bb44ab5156223e1e58e26dfe30a88
> --
> 2.31.1.362.g311531c9de
>


-- 
Best Regards
Masahiro Yamada

      reply	other threads:[~2021-04-24 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 20:19 [PATCH] kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test Nathan Chancellor
2021-04-24 21:13 ` Masahiro Yamada [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='CAK7LNATgbzTBCrDaD3HhUQv=W3wLOKq3_iOiKM3CNEB4B=qh6Q@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.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).