Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package llvm20 for openSUSE:Factory checked in at 2025-05-23 14:28:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/llvm20 (Old) and /work/SRC/openSUSE:Factory/.llvm20.new.2732 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "llvm20" Fri May 23 14:28:32 2025 rev:5 rq:1278295 version:20.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/llvm20/llvm20.changes 2025-05-06 16:38:36.949114376 +0200 +++ /work/SRC/openSUSE:Factory/.llvm20.new.2732/llvm20.changes 2025-05-23 14:28:55.940473249 +0200 @@ -1,0 +2,14 @@ +Sun May 18 12:00:54 UTC 2025 - Aaron Puchert <aaronpuch...@alice-dsl.net> + +- Update to version 20.1.5. + * This release contains bug-fixes for the LLVM 20.1.0 release. + This release is API and ABI compatible with 20.1.0. +- Rebase llvm-do-not-install-static-libraries.patch. +- Add llvm-fix-hexagon-test.patch to fix failing test. + +------------------------------------------------------------------- +Tue May 13 13:38:32 CEST 2025 - Ruediger Oertel <r...@suse.de> + +- Enable build of libc++ for ppc64le + +------------------------------------------------------------------- Old: ---- clang-20.1.4.src.tar.xz clang-20.1.4.src.tar.xz.sig clang-docs-20.1.4.src.tar.xz clang-tools-extra-20.1.4.src.tar.xz clang-tools-extra-20.1.4.src.tar.xz.sig cmake-20.1.4.src.tar.xz cmake-20.1.4.src.tar.xz.sig compiler-rt-20.1.4.src.tar.xz compiler-rt-20.1.4.src.tar.xz.sig libc-20.1.4.src.tar.xz libcxx-20.1.4.src.tar.xz libcxx-20.1.4.src.tar.xz.sig libcxxabi-20.1.4.src.tar.xz libcxxabi-20.1.4.src.tar.xz.sig lld-20.1.4.src.tar.xz lld-20.1.4.src.tar.xz.sig lldb-20.1.4.src.tar.xz lldb-20.1.4.src.tar.xz.sig llvm-20.1.4.src.tar.xz llvm-20.1.4.src.tar.xz.sig llvm-docs-20.1.4.src.tar.xz openmp-20.1.4.src.tar.xz openmp-20.1.4.src.tar.xz.sig polly-20.1.4.src.tar.xz polly-20.1.4.src.tar.xz.sig runtimes-20.1.4.src.tar.xz runtimes-20.1.4.src.tar.xz.sig third-party-20.1.4.src.tar.xz third-party-20.1.4.src.tar.xz.sig New: ---- clang-20.1.5.src.tar.xz clang-20.1.5.src.tar.xz.sig clang-docs-20.1.5.src.tar.xz clang-tools-extra-20.1.5.src.tar.xz clang-tools-extra-20.1.5.src.tar.xz.sig cmake-20.1.5.src.tar.xz cmake-20.1.5.src.tar.xz.sig compiler-rt-20.1.5.src.tar.xz compiler-rt-20.1.5.src.tar.xz.sig libc-20.1.5.src.tar.xz libcxx-20.1.5.src.tar.xz libcxx-20.1.5.src.tar.xz.sig libcxxabi-20.1.5.src.tar.xz libcxxabi-20.1.5.src.tar.xz.sig lld-20.1.5.src.tar.xz lld-20.1.5.src.tar.xz.sig lldb-20.1.5.src.tar.xz lldb-20.1.5.src.tar.xz.sig llvm-20.1.5.src.tar.xz llvm-20.1.5.src.tar.xz.sig llvm-docs-20.1.5.src.tar.xz llvm-fix-hexagon-test.patch openmp-20.1.5.src.tar.xz openmp-20.1.5.src.tar.xz.sig polly-20.1.5.src.tar.xz polly-20.1.5.src.tar.xz.sig runtimes-20.1.5.src.tar.xz runtimes-20.1.5.src.tar.xz.sig third-party-20.1.5.src.tar.xz third-party-20.1.5.src.tar.xz.sig BETA DEBUG BEGIN: New:- Rebase llvm-do-not-install-static-libraries.patch. - Add llvm-fix-hexagon-test.patch to fix failing test. BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ llvm20.spec ++++++ --- /var/tmp/diff_new_pack.iHlff4/_old 2025-05-23 14:28:59.748635178 +0200 +++ /var/tmp/diff_new_pack.iHlff4/_new 2025-05-23 14:28:59.752635347 +0200 @@ -19,7 +19,7 @@ %global _sonum 20 %global _minor %{_sonum}.1 %global _soname %{_minor}%{?_rc:-rc%_rc} -%global _patch_level 4 +%global _patch_level 5 %global _relver %{_minor}.%{_patch_level} %global _version %_relver%{?_rc:-rc%_rc} %global _itsme20 1 @@ -28,7 +28,7 @@ %global _soclang 13 %global _socxx 1 -%ifarch x86_64 aarch64 %arm riscv64 +%ifarch x86_64 aarch64 %arm riscv64 ppc64le %bcond_without libcxx %else %bcond_with libcxx @@ -444,6 +444,8 @@ Patch27: clang-fix-openmp-test.patch # PATCH-FIX-UPSTREAM: Fix test with x87 floating-point. Patch28: llvm-fix-cov-test-i586.patch +# PATCH-FIX-UPSTREAM: Fix test pfalse-v4i1.ll +Patch29: llvm-fix-hexagon-test.patch BuildRequires: %{python_pkg}-base >= 3.8 BuildRequires: binutils-devel >= 2.21.90 BuildRequires: cmake >= 3.13.4 @@ -885,6 +887,7 @@ %patch -P 24 -p1 %patch -P 25 -p2 %patch -P 28 -p2 +%patch -P 29 -p2 pushd clang-%{_version}.src %patch -P 2 -p1 ++++++ clang-20.1.4.src.tar.xz -> clang-20.1.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm20/clang-20.1.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm20.new.2732/clang-20.1.5.src.tar.xz differ: char 15, line 1 ++++++ clang-docs-20.1.4.src.tar.xz -> clang-docs-20.1.5.src.tar.xz ++++++ ++++ 3233 lines of diff (skipped) ++++++ clang-tools-extra-20.1.4.src.tar.xz -> clang-tools-extra-20.1.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-tools-extra-20.1.4.src/clang-tidy/tool/run-clang-tidy.py new/clang-tools-extra-20.1.5.src/clang-tidy/tool/run-clang-tidy.py --- old/clang-tools-extra-20.1.4.src/clang-tidy/tool/run-clang-tidy.py 2025-04-30 01:05:17.000000000 +0200 +++ new/clang-tools-extra-20.1.5.src/clang-tidy/tool/run-clang-tidy.py 2025-05-14 00:18:22.000000000 +0200 @@ -87,7 +87,7 @@ def get_tidy_invocation( - f: str, + f: Optional[str], clang_tidy_binary: str, checks: str, tmpdir: Optional[str], @@ -147,7 +147,8 @@ start.append(f"--warnings-as-errors={warnings_as_errors}") if allow_no_checks: start.append("--allow-no-checks") - start.append(f) + if f: + start.append(f) return start @@ -490,7 +491,7 @@ try: invocation = get_tidy_invocation( - "", + None, clang_tidy_binary, args.checks, None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-tools-extra-20.1.4.src/docs/ReleaseNotes.rst new/clang-tools-extra-20.1.5.src/docs/ReleaseNotes.rst --- old/clang-tools-extra-20.1.4.src/docs/ReleaseNotes.rst 2025-04-30 01:05:17.000000000 +0200 +++ new/clang-tools-extra-20.1.5.src/docs/ReleaseNotes.rst 2025-05-14 00:18:22.000000000 +0200 @@ -190,6 +190,9 @@ - Fixed bug in :program:`clang-tidy` by which `HeaderFilterRegex` did not take effect when passed via the `.clang-tidy` file. +- Fixed bug in :program:`run_clang_tidy.py` where the program would not + correctly display the checks enabled by the top-level `.clang-tidy` file. + New checks ^^^^^^^^^^ ++++++ cmake-20.1.4.src.tar.xz -> cmake-20.1.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmake-20.1.4.src/Modules/LLVMVersion.cmake new/cmake-20.1.5.src/Modules/LLVMVersion.cmake --- old/cmake-20.1.4.src/Modules/LLVMVersion.cmake 2025-04-30 01:05:17.000000000 +0200 +++ new/cmake-20.1.5.src/Modules/LLVMVersion.cmake 2025-05-14 00:18:22.000000000 +0200 @@ -7,7 +7,7 @@ set(LLVM_VERSION_MINOR 1) endif() if(NOT DEFINED LLVM_VERSION_PATCH) - set(LLVM_VERSION_PATCH 4) + set(LLVM_VERSION_PATCH 5) endif() if(NOT DEFINED LLVM_VERSION_SUFFIX) set(LLVM_VERSION_SUFFIX) ++++++ compiler-rt-20.1.4.src.tar.xz -> compiler-rt-20.1.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/rtsan/rtsan_interceptors_posix.cpp new/compiler-rt-20.1.5.src/lib/rtsan/rtsan_interceptors_posix.cpp --- old/compiler-rt-20.1.4.src/lib/rtsan/rtsan_interceptors_posix.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/rtsan/rtsan_interceptors_posix.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -21,18 +21,6 @@ #include "rtsan/rtsan.h" #if SANITIZER_APPLE - -#if TARGET_OS_MAC -// On MacOS OSSpinLockLock is deprecated and no longer present in the headers, -// but the symbol still exists on the system. Forward declare here so we -// don't get compilation errors. -#include <stdint.h> -extern "C" { -typedef int32_t OSSpinLock; -void OSSpinLockLock(volatile OSSpinLock *__lock); -} -#endif // TARGET_OS_MAC - #include <libkern/OSAtomic.h> #include <os/lock.h> #endif // SANITIZER_APPLE @@ -627,21 +615,35 @@ #pragma clang diagnostic push // OSSpinLockLock is deprecated, but still in use in libc++ #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#undef OSSpinLockLock + INTERCEPTOR(void, OSSpinLockLock, volatile OSSpinLock *lock) { __rtsan_notify_intercepted_call("OSSpinLockLock"); return REAL(OSSpinLockLock)(lock); } -#pragma clang diagnostic pop + #define RTSAN_MAYBE_INTERCEPT_OSSPINLOCKLOCK INTERCEPT_FUNCTION(OSSpinLockLock) #else #define RTSAN_MAYBE_INTERCEPT_OSSPINLOCKLOCK #endif // SANITIZER_APPLE #if SANITIZER_APPLE +// _os_nospin_lock_lock may replace OSSpinLockLock due to deprecation macro. +typedef volatile OSSpinLock *_os_nospin_lock_t; + +INTERCEPTOR(void, _os_nospin_lock_lock, _os_nospin_lock_t lock) { + __rtsan_notify_intercepted_call("_os_nospin_lock_lock"); + return REAL(_os_nospin_lock_lock)(lock); +} +#pragma clang diagnostic pop // "-Wdeprecated-declarations" +#endif // SANITIZER_APPLE + +#if SANITIZER_APPLE INTERCEPTOR(void, os_unfair_lock_lock, os_unfair_lock_t lock) { __rtsan_notify_intercepted_call("os_unfair_lock_lock"); return REAL(os_unfair_lock_lock)(lock); } + #define RTSAN_MAYBE_INTERCEPT_OS_UNFAIR_LOCK_LOCK \ INTERCEPT_FUNCTION(os_unfair_lock_lock) #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp new/compiler-rt-20.1.5.src/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp --- old/compiler-rt-20.1.4.src/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -1036,10 +1036,18 @@ } #if SANITIZER_APPLE - #pragma clang diagnostic push // OSSpinLockLock is deprecated, but still in use in libc++ #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#undef OSSpinLockLock +extern "C" { +typedef int32_t OSSpinLock; +void OSSpinLockLock(volatile OSSpinLock *__lock); +// _os_nospin_lock_lock may replace OSSpinLockLock due to deprecation macro. +typedef volatile OSSpinLock *_os_nospin_lock_t; +void _os_nospin_lock_lock(_os_nospin_lock_t lock); +} + TEST(TestRtsanInterceptors, OsSpinLockLockDiesWhenRealtime) { auto Func = []() { OSSpinLock spin_lock{}; @@ -1048,7 +1056,14 @@ ExpectRealtimeDeath(Func, "OSSpinLockLock"); ExpectNonRealtimeSurvival(Func); } -#pragma clang diagnostic pop + +TEST(TestRtsanInterceptors, OsNoSpinLockLockDiesWhenRealtime) { + OSSpinLock lock{}; + auto Func = [&]() { _os_nospin_lock_lock(&lock); }; + ExpectRealtimeDeath(Func, "_os_nospin_lock_lock"); + ExpectNonRealtimeSurvival(Func); +} +#pragma clang diagnostic pop //"-Wdeprecated-declarations" TEST(TestRtsanInterceptors, OsUnfairLockLockDiesWhenRealtime) { auto Func = []() { @@ -1058,7 +1073,7 @@ ExpectRealtimeDeath(Func, "os_unfair_lock_lock"); ExpectNonRealtimeSurvival(Func); } -#endif +#endif // SANITIZER_APPLE #if SANITIZER_LINUX TEST(TestRtsanInterceptors, SpinLockLockDiesWhenRealtime) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_linux.cpp new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_linux.cpp --- old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_linux.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_linux.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -86,6 +86,10 @@ # include <sys/sysmacros.h> # endif +# if SANITIZER_LINUX && defined(__powerpc64__) +# include <asm/ptrace.h> +# endif + # if SANITIZER_FREEBSD # include <machine/atomic.h> # include <sys/exec.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_linux_libcdep.cpp new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_linux_libcdep.cpp --- old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_linux_libcdep.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_linux_libcdep.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -619,21 +619,22 @@ *addr = tp - RoundUpTo(*size, align); *size = tp - *addr + ThreadDescriptorSize(); # else - if (SANITIZER_GLIBC) - *size += 1664; - else if (SANITIZER_FREEBSD) - *size += 128; // RTLD_STATIC_TLS_EXTRA -# if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64 +# if SANITIZER_GLIBC + *size += 1664; +# elif SANITIZER_FREEBSD + *size += 128; // RTLD_STATIC_TLS_EXTRA +# if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64 const uptr pre_tcb_size = TlsPreTcbSize(); *addr -= pre_tcb_size; *size += pre_tcb_size; -# else +# else // arm and aarch64 reserve two words at TP, so this underestimates the range. // However, this is sufficient for the purpose of finding the pointers to // thread-specific data keys. const uptr tcb_size = ThreadDescriptorSize(); *addr -= tcb_size; *size += tcb_size; +# endif # endif # endif # elif SANITIZER_NETBSD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp --- old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -96,7 +96,7 @@ # include <sys/ptrace.h> # if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \ defined(__hexagon__) || defined(__loongarch__) || SANITIZER_RISCV64 || \ - defined(__sparc__) + defined(__sparc__) || defined(__powerpc64__) # include <asm/ptrace.h> # ifdef __arm__ typedef struct user_fpregs elf_fpregset_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp --- old/compiler-rt-20.1.4.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/compiler-rt-20.1.5.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -31,7 +31,8 @@ #include <sys/types.h> // for pid_t #include <sys/uio.h> // for iovec #include <elf.h> // for NT_PRSTATUS -#if (defined(__aarch64__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \ +#if (defined(__aarch64__) || defined(__powerpc64__) || \ + SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \ !SANITIZER_ANDROID // GLIBC 2.20+ sys/user does not include asm/ptrace.h # include <asm/ptrace.h> ++++++ libc-20.1.4.src.tar.xz -> libc-20.1.5.src.tar.xz ++++++ ++++++ libcxx-20.1.4.src.tar.xz -> libcxx-20.1.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcxx-20.1.4.src/docs/ReleaseNotes/20.rst new/libcxx-20.1.5.src/docs/ReleaseNotes/20.rst --- old/libcxx-20.1.4.src/docs/ReleaseNotes/20.rst 2025-04-30 01:05:17.000000000 +0200 +++ new/libcxx-20.1.5.src/docs/ReleaseNotes/20.rst 2025-05-14 00:18:22.000000000 +0200 @@ -153,9 +153,6 @@ headers as an extension and only deprecates them. The ``_LIBCPP_DISABLE_DEPRECATION_WARNINGS`` macro can be defined to suppress deprecation for these headers. -- The ``_LIBCPP_DISABLE_AVAILABILITY`` macro that was used to force-disable availability markup has now been removed. - Whether availability markup is used by the library is now solely controlled at configuration-time. - - The pointer safety functions ``declare_reachable``, ``declare_no_pointers``, ``undeclare_no_pointers`` and ``__undeclare_reachable`` have been removed from the library. These functions were never implemented in a non-trivial way, making it very unlikely that any binary depends on them. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcxx-20.1.4.src/include/__configuration/availability.h new/libcxx-20.1.5.src/include/__configuration/availability.h --- old/libcxx-20.1.4.src/include/__configuration/availability.h 2025-04-30 01:05:17.000000000 +0200 +++ new/libcxx-20.1.5.src/include/__configuration/availability.h 2025-05-14 00:18:22.000000000 +0200 @@ -69,7 +69,13 @@ // Availability markup is disabled when building the library, or when a non-Clang // compiler is used because only Clang supports the necessary attributes. -#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED) +// +// We also allow users to force-disable availability markup via the `_LIBCPP_DISABLE_AVAILABILITY` +// macro because that is the only way to work around a Clang bug related to availability +// attributes: https://github.com/llvm/llvm-project/issues/134151. +// Once that bug has been fixed, we should remove the macro. +#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || \ + !defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_DISABLE_AVAILABILITY) # undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS # define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0 #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcxx-20.1.4.src/test/libcxx/vendor/apple/disable-availability.sh.cpp new/libcxx-20.1.5.src/test/libcxx/vendor/apple/disable-availability.sh.cpp --- old/libcxx-20.1.4.src/test/libcxx/vendor/apple/disable-availability.sh.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/libcxx-20.1.5.src/test/libcxx/vendor/apple/disable-availability.sh.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// REQUIRES: stdlib=apple-libc++ + +// This test is dependent on the code generated by the compiler, and it doesn't +// work properly with older AppleClangs. +// UNSUPPORTED: apple-clang-15 + +// This test ensures that we retain a way to disable availability markup on Apple platforms +// in order to work around Clang bug https://github.com/llvm/llvm-project/issues/134151. +// +// Once that bug has been fixed or once we've made changes to libc++'s use of availability +// that render that workaround unnecessary, the macro and this test can be removed. +// +// The test works by creating a final linked image that refers to a function marked with +// both an availability attribute and with _LIBCPP_HIDE_FROM_ABI. We then check that this +// generates a weak reference to the function -- without the bug, we'd expect a strong +// reference or no reference at all instead. + +// First, test the test. Make sure that we do (incorrectly) produce a weak definition when we +// don't define _LIBCPP_DISABLE_AVAILABILITY. Otherwise, something may have changed in libc++ +// and this test might not work anymore. +// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -fvisibility=hidden -fvisibility-inlines-hidden -shared -o %t.1.dylib +// RUN: nm -m %t.1.dylib | c++filt | grep value > %t.1.symbols +// RUN: grep weak %t.1.symbols + +// Now, make sure that 'weak' goes away when we define _LIBCPP_DISABLE_AVAILABILITY. +// In fact, all references to the function might go away, so we just check that we don't emit +// any weak reference. +// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -fvisibility=hidden -fvisibility-inlines-hidden -D_LIBCPP_DISABLE_AVAILABILITY -shared -o %t.2.dylib +// RUN: nm -m %t.2.dylib | c++filt | grep value > %t.2.symbols +// RUN: not grep weak %t.2.symbols + +#include <version> + +template <class T> +struct optional { + T val_; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE T value() const { return val_; } +}; + +using PMF = int (optional<int>::*)() const; +PMF f() { return &optional<int>::value; } ++++++ libcxxabi-20.1.4.src.tar.xz -> libcxxabi-20.1.5.src.tar.xz ++++++ ++++++ lld-20.1.4.src.tar.xz -> lld-20.1.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/COFF/Driver.cpp new/lld-20.1.5.src/COFF/Driver.cpp --- old/lld-20.1.4.src/COFF/Driver.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/COFF/Driver.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -2639,10 +2639,8 @@ createECExportThunks(); // Resolve remaining undefined symbols and warn about imported locals. - ctx.forEachSymtab([&](SymbolTable &symtab) { - while (symtab.resolveRemainingUndefines()) - run(); - }); + ctx.forEachSymtab( + [&](SymbolTable &symtab) { symtab.resolveRemainingUndefines(); }); if (errorCount()) return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/COFF/SymbolTable.cpp new/lld-20.1.5.src/COFF/SymbolTable.cpp --- old/lld-20.1.4.src/COFF/SymbolTable.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/COFF/SymbolTable.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -214,7 +214,8 @@ std::vector<File> files; }; -static void reportUndefinedSymbol(COFFLinkerContext &ctx, +static void reportUndefinedSymbol(SymbolTable *symTab, + COFFLinkerContext &ctx, const UndefinedDiag &undefDiag) { auto diag = errorOrWarn(ctx); diag << "undefined symbol: " << undefDiag.sym; @@ -232,6 +233,17 @@ } if (numDisplayedRefs < numRefs) diag << "\n>>> referenced " << numRefs - numDisplayedRefs << " more times"; + + // Hints + StringRef name = undefDiag.sym->getName(); + if (name.consume_front("__imp_")) { + Symbol *imp = symTab->find(name); + if (imp && imp->isLazy()) { + diag << "\nNOTE: a relevant symbol '" << imp->getName() + << "' is available in " << toString(imp->getFile()) + << " but cannot be used because it is not an import library."; + } + } } void SymbolTable::loadMinGWSymbols() { @@ -402,7 +414,7 @@ processFile(file, file->getSymbols()); for (const UndefinedDiag &undefDiag : undefDiags) - reportUndefinedSymbol(ctx, undefDiag); + reportUndefinedSymbol(this, ctx, undefDiag); } void SymbolTable::reportUnresolvable() { @@ -432,11 +444,10 @@ reportProblemSymbols(undefs, /*localImports=*/nullptr, true); } -bool SymbolTable::resolveRemainingUndefines() { +void SymbolTable::resolveRemainingUndefines() { llvm::TimeTraceScope timeScope("Resolve remaining undefined symbols"); SmallPtrSet<Symbol *, 8> undefs; DenseMap<Symbol *, Symbol *> localImports; - bool foundLazy = false; for (auto &i : symMap) { Symbol *sym = i.second; @@ -481,11 +492,6 @@ imp = findLocalSym(*mangledName); } } - if (imp && imp->isLazy()) { - forceLazy(imp); - foundLazy = true; - continue; - } if (imp && isa<Defined>(imp)) { auto *d = cast<Defined>(imp); replaceSymbol<DefinedLocalImport>(sym, ctx, name, d); @@ -513,7 +519,6 @@ reportProblemSymbols( undefs, ctx.config.warnLocallyDefinedImported ? &localImports : nullptr, false); - return foundLazy; } std::pair<Symbol *, bool> SymbolTable::insert(StringRef name) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/COFF/SymbolTable.h new/lld-20.1.5.src/COFF/SymbolTable.h --- old/lld-20.1.4.src/COFF/SymbolTable.h 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/COFF/SymbolTable.h 2025-05-14 00:18:22.000000000 +0200 @@ -58,10 +58,7 @@ // Try to resolve any undefined symbols and update the symbol table // accordingly, then print an error message for any remaining undefined // symbols and warn about imported local symbols. - // Returns whether more files might need to be linked in to resolve lazy - // symbols, in which case the caller is expected to call the function again - // after linking those files. - bool resolveRemainingUndefines(); + void resolveRemainingUndefines(); // Load lazy objects that are needed for MinGW automatic import and for // doing stdcall fixups. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/test/COFF/imports-static-lib-indirect.test new/lld-20.1.5.src/test/COFF/imports-static-lib-indirect.test --- old/lld-20.1.4.src/test/COFF/imports-static-lib-indirect.test 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-20.1.5.src/test/COFF/imports-static-lib-indirect.test 2025-05-14 00:18:22.000000000 +0200 @@ -0,0 +1,26 @@ +# REQUIRES: x86 + +# Pulling in on both a dllimport symbol and a static symbol should only warn. +# RUN: split-file %s %t.dir +# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/other.s -o %t.other.obj +# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/main.s -o %t.main.obj +# RUN: llvm-lib %t.other.obj -out:%t.other.lib +# RUN: lld-link %t.other.lib %t.main.obj -out:%t.dll -dll 2>&1 | FileCheck %s + +CHECK: warning: {{.*}} locally defined symbol imported: foo {{.*}} [LNK4217] + +#--- other.s +.text +.globl other +.globl foo +other: + ret +foo: + ret +#--- main.s +.text +.global _DllMainCRTStartup +_DllMainCRTStartup: + call *other(%rip) + call *__imp_foo(%rip) + ret diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/test/COFF/imports-static-lib.test new/lld-20.1.5.src/test/COFF/imports-static-lib.test --- old/lld-20.1.4.src/test/COFF/imports-static-lib.test 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-20.1.5.src/test/COFF/imports-static-lib.test 2025-05-14 00:18:22.000000000 +0200 @@ -0,0 +1,33 @@ +# REQUIRES: x86 + +# Ensure that we don't import dllimport symbols from static (non-import) libraries +# RUN: split-file %s %t.dir +# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/foo.s -o %t.foo.obj +# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/main.s -o %t.main.obj +# RUN: llvm-lib %t.foo.obj -out:%t.foo.lib +# RUN: not lld-link %t.foo.lib %t.main.obj -out:%t.dll -dll 2>&1 | FileCheck %s + +CHECK: error: undefined symbol: __declspec(dllimport) foo +CHECK: NOTE: a relevant symbol 'foo' is available in {{.*}}.foo.lib but cannot be used because it is not an import library. + +# Now do the same thing, but import the symbol from a import library. +# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/foo_dll_main.s -o %t.foo_dll_main.obj +# RUN: lld-link /out:%t.dll /dll %t.foo.obj %t.foo_dll_main.obj /export:foo /implib:%t.foo.imp.lib +# RUN: lld-link %t.main.obj %t.foo.imp.lib -out:%t.exe -dll + +#--- foo.s +.text +.globl foo +foo: + ret +#--- foo_dll_main.s +.text +.global _DllMainCRTStartup +_DllMainCRTStartup: + ret +#--- main.s +.text +.global _DllMainCRTStartup +_DllMainCRTStartup: + call *__imp_foo(%rip) + ret diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/test/COFF/undefined_lazy.test new/lld-20.1.5.src/test/COFF/undefined_lazy.test --- old/lld-20.1.4.src/test/COFF/undefined_lazy.test 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/test/COFF/undefined_lazy.test 1970-01-01 01:00:00.000000000 +0100 @@ -1,26 +0,0 @@ -# REQUIRES: x86 - -# RUN: split-file %s %t.dir -# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/foo.s -o %t.foo.obj -# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/bar.s -o %t.bar.obj -# RUN: llvm-mc --filetype=obj -triple=x86_64-windows-msvc %t.dir/qux.s -o %t.qux.obj -# RUN: llvm-lib %t.foo.obj -out:%t.foo.lib -# RUN: llvm-lib %t.bar.obj -out:%t.bar.lib -# RUN: lld-link %t.foo.lib %t.bar.lib %t.qux.obj -out:%t.dll -dll -# -#--- foo.s -.text -.globl foo -foo: - call bar -#--- bar.s -.text -.globl bar -bar: - ret -#--- qux.s -.text -.global _DllMainCRTStartup -_DllMainCRTStartup: - call *__imp_foo(%rip) - ret diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/Config.h new/lld-20.1.5.src/wasm/Config.h --- old/lld-20.1.4.src/wasm/Config.h 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/Config.h 2025-05-14 00:18:22.000000000 +0200 @@ -32,6 +32,11 @@ class InputGlobal; class InputFunction; class Symbol; +class DefinedData; +class GlobalSymbol; +class DefinedFunction; +class UndefinedGlobal; +class TableSymbol; // For --unresolved-symbols. enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic }; @@ -139,6 +144,107 @@ llvm::SmallVector<InputGlobal *, 0> syntheticGlobals; llvm::SmallVector<InputTable *, 0> syntheticTables; + // linker-generated symbols + struct WasmSym { + // __global_base + // Symbol marking the start of the global section. + DefinedData *globalBase; + + // __stack_pointer/__stack_low/__stack_high + // Global that holds current value of stack pointer and data symbols marking + // the start and end of the stack region. stackPointer is initialized to + // stackHigh and grows downwards towards stackLow + GlobalSymbol *stackPointer; + DefinedData *stackLow; + DefinedData *stackHigh; + + // __tls_base + // Global that holds the address of the base of the current thread's + // TLS block. + GlobalSymbol *tlsBase; + + // __tls_size + // Symbol whose value is the size of the TLS block. + GlobalSymbol *tlsSize; + + // __tls_size + // Symbol whose value is the alignment of the TLS block. + GlobalSymbol *tlsAlign; + + // __data_end + // Symbol marking the end of the data and bss. + DefinedData *dataEnd; + + // __heap_base/__heap_end + // Symbols marking the beginning and end of the "heap". It starts at the end + // of the data, bss and explicit stack, and extends to the end of the linear + // memory allocated by wasm-ld. This region of memory is not used by the + // linked code, so it may be used as a backing store for `sbrk` or `malloc` + // implementations. + DefinedData *heapBase; + DefinedData *heapEnd; + + // __wasm_init_memory_flag + // Symbol whose contents are nonzero iff memory has already been + // initialized. + DefinedData *initMemoryFlag; + + // __wasm_init_memory + // Function that initializes passive data segments during instantiation. + DefinedFunction *initMemory; + + // __wasm_call_ctors + // Function that directly calls all ctors in priority order. + DefinedFunction *callCtors; + + // __wasm_call_dtors + // Function that calls the libc/etc. cleanup function. + DefinedFunction *callDtors; + + // __wasm_apply_global_relocs + // Function that applies relocations to wasm globals post-instantiation. + // Unlike __wasm_apply_data_relocs this needs to run on every thread. + DefinedFunction *applyGlobalRelocs; + + // __wasm_apply_tls_relocs + // Like __wasm_apply_data_relocs but for TLS section. These must be + // delayed until __wasm_init_tls. + DefinedFunction *applyTLSRelocs; + + // __wasm_apply_global_tls_relocs + // Like applyGlobalRelocs but for globals that hold TLS addresses. These + // must be delayed until __wasm_init_tls. + DefinedFunction *applyGlobalTLSRelocs; + + // __wasm_init_tls + // Function that allocates thread-local storage and initializes it. + DefinedFunction *initTLS; + + // Pointer to the function that is to be used in the start section. + // (normally an alias of initMemory, or applyGlobalRelocs). + DefinedFunction *startFunction; + + // __dso_handle + // Symbol used in calls to __cxa_atexit to determine current DLL + DefinedData *dsoHandle; + + // __table_base + // Used in PIC code for offset of indirect function table + UndefinedGlobal *tableBase; + DefinedData *definedTableBase; + + // __memory_base + // Used in PIC code for offset of global data + UndefinedGlobal *memoryBase; + DefinedData *definedMemoryBase; + + // __indirect_function_table + // Used as an address space for function pointers, with each function that + // is used as a function pointer being allocated a slot. + TableSymbol *indirectFunctionTable; + }; + WasmSym sym; + // True if we are creating position-independent code. bool isPic = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/Driver.cpp new/lld-20.1.5.src/wasm/Driver.cpp --- old/lld-20.1.4.src/wasm/Driver.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/Driver.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -70,6 +70,7 @@ isPic = false; legacyFunctionTable = false; emitBssSegments = false; + sym = WasmSym{}; } namespace { @@ -941,14 +942,14 @@ true}; static llvm::wasm::WasmGlobalType mutableGlobalTypeI64 = {WASM_TYPE_I64, true}; - WasmSym::callCtors = symtab->addSyntheticFunction( + ctx.sym.callCtors = symtab->addSyntheticFunction( "__wasm_call_ctors", WASM_SYMBOL_VISIBILITY_HIDDEN, make<SyntheticFunction>(nullSignature, "__wasm_call_ctors")); bool is64 = ctx.arg.is64.value_or(false); if (ctx.isPic) { - WasmSym::stackPointer = + ctx.sym.stackPointer = createUndefinedGlobal("__stack_pointer", ctx.arg.is64.value_or(false) ? &mutableGlobalTypeI64 : &mutableGlobalTypeI32); @@ -958,25 +959,24 @@ // See: // https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md auto *globalType = is64 ? &globalTypeI64 : &globalTypeI32; - WasmSym::memoryBase = createUndefinedGlobal("__memory_base", globalType); - WasmSym::tableBase = createUndefinedGlobal("__table_base", globalType); - WasmSym::memoryBase->markLive(); - WasmSym::tableBase->markLive(); + ctx.sym.memoryBase = createUndefinedGlobal("__memory_base", globalType); + ctx.sym.tableBase = createUndefinedGlobal("__table_base", globalType); + ctx.sym.memoryBase->markLive(); + ctx.sym.tableBase->markLive(); } else { // For non-PIC code - WasmSym::stackPointer = createGlobalVariable("__stack_pointer", true); - WasmSym::stackPointer->markLive(); + ctx.sym.stackPointer = createGlobalVariable("__stack_pointer", true); + ctx.sym.stackPointer->markLive(); } if (ctx.arg.sharedMemory) { - WasmSym::tlsBase = createGlobalVariable("__tls_base", true); - WasmSym::tlsSize = createGlobalVariable("__tls_size", false); - WasmSym::tlsAlign = createGlobalVariable("__tls_align", false); - WasmSym::initTLS = symtab->addSyntheticFunction( + ctx.sym.tlsBase = createGlobalVariable("__tls_base", true); + ctx.sym.tlsSize = createGlobalVariable("__tls_size", false); + ctx.sym.tlsAlign = createGlobalVariable("__tls_align", false); + ctx.sym.initTLS = symtab->addSyntheticFunction( "__wasm_init_tls", WASM_SYMBOL_VISIBILITY_HIDDEN, - make<SyntheticFunction>( - is64 ? i64ArgSignature : i32ArgSignature, - "__wasm_init_tls")); + make<SyntheticFunction>(is64 ? i64ArgSignature : i32ArgSignature, + "__wasm_init_tls")); } } @@ -984,19 +984,19 @@ if (ctx.arg.relocatable) return; - WasmSym::dsoHandle = symtab->addOptionalDataSymbol("__dso_handle"); + ctx.sym.dsoHandle = symtab->addOptionalDataSymbol("__dso_handle"); if (!ctx.arg.shared) - WasmSym::dataEnd = symtab->addOptionalDataSymbol("__data_end"); + ctx.sym.dataEnd = symtab->addOptionalDataSymbol("__data_end"); if (!ctx.isPic) { - WasmSym::stackLow = symtab->addOptionalDataSymbol("__stack_low"); - WasmSym::stackHigh = symtab->addOptionalDataSymbol("__stack_high"); - WasmSym::globalBase = symtab->addOptionalDataSymbol("__global_base"); - WasmSym::heapBase = symtab->addOptionalDataSymbol("__heap_base"); - WasmSym::heapEnd = symtab->addOptionalDataSymbol("__heap_end"); - WasmSym::definedMemoryBase = symtab->addOptionalDataSymbol("__memory_base"); - WasmSym::definedTableBase = symtab->addOptionalDataSymbol("__table_base"); + ctx.sym.stackLow = symtab->addOptionalDataSymbol("__stack_low"); + ctx.sym.stackHigh = symtab->addOptionalDataSymbol("__stack_high"); + ctx.sym.globalBase = symtab->addOptionalDataSymbol("__global_base"); + ctx.sym.heapBase = symtab->addOptionalDataSymbol("__heap_base"); + ctx.sym.heapEnd = symtab->addOptionalDataSymbol("__heap_end"); + ctx.sym.definedMemoryBase = symtab->addOptionalDataSymbol("__memory_base"); + ctx.sym.definedTableBase = symtab->addOptionalDataSymbol("__table_base"); } // For non-shared memory programs we still need to define __tls_base since we @@ -1009,7 +1009,7 @@ // __tls_size and __tls_align are not needed in this case since they are only // needed for __wasm_init_tls (which we do not create in this case). if (!ctx.arg.sharedMemory) - WasmSym::tlsBase = createOptionalGlobal("__tls_base", false); + ctx.sym.tlsBase = createOptionalGlobal("__tls_base", false); } static void processStubLibrariesPreLTO() { @@ -1384,9 +1384,9 @@ // by libc/etc., because destructors are registered dynamically with // `__cxa_atexit` and friends. if (!ctx.arg.relocatable && !ctx.arg.shared && - !WasmSym::callCtors->isUsedInRegularObj && - WasmSym::callCtors->getName() != ctx.arg.entry && - !ctx.arg.exportedSymbols.count(WasmSym::callCtors->getName())) { + !ctx.sym.callCtors->isUsedInRegularObj && + ctx.sym.callCtors->getName() != ctx.arg.entry && + !ctx.arg.exportedSymbols.count(ctx.sym.callCtors->getName())) { if (Symbol *callDtors = handleUndefined("__wasm_call_dtors", "<internal>")) { if (auto *callDtorsFunc = dyn_cast<DefinedFunction>(callDtors)) { @@ -1395,7 +1395,7 @@ !callDtorsFunc->signature->Returns.empty())) { error("__wasm_call_dtors must have no argument or return values"); } - WasmSym::callDtors = callDtorsFunc; + ctx.sym.callDtors = callDtorsFunc; } else { error("__wasm_call_dtors must be a function"); } @@ -1488,7 +1488,7 @@ markLive(); // Provide the indirect function table if needed. - WasmSym::indirectFunctionTable = + ctx.sym.indirectFunctionTable = symtab->resolveIndirectFunctionTable(/*required =*/false); if (errorCount()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/InputChunks.cpp new/lld-20.1.5.src/wasm/InputChunks.cpp --- old/lld-20.1.4.src/wasm/InputChunks.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/InputChunks.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -397,9 +397,9 @@ if (ctx.isPic) { writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); if (isTLS()) - writeUleb128(os, WasmSym::tlsBase->getGlobalIndex(), "tls_base"); + writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "tls_base"); else - writeUleb128(os, WasmSym::memoryBase->getGlobalIndex(), "memory_base"); + writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "memory_base"); writeU8(os, opcode_ptr_add, "ADD"); } @@ -422,12 +422,12 @@ } } else { assert(ctx.isPic); - const GlobalSymbol* baseSymbol = WasmSym::memoryBase; + const GlobalSymbol *baseSymbol = ctx.sym.memoryBase; if (rel.Type == R_WASM_TABLE_INDEX_I32 || rel.Type == R_WASM_TABLE_INDEX_I64) - baseSymbol = WasmSym::tableBase; + baseSymbol = ctx.sym.tableBase; else if (sym->isTLS()) - baseSymbol = WasmSym::tlsBase; + baseSymbol = ctx.sym.tlsBase; writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); writeUleb128(os, baseSymbol->getGlobalIndex(), "base"); writeU8(os, opcode_reloc_const, "CONST"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/MarkLive.cpp new/lld-20.1.5.src/wasm/MarkLive.cpp --- old/lld-20.1.4.src/wasm/MarkLive.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/MarkLive.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -114,8 +114,8 @@ if (sym->isNoStrip() || sym->isExported()) enqueue(sym); - if (WasmSym::callDtors) - enqueue(WasmSym::callDtors); + if (ctx.sym.callDtors) + enqueue(ctx.sym.callDtors); for (const ObjFile *obj : ctx.objectFiles) if (obj->isLive()) { @@ -131,7 +131,7 @@ // If we have any non-discarded init functions, mark `__wasm_call_ctors` as // live so that we assign it an index and call it. if (isCallCtorsLive()) - WasmSym::callCtors->markLive(); + ctx.sym.callCtors->markLive(); } void MarkLive::mark() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/OutputSections.cpp new/lld-20.1.5.src/wasm/OutputSections.cpp --- old/lld-20.1.4.src/wasm/OutputSections.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/OutputSections.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -123,7 +123,7 @@ if ((segment->initFlags & WASM_DATA_SEGMENT_IS_PASSIVE) == 0) { if (ctx.isPic && ctx.arg.extendedConst) { writeU8(os, WASM_OPCODE_GLOBAL_GET, "global get"); - writeUleb128(os, WasmSym::memoryBase->getGlobalIndex(), + writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "literal (global index)"); if (segment->startVA) { writePtrConst(os, segment->startVA, is64, "offset"); @@ -136,7 +136,7 @@ if (ctx.isPic) { assert(segment->startVA == 0); initExpr.Inst.Opcode = WASM_OPCODE_GLOBAL_GET; - initExpr.Inst.Value.Global = WasmSym::memoryBase->getGlobalIndex(); + initExpr.Inst.Value.Global = ctx.sym.memoryBase->getGlobalIndex(); } else { initExpr = intConst(segment->startVA, is64); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/Symbols.cpp new/lld-20.1.5.src/wasm/Symbols.cpp --- old/lld-20.1.4.src/wasm/Symbols.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/Symbols.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -77,31 +77,6 @@ } namespace wasm { -DefinedFunction *WasmSym::callCtors; -DefinedFunction *WasmSym::callDtors; -DefinedFunction *WasmSym::initMemory; -DefinedFunction *WasmSym::applyGlobalRelocs; -DefinedFunction *WasmSym::applyTLSRelocs; -DefinedFunction *WasmSym::applyGlobalTLSRelocs; -DefinedFunction *WasmSym::initTLS; -DefinedFunction *WasmSym::startFunction; -DefinedData *WasmSym::dsoHandle; -DefinedData *WasmSym::dataEnd; -DefinedData *WasmSym::globalBase; -DefinedData *WasmSym::heapBase; -DefinedData *WasmSym::heapEnd; -DefinedData *WasmSym::initMemoryFlag; -GlobalSymbol *WasmSym::stackPointer; -DefinedData *WasmSym::stackLow; -DefinedData *WasmSym::stackHigh; -GlobalSymbol *WasmSym::tlsBase; -GlobalSymbol *WasmSym::tlsSize; -GlobalSymbol *WasmSym::tlsAlign; -UndefinedGlobal *WasmSym::tableBase; -DefinedData *WasmSym::definedTableBase; -UndefinedGlobal *WasmSym::memoryBase; -DefinedData *WasmSym::definedMemoryBase; -TableSymbol *WasmSym::indirectFunctionTable; WasmSymbolType Symbol::getWasmType() const { if (isa<FunctionSymbol>(this)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/Symbols.h new/lld-20.1.5.src/wasm/Symbols.h --- old/lld-20.1.4.src/wasm/Symbols.h 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/Symbols.h 2025-05-14 00:18:22.000000000 +0200 @@ -537,105 +537,6 @@ const WasmSignature *signature = nullptr; }; -// linker-generated symbols -struct WasmSym { - // __global_base - // Symbol marking the start of the global section. - static DefinedData *globalBase; - - // __stack_pointer/__stack_low/__stack_high - // Global that holds current value of stack pointer and data symbols marking - // the start and end of the stack region. stackPointer is initialized to - // stackHigh and grows downwards towards stackLow - static GlobalSymbol *stackPointer; - static DefinedData *stackLow; - static DefinedData *stackHigh; - - // __tls_base - // Global that holds the address of the base of the current thread's - // TLS block. - static GlobalSymbol *tlsBase; - - // __tls_size - // Symbol whose value is the size of the TLS block. - static GlobalSymbol *tlsSize; - - // __tls_size - // Symbol whose value is the alignment of the TLS block. - static GlobalSymbol *tlsAlign; - - // __data_end - // Symbol marking the end of the data and bss. - static DefinedData *dataEnd; - - // __heap_base/__heap_end - // Symbols marking the beginning and end of the "heap". It starts at the end - // of the data, bss and explicit stack, and extends to the end of the linear - // memory allocated by wasm-ld. This region of memory is not used by the - // linked code, so it may be used as a backing store for `sbrk` or `malloc` - // implementations. - static DefinedData *heapBase; - static DefinedData *heapEnd; - - // __wasm_init_memory_flag - // Symbol whose contents are nonzero iff memory has already been initialized. - static DefinedData *initMemoryFlag; - - // __wasm_init_memory - // Function that initializes passive data segments during instantiation. - static DefinedFunction *initMemory; - - // __wasm_call_ctors - // Function that directly calls all ctors in priority order. - static DefinedFunction *callCtors; - - // __wasm_call_dtors - // Function that calls the libc/etc. cleanup function. - static DefinedFunction *callDtors; - - // __wasm_apply_global_relocs - // Function that applies relocations to wasm globals post-instantiation. - // Unlike __wasm_apply_data_relocs this needs to run on every thread. - static DefinedFunction *applyGlobalRelocs; - - // __wasm_apply_tls_relocs - // Like __wasm_apply_data_relocs but for TLS section. These must be - // delayed until __wasm_init_tls. - static DefinedFunction *applyTLSRelocs; - - // __wasm_apply_global_tls_relocs - // Like applyGlobalRelocs but for globals that hold TLS addresses. These - // must be delayed until __wasm_init_tls. - static DefinedFunction *applyGlobalTLSRelocs; - - // __wasm_init_tls - // Function that allocates thread-local storage and initializes it. - static DefinedFunction *initTLS; - - // Pointer to the function that is to be used in the start section. - // (normally an alias of initMemory, or applyGlobalRelocs). - static DefinedFunction *startFunction; - - // __dso_handle - // Symbol used in calls to __cxa_atexit to determine current DLL - static DefinedData *dsoHandle; - - // __table_base - // Used in PIC code for offset of indirect function table - static UndefinedGlobal *tableBase; - static DefinedData *definedTableBase; - - // __memory_base - // Used in PIC code for offset of global data - static UndefinedGlobal *memoryBase; - static DefinedData *definedMemoryBase; - - // __indirect_function_table - // Used as an address space for function pointers, with each function that is - // used as a function pointer being allocated a slot. - static TableSymbol *indirectFunctionTable; -}; - // A buffer class that is large enough to hold any Symbol-derived // object. We allocate memory using this class and instantiate a symbol // using the placement new. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/SyntheticSections.cpp new/lld-20.1.5.src/wasm/SyntheticSections.cpp --- old/lld-20.1.4.src/wasm/SyntheticSections.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/SyntheticSections.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -319,8 +319,8 @@ // Some inputs require that the indirect function table be assigned to table // number 0. if (ctx.legacyFunctionTable && - isa<DefinedTable>(WasmSym::indirectFunctionTable) && - cast<DefinedTable>(WasmSym::indirectFunctionTable)->table == table) { + isa<DefinedTable>(ctx.sym.indirectFunctionTable) && + cast<DefinedTable>(ctx.sym.indirectFunctionTable)->table == table) { if (out.importSec->getNumImportedTables()) { // Alack! Some other input imported a table, meaning that we are unable // to assign table number 0 to the indirect function table. @@ -395,8 +395,8 @@ } static void ensureIndirectFunctionTable() { - if (!WasmSym::indirectFunctionTable) - WasmSym::indirectFunctionTable = + if (!ctx.sym.indirectFunctionTable) + ctx.sym.indirectFunctionTable = symtab->resolveIndirectFunctionTable(/*required =*/true); } @@ -430,10 +430,9 @@ // Get __memory_base writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); if (sym->isTLS()) - writeUleb128(os, WasmSym::tlsBase->getGlobalIndex(), "__tls_base"); + writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "__tls_base"); else - writeUleb128(os, WasmSym::memoryBase->getGlobalIndex(), - "__memory_base"); + writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "__memory_base"); // Add the virtual address of the data symbol writeU8(os, opcode_ptr_const, "CONST"); @@ -443,7 +442,7 @@ continue; // Get __table_base writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); - writeUleb128(os, WasmSym::tableBase->getGlobalIndex(), "__table_base"); + writeUleb128(os, ctx.sym.tableBase->getGlobalIndex(), "__table_base"); // Add the table index to __table_base writeU8(os, opcode_ptr_const, "CONST"); @@ -490,13 +489,13 @@ if (ctx.arg.extendedConst && ctx.isPic) { if (auto *d = dyn_cast<DefinedData>(sym)) { if (!sym->isTLS()) { - globalIdx = WasmSym::memoryBase->getGlobalIndex(); + globalIdx = ctx.sym.memoryBase->getGlobalIndex(); offset = d->getVA(); useExtendedConst = true; } } else if (auto *f = dyn_cast<FunctionSymbol>(sym)) { if (!sym->isStub) { - globalIdx = WasmSym::tableBase->getGlobalIndex(); + globalIdx = ctx.sym.tableBase->getGlobalIndex(); offset = f->getTableIndex(); useExtendedConst = true; } @@ -550,14 +549,11 @@ writeExport(os, export_); } -bool StartSection::isNeeded() const { - return WasmSym::startFunction != nullptr; -} +bool StartSection::isNeeded() const { return ctx.sym.startFunction != nullptr; } void StartSection::writeBody() { raw_ostream &os = bodyOutputStream; - writeUleb128(os, WasmSym::startFunction->getFunctionIndex(), - "function index"); + writeUleb128(os, ctx.sym.startFunction->getFunctionIndex(), "function index"); } void ElemSection::addEntry(FunctionSymbol *sym) { @@ -573,9 +569,9 @@ void ElemSection::writeBody() { raw_ostream &os = bodyOutputStream; - assert(WasmSym::indirectFunctionTable); + assert(ctx.sym.indirectFunctionTable); writeUleb128(os, 1, "segment count"); - uint32_t tableNumber = WasmSym::indirectFunctionTable->getTableNumber(); + uint32_t tableNumber = ctx.sym.indirectFunctionTable->getTableNumber(); uint32_t flags = 0; if (tableNumber) flags |= WASM_ELEM_SEGMENT_HAS_TABLE_NUMBER; @@ -587,7 +583,7 @@ initExpr.Extended = false; if (ctx.isPic) { initExpr.Inst.Opcode = WASM_OPCODE_GLOBAL_GET; - initExpr.Inst.Value.Global = WasmSym::tableBase->getGlobalIndex(); + initExpr.Inst.Value.Global = ctx.sym.tableBase->getGlobalIndex(); } else { bool is64 = ctx.arg.is64.value_or(false); initExpr = intConst(ctx.arg.tableBase, is64); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-20.1.4.src/wasm/Writer.cpp new/lld-20.1.5.src/wasm/Writer.cpp --- old/lld-20.1.4.src/wasm/Writer.cpp 2025-04-30 01:05:17.000000000 +0200 +++ new/lld-20.1.5.src/wasm/Writer.cpp 2025-05-14 00:18:22.000000000 +0200 @@ -340,16 +340,16 @@ if (ctx.arg.relocatable || ctx.isPic) return; memoryPtr = alignTo(memoryPtr, stackAlignment); - if (WasmSym::stackLow) - WasmSym::stackLow->setVA(memoryPtr); + if (ctx.sym.stackLow) + ctx.sym.stackLow->setVA(memoryPtr); if (ctx.arg.zStackSize != alignTo(ctx.arg.zStackSize, stackAlignment)) error("stack size must be " + Twine(stackAlignment) + "-byte aligned"); log("mem: stack size = " + Twine(ctx.arg.zStackSize)); log("mem: stack base = " + Twine(memoryPtr)); memoryPtr += ctx.arg.zStackSize; - setGlobalPtr(cast<DefinedGlobal>(WasmSym::stackPointer), memoryPtr); - if (WasmSym::stackHigh) - WasmSym::stackHigh->setVA(memoryPtr); + setGlobalPtr(cast<DefinedGlobal>(ctx.sym.stackPointer), memoryPtr); + if (ctx.sym.stackHigh) + ctx.sym.stackHigh->setVA(memoryPtr); log("mem: stack top = " + Twine(memoryPtr)); }; @@ -367,15 +367,15 @@ } log("mem: global base = " + Twine(memoryPtr)); - if (WasmSym::globalBase) - WasmSym::globalBase->setVA(memoryPtr); + if (ctx.sym.globalBase) + ctx.sym.globalBase->setVA(memoryPtr); uint64_t dataStart = memoryPtr; // Arbitrarily set __dso_handle handle to point to the start of the data // segments. - if (WasmSym::dsoHandle) - WasmSym::dsoHandle->setVA(dataStart); + if (ctx.sym.dsoHandle) + ctx.sym.dsoHandle->setVA(dataStart); out.dylinkSec->memAlign = 0; for (OutputSegment *seg : segments) { @@ -386,16 +386,16 @@ memoryPtr, seg->size, seg->alignment)); if (!ctx.arg.relocatable && seg->isTLS()) { - if (WasmSym::tlsSize) { - auto *tlsSize = cast<DefinedGlobal>(WasmSym::tlsSize); + if (ctx.sym.tlsSize) { + auto *tlsSize = cast<DefinedGlobal>(ctx.sym.tlsSize); setGlobalPtr(tlsSize, seg->size); } - if (WasmSym::tlsAlign) { - auto *tlsAlign = cast<DefinedGlobal>(WasmSym::tlsAlign); + if (ctx.sym.tlsAlign) { + auto *tlsAlign = cast<DefinedGlobal>(ctx.sym.tlsAlign); setGlobalPtr(tlsAlign, int64_t{1} << seg->alignment); } - if (!ctx.arg.sharedMemory && WasmSym::tlsBase) { - auto *tlsBase = cast<DefinedGlobal>(WasmSym::tlsBase); + if (!ctx.arg.sharedMemory && ctx.sym.tlsBase) { + auto *tlsBase = cast<DefinedGlobal>(ctx.sym.tlsBase); setGlobalPtr(tlsBase, memoryPtr); } } @@ -406,17 +406,17 @@ // Make space for the memory initialization flag if (ctx.arg.sharedMemory && hasPassiveInitializedSegments()) { memoryPtr = alignTo(memoryPtr, 4); - WasmSym::initMemoryFlag = symtab->addSyntheticDataSymbol( + ctx.sym.initMemoryFlag = symtab->addSyntheticDataSymbol( "__wasm_init_memory_flag", WASM_SYMBOL_VISIBILITY_HIDDEN); - WasmSym::initMemoryFlag->markLive(); - WasmSym::initMemoryFlag->setVA(memoryPtr); + ctx.sym.initMemoryFlag->markLive(); + ctx.sym.initMemoryFlag->setVA(memoryPtr); log(formatv("mem: {0,-15} offset={1,-8} size={2,-8} align={3}", "__wasm_init_memory_flag", memoryPtr, 4, 4)); memoryPtr += 4; } - if (WasmSym::dataEnd) - WasmSym::dataEnd->setVA(memoryPtr); + if (ctx.sym.dataEnd) + ctx.sym.dataEnd->setVA(memoryPtr); uint64_t staticDataSize = memoryPtr - dataStart; log("mem: static data = " + Twine(staticDataSize)); @@ -426,7 +426,7 @@ if (!ctx.arg.stackFirst) placeStack(); - if (WasmSym::heapBase) { + if (ctx.sym.heapBase) { // Set `__heap_base` to follow the end of the stack or global data. The // fact that this comes last means that a malloc/brk implementation can // grow the heap at runtime. @@ -434,7 +434,7 @@ // __heap_base to be aligned already. memoryPtr = alignTo(memoryPtr, heapAlignment); log("mem: heap base = " + Twine(memoryPtr)); - WasmSym::heapBase->setVA(memoryPtr); + ctx.sym.heapBase->setVA(memoryPtr); } uint64_t maxMemorySetting = 1ULL << 32; @@ -470,12 +470,12 @@ out.memorySec->numMemoryPages = memoryPtr / WasmPageSize; log("mem: total pages = " + Twine(out.memorySec->numMemoryPages)); - if (WasmSym::heapEnd) { + if (ctx.sym.heapEnd) { // Set `__heap_end` to follow the end of the statically allocated linear // memory. The fact that this comes last means that a malloc/brk // implementation can grow the heap at runtime. log("mem: heap end = " + Twine(memoryPtr)); - WasmSym::heapEnd->setVA(memoryPtr); + ctx.sym.heapEnd->setVA(memoryPtr); } uint64_t maxMemory = 0; @@ -758,14 +758,14 @@ // Some inputs require that the indirect function table be assigned to table // number 0, so if it is present and is an import, allocate it before any // other tables. - if (WasmSym::indirectFunctionTable && - shouldImport(WasmSym::indirectFunctionTable)) - out.importSec->addImport(WasmSym::indirectFunctionTable); + if (ctx.sym.indirectFunctionTable && + shouldImport(ctx.sym.indirectFunctionTable)) + out.importSec->addImport(ctx.sym.indirectFunctionTable); for (Symbol *sym : symtab->symbols()) { if (!shouldImport(sym)) continue; - if (sym == WasmSym::indirectFunctionTable) + if (sym == ctx.sym.indirectFunctionTable) continue; LLVM_DEBUG(dbgs() << "import: " << sym->getName() << "\n"); out.importSec->addImport(sym); @@ -879,7 +879,7 @@ // If there are no ctors and there's no libc `__wasm_call_dtors` to // call, don't wrap the exports. - if (initFunctions.empty() && WasmSym::callDtors == nullptr) + if (initFunctions.empty() && ctx.sym.callDtors == nullptr) return; std::vector<DefinedFunction *> toWrap; @@ -919,27 +919,27 @@ } static void finalizeIndirectFunctionTable() { - if (!WasmSym::indirectFunctionTable) + if (!ctx.sym.indirectFunctionTable) return; - if (shouldImport(WasmSym::indirectFunctionTable) && - !WasmSym::indirectFunctionTable->hasTableNumber()) { + if (shouldImport(ctx.sym.indirectFunctionTable) && + !ctx.sym.indirectFunctionTable->hasTableNumber()) { // Processing -Bsymbolic relocations resulted in a late requirement that the // indirect function table be present, and we are running in --import-table // mode. Add the table now to the imports section. Otherwise it will be // added to the tables section later in assignIndexes. - out.importSec->addImport(WasmSym::indirectFunctionTable); + out.importSec->addImport(ctx.sym.indirectFunctionTable); } uint32_t tableSize = ctx.arg.tableBase + out.elemSec->numEntries(); WasmLimits limits = {0, tableSize, 0}; - if (WasmSym::indirectFunctionTable->isDefined() && !ctx.arg.growableTable) { + if (ctx.sym.indirectFunctionTable->isDefined() && !ctx.arg.growableTable) { limits.Flags |= WASM_LIMITS_FLAG_HAS_MAX; limits.Maximum = limits.Minimum; } if (ctx.arg.is64.value_or(false)) limits.Flags |= WASM_LIMITS_FLAG_IS_64; - WasmSym::indirectFunctionTable->setLimits(limits); + ctx.sym.indirectFunctionTable->setLimits(limits); } static void scanRelocations() { @@ -1142,26 +1142,26 @@ // We also initialize bss segments (using memory.fill) as part of this // function. if (hasPassiveInitializedSegments()) { - WasmSym::initMemory = symtab->addSyntheticFunction( + ctx.sym.initMemory = symtab->addSyntheticFunction( "__wasm_init_memory", WASM_SYMBOL_VISIBILITY_HIDDEN, make<SyntheticFunction>(nullSignature, "__wasm_init_memory")); - WasmSym::initMemory->markLive(); + ctx.sym.initMemory->markLive(); if (ctx.arg.sharedMemory) { // This global is assigned during __wasm_init_memory in the shared memory // case. - WasmSym::tlsBase->markLive(); + ctx.sym.tlsBase->markLive(); } } if (ctx.arg.sharedMemory) { if (out.globalSec->needsTLSRelocations()) { - WasmSym::applyGlobalTLSRelocs = symtab->addSyntheticFunction( + ctx.sym.applyGlobalTLSRelocs = symtab->addSyntheticFunction( "__wasm_apply_global_tls_relocs", WASM_SYMBOL_VISIBILITY_HIDDEN, make<SyntheticFunction>(nullSignature, "__wasm_apply_global_tls_relocs")); - WasmSym::applyGlobalTLSRelocs->markLive(); + ctx.sym.applyGlobalTLSRelocs->markLive(); // TLS relocations depend on the __tls_base symbols - WasmSym::tlsBase->markLive(); + ctx.sym.tlsBase->markLive(); } auto hasTLSRelocs = [](const OutputSegment *segment) { @@ -1172,40 +1172,39 @@ return false; }; if (llvm::any_of(segments, hasTLSRelocs)) { - WasmSym::applyTLSRelocs = symtab->addSyntheticFunction( + ctx.sym.applyTLSRelocs = symtab->addSyntheticFunction( "__wasm_apply_tls_relocs", WASM_SYMBOL_VISIBILITY_HIDDEN, - make<SyntheticFunction>(nullSignature, - "__wasm_apply_tls_relocs")); - WasmSym::applyTLSRelocs->markLive(); + make<SyntheticFunction>(nullSignature, "__wasm_apply_tls_relocs")); + ctx.sym.applyTLSRelocs->markLive(); } } if (ctx.isPic && out.globalSec->needsRelocations()) { - WasmSym::applyGlobalRelocs = symtab->addSyntheticFunction( + ctx.sym.applyGlobalRelocs = symtab->addSyntheticFunction( "__wasm_apply_global_relocs", WASM_SYMBOL_VISIBILITY_HIDDEN, make<SyntheticFunction>(nullSignature, "__wasm_apply_global_relocs")); - WasmSym::applyGlobalRelocs->markLive(); + ctx.sym.applyGlobalRelocs->markLive(); } // If there is only one start function we can just use that function // itself as the Wasm start function, otherwise we need to synthesize // a new function to call them in sequence. - if (WasmSym::applyGlobalRelocs && WasmSym::initMemory) { - WasmSym::startFunction = symtab->addSyntheticFunction( + if (ctx.sym.applyGlobalRelocs && ctx.sym.initMemory) { + ctx.sym.startFunction = symtab->addSyntheticFunction( "__wasm_start", WASM_SYMBOL_VISIBILITY_HIDDEN, make<SyntheticFunction>(nullSignature, "__wasm_start")); - WasmSym::startFunction->markLive(); + ctx.sym.startFunction->markLive(); } } void Writer::createInitMemoryFunction() { LLVM_DEBUG(dbgs() << "createInitMemoryFunction\n"); - assert(WasmSym::initMemory); + assert(ctx.sym.initMemory); assert(hasPassiveInitializedSegments()); uint64_t flagAddress; if (ctx.arg.sharedMemory) { - assert(WasmSym::initMemoryFlag); - flagAddress = WasmSym::initMemoryFlag->getVA(); + assert(ctx.sym.initMemoryFlag); + flagAddress = ctx.sym.initMemoryFlag->getVA(); } bool is64 = ctx.arg.is64.value_or(false); std::string bodyContent; @@ -1278,7 +1277,7 @@ writeUleb128(os, 2, "local count"); writeU8(os, is64 ? WASM_TYPE_I64 : WASM_TYPE_I32, "address type"); writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); - writeUleb128(os, WasmSym::memoryBase->getGlobalIndex(), "memory_base"); + writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "memory_base"); writePtrConst(os, flagAddress, is64, "flag address"); writeU8(os, is64 ? WASM_OPCODE_I64_ADD : WASM_OPCODE_I32_ADD, "add"); writeU8(os, WASM_OPCODE_LOCAL_SET, "local.set"); @@ -1325,7 +1324,7 @@ writePtrConst(os, s->startVA, is64, "destination address"); if (ctx.isPic) { writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET"); - writeUleb128(os, WasmSym::memoryBase->getGlobalIndex(), + writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "__memory_base"); writeU8(os, is64 ? WASM_OPCODE_I64_ADD : WASM_OPCODE_I32_ADD, "i32.add"); @@ -1343,8 +1342,7 @@ writePtrConst(os, s->startVA, is64, "destination address"); } writeU8(os, WASM_OPCODE_GLOBAL_SET, "GLOBAL_SET"); - writeUleb128(os, WasmSym::tlsBase->getGlobalIndex(), - "__tls_base"); + writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "__tls_base"); if (ctx.isPic) { writeU8(os, WASM_OPCODE_LOCAL_GET, "local.tee"); writeUleb128(os, 1, "local 1"); @@ -1420,30 +1418,30 @@ writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::initMemory, bodyContent); + createFunction(ctx.sym.initMemory, bodyContent); } void Writer::createStartFunction() { // If the start function exists when we have more than one function to call. - if (WasmSym::initMemory && WasmSym::applyGlobalRelocs) { - assert(WasmSym::startFunction); + if (ctx.sym.initMemory && ctx.sym.applyGlobalRelocs) { + assert(ctx.sym.startFunction); std::string bodyContent; { raw_string_ostream os(bodyContent); writeUleb128(os, 0, "num locals"); writeU8(os, WASM_OPCODE_CALL, "CALL"); - writeUleb128(os, WasmSym::applyGlobalRelocs->getFunctionIndex(), + writeUleb128(os, ctx.sym.applyGlobalRelocs->getFunctionIndex(), "function index"); writeU8(os, WASM_OPCODE_CALL, "CALL"); - writeUleb128(os, WasmSym::initMemory->getFunctionIndex(), + writeUleb128(os, ctx.sym.initMemory->getFunctionIndex(), "function index"); writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::startFunction, bodyContent); - } else if (WasmSym::initMemory) { - WasmSym::startFunction = WasmSym::initMemory; - } else if (WasmSym::applyGlobalRelocs) { - WasmSym::startFunction = WasmSym::applyGlobalRelocs; + createFunction(ctx.sym.startFunction, bodyContent); + } else if (ctx.sym.initMemory) { + ctx.sym.startFunction = ctx.sym.initMemory; + } else if (ctx.sym.applyGlobalRelocs) { + ctx.sym.startFunction = ctx.sym.applyGlobalRelocs; } } @@ -1497,7 +1495,7 @@ writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::applyTLSRelocs, bodyContent); + createFunction(ctx.sym.applyTLSRelocs, bodyContent); } // Similar to createApplyDataRelocationsFunction but generates relocation code @@ -1513,7 +1511,7 @@ writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::applyGlobalRelocs, bodyContent); + createFunction(ctx.sym.applyGlobalRelocs, bodyContent); } // Similar to createApplyGlobalRelocationsFunction but for @@ -1529,7 +1527,7 @@ writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::applyGlobalTLSRelocs, bodyContent); + createFunction(ctx.sym.applyGlobalTLSRelocs, bodyContent); } // Create synthetic "__wasm_call_ctors" function based on ctor functions @@ -1537,7 +1535,7 @@ void Writer::createCallCtorsFunction() { // If __wasm_call_ctors isn't referenced, there aren't any ctors, don't // define the `__wasm_call_ctors` function. - if (!WasmSym::callCtors->isLive() && initFunctions.empty()) + if (!ctx.sym.callCtors->isLive() && initFunctions.empty()) return; // First write the body's contents to a string. @@ -1558,7 +1556,7 @@ writeU8(os, WASM_OPCODE_END, "END"); } - createFunction(WasmSym::callCtors, bodyContent); + createFunction(ctx.sym.callCtors, bodyContent); } // Create a wrapper around a function export which calls the @@ -1573,10 +1571,9 @@ // Call `__wasm_call_ctors` which call static constructors (and // applies any runtime relocations in Emscripten-style PIC mode) - if (WasmSym::callCtors->isLive()) { + if (ctx.sym.callCtors->isLive()) { writeU8(os, WASM_OPCODE_CALL, "CALL"); - writeUleb128(os, WasmSym::callCtors->getFunctionIndex(), - "function index"); + writeUleb128(os, ctx.sym.callCtors->getFunctionIndex(), "function index"); } // Call the user's code, leaving any return values on the operand stack. @@ -1588,7 +1585,7 @@ writeUleb128(os, functionIndex, "function index"); // Call the function that calls the destructors. - if (DefinedFunction *callDtors = WasmSym::callDtors) { + if (DefinedFunction *callDtors = ctx.sym.callDtors) { writeU8(os, WASM_OPCODE_CALL, "CALL"); writeUleb128(os, callDtors->getFunctionIndex(), "function index"); } @@ -1619,7 +1616,7 @@ writeUleb128(os, 0, "local index"); writeU8(os, WASM_OPCODE_GLOBAL_SET, "global.set"); - writeUleb128(os, WasmSym::tlsBase->getGlobalIndex(), "global index"); + writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "global index"); // FIXME(wvo): this local needs to be I64 in wasm64, or we need an extend op. writeU8(os, WASM_OPCODE_LOCAL_GET, "local.get"); @@ -1635,28 +1632,28 @@ writeU8(os, 0, "memory index immediate"); } - if (WasmSym::applyTLSRelocs) { + if (ctx.sym.applyTLSRelocs) { writeU8(os, WASM_OPCODE_CALL, "CALL"); - writeUleb128(os, WasmSym::applyTLSRelocs->getFunctionIndex(), + writeUleb128(os, ctx.sym.applyTLSRelocs->getFunctionIndex(), "function index"); } - if (WasmSym::applyGlobalTLSRelocs) { + if (ctx.sym.applyGlobalTLSRelocs) { writeU8(os, WASM_OPCODE_CALL, "CALL"); - writeUleb128(os, WasmSym::applyGlobalTLSRelocs->getFunctionIndex(), + writeUleb128(os, ctx.sym.applyGlobalTLSRelocs->getFunctionIndex(), "function index"); } writeU8(os, WASM_OPCODE_END, "end function"); } - createFunction(WasmSym::initTLS, bodyContent); + createFunction(ctx.sym.initTLS, bodyContent); } // Populate InitFunctions vector with init functions from all input objects. // This is then used either when creating the output linking section or to // synthesize the "__wasm_call_ctors" function. void Writer::calculateInitFunctions() { - if (!ctx.arg.relocatable && !WasmSym::callCtors->isLive()) + if (!ctx.arg.relocatable && !ctx.sym.callCtors->isLive()) return; for (ObjFile *file : ctx.objectFiles) { @@ -1707,8 +1704,8 @@ void Writer::run() { // For PIC code the table base is assigned dynamically by the loader. // For non-PIC, we start at 1 so that accessing table index 0 always traps. - if (!ctx.isPic && WasmSym::definedTableBase) - WasmSym::definedTableBase->setVA(ctx.arg.tableBase); + if (!ctx.isPic && ctx.sym.definedTableBase) + ctx.sym.definedTableBase->setVA(ctx.arg.tableBase); log("-- createOutputSegments"); createOutputSegments(); @@ -1776,14 +1773,18 @@ if (!ctx.arg.relocatable) { // Create linker synthesized functions - if (WasmSym::applyGlobalRelocs) + if (ctx.sym.applyGlobalRelocs) { createApplyGlobalRelocationsFunction(); - if (WasmSym::applyTLSRelocs) + } + if (ctx.sym.applyTLSRelocs) { createApplyTLSRelocationsFunction(); - if (WasmSym::applyGlobalTLSRelocs) + } + if (ctx.sym.applyGlobalTLSRelocs) { createApplyGlobalTLSRelocationsFunction(); - if (WasmSym::initMemory) + } + if (ctx.sym.initMemory) { createInitMemoryFunction(); + } createStartFunction(); createCallCtorsFunction(); @@ -1794,14 +1795,14 @@ // the input objects or an explicit export from the command-line, we // assume ctors and dtors are taken care of already. if (!ctx.arg.relocatable && !ctx.isPic && - !WasmSym::callCtors->isUsedInRegularObj && - !WasmSym::callCtors->isExported()) { + !ctx.sym.callCtors->isUsedInRegularObj && + !ctx.sym.callCtors->isExported()) { log("-- createCommandExportWrappers"); createCommandExportWrappers(); } } - if (WasmSym::initTLS && WasmSym::initTLS->isLive()) { + if (ctx.sym.initTLS && ctx.sym.initTLS->isLive()) { log("-- createInitTLSFunction"); createInitTLSFunction(); } ++++++ lldb-20.1.4.src.tar.xz -> lldb-20.1.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm20/lldb-20.1.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm20.new.2732/lldb-20.1.5.src.tar.xz differ: char 15, line 1 ++++++ llvm-20.1.4.src.tar.xz -> llvm-20.1.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm20/llvm-20.1.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm20.new.2732/llvm-20.1.5.src.tar.xz differ: char 15, line 1 ++++++ llvm-do-not-install-static-libraries.patch ++++++ --- /var/tmp/diff_new_pack.iHlff4/_old 2025-05-23 14:29:08.433002661 +0200 +++ /var/tmp/diff_new_pack.iHlff4/_new 2025-05-23 14:29:08.437002830 +0200 @@ -2,10 +2,10 @@ want after installation. By not copying them in the first place we reduce the disk usage during installation. -Index: clang-20.1.4.src/cmake/modules/AddClang.cmake +Index: clang-20.1.5.src/cmake/modules/AddClang.cmake =================================================================== ---- a/clang-20.1.4.src/cmake/modules/AddClang.cmake -+++ b/clang-20.1.4.src/cmake/modules/AddClang.cmake +--- a/clang-20.1.5.src/cmake/modules/AddClang.cmake ++++ b/clang-20.1.5.src/cmake/modules/AddClang.cmake @@ -106,12 +106,15 @@ macro(add_clang_library name) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) @@ -73,10 +73,10 @@ endif() get_subproject_title(subproject_title) -Index: lld-20.1.4.src/cmake/modules/AddLLD.cmake +Index: lld-20.1.5.src/cmake/modules/AddLLD.cmake =================================================================== ---- a/lld-20.1.4.src/cmake/modules/AddLLD.cmake -+++ b/lld-20.1.4.src/cmake/modules/AddLLD.cmake +--- a/lld-20.1.5.src/cmake/modules/AddLLD.cmake ++++ b/lld-20.1.5.src/cmake/modules/AddLLD.cmake @@ -17,13 +17,6 @@ macro(add_lld_library name) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) @@ -91,10 +91,10 @@ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) add_llvm_install_targets(install-${name} DEPENDS ${name} -Index: polly-20.1.4.src/cmake/polly_macros.cmake +Index: polly-20.1.5.src/cmake/polly_macros.cmake =================================================================== ---- a/polly-20.1.4.src/cmake/polly_macros.cmake -+++ b/polly-20.1.4.src/cmake/polly_macros.cmake +--- a/polly-20.1.5.src/cmake/polly_macros.cmake ++++ b/polly-20.1.5.src/cmake/polly_macros.cmake @@ -43,16 +43,18 @@ if (LLVM_POLLY_LINK_INTO_TOOLS) set(exports EXPORT LLVMExports) @@ -125,10 +125,10 @@ endmacro(add_polly_library) macro(add_polly_loadable_module name) -Index: polly-20.1.4.src/lib/CMakeLists.txt +Index: polly-20.1.5.src/lib/CMakeLists.txt =================================================================== ---- a/polly-20.1.4.src/lib/CMakeLists.txt -+++ b/polly-20.1.4.src/lib/CMakeLists.txt +--- a/polly-20.1.5.src/lib/CMakeLists.txt ++++ b/polly-20.1.5.src/lib/CMakeLists.txt @@ -109,7 +109,7 @@ set_target_properties(PollyCore PROPERTI # It depends on all library it needs, such that with # LLVM_POLLY_LINK_INTO_TOOLS=ON, its dependencies like PollyISL are linked as ++++++ llvm-docs-20.1.4.src.tar.xz -> llvm-docs-20.1.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm20/llvm-docs-20.1.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm20.new.2732/llvm-docs-20.1.5.src.tar.xz differ: char 15, line 1 ++++++ llvm-fix-hexagon-test.patch ++++++ >From ff2e8f93f6090965e82d799af43f6dfef52baa66 Mon Sep 17 00:00:00 2001 From: Douglas Yung <douglas.y...@sony.com> Date: Wed, 7 May 2025 06:13:07 +0000 Subject: [PATCH] Fix test pfalse-v4i1.ll added in #138712 to require asserts. Should fix build bot failure: https://lab.llvm.org/buildbot/#/builders/202/builds/1102 (cherry picked from commit 194a4a333a95f9e001d2c8abe82c3d4cf8894acf) --- llvm/test/CodeGen/Hexagon/isel/pfalse-v4i1.ll | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/test/CodeGen/Hexagon/isel/pfalse-v4i1.ll b/llvm/test/CodeGen/Hexagon/isel/pfalse-v4i1.ll index c0904b8b4fdd6..2c26bb1e310ea 100644 --- a/llvm/test/CodeGen/Hexagon/isel/pfalse-v4i1.ll +++ b/llvm/test/CodeGen/Hexagon/isel/pfalse-v4i1.ll @@ -1,4 +1,5 @@ ; RUN: llc -march=hexagon -debug-only=isel 2>&1 < %s - | FileCheck %s +; REQUIRES: asserts ; CHECK: [[R0:%[0-9]+]]:intregs = A2_tfrsi 0 ; CHECK-NEXT: predregs = C2_tfrrp killed [[R0]]:intregs ++++++ openmp-20.1.4.src.tar.xz -> openmp-20.1.5.src.tar.xz ++++++ ++++++ polly-20.1.4.src.tar.xz -> polly-20.1.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm20/polly-20.1.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm20.new.2732/polly-20.1.5.src.tar.xz differ: char 15, line 1 ++++++ runtimes-20.1.4.src.tar.xz -> runtimes-20.1.5.src.tar.xz ++++++ ++++++ third-party-20.1.4.src.tar.xz -> third-party-20.1.5.src.tar.xz ++++++