flat assembler
Message board for the users of flat assembler.
Index
> Linux > Manipulating the ELF header |
Author |
|
Tommy 25 Feb 2005, 18:14
Does the word virtual tell you anything? Try the "store" directive.. (I haven't tested it myself, but if there's a way of doing it, that should be the way to go)
|
|||
25 Feb 2005, 18:14 |
|
ronware 25 Feb 2005, 18:46
Tommy wrote: Does the word virtual tell you anything? Try the "store" directive.. (I haven't tested it myself, but if there's a way of doing it, that should be the way to go) 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> |
|||
25 Feb 2005, 18:46 |
|
ronware 29 Mar 2005, 05:59
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! |
|||
29 Mar 2005, 05:59 |
|
Tomasz Grysztar 31 Mar 2005, 12:31
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: |
|||
31 Mar 2005, 12:31 |
|
ronware 31 Mar 2005, 17:20
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 |
|||
31 Mar 2005, 17:20 |
|
Tomasz Grysztar 01 Apr 2005, 15:34
I will put it on my TODO list.
|
|||
01 Apr 2005, 15:34 |
|
ronware 01 Apr 2005, 15:45
Thank you! I'll anxiously look for it.
|
|||
01 Apr 2005, 15:45 |
|
Raedwulf 15 Nov 2006, 08:27
Any progress on this?
|
|||
15 Nov 2006, 08:27 |
|
Tomasz Grysztar 15 Nov 2006, 08:37
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 |
|||
15 Nov 2006, 08:37 |
|
rugxulo 16 Nov 2006, 02:25
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.
|
|||
16 Nov 2006, 02:25 |
|
Raedwulf 16 Nov 2006, 06:27
Nice I'll try it thanks
|
|||
16 Nov 2006, 06:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.