Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[libc][NFC] add remarks to the setjmp implementation #137066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 1, 2025

Conversation

SchrodingerZhu
Copy link
Contributor

@SchrodingerZhu SchrodingerZhu commented Apr 23, 2025

We use naked functions to avoid compiler-generated prologue and epilogue.

Despite GCC documentation listing this as an unsupported case for extended asm, the generated code is not wrong as we only pass in constant operands to extended asm.

See #137055 for related remarks.

@SchrodingerZhu SchrodingerZhu requested review from Copilot and lntue April 23, 2025 21:43
@llvmbot llvmbot added the libc label Apr 23, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds clarifying remarks to the x86_64 setjmp implementation, explaining the use of naked functions and linking to a related LLVM issue.

  • Added detailed comments explaining the rationale for using naked functions.
  • Provided a reference to the LLVM issue for additional context.

@llvmbot
Copy link
Member

llvmbot commented Apr 23, 2025

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

Changes

We use naked functions to avoid compiler-generated prologue and epilogue.

Despite GCC document list this as an supported case for extended asm, the generated code is not wrong as we only pass in constant operands to extended asm.

See #137055 for related remarks.


Full diff: https://github.com/llvm/llvm-project/pull/137066.diff

1 Files Affected:

  • (modified) libc/src/setjmp/x86_64/setjmp.cpp (+6)
diff --git a/libc/src/setjmp/x86_64/setjmp.cpp b/libc/src/setjmp/x86_64/setjmp.cpp
index 28e52712c785d..83d0b635ffcbf 100644
--- a/libc/src/setjmp/x86_64/setjmp.cpp
+++ b/libc/src/setjmp/x86_64/setjmp.cpp
@@ -6,6 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// We use naked functions to avoid compiler-generated prologue and epilogue.
+// Despite GCC document list this as an supported case for extended asm, the 
+// generated code is not wrong as we only pass in constant operands to 
+// extended asm.
+// See https://github.com/llvm/llvm-project/issues/137055 for related remarks.
+
 #include "hdr/offsetof_macros.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"

Copy link

github-actions bot commented Apr 23, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@SchrodingerZhu SchrodingerZhu changed the title [libc] add remarks to the setjmp implementation [libc][NFC] add remarks to the setjmp implementation May 1, 2025
@SchrodingerZhu
Copy link
Contributor Author

Merge directly as the change is trivial

@SchrodingerZhu SchrodingerZhu merged commit 8023375 into llvm:main May 1, 2025
13 of 15 checks passed
@SchrodingerZhu SchrodingerZhu deleted the libc/remark-setjmp branch May 1, 2025 14:41
@lntue
Copy link
Contributor

lntue commented May 1, 2025

LGTM.

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
We use naked functions to avoid compiler-generated prologue and
epilogue.

Despite GCC documentation listing this as an unsupported case for
extended asm, the generated code is not wrong as we only pass in
constant operands to extended asm.

See llvm#137055 for related
remarks.

---------

Co-authored-by: Copilot <[email protected]>
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
We use naked functions to avoid compiler-generated prologue and
epilogue.

Despite GCC documentation listing this as an unsupported case for
extended asm, the generated code is not wrong as we only pass in
constant operands to extended asm.

See llvm#137055 for related
remarks.

---------

Co-authored-by: Copilot <[email protected]>
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
We use naked functions to avoid compiler-generated prologue and
epilogue.

Despite GCC documentation listing this as an unsupported case for
extended asm, the generated code is not wrong as we only pass in
constant operands to extended asm.

See llvm#137055 for related
remarks.

---------

Co-authored-by: Copilot <[email protected]>
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
We use naked functions to avoid compiler-generated prologue and
epilogue.

Despite GCC documentation listing this as an unsupported case for
extended asm, the generated code is not wrong as we only pass in
constant operands to extended asm.

See llvm#137055 for related
remarks.

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants