Code: Select all
void start() {
init_memory();
char* str = "Hello world";
print_s(str);
}
void print_s(char*s)
{
put_c(s[0]);
}
When i execute code, instead of printing 'H' i get nothing on screen.
dump of obj
Code: Select all
Disassembly of section .text:
00000000 <start>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 28 sub $0x28,%esp
6: e8 fc ff ff ff call 7 <start+0x7>
7: R_386_PC32 init_memory
b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
e: R_386_32 .rodata
12: 8b 45 f4 mov -0xc(%ebp),%eax
15: 89 04 24 mov %eax,(%esp)
18: e8 fc ff ff ff call 19 <start+0x19>
19: R_386_PC32 print_s
1d: c9 leave
1e: c3 ret
Disassembly of section .rodata:
00000000 <.rodata>:
0: 48 dec %eax
1: 65 6c gs insb (%dx),%es:(%edi)
3: 6c insb (%dx),%es:(%edi)
4: 6f outsl %ds:(%esi),(%dx)
5: 20 77 6f and %dh,0x6f(%edi)
8: 72 6c jb 76 <start+0x76>
a: 64 fs
...
UPD: with
Code: Select all
char str[] = "Hello world"
Code: Select all
char*