2

IDA Pro function with no ret as last instruction but a jump to a label

Analyzing the ELF file /usr/bin/curl (Ubuntu 14.04, 64bit), I stumbled upon a strange function (see image). It is called regularly via call sub_403D90 but does not end with a ret. Instead, it jumps to a label / another function (sub_403C90). This is strange because there seems to be no return to sub_403D90, as from sub_403C90 onwards in the control flow, there are no jumps but only rets.

Can someone explain to me why this is? Does it makes sense?

3

This is just a bit of optimization. A call xxxx followed by a ret can be optimized to a jmp xxxx.

  • 2
    Commonly known as "Tail Call" elimination / optimization. – Ian Cook Mar 22 '15 at 23:24
  • @IanCook: Thank you for the keyword. I only came up with "tail recursion elimination", which isn't the case here, so i decided to omit it. – Guntram Blohm supports Monica Mar 23 '15 at 13:18

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.