I came across this article that suggested that adding two lines to the /etc/profile would increase the compiler optimizations for a system like mine (64bit x686 processor). Here are the lines:
export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL INPUTRC CFLAGS LANG LESSCHARSET
Of course I would put the changes in my profile.local file instead but I have two questions:
Is this the best way to get these optimizations in OpenSuSE? Or for that matter, does it already optimize the code when it detects more advanced processors; and,
Assuming making this change is a good idea, how do I get it to recompile with the changes?
I’ve never thought about recompiling the kernel before so this is very new to me.
On 01/12/2010 12:36 PM, Reg gie wrote:
>
> Hello,
>
> I came across this article ‘The /etc/profile file’
> (http://www.faqs.org/docs/securing/chap6sec64.html) which suggested that
> adding to lines to the profile file would increase the compiler
> optimizations for a system like mine (64bit x686 processor). Here are
> the lines:
>
> CFLAGS=-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro
> -march=pentiumpro -fomit-frame-pointer -fno-exceptions
>
> export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER LOGNAME MAIL
> INPUTRC CFLAGS LANG LESSCHARSET
>
>
> Of course I would put the changes in my profile.local file instead but
> I have two questions:
> - Is this the best way to get these optimizations in OpenSuSE? Or for
> that matter, does it already optimize the code when it detects more
> advanced processors; and,
>
> - Assuming making this change is a good idea, how do I get it to
> recompile with the changes?
>
> I’ve never thought about recompiling the kernel before so this is very
> new to me.
Do NOT change the compilation options on the kernel.
Do NOT change the compilation options on the kernel.
Do NOT change the compilation options on the kernel.
Do NOT change the compilation options on the kernel.
I hope you got the point. The default options have been set by the real experts
who know the quirks of every version of gcc and have tweaked the code when
necessary to get correct compilation from every supported version. “Randomly”
changing the options could lead to some very interesting crashes because some
critical piece of source generated incorrect binary.
That’s a nice blanket statement but I need to dig further, how do I find the options it is being compiled with?
I suspect that being 64bit it’s already being optimized anyway since probably only x686 processors ever existed in 64bit – but I don’t know how to prove that theory.
As for experts, while I don’t know where to find the options, I am programmer of over 25 years and started in assembly and have written my own BIOS’s amongst many other low-level programming tasks so I am neither unfamiliar nor intimidated by changing compiler options to take advantage of processor characteristics.
I am simply still unfamiliar with various aspects of Linux since I only started digging into it a year ago. However, you learn by doing and I plan to play with this, they are my own home computers so why not? The worst that can happen is I have to reinstall a distribution, I can live with that.
However, thanks for the warning, it is appreciated that people are looking out for people.
On 01/12/2010 01:56 PM, Reg gie wrote:
>
> That’s a nice blanket statement but I need to dig further, how do I find
> the options it is being compiled with?
You need to install the kernel source and explore the kernel make system. The
default flags are in the CFLAGS entries. Some subsections will make changes and
list those as EXTRA_CFLAGS.