Someone should correct me when I'm wrong.
Quoted 2 lines
Your program is loaded a little bit above address
0x80000000,
I can't believe no one caught that... Linux programs load a little bit above 0x08000000, not 0x80000000.
The exact address is 0x08048080. Thus there's almost 3GB of space between the program and the stack.
Hopefully that's all that I got wrong.
Hello,
Quoted 5 lines · --- Richard Cooper
Quoted 2 lines
Your program is loaded a little bit above address
0x80000000,I can't believe no one caught that...
no one cares to count zeroes I believe.
Quoted 4 lines
Linux programs load a little bit above
0x08000000, not0x80000000.The exact address is
0x08048080.
This address is not set in stone.
Try this one (the asm file is just a random example):
$ cat prova2.asm
BITS 32
GLOBAL _start
SECTION .text
_start:
mov eax, 4
mov ebx, 1
mov ecx, erase_screen
mov edx, 4 int 0x80
mov eax, 4
mov ecx, string
mov edx, 7
int 0x80
mov eax, 1
xor ebx, ebx
int 0x80
SECTION .data
erase_screen: db 1bh, '[2J' string: db 'Hello!', 0ah
SECTION .bss
$ nasm -f elf -o prova2.o prova2.asm $ ld --section-start .text=0x1000 --section-start .data=0x10000 prova2.o
$ objdump -h a.out
a.out: file format elf32-i386
Sections:
Idx Name Size VMA LMA File
off Algn
0 .text 00000030 00001000 00001000
00001000 2**4
CONTENTS, ALLOC, LOAD, READONLY,
CODE
1 .data 0000000b 00010000 00010000
00002000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .got.plt 00000000 00002000 000020000000200b 2**0
CONTENTS
3 .bss 00000000 0001000c 0001000c0000200b 2**2
ALLOC
4 .comment 0000001f 00000000 000000000000200b 2**0
CONTENTS, READONLY
Bye,
Claudio
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com