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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 9 Sep 2008 22:43:05 +0300
From:	Adrian Bunk <bunk@...nel.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	"Keith A. Prickett" <keithp@...vell.com>,
	linux-kernel@...r.kernel.org
Subject: Re: Building Kernel with -O0

On Tue, Sep 09, 2008 at 09:24:58PM +0200, Andi Kleen wrote:
> "Keith A. Prickett" <keithp@...vell.com> writes:
> >
> > All of this could, potentially be changed by a configuration parameter
> > and added into the kernel release.  Does someone have a primer on why
> > this kind of behavior is not desired or "possible"?
> 
> Traditionally it was not allowed because -O0 didn't inline and
> the kernel relied on inlining in some cases. But with always_inline
> that is obsolete -- all functions that rely on inlining should be 
> marked __always_inline.
> 
> I think a few more cases crept in where it was common to write
> build time asserts as
> 
>       if (some condition the compiler evaluates at runtime)
                                                     ^^^^^^^
buildtime

>          __error_condition_xyz_is_false(); 
>  
> and this obviously relies on the optimizer to build. But these
> are all slowly moving over the BUILD_BUG_ON() which also doesn't
> rely on the optimizer, so it's also obsolete.
>...

The reason why it works for Keith at all seems to be that even with -O0 
gcc already does this kind of optimizations.

Check e.g. the assembler generated for the following
(userspace) program with -O0:

<--  snip  -->

int foobar;

int main()
{ 
	if (1) return 0;

	foobar = 12345;

	return 42;
}

<--  snip  -->

> Hope this helps,
> 
> -Andi

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--
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