From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752123AbeCPONV (ORCPT ); Fri, 16 Mar 2018 10:13:21 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56278 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751064AbeCPONT (ORCPT ); Fri, 16 Mar 2018 10:13:19 -0400 Date: Fri, 16 Mar 2018 14:13:14 +0000 From: Mark Rutland To: Andrey Konovalov Cc: Nick Desaulniers , Stephen Hines , Greg Hackmann , Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Linux ARM , kvmarm@lists.cs.columbia.edu, LKML , kernel-dynamic-tools Subject: Re: arm64 kvm built with clang doesn't boot Message-ID: <20180316141313.q5vjmj627rv7r7kf@lakrids.cambridge.arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 16, 2018 at 02:49:00PM +0100, Andrey Konovalov wrote: > Hi! Hi, > I've recently tried to boot clang built kernel on real hardware > (Odroid C2 board) instead of using a VM. The issue that I stumbled > upon is that arm64 kvm built with clang doesn't boot. > > Adding -fno-jump-tables compiler flag to arch/arm64/kvm/* helps. There > was a patch some time ago that did exactly that > (https://patchwork.kernel.org/patch/10060381/), but it wasn't accepted > AFAICT (see the discussion on that thread). > > What would be the best way to get this fixed? I think that patch is our best bet currently, but to save ourselves pain in future it would be *really* nice if GCC and clang could provide an option line -fno-absolute-addressing that would implicitly disable any feature that would generate an absolute address as jump tables do. > I've also had to disable CONFIG_JUMP_LABEL to get the kernel boot > (even without kvm enabled), but that might be a different (though > related) issue. With v4.15 (and clang 5.0.0), I did not have to disable jump labels to get a kernel booting on a Juno platform, though I did have to pass -fno-jump-tables to the hyp code. Which kernel version and clang version are you using? Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: mark.rutland@arm.com (Mark Rutland) Date: Fri, 16 Mar 2018 14:13:14 +0000 Subject: arm64 kvm built with clang doesn't boot In-Reply-To: References: Message-ID: <20180316141313.q5vjmj627rv7r7kf@lakrids.cambridge.arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, Mar 16, 2018 at 02:49:00PM +0100, Andrey Konovalov wrote: > Hi! Hi, > I've recently tried to boot clang built kernel on real hardware > (Odroid C2 board) instead of using a VM. The issue that I stumbled > upon is that arm64 kvm built with clang doesn't boot. > > Adding -fno-jump-tables compiler flag to arch/arm64/kvm/* helps. There > was a patch some time ago that did exactly that > (https://patchwork.kernel.org/patch/10060381/), but it wasn't accepted > AFAICT (see the discussion on that thread). > > What would be the best way to get this fixed? I think that patch is our best bet currently, but to save ourselves pain in future it would be *really* nice if GCC and clang could provide an option line -fno-absolute-addressing that would implicitly disable any feature that would generate an absolute address as jump tables do. > I've also had to disable CONFIG_JUMP_LABEL to get the kernel boot > (even without kvm enabled), but that might be a different (though > related) issue. With v4.15 (and clang 5.0.0), I did not have to disable jump labels to get a kernel booting on a Juno platform, though I did have to pass -fno-jump-tables to the hyp code. Which kernel version and clang version are you using? Thanks, Mark.