Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Question about CFLAGS and CXXFLAGS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
gexarcha
n00b
n00b


Joined: 01 May 2010
Posts: 3

PostPosted: Fri Jun 04, 2010 10:09 am    Post subject: Question about CFLAGS and CXXFLAGS Reply with quote

I am a new user of gentoo and I noticed something that made me a little curious.
I installed gentoo on an samsung n130 netbook with an atom processor.
I looked at the gcc manual an I saw that the -march option could be changed with the -mtune option for some architectures.
And atom processors are only mentioned in the as a value for the -mtune option.
so I used this:
CFLAGS="-O2 -mtune=atom"
in my make.conf file.
I didn't have a problem compiling the kernel like that but I after I compiled the kernel I couldn't emerge any other package (it crashed when compilation started) unless I changed the CFLAGS to this:
CFLAGS="-O2 -march=i686"

I used the same CXXFLAGS in both cases and I don't use -pipe because I only have 1 GB RAM.
I used a lot of variations of USE flags and it is still the same.

I am writing this post to understand the purpose of this behavior?
What would happen if I wrote -march=atom?
Why does the gentoo handbook recommend -march and the gcc manual focuses so much on -mtune?
I don't know where to look for information on this so please recommend some websites or books?
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Fri Jun 04, 2010 10:44 am    Post subject: Reply with quote

The kernel build system ignores make.conf because the CFLAGS are chosen by the Processor Type and Features in menuconfig.

You should have checked config.log as emerge told you. -march implies -mtune, and -march=atom is supported since gcc 4.5.0. Use -march=native so gcc automatically chooses the optimal march. Unless you use distcc, that is.
Using -pipe on a 1 GB system should be ok.
Back to top
View user's profile Send private message
gexarcha
n00b
n00b


Joined: 01 May 2010
Posts: 3

PostPosted: Fri Jun 04, 2010 5:24 pm    Post subject: Reply with quote

thank you for your quick response chithanh.

I just tried -march=atom and it doesn't work but -march=native does.

Do you know why -march=atom doesn't work?
My system works now but I am still curious.


I am not using -pipe because I think it only matters in compile time not the result.
Is that right?

I took every step that emerge suggests but I couldn't figure out what the problem was.
I still don't see the reason why -mtune=atom doesn't work.
I couldn't figure out the config.log.
(I think it was a file with something like compiler errors and warnings
I don't remember very well because the last time I looked was a few of weeks ago).
It was very big and it was constantly mentioning the CFLAGS.
That's why I focused there and not something else.

This is my second gentoo installation.
The first one was on virtual box and I didn't use it very much so I don't know a lot about gentoo.
I can use any information that you can provide.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Fri Jun 04, 2010 7:06 pm    Post subject: Reply with quote

-march=atom is supported since gcc-4.5.0, earlier versions do not recognize this option. Check "gcc-config -l" and the gcc manpage for supported -march values if in doubt.
Back to top
View user's profile Send private message
gexarcha
n00b
n00b


Joined: 01 May 2010
Posts: 3

PostPosted: Fri Jun 04, 2010 7:37 pm    Post subject: Reply with quote

I see thank you
Back to top
View user's profile Send private message
phajdan.jr
Retired Dev
Retired Dev


Joined: 23 Mar 2006
Posts: 1777
Location: Poland

PostPosted: Sat Jun 05, 2010 8:00 am    Post subject: Reply with quote

Please consider running "emerge -e world" after playing with CFLAGS. I've seen you mentioned some crashes/errors. Re-emerging all packages with now known to be working CFLAGS may save you some mysterious trouble later. :wink:
_________________
http://phajdan-jr.blogspot.com/
Back to top
View user's profile Send private message
bendeguz
Apprentice
Apprentice


Joined: 10 Feb 2010
Posts: 189

PostPosted: Wed Jun 23, 2010 11:39 pm    Post subject: Reply with quote

Hi!

Does the -Os CFLAGS option have some security risks? Or it can cause "only" instability?

Is it wise to use -fstack-protector-all on a hardened system? So far glibc doesn't like this option. Should I compile glibc without it and the rest with the option enabled?

(This is just my home machine, but I wouldn't like to reinstall from scratch :) )

Edit: I've read that -fstack-protector-all is enabled by default on hardened. So this means I have a working SSP by default?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum