[all-commits] [llvm/llvm-project] 9b4e8b: [libc] Fix longjmp's fake return in x86_64

Mikhail R. Gadelha via All-commits all-commits at lists.llvm.org
Mon Mar 27 15:42:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b4e8b7b0a6b368dcce474e82bdcd55a2f27bc1e
      https://github.com/llvm/llvm-project/commit/9b4e8b7b0a6b368dcce474e82bdcd55a2f27bc1e
  Author: Mikhail R. Gadelha <mikhail at igalia.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

  Changed paths:
    M libc/src/setjmp/x86_64/longjmp.cpp
    M libc/test/src/setjmp/setjmp_test.cpp

  Log Message:
  -----------
  [libc] Fix longjmp's fake return in x86_64

This implements the fake return after a successful longjmp(), as
described in the linux man page:

Following  a  successful  longjmp(), execution continues as if setjmp()
had returned for a second time.  This  "fake"  return  can  be  distin-
guished from a true setjmp() call because the "fake" return returns the
value provided in val.  If the programmer mistakenly passes the value 0
in val, the "fake" return will instead return 1.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D146981




More information about the All-commits mailing list