Gcc64 => 32bit

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Code

Gcc64 => 32bit

Post by Code »

Hello, i downloaded a 64bit cross gcc for cygwin.(http://aireos.com/)
Is there a compiler option to generate 32bit code ?
zyp

Re:Gcc64 => 32bit

Post by zyp »

-m32
Code

Re:Gcc64 => 32bit

Post by Code »

xgcc -m32 -c init.c
Assembler messages:
FATAL: can't create init.o: Invalid bfd target
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Gcc64 => 32bit

Post by Pype.Clicker »

i suggest you try "gcc -dumpspecs" and "ld --specs" make sure your copy of gcc/binutils support the model you're trying to use.
Code

Re:Gcc64 => 32bit

Post by Code »

Hello, can anyone tell me how to build a cross gcc for 32bit & 64bit in one compiler on cygwin ?
Code

Re:Gcc64 => 32bit

Post by Code »

Hello, i installed Linux Slamd64 today.
I tried use -m32 -m64 both are working with gcc.
Now i want link -m32 object file
ld -Ttext 0x10000 --oformat binary test.o

"ld: warning: i386 architecture of input file `yeah.o' is incompatible with i386:x86-64 output"

A binary file is generated.
If i compile with gcc -m32 to a.out there are no warnings

Is the generated binary file 32bit ?
proxy

Re:Gcc64 => 32bit

Post by proxy »

a good way to test what type of binary a file is with the "file" command:

example:

Code: Select all

$ file /usr/bin/test
/usr/bin/test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.5, dynamically linked (uses shared libs), stripped
proxy
Post Reply