lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 28 Nov 2017 19:39:24 +0900
From:   Takashi Sakamoto <o-takashi@...amocchi.jp>
To:     Takashi Iwai <tiwai@...e.de>
Cc:     alsa-devel@...a-project.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Colin King <colin.king@...onical.com>, wharms@....de
Subject: Re: [PATCH] ALSA: drivers: make array 'names' const, reduces object
 code size

On Nov 28 2017 04:51, Takashi Iwai wrote:
> On Mon, 27 Nov 2017 18:34:17 +0100,
> Takashi Sakamoto wrote:
>>
>> Hi,
>>
>> On Nov 27 2017 21:58, Colin King wrote:
>>> From: Colin Ian King <colin.king@...onical.com>
>>>
>>> Don't populate array 'names' on the stack but instead make them static.
>>> Makes the object code smaller by 50 bytes:
>>>
>>> Before:
>>>      text	   data	    bss	    dec	    hex	filename
>>>     21237	   9192	   1120	  31549	   7b3d	linux/sound/drivers/dummy.o
>>>
>>> After:
>>>      text	   data	    bss	    dec	    hex	filename
>>>     21095	   9280	   1120	  31495	   7b07	linux/sound/drivers/dummy.o
>>>
>>> (gcc version 7.2.0 x86_64)
>>>
>>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>>> ---
>>>    sound/drivers/dummy.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
>>> index 7b2b1f766b00..69db45bc0197 100644
>>> --- a/sound/drivers/dummy.c
>>> +++ b/sound/drivers/dummy.c
>>> @@ -830,7 +830,7 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
>>>    static int snd_dummy_iobox_info(struct snd_kcontrol *kcontrol,
>>>    				struct snd_ctl_elem_info *info)
>>>    {
>>> -	const char *const names[] = { "None", "CD Player" };
>>> +	static const char *const names[] = { "None", "CD Player" };
>>>      	return snd_ctl_enum_info(info, 1, 2, names);
>>>    }
>>
>> Total size of snd-dummy.ko increases but this patch has an advantage
>> to have the symbol in read-only section.
> 
> The total size decreases :)

Ah, yes. The state of my local build tree is not good to calculate it... 
In fact, the relocatable object decreases its size when built with a 
header package from Ubuntu repository.


Thanks

Takashi Sakamoto

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