Prblem with AT&T
Hi All !
I have got the below 16 bit code which is
in Intel Syntax .
----------- INTEL SYNTAX CODE ------------------------
entry start
start:
mov ah,#0x03 ; read cursor position. xor bh,bh int 0x10 mov cx,#26 ; length of our beautiful string. mov bx,#0x0007 ; page 0, attribute 7 (normal) mov bp,#mymsg mov ax,#0x1301 ; write string, move cursor int 0x10 loop1: jmp loop1
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"
---------------------------------------------
I am trying to write to the above code in
AT&T format as given below .
But I get the error in "ld" .
sect2.o: In function `_start':sect2.o(.text+0xd): relocation truncated to fit:R_386_16 data
-------------AT&T SYNTAX --------------------
.code16
.align 4
.data
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"
.text
.globl _start
_start:
movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $24,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10
loop1:
jmp loop1
----------------------------------------------
Please help me how to resolve this .
Regards
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
hi!
how are you today?
;-)
well, with your error code, I think that what i said yesterday was right:
your syntax at
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"
[...]
movw $mymsg,%bp
But as I don't know about At&t syntax, here is an example of good syntax
$ cat write.s .data hw: .string "hello world\n" .text .globl main main: movl $SYS_write,%eax movl $1,%ebx movl $hw,%ecx movl $12,%edx int $0x80 movl $SYS_exit,%eax xorl %ebx,%ebx int $0x80 ret
For At&t / intel syntax, please refer to:
www.linuxassembly.org
or more precisely:
http://www.linuxassembly.org/linasm.html
happy new year!
;-)
Fred
Quoted 86 lines · Anticipating a Reply
Hi All !
I have got the below 16 bit code which is
in Intel Syntax .----------- INTEL SYNTAX CODE ------------------------
entry start
start:
mov ah,#0x03 ; read cursor position. xor bh,bh int 0x10 mov cx,#26 ; length of our beautiful string. mov bx,#0x0007 ; page 0, attribute 7 (normal) mov bp,#mymsg mov ax,#0x1301 ; write string, move cursor int 0x10 loop1: jmp loop1mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"---------------------------------------------
I am trying to write to the above code in AT&T format as given below .
But I get the error in "ld" .
sect2.o: In function `_start':
sect2.o(.text+0xd): relocation truncated to fit:R_386_16data-------------AT&T SYNTAX --------------------
.code16
.align 4
.data
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts".text
.globl
_start
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $24,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10loop1:
jmp loop1----------------------------------------------
Please help me how to resolve this .
Regards
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Frederic !
I'am fine but got up late this morning ,
because of the beautiful dream .
The code you sent was for 32 bit mode
and I have passed the address in the same
manner to "bp" .
I think there is some other method to
pass the address to the " bp " for 16
bit mode which is OS independent .
Hope some AT&T 16 bit specialist
will rescue me out of this problem .
Waiting for the AT&T Robinhood to
help me out .
Harmony !
--- Frederic Marmond <[email protected]> wrote: >
hi!
Quoted 133 lines
how are you today?
;-)well, with your error code, I think that what i said yesterday was right:
your syntax atmymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"[...]
movw $mymsg,%bp
But as I don't know about At&t syntax, here is an
example of good syntax$ cat write.s .data hw: .string "hello world\n" .text .globl main main: movl $SYS_write,%eax movl $1,%ebx movl $hw,%ecx movl $12,%edx int $0x80 movl $SYS_exit,%eax xorl %ebx,%ebx int $0x80 retFor At&t / intel syntax, please refer to:
www.linuxassembly.org
or more precisely:
http://www.linuxassembly.org/linasm.htmlhappy new year!
;-)
FredQuoted 6 lines · Anticipating a Reply
Hi All !
I have got the below 16 bit code which is
in Intel Syntax .----------- INTEL SYNTAX CODE
------------------------
Quoted 63 lines
entry start
start:
mov ah,#0x03 ; read cursor position. xor bh,bh int 0x10 mov cx,#26 ; length of our beautiful string. mov bx,#0x0007 ; page 0, attribute 7 (normal) mov bp,#mymsg mov ax,#0x1301 ; write string, move cursor int 0x10 loop1: jmp loop1mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"---------------------------------------------
I am trying to write to the above code in
AT&T format as given below .But I get the error in "ld" .
sect2.o: In function `_start':
sect2.o(.text+0xd): relocation truncated to fit:R_386_16data-------------AT&T SYNTAX --------------------
.code16
.align 4
.data
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts".text
.globl
_start
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $24,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10Quoted 9 lines
loop1:
jmp loop1----------------------------------------------
Please help me how to resolve this .
Regards
________________________________________________________________________
Quoted 1 line
Want to sell your car? advertise on Yahoo Autos
Quoted 14 lines
Classifieds. It's Free!!
Quoted 3 lines
visit http://in.autos.yahoo.com
-
To unsubscribe from this list: send the line"unsubscribe linux-assembly" in
Quoted 2 lines
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Quoted 3 lines
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
Quoted 37 lines · Anticipating a Reply
But I get the error in "ld" .
sect2.o: In function `_start':
sect2.o(.text+0xd): relocation truncated to fit:R_386_16data-------------AT&T SYNTAX --------------------
.code16
.align 4
.data
mymsg:
.byte 13,10
.ascii "Handling BIOS interrupts".text
.globl
_start
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $24,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10
Quoted 2 lines
loop1:
jmp loop1
try ld like this:
ld -Ttext 0x0 -o beauty_str beauty_str.o
it works but You must set right "text" address - more useful to You than 0x0 in this example.
Regards
Signature · 1 line
Maciej Hrebien
Hi All !
I got the below code compiled , but it does not
give the desired results .
I have two modules , stored on a boot floppy .
The first module residing in the boot sector loads the second module ( residing
on second sector of floppy ) into RAM and transfers control to it . The Second module prints a string onto the screen .
All the relevant code is given below .
Please help this newbie find out , what the problem is ?
Thanks in Advance .
With Best Regards.
---------THE MAKEFILE --------
all : bsect sect2 write
bsect : bsect.o
ld -s -oformat binary -Ttext 0x000 -o bsect bsect.o
sect2 : sect2.o
ld -s -oformat binary -Ttext 0x500 -o sect2 sect2.o
bsect.o : bsect.s
as bsect.s -o bsect.o
sect2.o : sect2.s
as sect2.s -o sect2.o
write : write.c
cc write.c -o write
clean :
rm bsect.o sect2.o bsect sect2 write
------( Module 1) bsect.s - Boot sector code
----------
.code16
.globl _start
_start:
movw $0x500,%ax movw %ax,%es movw $0,%bx #segment offset movb $0,%dl #drive no. movb $0,%dh #head no. movb $0,%ch #track no. movb $2,%cl #sector no.( 1..18 ) movb $1,%al #no. of sectors tranferred movb $2,%ah #function no. int $0x13 ljmp $0x500,$0
-----(Module 2)sect2.s -Code in 2nd sector --------
.code16
.data
mymsg:
.byte 13,10 .ascii "Handling BIOS interrupts"
.text
.globl _start
_start:
movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $26,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10
loop1:
jmp loop1
------------ write.c ---------------------
/*
* Program to write to boot sector and
* desired code to second sector
*
*/
#include <sys/types.h> /* unistd.h needs this */ #include <unistd.h> /* contains read/write */ #include <fcntl.h>
int main()
{
char boot_buf[512];
int floppy_desc, file_desc;
file_desc = open("./bsect", O_RDONLY);
read(file_desc, boot_buf, 510);
close(file_desc);
boot_buf[510] = 0x55;
boot_buf[511] = 0xaa;
floppy_desc = open("/dev/fd0", O_RDWR);
lseek(floppy_desc, 0, SEEK_SET);
write(floppy_desc, boot_buf, 512);
file_desc = open("./sect2", O_RDONLY);
read(file_desc, boot_buf, 512);
close(file_desc);
lseek(floppy_desc, 512, SEEK_SET);
write(floppy_desc, boot_buf, 512);
close(floppy_desc); }
---------------------THE END ----------------------
--- Maciej Hrebien <[email protected]> wrote: >
Quoted 45 lines · Anticipating a Reply
Quoted 24 lines
But I get the error in "ld" .
sect2.o: In function `_start':
sect2.o(.text+0xd): relocation truncated to fit:R_386_16data-------------AT&T SYNTAX --------------------
.code16
.align 4
.data
mymsg:
.byte 13,10
.ascii "Handling BIOS interrupts".text
.globl
_startQuoted 7 lines
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $24,%cx # length of our beautifulstring.
Quoted 1 line
movw $0x0007,%bx # page 0, attribute 7(normal)
Quoted 2 lines
movw $mymsg,%bp movw $0x1301,%ax # write string, movecursor
Quoted 5 lines
int $0x10loop1:
jmp loop1try ld like this:
Quoted 16 lines
ld -Ttext
0x0-obeauty_strbeauty_str.oit works but You must set right "text" address - more useful to You than
0x0in this example.Regards
Signature · 7 lines
Maciej Hrebien - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
Quoted 6 lines · Anticipating a Reply
Hi All !
I got the below code compiled , but it does not
give the desired results .
Quoted 6 lines
I have two modules , stored on a boot floppy .
The first module residing in the boot sector loads the second module ( residing
on second sector of floppy ) into RAM and transfers control to it . The Second module prints a string onto the screen .
I've tried very similar code some time ago and all the information needed to assembly and link it properly i've found in "info as" & Linux's arch/i386/boot/Makefile. Try to study it, it's very interesting lecture ;)
Quoted 3 lines
All the relevant code is given below .
Please help this newbie find out , what the problem is ?
I've chceck it. bsect.s, sect2.s & write.c are OK but Makefile is wrong! Please look below.
Quoted 6 lines
---------THE MAKEFILE --------
all : bsect sect2 write
bsect : bsect.o
ld -s -oformat binary -Ttext 0x000 -o bsect bsect.o
ld --oformat binary -Ttext 0x0 -o bsect bsect.o
^^ 2 "-" are needed & "-s" isn't useful for us
Quoted 2 lines
sect2 : sect2.o
ld -s -oformat binary -Ttext 0x500 -o sect2 sect2.o
ld --oformat binary -Ttext 0x0 -Tdata 0x1c -o sect2 sect2.o
The same thing with "-" & "-s". The text section in this "module" begins at 0x0 address and the data section is 0x1c bytes after text section. This is needed to properly do:
mov $mymsg,%bp
and see the beautiful string :)
Hope I helped You, regards
Quoted 104 lines
bsect.o : bsect.s
as bsect.s -o bsect.osect2.o : sect2.s
as sect2.s -o sect2.owrite :
write.c
ccwrite.c-o writeclean :
rm bsect.o sect2.o bsect sect2 write------( Module 1) bsect.s - Boot sector code
----------.code16
.globl
_start
_start:movw $0x500,%ax movw %ax,%es movw $0,%bx #segment offset movb $0,%dl #drive no. movb $0,%dh #head no. movb $0,%ch #track no. movb $2,%cl #sector no.( 1..18 ) movb $1,%al #no. of sectors tranferred movb $2,%ah #function no. int $0x13 ljmp $0x500,$0-----(Module 2)sect2.s -Code in 2nd sector --------
.code16
.data
mymsg:
.byte 13,10
.ascii "Handling BIOS interrupts"
.text.globl
_start
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $26,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10loop1:
jmp loop1------------
write.c---------------------/*
* Program to write to boot sector and
* desired code to second sector
*
*/#include <
sys/types.h> /*unistd.hneeds this */ #include <unistd.h> /* contains read/write */ #include <fcntl.h>int
main(){ char boot_buf[512]; int floppy_desc, file_desc; file_desc = open("./bsect", O_RDONLY); read(file_desc, boot_buf, 510); close(file_desc); boot_buf[510] = 0x55; boot_buf[511] = 0xaa; floppy_desc = open("/dev/fd0", O_RDWR); lseek(floppy_desc, 0, SEEK_SET); write(floppy_desc, boot_buf, 512); file_desc = open("./sect2", O_RDONLY); read(file_desc, boot_buf, 512); close(file_desc); lseek(floppy_desc, 512, SEEK_SET); write(floppy_desc, boot_buf, 512); close(floppy_desc);}
---------------------THE END ----------------------
Signature · 1 line
Maciej Hrebien
Quoted 6 lines · Anticipating a Reply
Hi All !
I got the below code compiled , but it does not
give the desired results .
Quoted 6 lines
I have two modules , stored on a boot floppy .
The first module residing in the boot sector loads the second module ( residing
on second sector of floppy ) into RAM and transfers control to it . The Second module prints a string onto the screen .
I've tried very similar code some time ago and all the information needed to assembly and link it properly i've found in "info as" & Linux's arch/i386/boot/Makefile. Try to study it, it's very interesting lecture ;)
Quoted 3 lines
All the relevant code is given below .
Please help this newbie find out , what the problem is ?
I've chceck it. bsect.s, sect2.s & write.c are OK but Makefile is wrong! Please look below.
Quoted 6 lines
---------THE MAKEFILE --------
all : bsect sect2 write
bsect : bsect.o
ld -s -oformat binary -Ttext 0x000 -o bsect bsect.o
ld --oformat binary -Ttext 0x0 -o bsect bsect.o
^^ 2 "-" are needed & "-s" isn't useful for us
Quoted 2 lines
sect2 : sect2.o
ld -s -oformat binary -Ttext 0x500 -o sect2 sect2.o
ld --oformat binary -Ttext 0x0 -Tdata 0x1c -o sect2 sect2.o
The same thing with "-" & "-s". The text section in this "module" begins at 0x0 address and the data section is 0x1c bytes after text section. This is needed to properly do:
mov $mymsg,%bp
and see the beautiful string :)
Hope I helped You, regards
Quoted 104 lines
bsect.o : bsect.s
as bsect.s -o bsect.osect2.o : sect2.s
as sect2.s -o sect2.owrite :
write.c
ccwrite.c-o writeclean :
rm bsect.o sect2.o bsect sect2 write------( Module 1) bsect.s - Boot sector code
----------.code16
.globl
_start
_start:movw $0x500,%ax movw %ax,%es movw $0,%bx #segment offset movb $0,%dl #drive no. movb $0,%dh #head no. movb $0,%ch #track no. movb $2,%cl #sector no.( 1..18 ) movb $1,%al #no. of sectors tranferred movb $2,%ah #function no. int $0x13 ljmp $0x500,$0-----(Module 2)sect2.s -Code in 2nd sector --------
.code16
.data
mymsg:
.byte 13,10
.ascii "Handling BIOS interrupts"
.text.globl
_start
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $26,%cx # length of our beautiful string. movw $0x0007,%bx # page 0, attribute 7 (normal) movw $mymsg,%bp movw $0x1301,%ax # write string, move cursor int $0x10loop1:
jmp loop1------------
write.c---------------------/*
* Program to write to boot sector and
* desired code to second sector
*
*/#include <
sys/types.h> /*unistd.hneeds this */ #include <unistd.h> /* contains read/write */ #include <fcntl.h>int
main(){ char boot_buf[512]; int floppy_desc, file_desc; file_desc = open("./bsect", O_RDONLY); read(file_desc, boot_buf, 510); close(file_desc); boot_buf[510] = 0x55; boot_buf[511] = 0xaa; floppy_desc = open("/dev/fd0", O_RDWR); lseek(floppy_desc, 0, SEEK_SET); write(floppy_desc, boot_buf, 512); file_desc = open("./sect2", O_RDONLY); read(file_desc, boot_buf, 512); close(file_desc); lseek(floppy_desc, 512, SEEK_SET); write(floppy_desc, boot_buf, 512); close(floppy_desc);}
---------------------THE END ----------------------
Signature · 1 line
Maciej Hrebien
Hello Maciej !
Thanks for your help , and the code
now works fine .
Can you please help me understand how
you decided the addresses to use for
the text and data section .
I could not figure out how you
decided to use specifically 0x1c
for the data section .
Can you please explain what addresses
are these referring to ?
Thanks in Advance .
With Regards
ld --oformat binary -Ttext 0x0 -Tdata 0x1c -o sect2 sect2.o
--- Maciej Hrebien <[email protected]> wrote: >
Quoted 161 lines · Anticipating a Reply
Quoted 6 lines
Hi All !
I got the below code compiled , but it does not
give the desired results .Quoted 6 lines
I have two modules , stored on a boot floppy .
The first module residing in the boot sector loads the second module ( residing
on second sector of floppy ) into RAM and transfers control to it . The Second module prints a string onto the screen .I've tried very similar code some time ago and all the information
needed to assembly and link it properly i've found in "info as" &
Linux'sarch/i386/boot/Makefile. Try to study it, it's very interesting
lecture ;)Quoted 3 lines
All the relevant code is given below .
Please help this newbie find out , what the problem is ?I've chceck it. bsect.s, sect2.s &
write.care OK butMakefileis wrong!
Please look below.Quoted 6 lines
---------THE MAKEFILE --------
all : bsect sect2 write
bsect : bsect.o
ld -s -oformat binary -Ttext 0x000 -obsect bsect.o
ld --oformat binary -Ttext
0x0-o bsect bsect.o^^ 2 "-" are needed & "-s" isn't useful for us
Quoted 2 lines
sect2 : sect2.o
ld -s -oformat binary -Ttext 0x500 -osect2 sect2.o
ld --oformat binary -Ttext
0x0-Tdata0x1c-o sect2 sect2.oThe same thing with "-" & "-s". The text section in this "module" begins
at0x0address and the data section is0x1cbytes after text section.
This is needed to properly do:mov $mymsg,%bp
and see the beautiful string :)
Hope I helped You, regards
Quoted 34 lines
bsect.o : bsect.s
as bsect.s -o bsect.osect2.o : sect2.s
as sect2.s -o sect2.owrite :
write.c
ccwrite.c-o writeclean :
rm bsect.o sect2.o bsect sect2 write------( Module 1) bsect.s - Boot sector code
----------.code16
.globl
_start
_start:movw $0x500,%ax movw %ax,%es movw $0,%bx #segment offset movb $0,%dl #drive no. movb $0,%dh #head no. movb $0,%ch #track no. movb $2,%cl #sector no.( 1..18 ) movb $1,%al #no. of sectors tranferred movb $2,%ah #function no. int $0x13 ljmp $0x500,$0Quoted 1 line
-----(Module 2)sect2.s -Code in 2nd sector
--------
Quoted 12 lines
.code16
.data
mymsg:
.byte 13,10
.ascii "Handling BIOS interrupts"
.text.globl
_startQuoted 7 lines
_start:movb $0x03,%ah # read cursor position. xor %bh,%bh int $0x10 movw $26,%cx # length of our beautifulstring.
Quoted 1 line
movw $0x0007,%bx # page 0, attribute 7(normal)
Quoted 2 lines
movw $mymsg,%bp movw $0x1301,%ax # write string, movecursor
Quoted 40 lines
int $0x10loop1:
jmp loop1------------
write.c---------------------/*
* Program to write to boot sector and
* desired code to second sector
*
*/#include <
sys/types.h> /*unistd.hneeds this */ #include <unistd.h> /* contains read/write */ #include <fcntl.h>int
main(){ char boot_buf[512]; int floppy_desc, file_desc; file_desc = open("./bsect", O_RDONLY); read(file_desc, boot_buf, 510); close(file_desc); boot_buf[510] = 0x55; boot_buf[511] = 0xaa; floppy_desc = open("/dev/fd0", O_RDWR); lseek(floppy_desc, 0, SEEK_SET); write(floppy_desc, boot_buf, 512); file_desc = open("./sect2", O_RDONLY); read(file_desc, boot_buf, 512); close(file_desc);
Quoted 17 lines
Quoted 7 lines
lseek(floppy_desc, 512, SEEK_SET); write(floppy_desc, boot_buf, 512); close(floppy_desc);}
---------------------THE END
----------------------
Signature · 7 lines
Maciej Hrebien - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
Quoted 6 lines · Anticipating a Reply
Hello Maciej !
Thanks for your help , and the code
now works fine .
Quoted 7 lines
Can you please help me understand how
you decided the addresses to use for
the text and data section .I could not figure out how you
decided to use specifically0x1c
for the data section .
Oops! It should be 0x18, sorry! ;) 0x1c works too but it adds 4 zeros (as a padding) at the end of text section and You don't need it, do You?
Quoted 9 lines
Can you please explain what addresses
are these referring to ?Thanks in Advance .
With Regards
ld --oformat binary -Ttext
0x0-Tdata0x1c-o sect2 sect2.o
The "-Ttext" and "-Tdata" options tell the linker what is the base address of text and data segment of the output file (man ld). ld links Your code in binary format so it's good to tell him how he must "look" at the code to link it as You wish. In Your "module" there is nothing before text section, it's the first section, so the starting address is set to 0x0. 0x18 bytes (or 0x1c in the fat version ;)) after text section there is the data section which holds the beautiful string. You must tell ld explicitly where it is to avoid default behavior which i think isn't good for You (pad with 0x1000 zeros!). Keep in mind that You are working with binary format and You are decideing how the result of linking looks.
Regards
Signature · 1 line
Maciej Hrebien
Hi Maciej !
Thanks for clearing the doubt .
I had checked the sect2.o file using
objdump -h , and got confused with the
difference in the text address locations .
Your explanation has made things clear .
Have a nice time .
Cheers !
--- Maciej Hrebien <[email protected]> wrote: >
Quoted 52 lines · Anticipating a Reply
Quoted 6 lines
Hello Maciej !
Thanks for your help , and the code
now works fine .Quoted 7 lines
Can you please help me understand how
you decided the addresses to use for
the text and data section .I could not figure out how you
decided to use specifically0x1c
for the data section .Oops! It should be
0x18, sorry! ;)0x1cworks too
but it adds 4 zeros
(as a padding) at the end of text section and You
don't need it, do You?Quoted 8 lines
Can you please explain what addresses
are these referring to ?Thanks in Advance .
With Regards
ld --oformat binary -Ttext
0x0-Tdata0x1c-osect2
Quoted 1 line
sect2.o
The "-Ttext" and "-Tdata" options tell the linker what is the base
address of text and data segment of the output file (man ld). ld links
Your code in binary format so it's good to tell him how he must "look"
at the code to link it as You wish. In Your "module" there is nothing
before text section, it's the first section, so the starting address is
set to0x0.0x18bytes (or0x1cin the fat version ;)) after text
section there is the data section which holds the beautiful string. You
must tell ld explicitly where it is to avoid default behavior which i
think isn't good for You (pad with0x1000zeros!). Keep in mind that You
are working with binary format and You are decideing how the result of
linking looks.
Quoted 10 lines
Regards
Signature · 7 lines
Maciej Hrebien - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com