Remix.run Logo
mananaysiempre 5 hours ago

Could be a number of things depending on context. In this case it’s a short function that adjusts some things and jumps to the actual functions (a “thunk” is another term for this). Specifically, if in GCC you write

  int f(int x) {
      int g(int y) { ... use x and y ... }
      ...
      h(&g);
      ...
  }
then what the compiled code for f does is construct on the stack a short piece of machine code:

  mov <well-known register>, <frame pointer>
  jmp <start of g’s code>
and &g points to the start not of g’s code but of this snippet on the stack, which has the parent function’s frame pointer compiled into it as a literal constant. The snippet is called a trampoline.