Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 431154 - Kernel Sources Compile Flags
Summary: Kernel Sources Compile Flags
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 OS X
: Normal QA (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-12 23:23 UTC by Jeffrey Walton
Modified: 2012-08-13 13:24 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Walton 2012-08-12 23:23:00 UTC
I'm working through a Gentoo installation. I'm at Chapter 7 and 'emerge gentoo-sources' (almost there).

I see -Wall and -Wextra are being used (sample below). That's awesome - I don't ever recall seeing it in the free software world. Hats off to the folks responsible for getting the option added.

CCCMD = x86_64-pc-linux-gnu-gcc -DPERL_CORE -c -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -O2 -pipe  -Wall -ansi -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat 
`sh  cflags "optimize='-O2 -pipe'" reentr.o` -fPIC reentr.c

I noticed a couple of interesting options are not present that might be useful: -Wconversion, and -fstrict-overflow -Wstrict-overflow. I don't believe they are part of -Wall and -Wextra.

I like to use the above flags to catch problems lurking in the background, such as truncation and extension problems, and code removed due to optimizations. They are especially important on a 64-bit machine, where the developer only used a 32-bit machine for dev/qa.
Comment 1 Jeffrey Walton 2012-08-12 23:27:17 UTC
$ uname -a
Linux Gentoo-2012 3.3.0-gentoo-r1 #1 SMP Fri Mar 30 06:21:40 UTC 2012 x86_64 Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz GenuineIntel GNU/Linux

Inside a VM om Mac OS X.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-13 13:23:54 UTC
We didn't add these. They are upstream defaults. We strive to add ours (CFLAGS and so on) after the upstream ones to allow Gentoo users more control over them. We also strive to remove upstream CFLAGS that might clash with our CFLAGS (or lack thereof), like overzealous optimisation and architecture specific options.

You can add the compiler flags you like to the CFLAGS variable in your own make.conf, though.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-13 13:24:42 UTC
(In reply to comment #2)
> We didn't add these. They are upstream defaults.

In the example you presented, they are from dev-lang/perl. :)