1

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
Tracy
  • 59
  • 1
  • 8
  • 1
    I don't know whether you have any reason to *ever* have a `.bss` segment in a Windows binary. That format is completely different from ELF. In an ELF executable, however, the `.bss` segment is where you would find global data that is implicitly or explicitly initialized to all zeroes. Your sample program has no such data. – John Bollinger Dec 19 '17 at 19:07
  • @JohnBollinger i tried to add those fields in the program but the output doesn't change. – Tracy Dec 19 '17 at 19:08
  • See [Why I can not directly get the content of `.bss` section?](https://reverseengineering.stackexchange.com/questions/4230/why-i-can-not-directly-get-the-content-of-bss-section) – David C. Rankin Dec 19 '17 at 21:01
  • add option [/MAP](https://learn.microsoft.com/en-us/cpp/build/reference/map-generate-mapfile) to linker and look what symbols actualy in .bss segment. and anyway map fie here more useful for understand, compare `link -dump` command – RbMm Dec 20 '17 at 00:09

0 Answers0