4

I'm following http://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/ to write a web server with only printf() call.

I am following the guidance of the article.

Howerver, I found that the executable file of my program doesn't contain the .fini_array section with the help of objdump.

It is noticed that the .fini_array is defined by the Linux Standard Base Core Specification.

I read it and I'm curious about the relationship between .fini_array section and .fini section, how could they work together?

It seems that the .fini_array is not necessary. So when it is used and how should I continue my work?

amazonsx
  • 71
  • 1
  • 3

1 Answers1

3

From http://docs.oracle.com/cd/E19683-01/817-1983/6mhm6r4es/index.html:

The runtime linker executes functions whose addresses are contained in the .fini_array section. These functions are executed in the reverse order in which their addresses appear in the array. The runtime linker executes a .fini section as an individual function. If an object contains both .fini and .fini_array sections, the functions defined by the .fini_array section are processed before the .fini section for that object.

So fini_array is optional, and is a sort of fancier version of fini.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 1
    when will the compiler insert the fini_array section into the executable header? – amazonsx Oct 13 '14 at 06:30
  • It depends on the compiler, and the version of the compiler, and perhaps the exact platform.... It's not clear to me why this would matter to you. – John Zwinck Oct 13 '14 at 07:05
  • I'm trying to do some shellcode things, the textbook told me to modify that section, while i cant find it. – amazonsx Oct 17 '14 at 08:43