Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
32-bit Athlon 64 CFLAGS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Duplicate Threads
View previous topic :: View next topic  
Author Message
NarGemini
n00b
n00b


Joined: 14 Apr 2005
Posts: 14

PostPosted: Thu Apr 14, 2005 11:03 pm    Post subject: 32-bit Athlon 64 CFLAGS Reply with quote

What CFLAGS should I use if I want a 32-bit only system with an Athlon 64 processor? Would this work:

Code:
CFLAGS="-march=athlon64 -m32 -O2 -pipe"


According to the GCC documentation, -m32/-m64 does this:

GCC Docs wrote:
-m32
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture.


Would -march=athlon64 automatically force -m64, or will -m32 override it?
_________________
[insert witty Linux-related quote here]
Back to top
View user's profile Send private message
Lucky B
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 235
Location: Florida

PostPosted: Thu Apr 14, 2005 11:09 pm    Post subject: Reply with quote

I am pretty sure -m32 overrides it. It's the way I've been doing 32-bit stuff and it seems to work. (might be dumb luck)
Back to top
View user's profile Send private message
NarGemini
n00b
n00b


Joined: 14 Apr 2005
Posts: 14

PostPosted: Thu Apr 14, 2005 11:11 pm    Post subject: Reply with quote

Cool, thanks a lot! Is there any way to verify whether or not it worked (check if it compiled for x86 or x86_64)?
_________________
[insert witty Linux-related quote here]
Back to top
View user's profile Send private message
Lucky B
Apprentice
Apprentice


Joined: 01 Apr 2005
Posts: 235
Location: Florida

PostPosted: Thu Apr 14, 2005 11:29 pm    Post subject: Reply with quote

one way I can test it is compiling:

Code:

#include <stdio.h>
#include <stdlib.h>

int main ()
{
printf("int : %d : * : %d\nchar : %d : * : %d\nfloat : %d : * : %d\n", sizeof(int), sizeof(int*), sizeof(char), sizeof(char*), sizeof(float), sizeof(float*) );
return 1;
}


with and without the flag and seeing if there is a difference (all the pointers should change size).

Right now I am not on my machine, but I will be in 20 or so minutes, yay work over.


EDIT:
Code:

luckyb@beast ~ $ gcc -march=athlon64 -m32 sizeof.c -o sizeof
luckyb@beast ~ $ ./sizeof
int : 4 : * : 4
char : 1 : * : 4
float : 4 : * : 4
luckyb@beast ~ $ gcc -march=athlon64 sizeof.c -o sizeof
luckyb@beast ~ $ ./sizeof
int : 4 : * : 8
char : 1 : * : 8
float : 4 : * : 8



-march=athlon64 didn't have any effect (it's set globaly)
Back to top
View user's profile Send private message
Deathwing00
Bodhisattva
Bodhisattva


Joined: 13 Jun 2003
Posts: 4087
Location: Dresden, Germany

PostPosted: Fri Apr 15, 2005 12:20 am    Post subject: Reply with quote

Moved to Duplicate Threads in favor of https://forums.gentoo.org/viewtopic-t-177670.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Duplicate Threads 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