mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Alistair Strachan <astrachan@google.com>
Cc: linux-kernel@vger.kernel.org, luto@kernel.org,
	tglx@linutronix.de, mingo@redhat.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	x86@kernel.org, kernel-team@android.com, joel@joelfernandes.com
Subject: Re: [PATCH] x86: vdso: Fix leaky vdso link with CC=clang
Date: Thu, 12 Jul 2018 15:06:54 -0700	[thread overview]
Message-ID: <1432bfde-41b4-e8aa-037b-fca41a149cb8@zytor.com> (raw)
In-Reply-To: <CANDihLEz3_fZ4r4g=VcxWps5DWSjMJdbJZKZWsLFKVp_c7FscA@mail.gmail.com>

On 07/12/18 13:37, Alistair Strachan wrote:
> On Thu, Jul 12, 2018 at 1:25 PM H. Peter Anvin <hpa@zytor.com> wrote:
>> On 07/12/18 13:10, Alistair Strachan wrote:
>>> The vdso{32,64}.so can fail to link with CC=clang when clang tries to
>>> find a suitable GCC toolchain to link these libraries with.
>>>
>>> /usr/bin/ld: arch/x86/entry/vdso/vclock_gettime.o:
>>>   access beyond end of merged section (782)
>>>
>>> This happens because the host environment leaked into the cross
>>> compiler environment due to the way clang searches for suitable GCC
>>> toolchains.
>>>
>>
>> Is this another clang bug that you want a workaround for in the kernel?
> 
> Clang is a retargetable compiler (specified with --target=<something>)
> and so it has a mechanism for searching for suitable binutils (from
> another "GCC toolchain") to perform assembly and linkage. This
> mechanism relies on both --target and --gcc-toolchain when
> cross-compiling, otherwise it will fall back to searching /usr.
> 
> The --target and --gcc-toolchain flags are already specified correctly
> in the top level Makefile, but the vdso Makefile rolls its own linker
> flags and doesn't use KBUILD_CFLAGS. Therefore, these flags get
> incorrectly dropped from the vdso $CC link command line, and an
> inconsistency is created between the "GCC toolchain" used to generate
> the objects for the vdso, and the linker used to link them.
> 

It sounds like there needs to be a more fundamental symbol than
KBUILD_CFLAGS to contain these kinds of things.

	-hpa

  reply	other threads:[~2018-07-12 22:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 20:10 Alistair Strachan
2018-07-12 20:25 ` H. Peter Anvin
2018-07-12 20:37   ` Alistair Strachan
2018-07-12 22:06     ` H. Peter Anvin [this message]
2018-07-12 23:20       ` Andy Lutomirski
2018-07-13  0:01         ` Alistair Strachan

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=1432bfde-41b4-e8aa-037b-fca41a149cb8@zytor.com \
    --to=hpa@zytor.com \
    --cc=astrachan@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®