LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-11-2005, 10:43 AM   #1
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Default/Undefined CFLAGS?


Let's say I built something from source but had no CFLAGS defined globally. What would the resulting binaries be? They would have been compiled on an i686 cpu more than likely but no -march, -mtune or -mcpu options are defined anywhere. Will gcc automatically default to i386 or would it somehow be a 'noarch' even tho binaries are involved?

Thanks!

Last edited by jong357; 03-11-2005 at 10:45 AM.
 
Old 03-11-2005, 11:09 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
gcc -v
cat /usr/lib/gcc-lib/i486-slackware-linux/3.3.5/specs
 
Old 03-11-2005, 11:29 AM   #3
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Original Poster
Rep: Reputation: 52
Ummm..... O.k... So, what would the binaries be?
cating the spec file spits out jibberish beyond reason.

[root@darkstar /work] gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1
 
Old 03-11-2005, 12:03 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
It's not well documented, but I am pretty sure that you can add your own compile default
flags in the specs file.

If no -march or -mcpu flags are given to gcc I would think your gcc version default it to i686 as
from your output ' i686-pc-linux-gnu '

Did you compile your gcc package, as the output from the slackware gcc is slightly different

keefaz@darkstar:~$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.5/specs
Configured with: ../gcc-3.3.5/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux
Thread model: posix
gcc version 3.3.5
 
Old 03-11-2005, 12:57 PM   #5
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Original Poster
Rep: Reputation: 52
I did compile it myself. Running a Slack/Arch hybrid at the moment. This is more of a curiosity than anything. I set a global CFLAGS and CXXFLAGS of -march=i686 -pipe -O2 but I was really curious what gcc will do on it's own if no CFLAGS are defined globally or in any given Makefile. You would think that the resulting binary should still run on an i386 arch if you didn't tell it to optimize for any given arch. It should pick the lowest common denominator... Thats just my guess anyway...

Anyone know how to test a binary file to see what arch it will run on?
 
Old 03-11-2005, 01:15 PM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I would think it is hard to figure out, the commands :

file /path/to/your/program
-->will just report the architecture and some stuff

strings /path/to/your/program
-->will output all strings found in the program (compiler and linker path, version, and more...)

Other than that a good assembly knowledge is required if you want to find which
with flags the program was compiled by dissassemble it and even in this case I would think
you won't find all flags infos
 
Old 03-11-2005, 01:59 PM   #7
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Original Poster
Rep: Reputation: 52
Interesting... Well, thanks. I let this one snow ball in my mind. I suppose it doesn't really matter tho I'd still like to know. It may be one of the unexplained mysteries of the universe...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
export CFLAGS GCC help TieN Programming 2 06-17-2005 03:24 AM
cflags exodist Linux - Software 2 01-14-2005 07:44 PM
Using CFLAGS and other options vexer Linux From Scratch 7 08-18-2004 09:04 AM
CFLAGS library -l and -i abs Programming 2 04-11-2004 10:03 PM
how to unset cflags? shanenin Linux - Software 4 01-25-2004 09:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration