flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tommy
Does the word virtual tell you anything? Try the "store" directive..
![]() |
|||
![]() |
|
ronware
Tommy wrote: Does the word virtual tell you anything? Try the "store" directive.. I've tried using 'org', I've tried 'virtual' and now I've tried 'store'. The phrase: store dword 0x1234 at 24 gives me a message: "error: value out of range". ![]() Apparently, 'load' can only load in the current section; what I need to be able to do is to modify any part of the file (org does nothing useful here). 'virtual' is only useful at runtime. <arggggh> |
|||
![]() |
|
ronware
Privalov -
Is there any relatively easy way to accomplish what I want? That is, to add a dynamic imports section to my ELF program? Thanks! |
|||
![]() |
|
Tomasz Grysztar
No, you cannot alter the formatter-generated structures. The only way is to build ELF executable from scratch (with binary output mode), here is the simplest sample of such executable (this way it was done with the very early Linux versions of fasm):
Code: program_base = 0x700000 org program_base use32 macro align value { rb (value-1) - ($ + value-1) mod value } file_header: db 0x7F,'ELF',1,1,1 rb file_header+0x10-$ dw 2,3 dd 1,start dd program_header-file_header,0,0 dw program_header-file_header,0x20,1,0,0,0 program_header: dd 1,0,program_base,0 dd bss-program_base,program_end-program_base,7,0x1000 msg db 'Hello world!',0xA msg_size = $-msg start: mov eax,4 mov ebx,1 mov ecx,msg mov edx,msg_size int 0x80 mov eax,1 xor ebx,ebx int 0x80 bss: program_end: |
|||
![]() |
|
ronware
Privalov wrote: No, you cannot alter the formatter-generated structures. The only way is to build ELF executable from scratch... Hi, Privalov - Thank you, that is what I thought. I'm trying to "do the right thing" to import "dlopen" and "dlsym" from "libdl.so.2". and I get dlopen ok, but dlsym is not importing for me... Anyway, I would like to make the request that there be an 'imports' directive for ELF format, something like: imports 'libdl.so.6', 'dlopen' Which would simply make 'dlopen' callable fron within the ELF executable. This is something you can do pretty easily as you generate the headers, but it's a real pain to do manually. Plus, it's nice for the end user. At the moment, I am creating an ELF object and linking with gcc to get the result I want. The problem I have with that is twofold: first, it requires an external tool besides FASM. Second, it doesn't work when I want to generate the ELF file on Windows, since the import libs I need to link with are not there (and my Windows gcc doesn't output ELF!). Please do consider adding the feature, it will be greatly loved... All the best, Ron |
|||
![]() |
|
Tomasz Grysztar
I will put it on my TODO list.
|
|||
![]() |
|
ronware
Thank you! I'll anxiously look for it.
|
|||
![]() |
|
Raedwulf
Any progress on this?
|
|||
![]() |
|
Tomasz Grysztar
No.
EDIT: The creation of dynamic linking structures was finally introduced three years later, with the 1.69.05 release. Last edited by Tomasz Grysztar on 04 Aug 2017, 14:37; edited 1 time in total |
|||
![]() |
|
rugxulo
Okay, this may be wrong/unhelpful (I'm very unexperienced in this area), but there does exist a GCC-ELF port for DOS. Octavio uses it to compile a few things (e.g., ZLIB) for his OS.
|
|||
![]() |
|
Raedwulf
Nice I'll try it thanks
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.