flat assembler
Message board for the users of flat assembler.
Index
> Linux > [fasm2] Problem with 'format ELF64' |
| Author |
|
|
revolution 05 Jan 2026, 01:53
I've had success with linking in the past by using
Code: ld ... -e start ... Code: public start start: ;... |
|||
|
|
Jessé 05 Jan 2026, 04:00
Oooh, shame on me!
Sorry guys to annoy you with my lack of competence, it seems that my attention has blown away a fuse today! Clearly my own 'ld' command line is missing the 'asmextern.o' file as the source object. The correct is: Quote:
With optional '-e _start' also working normally. Change it here and it worked. Consider solved. Thanks anyways, revolution. |
|||
|
|
Jessé 05 Jan 2026, 04:09
And here, I let the correct working code, because the above one also has errors (if anyone wanna test it):
Code: format ELF64 extrn fprintf extrn exit extrn stdout public _start section '.text' executable align 4 _start: endbr64 mov rdi, [got.stdout] mov rdi, [rdi] lea rsi, [msg0] xor al, al call plt.fprintf sub rsp, 8 xor edi, edi jmp plt.exit section '.data' writeable msg0: db 'This is a fasm2 program, compiled in' db ' a traditional way!',10,0 |
|||
|
|
duanebonas6822 09 Jan 2026, 00:22
Jessé wrote: Hello there, noob question! Hello mate, i have done exactly what you want but u have to manually define the binary, I have a main script , If you want PM me and ill show you how to create the binary, But u have to do it all manually . Like define the LibC functions, I have a premaid binary that has everything included, its quite large tho as it has nearly every LibC function built in. Send me a PM if you do ill show you my binary. format ELF64 executable, There is loads of examples of how to do it but its called dynamic shared library examples or summet on the forum. But yeah the full binary readelf - a (---) , shows as PIE position independant binary, you can load any function from a static memory location, best thing is it even loads commands when on a remote stack. FASM is the best bud. NASM cant create PIC/PIE binarys only FASM _________________ d.bonas |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.