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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+icZUUAoG0VeY06r_=c7aNGbuSkHp5VRHNSB=bQGTiTHShGtQ@mail.gmail.com>
Date:	Mon, 4 Jan 2016 12:47:42 +0100
From:	Sedat Dilek <sedat.dilek@...il.com>
To:	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Marek <mmarek@...e.cz>, Sam Ravnborg <sam@...nborg.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...hat.com>,
	linux-kbuild@...r.kernel.org,
	Linux ACPI <linux-acpi@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	"the arch/x86 maintainers" <x86@...nel.org>
Subject: Re: Thoughts about introducing OPTIMIZATION_CFLAG

On Mon, Jan 4, 2016 at 12:33 PM, One Thousand Gnomes
<gnomes@...rguk.ukuu.org.uk> wrote:
>> As said... I checked only for x86 and acpi only.
>>
>> For example '-Os' is hardcoded in...
>>
>> arch/x86/Makefile
>> arch/x86/purgatory/Makefile
>>
>> drivers/acpi/Makefile
>> drivers/acpi/acpica/Makefile
>>
>> For acpi part we have currently both used '-O2' and '-Os' ('-Oz' for
>> llvmlinux) in approx 200 make-lines.
>
> Certain parts of the kernel are built in particular ways for specific
> reasons where the tradeoffs vary, or where people happen to know that -Os
> is the best choice with gcc. Of course those may not be the same trade
> offs for llvm.
>
>>
>> $ grep '\-O2' build-log_4.4.0-rc8-2-llvmlinux-amd64.txt | grep acpi | wc -l
>> 226
>> $ grep '\-Oz' build-log_4.4.0-rc8-2-llvmlinux-amd64.txt | grep acpi |
>> grep '\-O2' | wc -l
>> 200
>>
>> So, which optimization-cflags is now used if I have both in one
>> make-line (and how can I check this)?
>
> Consult the documentation for your compiler. GCC has an 810 page manual
> that answers your question quite specifically
>
>   "If you use multiple -O options with or without level numbers, the last
>    such option is the one that is effective"
>
>
> Don't assume they are contradictory options either. If you have other
> optimnisations directly set then if those are after it they will take
> effect
>
> eg -Os -fprefetch-loop-arrays
>
> is quite valid.
>
> The GCC manual lists each optimisation it supports and documents exactly
> which ones are enabled for each option. From that you should be able to
> match them up with llvm.
>
>> How can I switch a optimization-cflags for certain code-parts in the
>> Linux-kernel (with or without the kbuild-system)?
>> ( So the default optimization-cflags is '-O2' whereas parts wants '-Os'. )
>
> Not sure I follow - that's exactly what the current Makefiles are doing.
>
>> What to do when using CONFIG_CC_OPTIMIZE_FOR_SIZE=y which sets '-Os' explicitly?
>
> That's something you'd need to work out as you regression test and profile
> the codebase. A first guess would be to echo what gcc does but deal with
> the unfortunate option difference between llvm and gcc.
>
> It may also depend what "optimising for size" means to llvm. Some
> compilers take it as a hint to favour smaller but still fast code, others
> take it as an instruction to generate very tight but way slower code.
> That will change which bits need which options.
>

Thanks for your reply.

But I think you did not get my problem - to have two different
optimization-levels for a compiler in *one* make-line makes no sense
to me.

So, the kbuild-system adds optimization compiler-flags automatically -
see the upper/root Makefile.
Sort of "inheritance".

My question is how to set *one* optimization-level for whatever
compiler I use to build my Linux-kernel source.

-O1 || -O2 || -O3 || -O4 || -Os ('1..4' and 's' are so-called "optlevels")

It's still not clear if my problem is a compiler bug or not (see [1]
for the details).

Now a bit clearer?

- Sedat -

[1] http://marc.info/?t=144179442100006&r=1&w=1
--
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