Skip to content

[SYCL] Linking in static library with SYCL code should not require -Wl,--whole-archive #23194

Description

@dvrogozh

With 848eba7, Ubuntu 24.04, PVC. Consider the following trivial example:

This project builds main-static application from main.cpp and lib.cpp in the following way:

  1. main.cpp is regular C++ source and built with g++
  2. lib.cpp is SYCL source and built with dpclang++ into liblib-static.a
  3. main-static application is linked by g++

Review build-no-whole-archive.sh and build-whole-archive.sh scripts for the details.

main-static built without -Wl,--whole-archive will fail with:

$ ./main-static
main-static: /home/dvrogozh/git/intel-llvm/sycl/source/detail/program_manager/program_manager.cpp:1620: sycl::_V1::detail::DeviceKernelInfo& sycl::_V1::detail::ProgramManager::getDeviceKernelInfo(const sycl::_V1::detail::compile_time_kernel_info_v1::CompileTimeKernelInfoTy&): Assertion `It != m_DeviceKernelInfoMap.end()' failed.
Aborted (core dumped)

Can compiler be changed to not require -Wl,--whole-archive in this case? Note that NVidia nvcc does not require that in a similar scenario.

CC: @tahonermann, @sarnex

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions