flat assembler
Message board for the users of flat assembler.

Index > Linux > 64 bit source samples and ELF64 executables

Author
Thread Post new topic Reply to topic
Feryno



Joined: 23 Mar 2005
Posts: 448
Location: Czech republic, Slovak republic
Feryno
This is it:

http://feryno.host.sk/linux/asm_amd64_linux64.tar.bz2

Sources for fasm, yasm and feature nasm release with 64 bit support.
Working ELF64 programs.
Method for debugging ELF64 by gdb.
Linux syscall number list (thanx for it guys...).

Please mail me if you interess about 64 bit asm linux. Mail address is at homepage.
Post 23 Mar 2005, 07:22
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7420
Location: Kraków, Poland
Tomasz Grysztar
Remember that in fasm you should generally use = where you used EQU with NASM. fasm's EQU has a different meaning and is more like NASM's %XDEFINE (and it cannot be forward-referenced because of that).

Hmmm... maybe I should make some comparision table of equivalent syntax structures for different assemblers.
Post 23 Mar 2005, 08:19
View user's profile Send private message Visit poster's website Reply with quote
drs



Joined: 20 Jan 2005
Posts: 17
Location: Southern California, USA
drs
The link is down? Did anyone mirror the archive?

Thanks...
Post 24 Mar 2005, 15:37
View user's profile Send private message ICQ Number Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
The link is up, if yu recibe a forbided message, best press return enter in the direction bar, because the server have a switch somewhere for let or not let link directly to that space Wink.
Post 24 Mar 2005, 16:55
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 448
Location: Czech republic, Slovak republic
Feryno
You can download file from homepage
http://feryno.host.sk
link name is ELF64 executables
Post 25 Mar 2005, 11:48
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
privalov, that would be a great addition to the documentation
Post 25 Mar 2005, 21:46
View user's profile Send private message Reply with quote
hyrax



Joined: 05 Apr 2005
Posts: 1
hyrax
I tried the simple examples that came with fasm 1.60 and they segfaulted until I made the executable section writeable.

fasm itself does not make it's executable section writeable, yet I can assemble it and use the resulting fasm, and it works just fine.

If I omit the sections (or add writeable to the executable ones) I can get the 64 and 32 examples to work.

I'm running Linux version 2.6.11-gentoo-r2 (gcc version 3.4.3 20041125) 64 bit only. (I don't have any 32 bit gcc toolchain and glibc installed)
Post 05 Apr 2005, 02:37
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 448
Location: Czech republic, Slovak republic
Feryno
That's right. I had too much segfaults before create first good executable without segfault.
The advantage of asm coding is: for executable, it's enough to make 1 section only. You need set flags: exec, read, write to it. This make possibility to use one section for exec code as well writeable data segment mixed together. Unitialized data don't need section, udata is created with size defined in ELF64:
p_memsz - p_filesz
p_memsize = size codeseg+dataseg+udataseg
p_filesize = size codeseg+dataseg
udata is filled with zero bytes when Linux load executable befor jump to it's executable code.
Because writeable flag for exec segment, this prevent seg fault.

When you make ELF64 executable with 2 or more sections, you mustn't omit to make executable section writeable. If no - this make seg fault. I don't know why... Executable segment don't need be writeable. Exec and read privileges enough for it. For security it's better when exec seg is readable only, no writeable. This disable overwriting instructions. But asm coder need sometimes self-modifying exec code (e.g. antidebug protections...) and this is possible by 2 ways - executable segment with exec, read and WRITE flags, or use syscall _mprotect to set writeable flag.

For all my projects, 1 section is enough, so i make only 1 segment to store executable code and writeable data with exec, read, write flags. Uninitialized data section follow with zero padding created with size (p_memsz - p_filesz). For detailed header structure, see yasm/1st/header64.asm in my source examples ELF64 executables (asm_amd64_linux64.tar.bz2) at http://feryno.host.sk.

Good luck in great ASM64 coding under Linux, guys!
Feryno
Post 07 Apr 2005, 06:37
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.