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

Fix for "ld.lld: error: undefined symbol: _Uaarch64_setcontext" when doing build for FreeBSD-arm64 using internal libunwind #110432

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/native/external/libunwind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ elseif(CLR_CMAKE_TARGET_FREEBSD)
set(libunwind_la_SOURCES_arm_os_local arm/Los-freebsd.c)
set(libunwind_la_SOURCES_aarch64_os aarch64/Gos-freebsd.c)
set(libunwind_la_SOURCES_aarch64_os_local aarch64/Los-freebsd.c)
set(libunwind_aarch64_la_SOURCES_os aarch64/setcontext.S)
list(APPEND libunwind_coredump_la_SOURCES coredump/_UCD_access_reg_freebsd.c)
elseif(CLR_CMAKE_HOST_SUNOS)
set(libunwind_la_SOURCES_os ${libunwind_la_SOURCES_os_solaris})
Expand Down Expand Up @@ -229,7 +230,7 @@ set(libunwind_la_SOURCES_aarch64_common
# The list of files that go into libunwind:
set(libunwind_la_SOURCES_aarch64
${libunwind_la_SOURCES_aarch64_common}
${libunwind_la_SOURCES_aarch64_os_local}
${libunwind_la_SOURCES_aarch64_os_local} ${libunwind_aarch64_la_SOURCES_os}
Copy link
Member

Choose a reason for hiding this comment

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

Why is the aarch64/setcontext.S added only for FreeBSD and the getcontext.S for all targets? For other architectures, both are added for all targets.

Copy link
Member

Choose a reason for hiding this comment

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

@janvorli, getsetcontext is for x86 arch only and applies to Linux and FreeBSD OS alike.
FreeBSD aarch64 requirement was added in 1.8 libunwind/libunwind@032abaa. Linux aarch64 does not require it. I think we should make it clear by adding a column "OS" to the table in their readme https://github.com/libunwind/libunwind?tab=readme-ov-file#libc-requirements

Copy link
Member

Choose a reason for hiding this comment

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

Ah, thank you for the details, that makes sense.

${libunwind_la_SOURCES_local}
aarch64/Lapply_reg_state.c aarch64/Lreg_states_iterate.c
aarch64/Lcreate_addr_space.c aarch64/Lget_proc_info.c
Expand Down
Loading