linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* passing my own compiler options into linux kernel compiling
@ 2003-07-24  7:16 Michal Semler
  2003-07-24  7:59 ` Hacksaw
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Michal Semler @ 2003-07-24  7:16 UTC (permalink / raw)
  To: linux-kernel

Hello,

I use gcc-3.3 and I would like compile my kernel with flags:

-O4 -march=pentium3 -mcpu=pentium3

Is there any way to do this?
Maybe there should be a possibility in menuconfig and xconfig for users
specify their own compiler options.

What do you think about this people?

Michal


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  7:16 passing my own compiler options into linux kernel compiling Michal Semler
@ 2003-07-24  7:59 ` Hacksaw
  2003-07-24  8:01 ` Martin Zwickel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Hacksaw @ 2003-07-24  7:59 UTC (permalink / raw)
  To: cijoml; +Cc: linux-kernel

>Maybe there should be a possibility in menuconfig and xconfig for users
>specify their own compiler options.

The system does take the chip into account, as far as I remember. It's one of 
the first few options of the config system.

As to the -O4 option, it's important to think about what optimizations it's 
doing. Many of the critical functions in the kernel are hand coded assembler, 
no small amount of work. The other functions might gain from this, but I bet 
they don't. They might even lose from it.

In any case it appears that if you modify the HOSTCFLAGS in the top level 
Makefile, you can add these options. Do be careful. The data you save may be 
your own.
-- 
A principle is universal.
A rule is specific.
A law is invariable.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  7:16 passing my own compiler options into linux kernel compiling Michal Semler
  2003-07-24  7:59 ` Hacksaw
@ 2003-07-24  8:01 ` Martin Zwickel
  2003-07-24  8:50   ` Michal Semler
  2003-07-24 20:58 ` Sam Ravnborg
  2003-07-24 23:27 ` Kurt Wall
  3 siblings, 1 reply; 11+ messages in thread
From: Martin Zwickel @ 2003-07-24  8:01 UTC (permalink / raw)
  To: cijoml; +Cc: linux-kernel

On Thu, 24 Jul 2003 09:16:17 +0200
Michal Semler <cijoml@volny.cz> bubbled:

> Hello,
> 
> I use gcc-3.3 and I would like compile my kernel with flags:
> 
> -O4 -march=pentium3 -mcpu=pentium3
-O4 is useless. max is -O3

try this file: arch/i386/Makefile
there is something like:

ifdef CONFIG_MPENTIUMIII
CFLAGS += -march=i686
endif

maybe this helps...

Regards,
Martin

-- 
MyExcuse:
Arcserve crashed the server again.

Martin Zwickel <martin.zwickel@technotrend.de>
Research & Development

TechnoTrend AG <http://www.technotrend.de>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  8:01 ` Martin Zwickel
@ 2003-07-24  8:50   ` Michal Semler
  2003-07-24  8:55     ` Christoph Hellwig
  2003-07-24 12:35     ` James H. Cloos Jr.
  0 siblings, 2 replies; 11+ messages in thread
From: Michal Semler @ 2003-07-24  8:50 UTC (permalink / raw)
  To: Martin Zwickel; +Cc: linux-kernel

Hi,

-O4 is a feature - for example MPlayer (www.mplayerhq.hu) using it.

Is easyer way of passing these args planned? Editing source every time I 
change kernel is not goood way. make oldconfig adding these args is better 
way.

Michal

Dne čt 24. července 2003 10:01 jste napsal(a):
> On Thu, 24 Jul 2003 09:16:17 +0200
>
> Michal Semler <cijoml@volny.cz> bubbled:
> > Hello,
> >
> > I use gcc-3.3 and I would like compile my kernel with flags:
> >
> > -O4 -march=pentium3 -mcpu=pentium3
>
> -O4 is useless. max is -O3
>
> try this file: arch/i386/Makefile
> there is something like:
>
> ifdef CONFIG_MPENTIUMIII
> CFLAGS += -march=i686
> endif
>
> maybe this helps...
>
> Regards,
> Martin


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  8:50   ` Michal Semler
@ 2003-07-24  8:55     ` Christoph Hellwig
  2003-07-24  9:31       ` J.A. Magallon
  2003-07-24  9:41       ` J.A. Magallon
  2003-07-24 12:35     ` James H. Cloos Jr.
  1 sibling, 2 replies; 11+ messages in thread
