NO

Author Topic: POCC produces invalid MS COFF files (yet another minor bug)  (Read 2102 times)

iZzz32

  • Guest
POCC produces invalid MS COFF files (yet another minor bug)
« on: December 07, 2011, 11:49:11 PM »
Microsoft PE and COFF Specification says that the VirtualSize field of the section header “is valid only for executable images and should be set to zero for object files”. However Pelles C leaves random trash in this field. Here’s a simple test:

Code: [Select]
static int foo; // It needs to be static to disable so called “tentative” definition.

int bar(void) {
  return foo * 2 + 1;
}

Quote from: pocc /c test.c && podump /HEADERS test.obj
…cut…
SECTION #2
    .bss name
      18 virtual size
       0 virtual address
       4 size of raw data
       0 offset to raw data
       0 offset to relocation table
       0 offset to line numbers
       0 number of relocations
       0 number of line numbers
…cut…
Microsoft C compiler behaves as per specification. However the value of this field seems to be ignored by both MS link.exe and Pelles polink.exe.

It is Pelles ISO C Compiler, Version 6.50.35 (Pelles C 6.50 RC4) on Windows XP SP3 (32-bit).

PS: IIRC Pelles C 6.00 didn’t have this bug. If someone has that version installed please confiirm.