简体   繁体   中英

What does .text.unlikely mean in ELF object files?

In my objdump -t output, I see the following two lines:

00000000000004d2 l     F .text.unlikely 00000000000000ec function-signature-goes-here [clone .cold.427]

and

00000000000018e0 g     F .text  0000000000000690 function-signature-goes-here

I know l means local and g means global. I also know that .text is a section, or a type of section, in an object file, containing compiled program instructions. But what is .text.unlikely ? Assuming it's a different section (or type-of-section) from .text - what's the difference?

In my GCC v5.4.0 manpage, I found the following switch:

-freorder-functions which says:

Reorder functions in the object file in order to improve code locality. This is implemented by using special subsections ".text.hot" for most frequently executed functions and ".text.unlikely" for unlikely executed functions. Reordering is done by the linker so object file format must support named sections and linker must place them in a reasonable way.

Also profile feedback must be available to make this option effective. See -fprofile-arcs for details.

Enabled at levels -O2, -O3, -Os.

Looks like the compiler was run with optimization flags or that switch for this binary, and functions are organized in subsections to optimize spatial locality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM