Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18392702ybl; Fri, 3 Jan 2020 01:13:12 -0800 (PST) X-Google-Smtp-Source: APXvYqx+B2EUIjUnkosJrOjr3GRgAAsaVJC+paYZtDUhYUVBdVM6EFRdXemTN2l/6tvQa5F0k6Cd X-Received: by 2002:a9d:6857:: with SMTP id c23mr81322779oto.351.1578042792228; Fri, 03 Jan 2020 01:13:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578042792; cv=none; d=google.com; s=arc-20160816; b=0X8WA7e9WhP6E41rzpjh53Lzt/+Naj9f6oM0YMNb8HYGh74eRYdNNquaDmWq5Xb6tJ c+idvaxCigsUjWqhxqH8fLaPgjUbn5FWGARqbv5Og0otEZcDwtufm/EAijv29BfKW3oa gaPaavJoquyA9HcgvMRY32tBpdw51QYMwGAnHVKXuxJ/kHN5NzPo3fJmI4oCBUUYo//3 8ciqxrq4lrTmFySY7wd6DRbJJjI53hkqULVePsWoXG3OwQReK2EHavq8Ja//xpTXKH0X 9Kk/4Cn0lWbQ9X54L5/y8qjI77BtIaKQ2dN4fP696aMfXh0BHGjMEAhXLgwT3HB2AC4q BqRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=aP9OWjywmzrZI9zC4+ScmJUXaSJGlh+lwZTvCu3EVZo=; b=AN46ViWzXba32gxpXRr1Ar+giq0qA9wNbzdzrI2L8gK3BLUNEkcXkpxva4RMnziRie vS594JWCHc8rG97HU85ijD9NP/XmjRwXUW/mmPgcuswFxit5FTNAx9FCcz9O7EATIhqM 76Acwgwy422Ikc4uu+wqNOoU76RrhO9105qehQHfg0Qk9pT/+LVSUG2uMnKo6lBJsxlW SugAT8UxeI8oV//Ue/UcXH61bruCBpOzU3VkZYFNHGsljapIC6dOTy2oCi42telP4WNf qNVOjF4Dh1Woh/oM1Z1iF/RCRJbLjzrSUBZV8kg5Ud/rPS6DJHiJM9DVCydCJVUEQhHC IYsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si30397943otm.224.2020.01.03.01.13.00; Fri, 03 Jan 2020 01:13:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbgACJMU (ORCPT + 99 others); Fri, 3 Jan 2020 04:12:20 -0500 Received: from foss.arm.com ([217.140.110.172]:54020 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbgACJMU (ORCPT ); Fri, 3 Jan 2020 04:12:20 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 264C61FB; Fri, 3 Jan 2020 01:12:19 -0800 (PST) Received: from [192.168.1.18] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 918673F703; Fri, 3 Jan 2020 01:12:17 -0800 (PST) Subject: Re: [PATCH v2] MIPS: Avoid VDSO ABI breakage due to global register variable To: Paul Burton Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, "Jason A. Donenfeld" , Arnd Bergmann , Christian Brauner , stable@vger.kernel.org References: <20200102005343.GA495913@rani.riverdale.lan> <20200102045038.102772-1-paulburton@kernel.org> <754c5d05-4455-5ce1-475d-55c2191a06cf@arm.com> <20200103004229.lpbhocebuny6vxmf@lantea.localdomain> From: Vincenzo Frascino Message-ID: Date: Fri, 3 Jan 2020 09:15:10 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200103004229.lpbhocebuny6vxmf@lantea.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On 1/3/20 12:42 AM, Paul Burton wrote: > Using -ffixed-gp wouldn't be correct for the VDSO - the VDSO itself is > position independent code, and will need to use $gp to access the GOT > which is part of how position-independence is achieved (technically you > could access the GOT using another register of course but you'd need > some way to persuade the compiler to break with convention & you'd gain > nothing meaningful since you'd need to use some other register anyway). > If we use -ffixed-gp then we're telling GCC not to use $gp, and that > doesn't make sense. If we consider -ffixed-gp as telling GCC not to use > $gp as a general purpose register then it's meaningless because $gp > already has a specific use & isn't used as a general purpose register. > If we consider -ffixed-gp as telling GCC not to use $gp at all then it > doesn't make sense because it needs to in order to access the GOT. > > In terms of GCC's flags we'd want to use -fcall-saved-gp, but that would > just be telling GCC information it already knows about the n32 & n64 > ABIs & indeed it seems to have no effect at all on the way GCC handles > the global register variable - it doesn't cause gcc to save & restore > $gp with the global register variable present, so you gain nothing. > > We could use -ffixed-gp for the kernel proper (& not the VDSO), but: > > 1) The kernel builds as non-PIC code with no $gp-based optimizations > enabled, and since this has been fine forever it seems safe to expect > the compiler not to start using $gp in new ways. > > 2) It would be a separate issue to fixing the VDSO anyway. Makes totally sense. Thanks for the explanation. -- Regards, Vincenzo