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]
Message-ID: <51A8A215.2030706@cogentembedded.com>
Date:	Fri, 31 May 2013 17:13:57 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Clemens Ladisch <clemens@...isch.de>
CC:	Timur Tabi <timur.tabi@...xeda.com>,
	Mark Langsdorf <mark.langsdorf@...xeda.com>, tj@...nel.org,
	linux-kernel@...r.kernel.org, linux-ide@...r.kernel.org
Subject: Re: [PATCH v2] ata: increase retry count but shorten duration for
 Calxeda controller

Hello.

On 31-05-2013 10:53, Clemens Ladisch wrote:

>>>> +    const unsigned long timing[] = { 5, 100, 500};

>>> You'll save space and time if you also make this array "static",
>>> otherwise the compiler will build the array every time this function is
>>> called.

>> No, *const* specifier is enough to not build this array every time. It will be put into the .const section.

> gcc disagrees:

> $ cat const_static.c
> int f(int x) {
> 	const unsigned long timing[] = { 5, 100, 500};
> 	static const unsigned long timing2[] = { 5, 100, 500};
> 	return timing[x] + timing2[x];
> }
> $ gcc -Os -S const_static.c
> $ cat const_static.s
	...
> timing2.0:
>          .long   5
>          .long   100
>          .long   500
> 	...
>          movl    8(%ebp), %edx
>          movl    $5, -16(%ebp)
>          movl    $100, -12(%ebp)
>          movl    $500, -8(%ebp)
>          movl    timing2.0(,%edx,4), %eax
>          addl    -16(%ebp,%edx,4), %eax

    Hm, I remember I was convinced by somebody just *const* was enough 
for the data to be put to .const section. Don't remember if he gave an 
object code example... Well, it means that person was wrong. Mark, we 
then need *static* as well...

> Regards,
> Clemens

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