flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 09 Nov 2010, 13:24
drobole wrote: In what circumstances is fasm able to do the linking itself, and in what circumstances do you have to use an external linker? http://flatassembler.net/docs.php?article=manual#2.4 |
|||
![]() |
|
drobole 09 Nov 2010, 14:45
Thanks for the link
I managed to convert my testbed to an executable by adding executable to the format directive, out commenting the sections and adding a entry point Code: format ELF executable ;public main as 'main' entry _main ;section '.text' executable _main: mov edi, hello call print mov ebx, 0 call exit print: mov ebx, edi xor ecx, ecx xor al, al not ecx cld repne scasb not ecx dec ecx mov edx, ecx mov ecx, ebx mov eax, 4 mov ebx, 1 int 0x80 ret exit: mov eax, 1 int 0x80 ret ;section '.data' writable hello db "Hello, world",10,0 Is this good code or should I be using the segment directive or something like that? |
|||
![]() |
|
revolution 09 Nov 2010, 14:50
If you want to protect against potential buffer overflows and such like then you should probably use the sections with appropriate attributes. But otherwise it mostly doesn't matter if you mix code and data, the CPU can handle it.
|
|||
![]() |
|
drobole 09 Nov 2010, 14:52
revolution wrote: If you want to protect against potential buffer overflows and such like then you should probably use the sections with appropriate attributes. But otherwise it mostly doesn't matter if you mix code and data, the CPU can handle it. I see. Thanks again |
|||
![]() |
|
revolution 09 Nov 2010, 14:58
|
|||
![]() |
|
drobole 09 Nov 2010, 15:19
revolution wrote: BTW: Don't forget the bss section. This stuff is a bit over my head still but if I get it right, earlier versions of the linux kernel would choke on any not writable .bss sections? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.