From: Christoph Hellwig @ 2003-07-24  8:55 UTC (permalink / raw)
  To: Michal Semler; +Cc: Martin Zwickel, linux-kernel

On Thu, Jul 24, 2003 at 10:50:25AM +0200, Michal Semler wrote:
> Hi,
> 
> -O4 is a feature - for example MPlayer (www.mplayerhq.hu) using it.

Maybe you and the mplayer folks want to take a look at gcc's "handling"
of -O4..


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  8:55     ` Christoph Hellwig
@ 2003-07-24  9:31       ` J.A. Magallon
  2003-07-24  9:41       ` J.A. Magallon
  1 sibling, 0 replies; 11+ messages in thread
From: J.A. Magallon @ 2003-07-24  9:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Michal Semler, Martin Zwickel, linux-kernel


On 07.24, Christoph Hellwig wrote:
> On Thu, Jul 24, 2003 at 10:50:25AM +0200, Michal Semler wrote:
> > Hi,
> > 
> > -O4 is a feature - for example MPlayer (www.mplayerhq.hu) using it.
> 
> Maybe you and the mplayer folks want to take a look at gcc's "handling"
> of -O4..
> 

http://freshmeat.net/articles/view/730/

;)

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.2 (Cooker) for i586
Linux 2.4.22-pre7-jam1m (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-0.6mdk))

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  8:55     ` Christoph Hellwig
  2003-07-24  9:31       ` J.A. Magallon
@ 2003-07-24  9:41       ` J.A. Magallon
  1 sibling, 0 replies; 11+ messages in thread
From: J.A. Magallon @ 2003-07-24  9:41 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel


On 07.24, Christoph Hellwig wrote:
> On Thu, Jul 24, 2003 at 10:50:25AM +0200, Michal Semler wrote:
> > Hi,
> > 
> > -O4 is a feature - for example MPlayer (www.mplayerhq.hu) using it.
> 
> Maybe you and the mplayer folks want to take a look at gcc's "handling"
> of -O4..
> 

BTW, is there any way to get from gcc the options it uses when you
put -ON in the options ?
(It's not I don't trust documentation, just want to double check ;))

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.2 (Cooker) for i586
Linux 2.4.22-pre7-jam1m (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-0.6mdk))

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  8:50   ` Michal Semler
  2003-07-24  8:55     ` Christoph Hellwig
@ 2003-07-24 12:35     ` James H. Cloos Jr.
  1 sibling, 0 replies; 11+ messages in thread
From: James H. Cloos Jr. @ 2003-07-24 12:35 UTC (permalink / raw)
  To: cijoml; +Cc: linux-kernel

>>>>> "Michal" == Michal Semler <cijoml@volny.cz> writes:

Michal> Is easyer way of passing these args planned? Editing source
Michal> every time I change kernel is not goood way. make oldconfig
Michal> adding these args is better way.

In 2.6 arch/i386/Makefile looks like this;

cflags-$(CONFIG_M686)           += -march=i686
cflags-$(CONFIG_MPENTIUMII)     += $(call check_gcc,-march=pentium2,-march=i686)
cflags-$(CONFIG_MPENTIUMIII)    += $(call check_gcc,-march=pentium3,-march=i686)
cflags-$(CONFIG_MPENTIUM4)      += $(call check_gcc,-march=pentium4,-march=i686)

et al for the other cpu CONFIG options.

IOW it pretty much makes the right choices w/o editing.

-JimC


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  7:16 passing my own compiler options into linux kernel compiling Michal Semler
  2003-07-24  7:59 ` Hacksaw
  2003-07-24  8:01 ` Martin Zwickel
@ 2003-07-24 20:58 ` Sam Ravnborg
  2003-07-24 21:41   ` Ed Sweetman
  2003-07-24 23:27 ` Kurt Wall
  3 siblings, 1 reply; 11+ messages in thread
