Why there is no .bss segment in COFF object file?

387 Views Asked by At

A simple hello world program:

#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

After dumpbin it with /HEADERS flag, i get those segments:

  8 .bss
  A0 .debug$S
  62 .drectve
  F .rdata
  8B .text$mn

If compile the program with /TC, so that it's a C program, i get those segments after the same use of a dumpbin:

2000 .data
1000 .gfids
7000 .rdata
1000 .reloc
10000 .text

point is:

How do i get this similar kind of output:

# objdump -hrt hello.o
hello.o:     file format elf32-i386

Sections:
Idx Name          Size     VMA       LMA       File off  Algn
  0 .text         00000011 00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000 00000000  00000000  00000048  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000 00000000  00000000  00000048  2**2
                  ALLOC
  3 .rodata.str1.1 0000000d  00000000  00000000  00000048 2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .comment      00000033  00000000 00000000  00000055  2**0
                  CONTENTS, READONLY

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 hello.c
00000000 l    d  .text  00000000
00000000 l    d  .data  00000000
00000000 l    d  .bss   00000000
00000000 l    d  .rodata.str1.1 00000000
00000000 l    d  .comment       00000000
00000000 g    F  .text  00000011 main
00000000         *UND*  00000000 puts
0

There are 0 best solutions below