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

fixes/cleanup for use-system-unwind make flags #55639

Merged
merged 2 commits into from
Aug 31, 2024

Conversation

benlorenz
Copy link
Contributor

@benlorenz benlorenz commented Aug 30, 2024

Assuming non-windows and libunwind not disabled:

The flag -DLLVMLIBUNWIND is currently set on macos only for USE_SYSTEM_UNWIND=0 which seems wrong to me and causes build issues for macos on Yggdrasil in combination with the recent #55049 which should only affect gnu libunwind (error: call to undeclared function 'unw_ensure_tls').
This flag is now set independently of the system-libunwind flag (on Darwin and OpenBSD as before).

LIBUNWIND=-lunwind is set for USE_SYSTEM_UNWIND=0 || USE_SYSTEM_UNWIND=1 && OS != Darwin.
I don't think the check for Darwin make sense and might be a leftover from using osxunwind a (long) while ago.
Changed that to always set -lunwind if enabled.

x-ref: JuliaPackaging/Yggdrasil#9331

@benlorenz benlorenz changed the title make sure LLVMLIBUNWIND is set for system-unwind on macos fixes/cleanup for use-system-unwind make flags Aug 30, 2024
Make.inc Outdated
ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
ifneq ($(OS),Darwin)
LIBUNWIND:=-lunwind
# Only for linux since we want to use not yet released libunwind features
Copy link
Contributor

Choose a reason for hiding this comment

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

It says "only for linux" here, but wouldn't this also be applied for OpenBSD and FreeBSD if USE_SYSTEM_LIBUNWIND=1 holds? Or maybe that can't happen? (Of course this is a question about the existing code, not something specific to this PR, so it is irrelevant for the acceptance of this PR)

@fingolfin
Copy link
Contributor

Looking at the new logic, wouldn't the following happen on OpenBSD: if USE_SYSTEM_LIBUNWIND=1 holds then both -DSYSTEM_LIBUNWIND and -DLLVMLIBUNWIND are added to JCPPFLAGS.

But perhaps this fine and/or this combo can not happen?

@gbaraldi
Copy link
Member

Yeah seems ok to me. The system libunwind in macos is LLVM's anyway

@benlorenz
Copy link
Contributor Author

I think this one ifneq ($(OS),Darwin) might have been missed in the OpenBSD refactor and should have included OpenBSD as well. So I did another simplification:

  • On OpenBSD and Darwin: always set -DLLVMLIBUNWIND since these are the platforms where the llvm libunwind is used.
  • Else, on Linux and FreeBSD: set -DSYSTEM_LIBUNWIND if USE_SYSTEM_LIBUNWIND is set to disable some extra gnu libunwind features which are only available in a custom patched gnu libunwind.
  • Windows or disabled libunwind: no change.

Looking at the new logic, wouldn't the following happen on OpenBSD: if USE_SYSTEM_LIBUNWIND=1 holds then both -DSYSTEM_LIBUNWIND and -DLLVMLIBUNWIND are added to JCPPFLAGS.

But perhaps this fine and/or this combo can not happen?

This cannot happen anymore now (but I think would be fine anyway).

Copy link
Contributor

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@fingolfin fingolfin merged commit 0622123 into JuliaLang:master Aug 31, 2024
5 of 7 checks passed
KristofferC pushed a commit that referenced this pull request Sep 12, 2024
Assuming non-windows and libunwind not disabled:

The flag `-DLLVMLIBUNWIND` is currently set on macos only for
`USE_SYSTEM_UNWIND=0` which seems wrong to me and causes build issues
for macos on Yggdrasil in combination with the recent
#55049 which should only affect
gnu libunwind (`error: call to undeclared function 'unw_ensure_tls'`).
This flag is now set independently of the system-libunwind flag (on
Darwin and OpenBSD as before).

`LIBUNWIND=-lunwind` is set for `USE_SYSTEM_UNWIND=0` ||
`USE_SYSTEM_UNWIND=1` && `OS != Darwin`.
I don't think the check for Darwin make sense and might be a leftover
from using osxunwind a (long) while ago.
Changed that to always set `-lunwind` if enabled.

x-ref: JuliaPackaging/Yggdrasil#9331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants