Particular GCC option for one file in the kernel

This is a discussion on Particular GCC option for one file in the kernel within the linux-misc forums in Operating Systems category; Hi all, I'm writing a module for Linux Kernel. That module is compiled from many files. General gcc optimization option for the hole kernel is - Os, but I want to use -O2 for one of my module's file source. How can I do it ? Thank you...

Go Back   Database Forum > Operating Systems > linux-misc

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-10-2007, 09:35 AM
Default Particular GCC option for one file in the kernel

Hi all,

I'm writing a module for Linux Kernel. That module is compiled from
many files. General gcc optimization option for the hole kernel is -
Os, but I want to use -O2 for one of my module's file source.

How can I do it ?

Thank you

Reply With Quote
  #2  
Old 10-10-2007, 06:10 PM
Default Re: Particular GCC option for one file in the kernel

bossdboss-at-gmail.com wrote:
> Hi all,
>
> I'm writing a module for Linux Kernel. That module is compiled from
> many files. General gcc optimization option for the hole kernel is -
> Os, but I want to use -O2 for one of my module's file source.
>
> How can I do it ?


Would you care to tell why? What are you
attempting to achieve?

It seems to me that the code is sick in some
way if it is dependent of the optimization
level.

--

Tauno Voipio
tauno voipio (at) iki fi

Reply With Quote
  #3  
Old 10-10-2007, 07:36 PM
Default Re: Particular GCC option for one file in the kernel

bossdboss-at-gmail.com writes:

> Hi all,
>
> I'm writing a module for Linux Kernel. That module is compiled from
> many files. General gcc optimization option for the hole kernel is -
> Os, but I want to use -O2 for one of my module's file source.
>
> How can I do it ?


By subscribing to the linux-kernel mailing list, where all your questions
regarding kernel module building will be read by thousands of people who,
for the most part of their day, do nothing except build kernel modules.

See http://www.kernel.org/pub/linux/docs/lkml/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHDVQGx9p3GYHlUOIRAo9pAJ9VBq+0mmCAtRRbr0PHFu UHFAmDmQCfa+N4
gItofnyyYZfcKSDHSqlnl2U=
=Paeo
-----END PGP SIGNATURE-----

Reply With Quote
  #4  
Old 10-12-2007, 03:39 AM
Default Re: Particular GCC option for one file in the kernel

On 10 oct, 23:10, Tauno Voipio wrote:
> bossdb...@gmail.com wrote:
> > Hi all,

>
> > I'm writing a module for Linux Kernel. That module is compiled from
> > many files. General gcc optimization option for the hole kernel is -
> > Os, but I want to use -O2 for one of my module's file source.

>
> > How can I do it ?

>
> Would you care to tell why? What are you
> attempting to achieve?
>
> It seems to me that the code is sick in some
> way if it is dependent of the optimization
> level.
>
> --
>
> Tauno Voipio
> tauno voipio (at) iki fi


Why I need to do so is not very important, but if you want to know,
the performances of code in that file is critical and works better
compiled with -O2 rather than -Os.

Reply With Quote
  #5  
Old 10-12-2007, 06:51 PM
Default Re: Particular GCC option for one file in the kernel

bossdboss-at-gmail.com wrote:
> On 10 oct, 23:10, Tauno Voipio wrote:
>
>>bossdb...@gmail.com wrote:
>>
>>>Hi all,

>>
>>>I'm writing a module for Linux Kernel. That module is compiled from
>>>many files. General gcc optimization option for the hole kernel is -
>>>Os, but I want to use -O2 for one of my module's file source.

>>
>>>How can I do it ?

>>
>>Would you care to tell why? What are you
>>attempting to achieve?
>>
>>It seems to me that the code is sick in some
>>way if it is dependent of the optimization
>>level.
>>
>>--
>>
>>Tauno Voipio
>>tauno voipio (at) iki fi

>
>
> Why I need to do so is not very important, but if you want to know,
> the performances of code in that file is critical and works better
> compiled with -O2 rather than -Os.



If it is so critical, use the embedded assembler
for the innermost loop and let the rest compile
as usual.

Do you realize that even a driver code may be
interfered with an interrupt if the interrupts
are not disabled?

You are probably doing something in the wrong way,
or the something is not actually doable in software
only (needs hardware assistance).

--

Tauno Voipio
tauno voipio (at) iki fi
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 02:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.