6

I wrote a very basic Hello World program to know about sections. After using objdump I got all sections. I am using ubuntu 12.04.

in output I found it like that :

  1. Disassembly of section .init

  2. Disassembly of section .plt

  3. Disassembly of section .text

  4. __do_global_dtors_aux

  5. Disassembly of section .fini

I want to know what those sections are? what data they store? Specially .plt and .fini. About .init and .text I can guess, but what about others?

someone
  • 1,638
  • 3
  • 21
  • 36

3 Answers3

6

You should google it : here is the first result. It's a good start to learn more about ELF format.

About .init and .fini, it's here.

Here is a list of the ELF sections with a brief description.

nouney
  • 4,363
  • 19
  • 31
  • `dtor` means destructor, and I am using c, then how come I am getting `__do_global_dtors_aux`. Is it destructor or something else? – someone Jul 04 '13 at 09:48
  • What's your compiler ? – nouney Jul 04 '13 at 09:52
  • I am using gcc on ubuntu 12.04 – someone Jul 04 '13 at 09:53
  • 1
    @Krishna Take a look at [question](http://stackoverflow.com/questions/6477494/do-global-dtors-aux-and-do-global-ctors-aux), this may help you. [This one](http://stackoverflow.com/questions/2741417/do-global-dtors-aux-in-c) can be interesting too. – nouney Jul 04 '13 at 09:55
  • 2
    I googled it and this thread was the first link ¯\\_(ツ)_/¯ – Josh Desmond Apr 04 '20 at 22:51
1

From this handy page:

The next section I want to mention is the .plt section. This contains the jump table that is used when we call functions in the shared library.

And from this page:

.fini

This section holds executable instructions that contribute to the process termination code. That is, when a program exits normally, the system arranges to execute the code in this section.

Community
  • 1
  • 1
unwind
  • 391,730
  • 64
  • 469
  • 606
0

you might find this brief tutorial helpful. It also contains links to related literature.

"The linker demystified, part 1": http://www.rtos.be/?p=2166

I hope it helps.

Fernando

Fernando
  • 97
  • 4