flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 06 Oct 2025, 07:21
The linker builds an executable - it does not set the IMAGE_SCN_CNT_UNINITIALIZED_DATA flag - which is needed.
MASM supports a verbose syntax: Code: _BSS SEGMENT READ WRITE 'BSS' ; Reserve space for an uninitialized variable some_var DWORD ? ; Reserve a buffer some_buffer BYTE 256 DUP(?) _BSS ENDS fasm[g|2]uses "udata": Code: section '.bss$t' udata readable writeable align 64 Searching the source code for the IMAGE_SCN_CNT_UNINITIALIZED_DATA flag will discover all support. _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
![]() |
|
Tomasz Grysztar 06 Oct 2025, 07:37
bitRAKE wrote: fasm[g|2]uses "udata": With object output the section that contains only uninitialized data is marked with IMAGE_SCN_CNT_UNINITIALIZED_DATA automatically, because of the format limitations (you do not have a separate raw and virtual size like in PE, if section data is in the file, it must of the length of the whole section, otherwise it must not be present at all). In case of PE you don't really need this flag to have section size in memory be larger than in file, that's why its optional and set manually with PE formatter. In fact, this flag matters more for linking than the runtime. When a section has no initialized data in the object file but ends up contributing to the size of the linked executable, it is usually because it has been combined with another section that is initialized and came later during the linking process. |
|||
![]() |
|
lunada 06 Oct 2025, 15:45
thanks for the reply...
I've try different combinations of flags, nothing seems to work change the name of the section so it does'nt get combined with other but same result. Code: _BSS SEGMENT 'BSS' ;som_var DWORD ? _data BYTE 307200 DUP(?) _BSS ENDS public _data END with masm doesn't work either.(well it gives me a warning LNK4078: multiple ".bss" sections found with different attributes (C0520080)) although there is no other .bss section (or I have'nt found it yet) Iknow that Borland compiler/linker can handle this, I'll check MS compiler to see what flags sets in its obj files or how does handle uninitialize data. Thank you. |
|||
![]() |
|
bitRAKE 06 Oct 2025, 20:28
Tomasz Grysztar wrote: With object output the section that contains only uninitialized data is marked with IMAGE_SCN_CNT_UNINITIALIZED_DATA automatically Code: format MS COFF ; or MS64 section ".bss" data readable writeable public _data ; if access is needed in other modules _data db 307200 DUP(?) We can verify with "dumpbin /ALL _data.obj": Code: SECTION HEADER #1 .bss name 0 physical address 0 virtual address 4B000 size of raw data 0 file pointer to raw data 0 file pointer to relocation table 0 file pointer to line numbers 0 number of relocations 0 number of line numbers C03000C0 flags Initialized Data Uninitialized Data 4 byte align Read Write _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. Last edited by bitRAKE on 06 Oct 2025, 20:39; edited 2 times in total |
|||
![]() |
|
bitRAKE 06 Oct 2025, 20:33
lunada wrote: with masm doesn't work either.(well it gives me a _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.