1

一个简单的hello world程序:

#include <stdio.h>

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

在使用/HEADERS标志转储它之后,我得到了这些段:

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

如果使用/TC编译程序,使其成为 C 程序,我在使用 dumpbin 后得到这些段:

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

重点是:

我如何获得这种类似的输出:

# 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
4

0 回答 0