compile and link using 'as' and 'ld' for x86 [solved]

Don´t be shy, Linux is fun! =)
Post Reply
User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

compile and link using 'as' and 'ld' for x86 [solved]

Post by maboroshi »

I have done some research into why I am geting a segfault in my code. It seems to have to do with compiling for the right architecture, I figured I would ask how do I compile and link using 'as' and 'ld' for x86 on x86_64. :-)

Edit: solved my problem the method is,

Code: Select all

as --32 filename.s -o filename.o
ld -melf_i386 -o filename filename.o
*cheers

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Re: compile and link using 'as' and 'ld' for x86 [solved]

Post by ayu »

Good work :D
"The best place to hide a tree, is in a forest"

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Re: compile and link using 'as' and 'ld' for x86 [solved]

Post by maboroshi »

Just a note :D

Code: Select all

as --32 net_test.s -o net_test.o 
and

Code: Select all

gcc -m32 net_test.o -o net_test

Post Reply