2

I was looking at an executable having GMP linked statically to it. The following seems weird.

Disassembly of section .text:

0000000000400e60 <refmpn_fill.part.4>:
  400e60:   50                      push   %rax
  400e61:   ba 55 84 42 00          mov    $0x428455,%edx
  400e66:   be 92 00 00 00          mov    $0x92,%esi
  400e6b:   bf a8 81 42 00          mov    $0x4281a8,%edi
  400e70:   e8 1b 66 00 00          callq  407490 <__gmp_assert_fail>

0000000000400e75 <refmpn_count_leading_zeros.part.19>:
  400e75:   50                      push   %rax
  400e76:   ba c2 81 42 00          mov    $0x4281c2,%edx
  400e7b:   be eb 06 00 00          mov    $0x6eb,%esi
  400e80:   bf a8 81 42 00          mov    $0x4281a8,%edi
  400e85:   e8 06 66 00 00          callq  407490 <__gmp_assert_fail>
  400e8a:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)

0000000000400e90 <main>:
  400e90:   53                      push   %rbx
  400e91:   bb e8 03 00 00          mov    $0x3e8,%ebx
  400e96:   48 83 ec 20             sub    $0x20,%rsp
  400e9a:   e8 11 03 00 00          callq  4011b0 <tests_start>

As you can see there are disassembly of functions of the form: function_name.part.# where # represents some number. There are no such function having name with part.# appended at the end in the source code. Then how do these objects appear?

3

It's called partial inlining:

Partial inlining is closely related to function outlining. Rather than inlining the entire body into a call site, the compiler may choose to inline part of the called function (typically a hot fragment at the start of the function with an early return).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.