
BSS Problem with Windows - win64
Reported by ray.seyfarth | September 26th, 2014 @ 06:52 PM
There is a problem with the .bss segment under Windows. I was using version 1.2.0 so I downloaded yasm version 1.3.0 and the problem exists there. Here is a sample program:
segment .data
a dq 0
b dq 0
segment .bss
data resb 1000
segment .text
ret
Using objdump -h after assembling this file you will see that the .data segment is 16 bytes and the .text segment is 1 byte. The .bss segment is 17 bytes which is the sum of the other 2 segments. This explains why I included the .text segment.
My real problem occurred with using a large data array in .bss and it would not read very many bytes. Eventually I determined that the .bss segment was too small and discovered that the object file was not quite right. nasm does this correctly, but I would prefer to continue with yasm since I am making practical use of the listing format to determine how to associate .text addresses with line numbers. nasm would make it harder to parse the listing file and determine line numbers.
Comments and changes to this ticket
-
Peter Johnson September 27th, 2014 @ 03:53 AM
- State changed from new to open
This is an interesting issue, as the various PE and COFF docs disagree on the handling of the "physical address" field in the section header, which seems to cause the objdump -h output you're seeing. It may well be that the GNU tools (in particular the linker) have a different interpretation than the Microsoft tools. Yasm sets the section size field correctly, but the GNU tools ignore it and prefer the physical address field for BSS sections.
According to http://msdn.microsoft.com/en-us/library/ms809762.aspx, the "physical address" in the section header has different meanings for EXE and OBJ files. In EXE files, it contains the rounded up size of the section, but in OBJ files it instead actually indicates the "physical address" of the section (e.g. the start of the section relative to other sections in the OBJ file).
Other references say to always set this field to 0 in OBJ files.
Yasm currently follows the Microsoft specification for OBJ files, and thus sets the physical address field to non-zero. Unfortunately, it appears the GNU tools always treat their input files as EXE files, so when the "physical address" field is nonzero, they prefer it over the section size header field.
The fix appears to be for Yasm to set the physical address field to 0. I'll commit a change to this effect but extensive testing will be required to make sure it doesn't break the Microsoft tool use cases before I roll a release with the change.
-
Peter Johnson September 27th, 2014 @ 04:23 AM
- State changed from open to resolved
-
ray.seyfarth September 27th, 2014 @ 02:07 PM
I have downloaded the latest yasm and this fix does solve my problem with using the bss segment. Thanks for the prompt action.
-
manisha April 5th, 2018 @ 11:10 AM
There is a problem with the .bss segment under Windows. I was using version 1.2.0 so I downloaded yasm version 1.3.0 and the problem exists there.I have just upgraded to windows 10. I had already installed SoundWeb designer 1.50 and was working fine on windows 7. After updating to windows 10 I cannot get Soundweb Designer to find any soundweb for my site book flight tickets using http://www-googleflights.com/ and search flight tickets using "Google Flights" anyone plz tell me how to fix the issue BSS Problem with Windows 10.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
The Yasm Modular Assembler Project