From: Sam Ravnborg @ 2003-07-24 20:58 UTC (permalink / raw)
  To: Michal Semler; +Cc: linux-kernel

On Thu, Jul 24, 2003 at 09:16:17AM +0200, Michal Semler wrote:
> Hello,
> 
> I use gcc-3.3 and I would like compile my kernel with flags:
> 
> -O4 -march=pentium3 -mcpu=pentium3
> 
> Is there any way to do this?
Only way to specify -O4 is to manually edit top-level Makefile.
Change the assignment to CFLAGS (not hOSTCFLAGS as someone suggested).

The -m options are set in arch/i386/Makefile.
The best way to set them is to select the correct processor type.

	Sam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24 20:58 ` Sam Ravnborg
@ 2003-07-24 21:41   ` Ed Sweetman
  0 siblings, 0 replies; 11+ messages in thread
From: Ed Sweetman @ 2003-07-24 21:41 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Michal Semler, linux-kernel

Sam Ravnborg wrote:
> On Thu, Jul 24, 2003 at 09:16:17AM +0200, Michal Semler wrote:
> 
>>Hello,
>>
>>I use gcc-3.3 and I would like compile my kernel with flags:
>>
>>-O4 -march=pentium3 -mcpu=pentium3

-mcpu is taken care of by -march in gcc3
-O4 does nothing, -O3 is the highest gcc3 goes, and -O3 does cause 
problems with certain code.

I'd suggest also -ftracer as it is supposed to help your standard -O2 
level optimizations do their jobs. How well, probably not very noticable 
in real life, but then neither is -march=pentium3 over i686.


>>Is there any way to do this?
> 
> Only way to specify -O4 is to manually edit top-level Makefile.
> Change the assignment to CFLAGS (not hOSTCFLAGS as someone suggested).
> 
> The -m options are set in arch/i386/Makefile.
> The best way to set them is to select the correct processor type.
> 
> 	Sam
> 
basically, makefiles are supposed to add the value of CFLAGS to their 
flag variable.  CXXFLAGS for c++ arguments. But i understand why the 
kernel doesn't do this since it needs strict management over the build.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: passing my own compiler options into linux kernel compiling
  2003-07-24  7:16 passing my own compiler options into linux kernel compiling Michal Semler
                   ` (2 preceding siblings ...)
  2003-07-24 20:58 ` Sam Ravnborg
@ 2003-07-24 23:27 ` Kurt Wall
  3 siblings, 0 replies; 11+ messages in thread
From: Kurt Wall @ 2003-07-24 23:27 UTC (permalink / raw)
  To: Michal Semler; +Cc: linux-kernel

Quoth Michal Semler:
> Hello,
> 
> I use gcc-3.3 and I would like compile my kernel with flags:
> 
> -O4 -march=pentium3 -mcpu=pentium3

Although it might be handled differently elsewhere, this snippet
from gcc/toplev.c suggests -O4 buys you nothing you don't get from
-O3:

  if (optimize >= 3)
    {
      flag_inline_functions = 1;
      flag_rename_registers = 1;
    }

Kurt
-- 
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
		-- Mark Twain

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-07-24 23:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-24  7:16 passing my own compiler options into linux kernel compiling Michal Semler
2003-07-24  7:59 ` Hacksaw
2003-07-24  8:01 ` Martin Zwickel
2003-07-24  8:50   ` Michal Semler
2003-07-24  8:55     ` Christoph Hellwig
2003-07-24  9:31       ` J.A. Magallon
2003-07-24  9:41       ` J.A. Magallon
2003-07-24 12:35     ` James H. Cloos Jr.
2003-07-24 20:58 ` Sam Ravnborg
2003-07-24 21:41   ` Ed Sweetman
2003-07-24 23:27 ` Kurt Wall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).