Received: by 10.223.185.111 with SMTP id b44csp16697wrg; Thu, 8 Mar 2018 23:53:58 -0800 (PST) X-Google-Smtp-Source: AG47ELs/XPrJF4F3N8Q79salfcsLS1H7cD/lt08iNyKHEcZBgZEdj21shBwZXUtcdp4ZIzhGAbHH X-Received: by 10.98.17.86 with SMTP id z83mr29181774pfi.207.1520582038440; Thu, 08 Mar 2018 23:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520582038; cv=none; d=google.com; s=arc-20160816; b=Gb3ziZtOsQCnobwDegWqfoq2l8GjYiBP31KL/aX8RscoIeM3bJCOsB9NCaKr2xIKpI +vXG6nFCl+5Uz6TR4Y1aA9GXVxTP+iDCTB8zjQ341ftksuAy+HXKBOIwAXvBVXzsf+2A Xe8pmI/pmyACAfxhuTqCOIe2lvmi7qHolzHkE9/FGptwCznPvak/IEksmPwqPEP/IuZH nUvATeftfHABn3HkEoUEK22kpQA6iAwEG+JjyLMj4sOchkIBt8b6riEEvqjHnpenH3tI JSnTmEEevBNLynI24KVP3vA5CLVb37YLdpDooSkfrnUHF03FY/hHjv8yhDpjQ7ZDpIaI gyCg== 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=qDah3sv6fufqqIa6U9PVIRvFjt7C0ztgsLoOb+E52Bk=; b=y0VDiu39999pr62uCxtXLKG8QW5+FPRVWcYYfcZJm6NFIQKJf3UeiV2MVUn1LIHEIt JLOISfQoReCFDauuAF6EdIPbZsgZtOPxNXoBkmiwUyEekb4ZP0+kWeJo8FSzaBH3Dejk NbbPJa1eekatG41aAf7T9OZcVTr1buFuu8Tq3qx+w+BHv8ArxCGlX3sFi33YMKKm0ZHz aReJdxxdMPdcd3JoYux3fP5K76OEUtnLQmTKBg3EfqRY7pfUWVQ/htlU/mxWyV5O7jsn AzCOfxvcfZaVJWcu6PVFqRhDB0fmS5h1DW16aIQBdGkBk3Rs2JgmJsGpKmIOkrRmmUtE i+kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bq+2vCuB; 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 1-v6si437292pla.496.2018.03.08.23.53.43; Thu, 08 Mar 2018 23:53:58 -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=bq+2vCuB; 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 S1751235AbeCIHwg (ORCPT + 99 others); Fri, 9 Mar 2018 02:52:36 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:45767 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbeCIHwf (ORCPT ); Fri, 9 Mar 2018 02:52:35 -0500 Received: by mail-io0-f194.google.com with SMTP id m22so2597473iob.12 for ; Thu, 08 Mar 2018 23:52:34 -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=qDah3sv6fufqqIa6U9PVIRvFjt7C0ztgsLoOb+E52Bk=; b=bq+2vCuB3xukTOYvbjHgZeS5IeHY4078+p9qJv9bIKFnpriSzEToSOekuYXqMigZUp qYR8MCYuTMSQPpT1mHCLjH4r2aFWOym6lQFLO03F6Q6axImcX2IkWCXqvcHwmxHrV4Sl jxgLDnnP8ylb1LQPghOxpGPlWV3HcsUqK7twc= 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=qDah3sv6fufqqIa6U9PVIRvFjt7C0ztgsLoOb+E52Bk=; b=GD1uKChXCXriF3185VJhk47tHuuN4iKDrqQX5NDZpB+EGvHNjPtxFo6xUxcNonh0+D pnn4CcdTdg3EUxX3y2KYBw6ULgBXa+N4Qi10mHCl+72r2JKf3PwYrOaZy5VI8E6G3TQR uoOmn0s3QA7YEvA2PT/ud7Jxg4jlduf6V69erJ8vKrULvN019gZ0vTdS5ob9He1pHQaO 6ODj7bBsPO0lX7ZoMjDTOvEsBk2nmCmAU6TClJO2vaIIbXYgnSTBgpwSkk50tmdbyV50 nnDHJb7JCUU/7rgIXDxuKyJe1kRx5YFfXNVfNAUnQTFufmctFYoy9cBqezMm+AIcitcP q6FQ== X-Gm-Message-State: AElRT7GBFdbzn8sO7A6KLD0/Cu6dELuxiLhYuEyu3ek1ONjY0gBwHpLi WaH5cm1EIhDnCQkPGX294z8Zq7Gg/EtAuCcQqcC/YDiX X-Received: by 10.107.213.72 with SMTP id x8mr31031771ioc.60.1520581954440; Thu, 08 Mar 2018 23:52:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Thu, 8 Mar 2018 23:52:34 -0800 (PST) In-Reply-To: <20180309074719.y33xe4bjkjsjsaa3@gmail.com> References: <20180308080020.22828-1-ard.biesheuvel@linaro.org> <20180308080020.22828-13-ard.biesheuvel@linaro.org> <20180309074719.y33xe4bjkjsjsaa3@gmail.com> From: Ard Biesheuvel Date: Fri, 9 Mar 2018 07:52:34 +0000 Message-ID: Subject: Re: [PATCH 12/12] efi: make const array 'apple' static To: Ingo Molnar Cc: 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 On 9 March 2018 at 07:47, 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. > > This makes it abundantly clear that it's not on the stack. > Fair enough. I didn't know there was such a policy, but since these have local scope by definition, it doesn't pollute the global namespace so it's fine > Also, would it make sense to rename it to something more descriptive like > "apple_unicode_str[]" or so? > > 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? > is u"xxx" the same as L"xxx"? In any case, this is for historical reasons: at some point (and I don't remember the exact details) we had a conflict at link time with objects using 4 byte wchar_t, so we started using this notation to be independent of the size of wchar_t. That issue no longer exists so we should be able to get rid of this.