flat assembler
Message board for the users of flat assembler.

Index > Windows > multiple .asm gives multiple sections

Author
Thread Post new topic Reply to topic
int0x50



Joined: 19 Jul 2019
Posts: 54
int0x50 07 Aug 2019, 11:40
I am writing a project with multiple ASM files. In the main .asm file I have included all the other .asm files. I have compiled it and it works fine. But, since I have created .data and .text sections in each .asm, I have multiple sections in the PE file as well. Is this recommended?

How to keep everything in one single .data and .text section?
Post 07 Aug 2019, 11:40
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4335
Location: Now
edfed 07 Aug 2019, 13:01
to achieve this, don't declare sections for each included file, but only beofre the first include.
Post 07 Aug 2019, 13:01
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 07 Aug 2019, 13:13
There are three options I can think of.

1) Rewrite your code to manually merge all the sections together in the source.
2) Output a linkable format and use the linker to merge the sections.
3) Use macros to build and extend lists for each section.
Post 07 Aug 2019, 13:13
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 07 Aug 2019, 16:02
Thou not needed to split code & data in subincludes at all.
do section splitting in main file only. Nothing terrible if dota & code would be intermixed.
And even if thour file would be presented by one single section there is nothing terrible - thou could intermix everithing there.
But if thou going to place there resources too thou should name section as .rsrc and start it from resource header - after thou could intermix within it imports exports data & code or whatever.
So classification of bytes sequences on data and code is very abstract.
Thou are free to play in that abstraction or ignore it.
Post 07 Aug 2019, 16:02
View user's profile Send private message Send e-mail Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 07 Aug 2019, 16:53
ProMiNick wrote:
Nothing terrible if dota & code would be intermixed.

Actually, this one is not a good idea unless one already has to have them intemixed (sizecoding?).
Post 07 Aug 2019, 16:53
View user's profile Send private message Visit poster's website Reply with quote
SokilOff



Joined: 20 Sep 2010
Posts: 15
SokilOff 08 Aug 2019, 21:12
int0x50 wrote:
I am writing a project with multiple ASM files. In the main .asm file I have included all the other .asm files. I have compiled it and it works fine. But, since I have created .data and .text sections in each .asm, I have multiple sections in the PE file as well. Is this recommended?

How to keep everything in one single .data and .text section?


Long ago I had the same question. And, as revolution already said, macro is probably the best way to keep all code and data parts in the appropriate sections.
You can take a look here.
Post 08 Aug 2019, 21:12
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.