-
-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Hello, I've just run into this issue when cross-compiling with LLVM 16.0.5(ubuntu-mvcrt) from the releases page; with stdlib set to libstdc++.
Without LTO enabled, passing -femulated-tls
to clang generates the correct symbols in the object files. However, when LTO is enabled(-flto=full
or -flto=thin
), lld throws an undefined symbol error looking for _ZSt15__once_callable
and friends instead of __imp____emutls_v._ZSt15__once_callable
. I thought it might be related to issue 62077 in the llvm-project, but passing -Wl,-plugin-opt=-emulated-tls=1
to clang or -plugin-opt=-emulated-tls=1
to lld during linking still has the problem. Has this issue come up before? Am I missing something?
Here's the exact commands passed to clang if it helps.
When compiling one of the files that references std::__once_callable:
"/usr/bin/clang" -cc1 -triple x86_64-w64-windows-gnu -emit-llvm-bc -flto=thin -flto-unit -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name web_backend.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -mms-bitfields -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/__w/citra/citra/build -resource-dir /usr/lib/clang/16 -dependency-file src/web_service/CMakeFiles/web_service.dir/web_backend.cpp.obj.d -MT src/web_service/CMakeFiles/web_service.dir/web_backend.cpp.obj -sys-header-deps -isystem /__w/citra/citra/externals/boost -D BOOST_ALL_NO_LIB -D BOOST_ASIO_DISABLE_CONCEPTS -D BOOST_DATE_TIME_NO_LIB -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_REGEX_NO_LIB -D BOOST_SYSTEM_NO_LIB -D CPPHTTPLIB_OPENSSL_SUPPORT -D CPP_JWT_USE_VENDORED_NLOHMANN_JSON -D "CRYPTOPP_DATA_DIR=\"/__w/citra/citra/externals/cryptopp\"" -D ENABLE_FFMPEG_VIDEO_DUMPER -D MINGW_HAS_SECURE_API -D NDEBUG -D _FILE_OFFSET_BITS=64 -I /__w/citra/citra/src/. -I /__w/citra/citra/externals/fmt/include -I /__w/citra/citra/externals/./microprofile -I /__w/citra/citra/externals/./json -I /__w/citra/citra/externals/./httplib -I /__w/citra/citra/externals/./cpp-jwt/include -D NDEBUG -D CPPHTTPLIB_OPENSSL_SUPPORT -internal-isystem /usr/x86_64-w64-mingw32/include/c++ -internal-isystem /usr/x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32 -internal-isystem /usr/x86_64-w64-mingw32/include/c++/backward -internal-isystem /usr/x86_64-w64-mingw32/include/c++/12.2.0 -internal-isystem /usr/x86_64-w64-mingw32/include/c++/12.2.0/x86_64-w64-mingw32 -internal-isystem /usr/x86_64-w64-mingw32/include/c++/12.2.0/backward -internal-isystem /usr/include/c++/12.2.0 -internal-isystem /usr/include/c++/12.2.0/x86_64-w64-mingw32 -internal-isystem /usr/include/c++/12.2.0/backward -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++ -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/x86_64-w64-mingw32 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/c++/backward -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2.0 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2.0/x86_64-w64-mingw32 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2.0/backward -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2/x86_64-w64-mingw32 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12.2/backward -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12/x86_64-w64-mingw32 -internal-isystem /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/include/g++-v12/backward -internal-isystem /usr/lib/clang/16/include -internal-isystem /usr/x86_64-w64-mingw32/include -internal-isystem /usr/x86_64-w64-mingw32/usr/include -O3 -Wall -Wno-attributes -Winvalid-pch -std=gnu++20 -fdeprecated-macro -fdebug-compilation-dir=/__w/citra/citra/build -ferror-limit 19 -femulated-tls -pthread -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -exception-model=seh -vectorize-loops -vectorize-slp -include-pch /__w/citra/citra/build/src/web_service/CMakeFiles/web_service.dir/cmake_pch.hxx.pch -include /__w/citra/citra/build/src/web_service/CMakeFiles/web_service.dir/cmake_pch.hxx -faddrsig -o src/web_service/CMakeFiles/web_service.dir/web_backend.cpp.obj -x c++ /__w/citra/citra/src/web_service/web_backend.cpp
When linking:
"/usr/sbin/ld.lld" -m i386pep -Bdynamic -o bin/Release/citra-room.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/crtbegin.o -L/usr/lib/gcc/x86_64-w64-mingw32/12.2.0 -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/usr/lib/clang/16/lib/windows -no-demangle -plugin-opt=-emulated-tls=1 src/dedicated_room/CMakeFiles/citra-room.dir/citra-room.cpp.obj src/dedicated_room/CMakeFiles/citra-room.dir/citra-room.rc.res --out-implib src/dedicated_room/libcitra-room.dll.a --major-image-version 0 --minor-image-version 0 src/common/libcitra_common.a src/network/libnetwork.a src/web_service/libweb_service.a externals/cryptopp-cmake/cryptopp/libcryptopp.a -lwinmm -lws2_32 -lpsapi -limm32 -lversion src/network/libnetwork.a src/web_service/libweb_service.a externals/enet/libenet.a -lwinmm -lws2_32 src/common/libcitra_common.a externals/fmt/libfmt.a externals/libboost_serialization.a externals/libboost_iostreams.a externals/zstd/build/cmake/lib/libzstd.a /usr/x86_64-w64-mingw32/lib/libssl.dll.a /usr/x86_64-w64-mingw32/lib/libcrypto.dll.a -lcrypt32 -lkernel32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lstdc++ -lmingw32 /usr/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -lunwind -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 /usr/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -lunwind -lmoldname -lmingwex -lmsvcrt -lkernel32 /usr/lib/gcc/x86_64-w64-mingw32/12.2.0/crtend.o