From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755123AbbDTM2l (ORCPT ); Mon, 20 Apr 2015 08:28:41 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:34922 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755099AbbDTM2g (ORCPT ); Mon, 20 Apr 2015 08:28:36 -0400 From: Rasmus Villemoes To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH] x86_64: use -mskip-rax-setup when available Date: Mon, 20 Apr 2015 14:28:16 +0200 Message-Id: <1429532896-10265-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc 5 supports the option -mskip-rax-setup to avoid emitting the two-byte instruction xor %eax,%eax before a vararg function call. Clearing %eax is redundant in the kernel, since no callee expects any floating point arguments, and hence never use the incoming value of %eax for anything. For a defconfig kernel, the .text saving is around 26 kB: $ size /tmp/vmlinux.{old,new} text data bss dec hex filename 12221850 1735352 1077248 15034450 e56852 /tmp/vmlinux.old 12195955 1735352 1077248 15008555 e5032b /tmp/vmlinux.new Signed-off-by: Rasmus Villemoes --- Nothing seems to have happened on the kernel side since H.J. Lu implemented this in December. Since gcc 5 is officially released soon, I think it would be nice if this could soak in -next until the next merge window. arch/x86/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 2fda005bb334..00bc42c4cbd1 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -81,6 +81,8 @@ else KBUILD_CFLAGS += $(call cc-option,-mno-80387) KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) + KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) + # Use -mpreferred-stack-boundary=3 if supported. KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3) -- 2.1.3