flat assembler
Message board for the users of flat assembler.

Index > Main > MS COFF output BUG?

Author
Thread Post new topic Reply to topic
rambo



Joined: 28 Feb 2005
Posts: 22
Location: posen, poland
rambo 10 Aug 2005, 20:37
i`m using fasm to make some object file, later linked with LINK.EXE from masm32 package. what`s the point? something is going wrong, when i`m trying to define more than 9 DATA sections. with 9 sections, after linking, RAW data in EXE output`s section is zeroed, as i want, but if i have 10, and more, sections, there are pieces of sections headers (!)..

linking this example will say more than thousand words:

Code:
format MS COFF
extrn "__imp__MessageBoxA@16" as MessageBox:dword
public _demo

section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50
section ".bss" data readable writeable
        rd 4*50

section ".text" code readable executable

 _demo:
        push    0
        push    _caption
        push    _message
        push    0
        call    [MessageBox]
        ret

section ".data" data readable writeable

 _caption db "Win32 assembly",0
 _message db "Coffee time!",0
    


parameters:
link.exe /subsystem:windows /entry:demo main.obj d3d9.lib gdi32.lib kernel32.lib user32.lib

is it FASM bug?
i don`t think, that linker does mistake, because the same thing is happening with other linker (packer) - crinkler.
or am i stupid and not reading faq? :)


Last edited by rambo on 10 Aug 2005, 20:44; edited 1 time in total
Post 10 Aug 2005, 20:37
View user's profile Send private message Visit poster's website Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 10 Aug 2005, 20:41
Where did 'start' come from?

_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 10 Aug 2005, 20:41
View user's profile Send private message Reply with quote
rambo



Joined: 28 Feb 2005
Posts: 22
Location: posen, poland
rambo 10 Aug 2005, 20:45
UCM wrote:
Where did 'start' come from?


which start? :)
it was from my original project.
Post 10 Aug 2005, 20:45
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 10 Aug 2005, 20:53
I got:
main.obj : warning LNK4078: multiple ".bss" sections found with different attrib
utes (C03000C0)

remove the "data" flag from the '.bss' definitions and it goes OK.

Also, when you use "rb", it is not guaranteed to zero the data - it just reserves it. And Microsoft's linker for some reason treats the unititialized data correctly only when it's in valid '.bss' section. And the "data" flag marks the section as initialized data.
Post 10 Aug 2005, 20:53
View user's profile Send private message Visit poster's website Reply with quote
rambo



Joined: 28 Feb 2005
Posts: 22
Location: posen, poland
rambo 10 Aug 2005, 21:45
then i`m just a silly boy Smile Wink
works fine, thanks.
Post 10 Aug 2005, 21:45
View user's profile Send private message Visit poster's website 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.