Re: Is it possible to turn off the gcc optimization when compiling kernel?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 21, 2016 at 5:51 PM, Nicholas Mc Guire <der.herr@xxxxxxx> wrote:
> You can not turn it off in all functions as some need particluar
> optimization flags to comile at all, but you can pass
> individual CFLAGS per file via the Makefile
>
> CFLAGS_target.o = -O0 or -flags-to-use
>
> aswell as remove specific CFLAGS with
>
> CFLAGS_REMOVE_target.o = -flags-to-remove
>
> but if you want to debug the kernel it is most likely not
> a good idea to try and disable optimization as the code you then
> are debugging might not have that much to do with the final code
> once optimization is on again. So simply generate the .lst file
> of the target you are trying to debug e.g. for kernel/sched/core.c:
>
> make kernel/sched/core.lst
>
> and then use that .lst file to understand the output of gdb you
> are inspecting.

Thanks for your reply!
Besides,I also find that use "gcc -c -Q -O1 --help=optimizers" can
print the exact set of optimizations.

regards,
Hao Lee

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux