Partitions are nothing more than independent memory sequences. Each new data byte is placed in the current open "program section". When writing a function, it is quite convenient to write related data to the source code, even if it is loaded into memory, it can be megabytes or gigabytes.
User-defined sections of the program work in the same way as standard sections, although usually you need to provide additional information to the linker and other post-processing tools so that they are loaded into memory in a reasonable way.
You can place executable code in the data section and vice versa, and most assemblers will not even warn about it. Executing code from a data section may require a little cheating; on the contrary, easy.
Assemblers usually process partitions by writing the equivalent to the object module in the same order as the source code, leaving the rearrangement of such partitions along with the linker. Only the most simplified assemblers do not provide this ability. The original MSDOS .COM assembler file comes to mind.
Different assemblers have a different philosophy on how to train a programmer. The traditional tactic is to assume that the programmer in assembly language knows what they are doing and does literally what is written, except what is not understood. Other assemblers are more useful (or pain in the ass, depending on your point of view), and complain about inconsistent multibyte structures, inconsistencies in data type or code, etc. Etc.
Based on the โusefulnessโ of the assembler, failure to initiate a section of the program leads to default behavior (usually assumed .psect code) or failure to build with a fatal error. Even the most structured assembler doesn't care if there is text, data or bss. In fact, there are useful object modules consisting only of character definitions without data bytes (or code).
source share