flat assembler
Message board for the users of flat assembler.
Index
> Main > 2 questions on sections and stack frames. |
Author |
|
zubi 29 Apr 2006, 12:39
Was that an inappropriate post?
|
|||
29 Apr 2006, 12:39 |
|
RedGhost 30 Apr 2006, 06:56
why would you have a .data section inside of a procedure? sub esp, #_of_needed_bytes, reference ebp-that_many_bytes for local data
|
|||
30 Apr 2006, 06:56 |
|
f0dder 30 Apr 2006, 07:44
When you switch between .data and .code in MASM, you go to "where you left off" in that section. In FASM, you introduce a new section every time you do it, check the output .obj file. Each section will be aligned, which is why you get those int3 instructions.
Perhaps somebody have made a macro to make "section-switching" more natural in FASM... |
|||
30 Apr 2006, 07:44 |
|
Tomasz Grysztar 30 Apr 2006, 07:53
Try giving those sections "align 1" attribute - perhaps that should get rid of those int3 alignments.
|
|||
30 Apr 2006, 07:53 |
|
zubi 01 May 2006, 08:12
First of all, thanks for the responses.
Giving the sections align 1 attribute actually solved it, no more int3s. Moreover I discovered that as long as I use the same name for the data sections, the rusulting exe contains only one data section per name. It seems that fasm doesn't create a new section in this case, is that correct? Addresses of those floating point variables do follow each other without a gap, suggesting that this assumption is correct. (When I give different names to different data sections the result is big gap between them because of the section allignment). So, if this observation and results are correct, can we say that we can actually do switch between sections by giving same names to the sections and aligning them by 1? Quote:
Yes, but this is exactly what I am trying to achieve, Vl_D is already defined as local variable, question is how can I assign arbitrary floating point literals to it. If it was needed only once I could have written it like local Vl_D dq 2.5 anyways. The problem stems from the fact that there is no opcode that operates on qword floating point literals. |
|||
01 May 2006, 08:12 |
|
f0dder 01 May 2006, 11:08
Quote:
Since you output to MS COFF format, I assume you're going through a linker. All linkers I know of will merge sections with identical names (and give warnings if multiple sections with same name but different attributes are found). *theoretically* a linker could choose to "mix" sections from different input files, but I don't know any that do this... so it should be safe doing the align-by-1 trick. Tomasz, is there a way (by the power of the might macro system ) to "magically switch" between sections and only output one of each? I assume it could be done with the virtual statement or similar? |
|||
01 May 2006, 11:08 |
|
zubi 01 May 2006, 11:39
Right. I got those warnings when I was experimenting on the issue. The linker I use have an option (/merge) that merges any 2 sections you name (as parameters to the option). It merges differently named sections only when you use that option. I tried that actually and, if I didn't do something wrong, I couldn't get rid of the int3s. So I assumed that fasm is writing that alignment information while creating the obj.
|
|||
01 May 2006, 11:39 |
|
f0dder 01 May 2006, 12:37
In a COFF file, each section object has an alignment value, which fasm sets, and fortunately all linkers (that I've tried) respect
|
|||
01 May 2006, 12:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.