flat assembler
Message board for the users of flat assembler.
Index
> Linux > 64bit..? |
Author |
|
kohlrak 27 Apr 2008, 03:55
No more giving back...
Last edited by kohlrak on 07 Aug 2008, 14:51; edited 1 time in total |
|||
27 Apr 2008, 03:55 |
|
gunblade 27 Apr 2008, 22:11
I know you mentioned you found some answers to it, but just in case your looking for more, there are some linux 64-bit examples on the example section of the fasm site: http://flatassembler.net/examples/fasm_amd64_linux64_samples.tar.gz
(Ignore the fact that it says "AMD64", its just 64-bit and will run on both intel and amd 64-bit processors) Very useful examples. |
|||
27 Apr 2008, 22:11 |
|
mattst88 28 Apr 2008, 02:10
I've got some example x86-64 code in my git repo. It uses libc functions also.
http://git.mattst88.com/x86_64-assembly/ Also, check out the x86-64 ABI for calling convention information. Last edited by mattst88 on 09 Feb 2013, 23:31; edited 1 time in total |
|||
28 Apr 2008, 02:10 |
|
kohlrak 28 Apr 2008, 07:39
No more giving back...
Last edited by kohlrak on 07 Aug 2008, 14:51; edited 1 time in total |
|||
28 Apr 2008, 07:39 |
|
LocoDelAssembly 28 Apr 2008, 16:18
Quote:
Sorry, I don't have the link but I'm pretty sure I read somewhere that this bug was intruduced because of a fix on a vulnerability with ELFs. Anyway, this bug was fixed long time ago and surely Ubuntu comes with a newer enough kernel. |
|||
28 Apr 2008, 16:18 |
|
kohlrak 29 Apr 2008, 03:50
No more giving back...
Last edited by kohlrak on 07 Aug 2008, 14:52; edited 2 times in total |
|||
29 Apr 2008, 03:50 |
|
Endre 29 Apr 2008, 12:06
I changed you libcdemo for 64bit system. It uses strict AMD64 ABI, however gcc would merely use 32 bit registers for passing parameters.
Code: ; fasm example of using the C library in Linux ; compile the source with commands like: ; fasm libcdemo.asm ; gcc -s libcdemo.o -o libcdemo format ELF64 section '.text' executable public main extrn printf extrn getpid main: push rbp mov rbp, rsp call getpid mov rdi, msg ; message pointer mov rsi, rax ; pid mov rax, 0 ; count of sse registers passed call printf leave ret section '.data' writeable msg db "Current process ID is %d.", 0xa, 0 |
|||
29 Apr 2008, 12:06 |
|
kohlrak 29 Apr 2008, 20:34
No more giving back...
Last edited by kohlrak on 07 Aug 2008, 14:55; edited 1 time in total |
|||
29 Apr 2008, 20:34 |
|
Endre 30 Apr 2008, 14:06
Oh sorry, now I see what you just want to do. I have checked nocona's code. I like the idea. The executable size is really much smaller.
Have you by the way checked what libraries your program is related to? I mean: Code: ldd ./test.bin I guess this is the answer on why you do not have to specify libc for printf or exit - it simply comes with libgtk. If you compiles a C-program with gcc you get libc with libgcc automagically even if you have not particularly specified it for the linker. |
|||
30 Apr 2008, 14:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.