Received: by 10.223.185.111 with SMTP id b44csp47600wrg; Fri, 9 Mar 2018 00:34:31 -0800 (PST) X-Google-Smtp-Source: AG47ELs5IvFU9rM56xpFlwT4p/QcBctbShy43P0kkE4uCMdL4FKw0/JhuVM/B3dJ+lj9s+DvFkyq X-Received: by 10.99.110.133 with SMTP id j127mr23796545pgc.79.1520584471355; Fri, 09 Mar 2018 00:34:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520584471; cv=none; d=google.com; s=arc-20160816; b=J27QwruC6B+hL8UnBLd+23NA52GeTici28xTewVI96GuHrqkiTgE6xxGQQk20aw+JE VNWjXoS2ktJRP5CkvDjaEODIEk1yEvRipaz7hnAWYgFr7m4XeFxRMV8TAZwBZRR8mu2c FM+4ITsbN8wT4bx2yU4inztlsuf3pUC7VUASzMN9NR229oNI8M6ZbCN4HVFHiT93xjUM Z4VuI2CHuMzjjF0R1B7a6eE+lh3SqAFBx5Lb0ilIrakTN5AHWwWJXClBzu1Ym1W4Uz3Q 0tHwcuz3p1LRugKH0CkHg58roSBuHMaRsTNwaJ+eDDPecoRkPW8pIW4jzv7FONnCyLq8 W42g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=35Xs8d6r4RvNhUnBUE163D3ERrLijx9nOYzZGwkL+7E=; b=FmhIU/QNgL+2tgRYHUW1qyhtaGvgItl9ziwMgGkGNQ//PBM9Gt4uypVuM/TZGp2ViH 5POm8nkSXNbylgfU+MKV6sBaslk/7Aww8ALaetQURRswn5RMjYqbMjcfmla3LiRx4JOa SBkF6PgTKoD2YFUvl/lqF4PTKXWn+Smvk58f3vlgvP3XjlH28b88iSAyPYEwoU2PpnWV BBCU0xT06lCq610JaQQaDlIWIqH+1hSiyKTaHJwQW9810SPDo+tFv1JyL4kI04FaGl16 8LSjeHNKoPSElrMwCMXFtv8ee1i7dMs7RaIScSOe4klP28MNe2Z65CqQch5Vhoe7hE1h a/Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yl8SDfxj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si487929pfi.123.2018.03.09.00.34.16; Fri, 09 Mar 2018 00:34:31 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Yl8SDfxj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751779AbeCIIdK (ORCPT + 99 others); Fri, 9 Mar 2018 03:33:10 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:40346 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbeCIIdJ (ORCPT ); Fri, 9 Mar 2018 03:33:09 -0500 Received: by mail-ot0-f193.google.com with SMTP id l12so8011623otj.7 for ; Fri, 09 Mar 2018 00:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=35Xs8d6r4RvNhUnBUE163D3ERrLijx9nOYzZGwkL+7E=; b=Yl8SDfxjAsRDwjWaSpkswPb5hMs5tIlhFQKYxDy/0A9zHNPr3tNCMc26baLLL+kPqK H6u2RgdQK0dRpKfn9Lz/KrKFw3gxENeINNemAhj4mbnEHyUDMDlnDm+SdtsbXxkfN5XY QN/muAVSEKJdCtOlIkX1WSp0QIJcFzfOsFzZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=35Xs8d6r4RvNhUnBUE163D3ERrLijx9nOYzZGwkL+7E=; b=p8WgmWLE4ylEvcaaWgSUU+dQmGirjqvT2FEIWaN6/VmGMaWaw+RpfjoYqA+8D8480z H+CLaFqcoHxvt8YAsSNaD2cvTlOfaxXqiDj4ke7GTwZLCnRrjoa8dy17j/fDYnIaI7uf lSGunjj5g0sC8GfKp9yKzxK3u935GbUSu+ZDTKqEF7DmL5xMNdqpcoP+Rf43EKK+W4Wv 732bOuY3e1UH7BQsahG6KdVaw39roXdpaqSEFUR+zy3YbNUmyP2gRAUawEtCWQ6amPvI 25erFX3wyWKLL2wIEVekVcGt/DXiATWOnm42S5RaX1tKu2EGcCdrckRzKB3N4IwPAv01 7G2g== X-Gm-Message-State: AElRT7GYC8LVm/I/b1SnUc1DZBChdKJsZzlztGbTgFivjWqqUg09EYAz et1UFyHY1dxRX/IAGudCGFuPziuFGQqc9A+pramovA== X-Received: by 10.157.33.51 with SMTP id i48mr18050725otb.343.1520584388697; Fri, 09 Mar 2018 00:33:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.13.2 with HTTP; Fri, 9 Mar 2018 00:33:08 -0800 (PST) In-Reply-To: <20180309082932.GA13228@wunner.de> References: <20180308080020.22828-1-ard.biesheuvel@linaro.org> <20180308080020.22828-13-ard.biesheuvel@linaro.org> <20180309074719.y33xe4bjkjsjsaa3@gmail.com> <20180309082932.GA13228@wunner.de> From: Ard Biesheuvel Date: Fri, 9 Mar 2018 08:33:08 +0000 Message-ID: Subject: Re: [PATCH 12/12] efi: make const array 'apple' static To: Lukas Wunner Cc: Ingo Molnar , linux-efi@vger.kernel.org, Thomas Gleixner , Colin Ian King , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lukas, On 9 March 2018 at 08:29, Lukas Wunner wrote: > On Fri, Mar 09, 2018 at 08:47:19AM +0100, Ingo Molnar wrote: >> * Ard Biesheuvel wrote: >> > From: Colin Ian King >> > >> > Don't populate the const read-only array 'buf' on the stack but instead >> > make it static. Makes the object code smaller by 64 bytes: >> > >> > Before: >> > text data bss dec hex filename >> > 9264 1 16 9281 2441 arch/x86/boot/compressed/eboot.o >> > >> > After: >> > text data bss dec hex filename >> > 9200 1 16 9217 2401 arch/x86/boot/compressed/eboot.o >> > >> > (gcc version 7.2.0 x86_64) >> > >> > Signed-off-by: Colin Ian King >> > Signed-off-by: Ard Biesheuvel >> > --- >> > arch/x86/boot/compressed/eboot.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c >> > index 886a9115af62..f2251c1c9853 100644 >> > --- a/arch/x86/boot/compressed/eboot.c >> > +++ b/arch/x86/boot/compressed/eboot.c >> > @@ -423,7 +423,7 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params) >> > >> > static void setup_quirks(struct boot_params *boot_params) >> > { >> > - efi_char16_t const apple[] = { 'A', 'p', 'p', 'l', 'e', 0 }; >> > + static efi_char16_t const apple[] = { 'A', 'p', 'p', 'l', 'e', 0 }; >> > efi_char16_t *fw_vendor = (efi_char16_t *)(unsigned long) >> > efi_table_attr(efi_system_table, fw_vendor, sys_table); >> >> As a general policy, please don't put 'static' variables into the local >> scope, use file scope instead - right before setup_quirks() would be fine. > > Well, I believe the end result is the same and the closer the declaration > is to where it's used, the easier the code is to read and understand. > > I object to patches like this because they paper over a missing > compiler optimization: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68725 > > I have told Colin before that it would be more useful to look into > fixing the underlying compiler issue rather than polluting the kernel > with "static" keywords, but he keeps sending these patches so I've > given up responding: > https://lkml.org/lkml/2017/8/25/636 > > >> Plus an unicode string literal initializer would be pretty descriptive >> as well, instead of the weird looking character array, i.e. something >> like: >> >> static efi_char16_t const apple_unicode_str[] = u"Apple"; >> >> ... or so? > > Last time I checked this didn't work, I believe it's because it's C11 > and the kernel is compiled with -std=gnu89. And I'm also not sure if > the oldest gcc version that we support understands u"". > Indeed arch/x86/platform/efi/quirks.c:78:46: error: 'u' undeclared here (not in a function); did you mean 'up'? static const efi_char16_t efi_dummy_name[] = u"DUMMY";