Skip to content
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

Add llvm libunwind callback to suppress exceptions on apple silicon #254

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented May 2, 2024

Adding fix from

This adds the find_dynamic_unwind_sections callback, used by libunwind to fix the libc++abi: terminating due to uncaught exception of type int on apple silicon. This returns fake_mach_header as the header for all JIT'd code.

The checks are performed during library loading and unloading time, and so have been added during interpreter creation and destruction called in CppInterOp.cpp, via the leaked compat::Interpreter class

Copy link
Contributor

github-actions bot commented May 2, 2024

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

github-actions bot commented May 2, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented May 2, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.64%. Comparing base (ef2f0a1) to head (02ca483).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   70.62%   70.64%   +0.01%     
==========================================
  Files           9        9              
  Lines        3500     3502       +2     
==========================================
+ Hits         2472     2474       +2     
  Misses       1028     1028              
Files with missing lines Coverage Δ
lib/Interpreter/Compatibility.h 88.28% <ø> (ø)
lib/Interpreter/CppInterOp.cpp 79.92% <100.00%> (+0.02%) ⬆️
Files with missing lines Coverage Δ
lib/Interpreter/Compatibility.h 88.28% <ø> (ø)
lib/Interpreter/CppInterOp.cpp 79.92% <100.00%> (+0.02%) ⬆️

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

#include "llvm/Support/Casting.h"
#include "llvm/Support/Path.h"

/home/maximus/cppyy-interop-dev/CppInterOp/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: expected unqualified-id [clang-diagnostic-error]

/home/maximus/cppyy-interop-dev/CppInterOp/llvm-project/compiler-rt/lib/orc/macho_platform.cpp
^

Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev vgvassilev force-pushed the libunwind-fix branch 2 times, most recently from a7ae7ef to be0085b Compare May 3, 2024 08:31
Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev
Copy link
Contributor

@mcbarton, our cache sizes nowadays allow for having 1-2 osx-x86 builds. Are they easy to bring back?

@mcbarton
Copy link
Collaborator

mcbarton commented May 3, 2024

@mcbarton, our cache sizes nowadays allow for having 1-2 osx-x86 builds. Are they easy to bring back?

@vgvassilev Yes, they are easy to bring back. I'll put in a PR which brings them back.

@vgvassilev
Copy link
Contributor

@mcbarton, our cache sizes nowadays allow for having 1-2 osx-x86 builds. Are they easy to bring back?

@vgvassilev Yes, they are easy to bring back. I'll put in a PR which brings them back.

Nice! Thanks for the speed-of-light reply and PR!

@aaronj0 aaronj0 self-assigned this May 3, 2024
@aaronj0 aaronj0 marked this pull request as draft May 3, 2024 11:03
Copy link
Contributor

github-actions bot commented May 3, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented May 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

dlsym(RTLD_DEFAULT, "__unw_remove_find_dynamic_unwind_sections"))
unw_remove_find_dynamic_unwind_sections(find_dynamic_unwind_sections);
#endif
sInterpreter.release();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the value returned by this function should be used [bugprone-unused-return-value]

      sInterpreter.release();
      ^
Additional context

lib/Interpreter/CppInterOp.cpp:109: cast the expression to void to silence this warning

      sInterpreter.release();
      ^

Copy link
Contributor

github-actions bot commented Dec 4, 2024

This PR is stale because it has been open for 90 days with no activity.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -72,9 +72,11 @@ static inline char* GetEnv(const char* Var_Name) {
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Config/llvm-config.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: included header MachO.h is not used directly [misc-include-cleaner]

Suggested change
#include "llvm/Config/llvm-config.h"
#include "llvm/Config/llvm-config.h"

#include "llvm/Config/llvm-config.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Casting.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: included header MachO.h is not used directly [misc-include-cleaner]

Suggested change
#include "llvm/Support/Casting.h"
#include "llvm/Support/Casting.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants