flat assembler
Message board for the users of flat assembler.

Index > Linux > How to create a section in ELF?

Author
Thread Post new topic Reply to topic
ASM-Man



Joined: 11 Jan 2013
Posts: 64
ASM-Man 16 Mar 2014, 03:50
I'm reading about ELF file format and trying to create one without any library, to really understand how the things works. In fact, I was able to create one by setting all needed headers and put some op code to it print a string on std out. But how to create the string table and then the sections, to be honest, I have no code to show because I didn't understand even how to create the string table myself and set it to sh_name. I'd love any code example how to do this. I've search a lot on internet without luck. Even libelf doesn't show how to do it directly the explanation actually I get it's same as from standard elf document.
Post 16 Mar 2014, 03:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 16 Mar 2014, 03:57
I'm not sure if this helps at all but fasmarm automatically creates various section in the ELF DWARF (debugging) format including a string table and line numbers table. Perhaps the source code will help to enlighten you a little. But to do this from the source code side would require the use of macros; probably not too different from the PE format import and export section macros.
Post 16 Mar 2014, 03:57
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Mar 2014, 13:40
Have you checked examples\elfexe\dynamic in fasm for Linux package?

Also http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html

PS: I'm assuming you that by section you mean segment, if that is not the case (so you want ELF object rather than executable), then my pointers will help you partially.
Post 16 Mar 2014, 13:40
View user's profile Send private message Reply with quote
ASM-Man



Joined: 11 Jan 2013
Posts: 64
ASM-Man 17 Mar 2014, 03:27
Revolution and LocoDelAssembly thanks for the answer. But I will use a high-level language instead of and not assembly anymore I didn't have so much time. Could the moderation remove this thread?
Post 17 Mar 2014, 03:27
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.