mingw ld ouput binary

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
ym
Posts: 8
Joined: Thu Mar 24, 2011 2:05 am

mingw ld ouput binary

Post by ym »

under mingw using ld run like :
ld -oformat binary -Ttext 0 -o test.bin test.o
the command could not work.
but in linux it work good, maybe mingw build a elf cross toolchain should be ok, so i try to compile i386-elf binutils under mingw.


i use binutil-2.10.1 and configure like:

Code: Select all

./configure  --target=i386-elf
make 
make install
after build it , i wrote test.s:

Code: Select all

.code16
.text

.global _start

_start:
    movw %cs, %ax
    movw %ax, %es
    movw %ax, %ds
    movw %ax, %ss
    call printstr
    jmp     _exit
loop1: jmp loop1

printstr:
	mov $0x9, %ah
	mov $test01mesg, %dx
	int $0x21

_exit:
    movw    $0x4c00, %ax 
    int     $0x21

test01mesg:    .byte 13, 10
         .ascii "test$"
and compile it use the i386-elf cross tool

Code: Select all

i386-elf-as -o  test.o test.s
i386-elf-ld  --oformat binary -Ttext 0x100  -o test.com test.o
the ld -oformat work .

put the test.com into dos, run test.com it can print the test on screen.
Last edited by ym on Thu Mar 24, 2011 6:57 am, edited 4 times in total.
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: mingw ld ouput binary

Post by Chandra »

What????
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Re: mingw ld ouput binary

Post by os64dev »

ym what are you trying to say?

If it is a tutorial, I think most people here know how to program and google gives more detailed tutorials.
if it is not then i agree with Chandra; what ????

we do like information and help new members but could you provide a little more details on what you are trying to say or achieve?
Author of COBOS
ym
Posts: 8
Joined: Thu Mar 24, 2011 2:05 am

Re: mingw ld ouput binary

Post by ym »

os64dev wrote:ym what are you trying to say?

If it is a tutorial, I think most people here know how to program and google gives more detailed tutorials.
if it is not then i agree with Chandra; what ????

we do like information and help new members but could you provide a little more details on what you are trying to say or achieve?
sorry, i want to say:
compiled mingw elf cross tool , and using it link a object file generate a dos com program .
maybe english not so good, not say clearly.
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Re: mingw ld ouput binary

Post by os64dev »

ok, concrats then on your first OS development achievement.
Author of COBOS
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: mingw ld ouput binary

Post by Combuster »

A tip for all the other people reading this: use the last version :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply