1 |
On Thu, 30 Jun 2011 21:36:38 -0700 |
2 |
Mark Knecht <markknecht@×××××.com> wrote: |
3 |
|
4 |
> |
5 |
> I think it's completely appropriate for this list. This distro expects |
6 |
> that we put CFLAG options in make.conf so I need to hear about this |
7 |
> stuff even if I don't have to background to completely understand |
8 |
> what's really causing the problem. |
9 |
> |
10 |
|
11 |
In this case, or in the case of any program where "-fno-strict-aliasing" |
12 |
could make a difference, the maintainer of the program would include |
13 |
the option in the ebuild. The user would not have to worry too much |
14 |
about it. |
15 |
|
16 |
But yes, it is always good to know about the compiler flags. |
17 |
|
18 |
To see exactly what compile flags are being used in your programs, here |
19 |
is a neat method I picked up from somewhere. Just open a terminal and |
20 |
enter the following command: |
21 |
|
22 |
echo 'int main(){return 0;}' > test.c && gcc -v -Q $CFLAGS test.c -o test && rm test.c test |
23 |
|
24 |
In place of $CFLAGS just substitute any option of interest. There will |
25 |
be a flood of output, but just scroll back a few lines to find the "options |
26 |
passed:" and "options enabled:" sections. |
27 |
|
28 |
For example, using "-O2" for $CFLAGS indicates that "-fstrict-aliasing" is |
29 |
used, but it is not used with "-O1." |
30 |
|
31 |
It also shows that with "-O2" the option "-mno-sse4" is used, and so if |
32 |
you want to use SSE4 for certain programs (e.g. video, audio) you will |
33 |
need to specifically enable it. |
34 |
|
35 |
There may be an even slicker way to reveal the flags, but this is the |
36 |
only way I know. |
37 |
|
38 |
Frank Peters |