Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package llvm16 for openSUSE:Factory checked in at 2023-06-06 19:54:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/llvm16 (Old) and /work/SRC/openSUSE:Factory/.llvm16.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "llvm16" Tue Jun 6 19:54:56 2023 rev:6 rq:1090772 version:16.0.5 Changes: -------- --- /work/SRC/openSUSE:Factory/llvm16/llvm16.changes 2023-05-19 11:55:04.699111016 +0200 +++ /work/SRC/openSUSE:Factory/.llvm16.new.15902/llvm16.changes 2023-06-06 19:55:30.458205899 +0200 @@ -1,0 +2,11 @@ +Sat Jun 3 21:56:34 UTC 2023 - Aaron Puchert <aaronpuch...@alice-dsl.net> + +- Update to version 16.0.5. + * This release contains bug-fixes for the LLVM 16.0.0 release. + This release is API and ABI compatible with 16.0.0. +- Rebase patches: + * llvm-do-not-install-static-libraries.patch + * llvm-remove-clang-only-flags.patch +- Enable ThinLTO on riscv64. + +------------------------------------------------------------------- Old: ---- clang-16.0.4.src.tar.xz clang-16.0.4.src.tar.xz.sig clang-docs-16.0.4.src.tar.xz clang-tools-extra-16.0.4.src.tar.xz clang-tools-extra-16.0.4.src.tar.xz.sig cmake-16.0.4.src.tar.xz cmake-16.0.4.src.tar.xz.sig compiler-rt-16.0.4.src.tar.xz compiler-rt-16.0.4.src.tar.xz.sig libcxx-16.0.4.src.tar.xz libcxx-16.0.4.src.tar.xz.sig libcxxabi-16.0.4.src.tar.xz libcxxabi-16.0.4.src.tar.xz.sig lld-16.0.4.src.tar.xz lld-16.0.4.src.tar.xz.sig lldb-16.0.4.src.tar.xz lldb-16.0.4.src.tar.xz.sig llvm-16.0.4.src.tar.xz llvm-16.0.4.src.tar.xz.sig llvm-docs-16.0.4.src.tar.xz openmp-16.0.4.src.tar.xz openmp-16.0.4.src.tar.xz.sig polly-16.0.4.src.tar.xz polly-16.0.4.src.tar.xz.sig third-party-16.0.4.src.tar.xz third-party-16.0.4.src.tar.xz.sig New: ---- clang-16.0.5.src.tar.xz clang-16.0.5.src.tar.xz.sig clang-docs-16.0.5.src.tar.xz clang-tools-extra-16.0.5.src.tar.xz clang-tools-extra-16.0.5.src.tar.xz.sig cmake-16.0.5.src.tar.xz cmake-16.0.5.src.tar.xz.sig compiler-rt-16.0.5.src.tar.xz compiler-rt-16.0.5.src.tar.xz.sig libcxx-16.0.5.src.tar.xz libcxx-16.0.5.src.tar.xz.sig libcxxabi-16.0.5.src.tar.xz libcxxabi-16.0.5.src.tar.xz.sig lld-16.0.5.src.tar.xz lld-16.0.5.src.tar.xz.sig lldb-16.0.5.src.tar.xz lldb-16.0.5.src.tar.xz.sig llvm-16.0.5.src.tar.xz llvm-16.0.5.src.tar.xz.sig llvm-docs-16.0.5.src.tar.xz openmp-16.0.5.src.tar.xz openmp-16.0.5.src.tar.xz.sig polly-16.0.5.src.tar.xz polly-16.0.5.src.tar.xz.sig third-party-16.0.5.src.tar.xz third-party-16.0.5.src.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ llvm16.spec ++++++ --- /var/tmp/diff_new_pack.jd4PMG/_old 2023-06-06 19:55:34.178227952 +0200 +++ /var/tmp/diff_new_pack.jd4PMG/_new 2023-06-06 19:55:34.182227977 +0200 @@ -16,14 +16,14 @@ # -%define _relver 16.0.4 +%define _relver 16.0.5 %define _version %_relver%{?_rc:rc%_rc} %define _tagver %_relver%{?_rc:-rc%_rc} %define _minor 16.0 %define _sonum 16 %define _itsme16 1 # Integer version used by update-alternatives -%define _uaver 1604 +%define _uaver 1605 %define _soclang 13 %define _socxx 1 @@ -39,7 +39,7 @@ %bcond_with openmp %endif -%ifarch s390x +%ifarch riscv64 s390x %bcond_with use_lld %else %bcond_without use_lld @@ -53,7 +53,7 @@ %bcond_with lldb_python %endif -%ifarch %{arm} aarch64 %{ix86} ppc64le s390x x86_64 +%ifarch %{arm} aarch64 %{ix86} ppc64le riscv64 s390x x86_64 %bcond_without thin_lto %else %bcond_with thin_lto ++++++ clang-16.0.4.src.tar.xz -> clang-16.0.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm16/clang-16.0.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm16.new.15902/clang-16.0.5.src.tar.xz differ: char 27, line 1 ++++++ clang-docs-16.0.4.src.tar.xz -> clang-docs-16.0.5.src.tar.xz ++++++ ++++ 2448 lines of diff (skipped) ++++++ clang-tools-extra-16.0.4.src.tar.xz -> clang-tools-extra-16.0.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-tools-extra-16.0.4.src/clangd/test/CMakeLists.txt new/clang-tools-extra-16.0.5.src/clangd/test/CMakeLists.txt --- old/clang-tools-extra-16.0.4.src/clangd/test/CMakeLists.txt 2023-05-17 07:03:06.000000000 +0200 +++ new/clang-tools-extra-16.0.5.src/clangd/test/CMakeLists.txt 2023-06-02 01:59:18.000000000 +0200 @@ -28,13 +28,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ) -# Copy an empty compile_flags.txt to make sure tests don't pick up arbitrary -# commands from parents. -file( - TOUCH - ${CMAKE_CURRENT_BINARY_DIR}/compile_flags.txt -) - add_lit_testsuite(check-clangd "Running the Clangd regression tests" # clangd doesn't put unittest configs in test/unit like every other project. # Because of that, this needs to pass two folders here, while every other diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-tools-extra-16.0.4.src/test/clang-tidy/checkers/performance/trivially-destructible.cpp new/clang-tools-extra-16.0.5.src/test/clang-tidy/checkers/performance/trivially-destructible.cpp --- old/clang-tools-extra-16.0.4.src/test/clang-tidy/checkers/performance/trivially-destructible.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/clang-tools-extra-16.0.5.src/test/clang-tidy/checkers/performance/trivially-destructible.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -1,7 +1,7 @@ // RUN: %check_clang_tidy %s performance-trivially-destructible %t // RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp -// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -fix -- -// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -warnings-as-errors='-*,performance-trivially-destructible' -- +// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -fix +// RUN: clang-tidy %t.cpp -checks='-*,performance-trivially-destructible' -warnings-as-errors='-*,performance-trivially-destructible' struct TriviallyDestructible1 { int a; ++++++ cmake-16.0.4.src.tar.xz -> cmake-16.0.5.src.tar.xz ++++++ ++++++ compiler-rt-16.0.4.src.tar.xz -> compiler-rt-16.0.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/compiler-rt-16.0.4.src/cmake/Modules/AddCompilerRT.cmake new/compiler-rt-16.0.5.src/cmake/Modules/AddCompilerRT.cmake --- old/compiler-rt-16.0.4.src/cmake/Modules/AddCompilerRT.cmake 2023-05-17 07:03:06.000000000 +0200 +++ new/compiler-rt-16.0.5.src/cmake/Modules/AddCompilerRT.cmake 2023-06-02 01:59:18.000000000 +0200 @@ -392,8 +392,8 @@ target_link_libraries(${libname} PRIVATE ${builtins_${libname}}) endif() if(${type} STREQUAL "SHARED") - if(COMMAND llvm_setup_rpath) - llvm_setup_rpath(${libname}) + if(APPLE OR WIN32) + set_property(TARGET ${libname} PROPERTY BUILD_WITH_INSTALL_RPATH ON) endif() if(WIN32 AND NOT CYGWIN AND NOT MINGW) set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "") ++++++ libcxx-16.0.4.src.tar.xz -> libcxx-16.0.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcxx-16.0.4.src/include/__config new/libcxx-16.0.5.src/include/__config --- old/libcxx-16.0.4.src/include/__config 2023-05-17 07:03:06.000000000 +0200 +++ new/libcxx-16.0.5.src/include/__config 2023-06-02 01:59:18.000000000 +0200 @@ -38,7 +38,7 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 16.0.1 == 16.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 160004 +# define _LIBCPP_VERSION 160005 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) ++++++ libcxxabi-16.0.4.src.tar.xz -> libcxxabi-16.0.5.src.tar.xz ++++++ ++++++ lld-16.0.4.src.tar.xz -> lld-16.0.5.src.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/docs/WebAssembly.rst new/lld-16.0.5.src/docs/WebAssembly.rst --- old/lld-16.0.4.src/docs/WebAssembly.rst 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/docs/WebAssembly.rst 2023-06-02 01:59:18.000000000 +0200 @@ -75,6 +75,11 @@ flag which corresponds to ``--unresolve-symbols=ignore`` + ``--import-undefined``. +.. option:: --allow-undefined-file=<filename> + + Like ``--allow-undefined``, but the filename specified a flat list of + symbols, one per line, which are allowed to be undefined. + .. option:: --unresolved-symbols=<method> This is a more full featured version of ``--allow-undefined``. @@ -182,11 +187,39 @@ By default no undefined symbols are allowed in the final binary. The flag ``--allow-undefined`` results in a WebAssembly import being defined for each undefined symbol. It is then up to the runtime to provide such symbols. +``--allow-undefined-file`` is the same but allows a list of symbols to be +specified. Alternatively symbols can be marked in the source code as with the ``import_name`` and/or ``import_module`` clang attributes which signals that they are expected to be undefined at static link time. +Stub Libraries +~~~~~~~~~~~~~~ + +Another way to specify imports and exports is via a "stub library". This +feature is inspired by the ELF stub objects which are supported by the Solaris +linker. Stub libraries are text files that can be passed as normal linker +inputs, similar to how linker scripts can be passed to the ELF linker. The stub +library is a stand-in for a set of symbols that will be available at runtime, +but doesn't contain any actual code or data. Instead it contains just a list of +symbols, one per line. Each symbol can specify zero or more dependencies. +These dependencies are symbols that must be defined, and exported, by the output +module if the symbol is question is imported/required by the output module. + +For example, imagine the runtime provides an external symbol ``foo`` that +depends on the ``malloc`` and ``free``. This can be expressed simply as:: + + #STUB + foo: malloc,free + +Here we are saying that ``foo`` is allowed to be imported (undefined) but that +if it is imported, then the output module must also export ``malloc`` and +``free`` to the runtime. If ``foo`` is imported (undefined), but the output +module does not define ``malloc`` and ``free`` then the link will fail. + +Stub libraries must begin with ``#STUB`` on a line by itself. + Garbage Collection ~~~~~~~~~~~~~~~~~~ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/test/wasm/Inputs/libstub-missing-dep.so new/lld-16.0.5.src/test/wasm/Inputs/libstub-missing-dep.so --- old/lld-16.0.4.src/test/wasm/Inputs/libstub-missing-dep.so 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-16.0.5.src/test/wasm/Inputs/libstub-missing-dep.so 2023-06-02 01:59:18.000000000 +0200 @@ -0,0 +1,2 @@ +#STUB +foo: missing_dep,missing_dep2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/test/wasm/Inputs/libstub-missing-sym.so new/lld-16.0.5.src/test/wasm/Inputs/libstub-missing-sym.so --- old/lld-16.0.4.src/test/wasm/Inputs/libstub-missing-sym.so 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-16.0.5.src/test/wasm/Inputs/libstub-missing-sym.so 2023-06-02 01:59:18.000000000 +0200 @@ -0,0 +1,3 @@ +#STUB +# Symbol `foo` is missing from this file which causes stub_object.s to fail +bar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/test/wasm/Inputs/libstub.so new/lld-16.0.5.src/test/wasm/Inputs/libstub.so --- old/lld-16.0.4.src/test/wasm/Inputs/libstub.so 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-16.0.5.src/test/wasm/Inputs/libstub.so 2023-06-02 01:59:18.000000000 +0200 @@ -0,0 +1,5 @@ +#STUB +# This is a comment +foo: foodep1,foodep2 +# This symbols as no dependencies +bar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/test/wasm/stub_library.s new/lld-16.0.5.src/test/wasm/stub_library.s --- old/lld-16.0.4.src/test/wasm/stub_library.s 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-16.0.5.src/test/wasm/stub_library.s 2023-06-02 01:59:18.000000000 +0200 @@ -0,0 +1,48 @@ +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s +# RUN: wasm-ld %t.o %p/Inputs/libstub.so -o %t.wasm +# RUN: obj2yaml %t.wasm | FileCheck %s + +# When the dependencies are missing the link fails +# RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-dep.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-DEP %s + +# When the dependencies are missing the link fails +# RUN: not wasm-ld %t.o %p/Inputs/libstub-missing-sym.so -o %t.wasm 2>&1 | FileCheck --check-prefix=MISSING-SYM %s + +# MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep. Required by foo +# MISSING-DEP: libstub-missing-dep.so: undefined symbol: missing_dep2. Required by foo + +# MISSING-SYM: undefined symbol: foo + +# The function foo is defined in libstub.so but depend on foodep1 and foodep2 +.functype foo () -> () + +.globl foodep1 +foodep1: + .functype foodep1 () -> () + end_function + +.globl foodep2 +foodep2: + .functype foodep2 () -> () + end_function + +.globl _start +_start: + .functype _start () -> () + call foo + end_function + +# CHECK: - Type: EXPORT +# CHECK-NEXT: Exports: +# CHECK-NEXT: - Name: memory +# CHECK-NEXT: Kind: MEMORY +# CHECK-NEXT: Index: 0 +# CHECK-NEXT: - Name: foodep1 +# CHECK-NEXT: Kind: FUNCTION +# CHECK-NEXT: Index: 1 +# CHECK-NEXT: - Name: foodep2 +# CHECK-NEXT: Kind: FUNCTION +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: - Name: _start +# CHECK-NEXT: Kind: FUNCTION +# CHECK-NEXT: Index: 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/test/wasm/why-extract.s new/lld-16.0.5.src/test/wasm/why-extract.s --- old/lld-16.0.4.src/test/wasm/why-extract.s 1970-01-01 01:00:00.000000000 +0100 +++ new/lld-16.0.5.src/test/wasm/why-extract.s 2023-06-02 01:59:18.000000000 +0200 @@ -0,0 +1,87 @@ +# RUN: rm -rf %t && split-file %s %t +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/main.s -o %t/main.o +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/a.s -o %t/a.o +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/a_b.s -o %t/a_b.o +# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %t/b.s -o %t/b.o +# RUN: llvm-ar rc %t/a.a %t/a.o +# RUN: llvm-ar rc %t/a_b.a %t/a_b.o +# RUN: llvm-ar rc %t/b.a %t/b.o +# RUN: cd %t + +## Nothing is extracted from an archive. The file is created with just a header. +# RUN: wasm-ld main.o a.o b.a -o /dev/null --why-extract=why1.txt +# RUN: FileCheck %s --input-file=why1.txt --check-prefix=CHECK1 --match-full-lines --strict-whitespace + +# CHECK1:reference extracted symbol +# CHECK1-NOT:{{.}} + +## Some archive members are extracted. +# RUN: wasm-ld main.o a_b.a b.a -o /dev/null --why-extract=why2.txt +# RUN: FileCheck %s --input-file=why2.txt --check-prefix=CHECK2 --match-full-lines --strict-whitespace + +# CHECK2:reference extracted symbol +# CHECK2-NEXT:main.o a_b.a(a_b.o) a +# CHECK2-NEXT:a_b.a(a_b.o) b.a(b.o) b() + +## An undefined symbol error does not suppress the output. +# RUN: not wasm-ld main.o a_b.a -o /dev/null --why-extract=why3.txt +# RUN: FileCheck %s --input-file=why3.txt --check-prefix=CHECK3 --match-full-lines --strict-whitespace + +## Check that backward references are supported. +## - means stdout. +# RUN: wasm-ld b.a a_b.a main.o -o /dev/null --why-extract=- | FileCheck %s --check-prefix=CHECK4 + +# CHECK3:reference extracted symbol +# CHECK3-NEXT:main.o a_b.a(a_b.o) a + +# CHECK4:reference extracted symbol +# CHECK4-NEXT:a_b.a(a_b.o) b.a(b.o) b() +# CHECK4-NEXT:main.o a_b.a(a_b.o) a + +# RUN: wasm-ld main.o a_b.a b.a -o /dev/null --no-demangle --why-extract=- | FileCheck %s --check-prefix=MANGLED + +# MANGLED: a_b.a(a_b.o) b.a(b.o) _Z1bv + +# RUN: wasm-ld main.o a.a b.a -o /dev/null -u _Z1bv --why-extract=- | FileCheck %s --check-prefix=UNDEFINED + +## We insert -u symbol before processing other files, so its name is <internal>. +## This is not ideal. +# UNDEFINED: <internal> b.a(b.o) b() + +# RUN: wasm-ld main.o a.a b.a -o /dev/null -e _Z1bv --why-extract=- | FileCheck %s --check-prefix=ENTRY + +# ENTRY: --entry b.a(b.o) b() + +# SCRIPT: <internal> b.a(b.o) b() + +# RUN: not wasm-ld -shared main.o -o /dev/null --why-extract=/ 2>&1 | FileCheck %s --check-prefix=ERR + +# ERR: error: cannot open --why-extract= file /: {{.*}} + +#--- main.s +.globl _start +.functype a () -> () +_start: + .functype _start () -> () + call a + end_function + +#--- a.s +.globl a +a: + .functype a () -> () + end_function + +#--- a_b.s +.functype _Z1bv () -> () +.globl a +a: + .functype a () -> () + call _Z1bv + end_function + +#--- b.s +.globl _Z1bv +_Z1bv: + .functype _Z1bv () -> () + end_function diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Config.h new/lld-16.0.5.src/wasm/Config.h --- old/lld-16.0.4.src/wasm/Config.h 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Config.h 2023-06-02 01:59:18.000000000 +0200 @@ -19,6 +19,9 @@ namespace lld { namespace wasm { +class InputFile; +class Symbol; + // For --unresolved-symbols. enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic }; @@ -72,6 +75,7 @@ llvm::StringRef mapFile; llvm::StringRef outputFile; llvm::StringRef thinLTOCacheDir; + llvm::StringRef whyExtract; llvm::StringSet<> allowUndefinedSymbols; llvm::StringSet<> exportedSymbols; @@ -82,7 +86,8 @@ std::optional<std::vector<std::string>> extraFeatures; // The following config options do not directly correspond to any - // particular command line options. + // particular command line options, and should probably be moved to seperate + // Ctx struct as in ELF/Config.h // True if we are creating position-independent code. bool isPic; @@ -100,6 +105,11 @@ // Will be set to true if bss data segments should be emitted. In most cases // this is not necessary. bool emitBssSegments = false; + + // A tuple of (reference, extractedFile, sym). Used by --why-extract=. + llvm::SmallVector<std::tuple<std::string, const InputFile *, const Symbol &>, + 0> + whyExtractRecords; }; // The only instance of Configuration struct. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Driver.cpp new/lld-16.0.5.src/wasm/Driver.cpp --- old/lld-16.0.4.src/wasm/Driver.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Driver.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -280,6 +280,12 @@ case file_magic::wasm_object: files.push_back(createObjectFile(mbref)); break; + case file_magic::unknown: + if (mbref.getBuffer().starts_with("#STUB\n")) { + files.push_back(make<StubFile>(mbref)); + break; + } + [[fallthrough]]; default: error("unknown file type: " + mbref.getBufferIdentifier()); } @@ -450,6 +456,7 @@ parseCachePruningPolicy(args.getLastArgValue(OPT_thinlto_cache_policy)), "--thinlto-cache-policy: invalid cache policy"); config->unresolvedSymbols = getUnresolvedSymbolPolicy(args); + config->whyExtract = args.getLastArgValue(OPT_why_extract); errorHandler().verbose = args.hasArg(OPT_verbose); LLVM_DEBUG(errorHandler().verbose = true); @@ -631,7 +638,7 @@ } // Force Sym to be entered in the output. Used for -u or equivalent. -static Symbol *handleUndefined(StringRef name) { +static Symbol *handleUndefined(StringRef name, const char *option) { Symbol *sym = symtab->find(name); if (!sym) return nullptr; @@ -640,8 +647,11 @@ // eliminate it. Mark the symbol as "used" to prevent it. sym->isUsedInRegularObj = true; - if (auto *lazySym = dyn_cast<LazySymbol>(sym)) + if (auto *lazySym = dyn_cast<LazySymbol>(sym)) { lazySym->fetch(); + if (!config->whyExtract.empty()) + config->whyExtractRecords.emplace_back(option, sym->getFile(), *sym); + } return sym; } @@ -653,8 +663,31 @@ if (auto *lazySym = dyn_cast<LazySymbol>(sym)) { MemoryBufferRef mb = lazySym->getMemberBuffer(); - if (isBitcode(mb)) + if (isBitcode(mb)) { + if (!config->whyExtract.empty()) + config->whyExtractRecords.emplace_back("<libcall>", sym->getFile(), + *sym); lazySym->fetch(); + } + } +} + +static void writeWhyExtract() { + if (config->whyExtract.empty()) + return; + + std::error_code ec; + raw_fd_ostream os(config->whyExtract, ec, sys::fs::OF_None); + if (ec) { + error("cannot open --why-extract= file " + config->whyExtract + ": " + + ec.message()); + return; + } + + os << "reference\textracted\tsymbol\n"; + for (auto &entry : config->whyExtractRecords) { + os << std::get<0>(entry) << '\t' << toString(std::get<1>(entry)) << '\t' + << toString(std::get<2>(entry)) << '\n'; } } @@ -807,6 +840,53 @@ WasmSym::tlsBase = createOptionalGlobal("__tls_base", false); } +static void processStubLibraries() { + log("-- processStubLibraries"); + for (auto &stub_file : symtab->stubFiles) { + LLVM_DEBUG(llvm::dbgs() + << "processing stub file: " << stub_file->getName() << "\n"); + for (auto [name, deps]: stub_file->symbolDependencies) { + auto* sym = symtab->find(name); + if (!sym || !sym->isUndefined() || !sym->isUsedInRegularObj || + sym->forceImport) { + LLVM_DEBUG(llvm::dbgs() << "stub not in needed: " << name << "\n"); + continue; + } + // The first stub library to define a given symbol sets this and + // definitions in later stub libraries are ignored. + sym->forceImport = true; + if (sym->traced) + message(toString(stub_file) + ": importing " + name); + else + LLVM_DEBUG(llvm::dbgs() + << toString(stub_file) << ": importing " << name << "\n"); + for (const auto dep : deps) { + auto* needed = symtab->find(dep); + if (!needed) { + error(toString(stub_file) + ": undefined symbol: " + dep + + ". Required by " + toString(*sym)); + } else if (needed->isUndefined()) { + error(toString(stub_file) + + ": undefined symbol: " + toString(*needed) + + ". Required by " + toString(*sym)); + } else { + LLVM_DEBUG(llvm::dbgs() + << "force export: " << toString(*needed) << "\n"); + needed->forceExport = true; + needed->isUsedInRegularObj = true; + if (auto *lazy = dyn_cast<LazySymbol>(needed)) { + lazy->fetch(); + if (!config->whyExtract.empty()) + config->whyExtractRecords.emplace_back(stub_file->getName(), + sym->getFile(), *sym); + } + } + } + } + } + log("-- done processStubLibraries"); +} + // Reconstructs command line arguments so that so that you can re-run // the same command with the same inputs. This is for --reproduce. static std::string createResponseFile(const opt::InputArgList &args) { @@ -1035,16 +1115,16 @@ // Handle the `--undefined <sym>` options. for (auto *arg : args.filtered(OPT_undefined)) - handleUndefined(arg->getValue()); + handleUndefined(arg->getValue(), "<internal>"); // Handle the `--export <sym>` options // This works like --undefined but also exports the symbol if its found for (auto &iter : config->exportedSymbols) - handleUndefined(iter.first()); + handleUndefined(iter.first(), "--export"); Symbol *entrySym = nullptr; if (!config->relocatable && !config->entry.empty()) { - entrySym = handleUndefined(config->entry); + entrySym = handleUndefined(config->entry, "--entry"); if (entrySym && entrySym->isDefined()) entrySym->forceExport = true; else @@ -1061,7 +1141,8 @@ !WasmSym::callCtors->isUsedInRegularObj && WasmSym::callCtors->getName() != config->entry && !config->exportedSymbols.count(WasmSym::callCtors->getName())) { - if (Symbol *callDtors = handleUndefined("__wasm_call_dtors")) { + if (Symbol *callDtors = + handleUndefined("__wasm_call_dtors", "<internal>")) { if (auto *callDtorsFunc = dyn_cast<DefinedFunction>(callDtors)) { if (callDtorsFunc->signature && (!callDtorsFunc->signature->Params.empty() || @@ -1096,12 +1177,16 @@ if (errorCount()) return; + writeWhyExtract(); + // Do link-time optimization if given files are LLVM bitcode files. // This compiles bitcode files into real object files. symtab->compileBitcodeFiles(); if (errorCount()) return; + processStubLibraries(); + createOptionalSymbols(); // Resolve any variant symbols that were created due to signature diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/InputFiles.cpp new/lld-16.0.5.src/wasm/InputFiles.cpp --- old/lld-16.0.4.src/wasm/InputFiles.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/InputFiles.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -12,6 +12,7 @@ #include "InputElement.h" #include "OutputSegment.h" #include "SymbolTable.h" +#include "lld/Common/Args.h" #include "lld/Common/CommonLinkerContext.h" #include "lld/Common/Reproduce.h" #include "llvm/Object/Binary.h" @@ -678,6 +679,48 @@ llvm_unreachable("unknown symbol kind"); } + +StringRef strip(StringRef s) { + while (s.starts_with(" ")) { + s = s.drop_front(); + } + while (s.ends_with(" ")) { + s = s.drop_back(); + } + return s; +} + +void StubFile::parse() { + bool first = false; + + for (StringRef line : args::getLines(mb)) { + // File must begin with #STUB + if (first) { + assert(line == "#STUB\n"); + first = false; + } + + // Lines starting with # are considered comments + if (line.startswith("#")) + continue; + + StringRef sym; + StringRef rest; + std::tie(sym, rest) = line.split(':'); + sym = strip(sym); + rest = strip(rest); + + symbolDependencies[sym] = {}; + + while (rest.size()) { + StringRef first; + std::tie(first, rest) = rest.split(','); + first = strip(first); + symbolDependencies[sym].push_back(first); + } + } +} + void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. LLVM_DEBUG(dbgs() << "Parsing library: " << toString(this) << "\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/InputFiles.h new/lld-16.0.5.src/wasm/InputFiles.h --- old/lld-16.0.4.src/wasm/InputFiles.h 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/InputFiles.h 2023-06-02 01:59:18.000000000 +0200 @@ -47,6 +47,7 @@ SharedKind, ArchiveKind, BitcodeKind, + StubKind, }; virtual ~InputFile() {} @@ -183,6 +184,18 @@ static bool doneLTO; }; +// Stub libray (See docs/WebAssembly.rst) +class StubFile : public InputFile { +public: + explicit StubFile(MemoryBufferRef m) : InputFile(StubKind, m) {} + + static bool classof(const InputFile *f) { return f->kind() == StubKind; } + + void parse(); + + llvm::DenseMap<StringRef, std::vector<StringRef>> symbolDependencies; +}; + inline bool isBitcode(MemoryBufferRef mb) { return identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Options.td new/lld-16.0.5.src/wasm/Options.td --- old/lld-16.0.4.src/wasm/Options.td 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Options.td 2023-06-02 01:59:18.000000000 +0200 @@ -221,6 +221,8 @@ "Force load of all members in a static library", "Do not force load of all members in a static library (default)">; +def why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">; + defm check_features: BB<"check-features", "Check feature compatibility of linked objects (default)", "Ignore feature compatibility of linked objects">; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Relocations.cpp new/lld-16.0.5.src/wasm/Relocations.cpp --- old/lld-16.0.4.src/wasm/Relocations.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Relocations.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -33,9 +33,9 @@ } static bool allowUndefined(const Symbol* sym) { - // Symbols with explicit import names are always allowed to be undefined at + // Symbols that are explicitly imported are always allowed to be undefined at // link time. - if (sym->importName) + if (sym->isImported()) return true; if (isa<UndefinedFunction>(sym) && config->importUndefined) return true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/SymbolTable.cpp new/lld-16.0.5.src/wasm/SymbolTable.cpp --- old/lld-16.0.4.src/wasm/SymbolTable.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/SymbolTable.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -39,6 +39,13 @@ return; } + // stub file + if (auto *f = dyn_cast<StubFile>(file)) { + f->parse(); + stubFiles.push_back(f); + return; + } + if (config->trace) message(toString(file)); @@ -524,6 +531,9 @@ lazy->signature = sig; } else { lazy->fetch(); + if (!config->whyExtract.empty()) + config->whyExtractRecords.emplace_back(toString(file), s->getFile(), + *s); } } else { auto existingFunction = dyn_cast<FunctionSymbol>(s); @@ -748,7 +758,10 @@ } LLVM_DEBUG(dbgs() << "replacing existing undefined\n"); + const InputFile *oldFile = s->getFile(); file->addMember(sym); + if (!config->whyExtract.empty()) + config->whyExtractRecords.emplace_back(toString(oldFile), s->getFile(), *s); } bool SymbolTable::addComdat(StringRef name) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/SymbolTable.h new/lld-16.0.5.src/wasm/SymbolTable.h --- old/lld-16.0.4.src/wasm/SymbolTable.h 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/SymbolTable.h 2023-06-02 01:59:18.000000000 +0200 @@ -103,6 +103,7 @@ DefinedFunction *createUndefinedStub(const WasmSignature &sig); std::vector<ObjFile *> objectFiles; + std::vector<StubFile *> stubFiles; std::vector<SharedFile *> sharedFiles; std::vector<BitcodeFile *> bitcodeFiles; std::vector<InputFunction *> syntheticFunctions; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Symbols.cpp new/lld-16.0.5.src/wasm/Symbols.cpp --- old/lld-16.0.4.src/wasm/Symbols.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Symbols.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -220,6 +220,10 @@ flags |= WASM_SYMBOL_VISIBILITY_DEFAULT; } +bool Symbol::isImported() const { + return isUndefined() && (importName.has_value() || forceImport); +} + bool Symbol::isExported() const { if (!isDefined() || isLocal()) return false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Symbols.h new/lld-16.0.5.src/wasm/Symbols.h --- old/lld-16.0.4.src/wasm/Symbols.h 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Symbols.h 2023-06-02 01:59:18.000000000 +0200 @@ -114,6 +114,7 @@ void setOutputSymbolIndex(uint32_t index); WasmSymbolType getWasmType() const; + bool isImported() const; bool isExported() const; bool isExportedExplicit() const; @@ -135,7 +136,8 @@ Symbol(StringRef name, Kind k, uint32_t flags, InputFile *f) : name(name), file(f), symbolKind(k), referenced(!config->gcSections), requiresGOT(false), isUsedInRegularObj(false), forceExport(false), - canInline(false), traced(false), isStub(false), flags(flags) {} + forceImport(false), canInline(false), traced(false), isStub(false), + flags(flags) {} StringRef name; InputFile *file; @@ -160,6 +162,8 @@ // -e/--export command line flag) bool forceExport : 1; + bool forceImport : 1; + // False if LTO shouldn't inline whatever this symbol points to. If a symbol // is overwritten after LTO, LTO shouldn't inline the symbol because it // doesn't know the final contents of the symbol. @@ -656,6 +660,7 @@ T *s2 = new (s) T(std::forward<ArgT>(arg)...); s2->isUsedInRegularObj = symCopy.isUsedInRegularObj; s2->forceExport = symCopy.forceExport; + s2->forceImport = symCopy.forceImport; s2->canInline = symCopy.canInline; s2->traced = symCopy.traced; s2->referenced = symCopy.referenced; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lld-16.0.4.src/wasm/Writer.cpp new/lld-16.0.5.src/wasm/Writer.cpp --- old/lld-16.0.4.src/wasm/Writer.cpp 2023-05-17 07:03:06.000000000 +0200 +++ new/lld-16.0.5.src/wasm/Writer.cpp 2023-06-02 01:59:18.000000000 +0200 @@ -647,7 +647,7 @@ if (config->allowUndefinedSymbols.count(sym->getName()) != 0) return true; - return sym->importName.has_value(); + return sym->isImported(); } void Writer::calculateImports() { @@ -1570,7 +1570,7 @@ sym->forceExport = true; } - // Delay reporting error about explicit exports until after + // Delay reporting errors about explicit exports until after // addStartStopSymbols which can create optional symbols. for (auto &name : config->requiredExports) { Symbol *sym = symtab->find(name); ++++++ lldb-16.0.4.src.tar.xz -> lldb-16.0.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm16/lldb-16.0.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm16.new.15902/lldb-16.0.5.src.tar.xz differ: char 27, line 1 ++++++ llvm-16.0.4.src.tar.xz -> llvm-16.0.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm16/llvm-16.0.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm16.new.15902/llvm-16.0.5.src.tar.xz differ: char 69, line 2 ++++++ llvm-do-not-install-static-libraries.patch ++++++ --- /var/tmp/diff_new_pack.jd4PMG/_old 2023-06-06 19:55:41.226269740 +0200 +++ /var/tmp/diff_new_pack.jd4PMG/_new 2023-06-06 19:55:41.230269763 +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-16.0.4.src/cmake/modules/AddClang.cmake +Index: clang-16.0.5.src/cmake/modules/AddClang.cmake =================================================================== ---- a/clang-16.0.4.src/cmake/modules/AddClang.cmake -+++ b/clang-16.0.4.src/cmake/modules/AddClang.cmake +--- a/clang-16.0.5.src/cmake/modules/AddClang.cmake ++++ b/clang-16.0.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) @@ -68,10 +68,10 @@ endif() if (ARG_MODULE) set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") -Index: lld-16.0.4.src/cmake/modules/AddLLD.cmake +Index: lld-16.0.5.src/cmake/modules/AddLLD.cmake =================================================================== ---- a/lld-16.0.4.src/cmake/modules/AddLLD.cmake -+++ b/lld-16.0.4.src/cmake/modules/AddLLD.cmake +--- a/lld-16.0.5.src/cmake/modules/AddLLD.cmake ++++ b/lld-16.0.5.src/cmake/modules/AddLLD.cmake @@ -17,13 +17,6 @@ macro(add_lld_library name) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) @@ -86,10 +86,10 @@ if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) add_llvm_install_targets(install-${name} DEPENDS ${name} -Index: polly-16.0.4.src/cmake/polly_macros.cmake +Index: polly-16.0.5.src/cmake/polly_macros.cmake =================================================================== ---- a/polly-16.0.4.src/cmake/polly_macros.cmake -+++ b/polly-16.0.4.src/cmake/polly_macros.cmake +--- a/polly-16.0.5.src/cmake/polly_macros.cmake ++++ b/polly-16.0.5.src/cmake/polly_macros.cmake @@ -42,12 +42,14 @@ macro(add_polly_library name) llvm_config(${name} ${LLVM_LINK_COMPONENTS}) endif( LLVM_LINK_COMPONENTS ) @@ -110,10 +110,10 @@ endmacro(add_polly_library) macro(add_polly_loadable_module name) -Index: polly-16.0.4.src/lib/CMakeLists.txt +Index: polly-16.0.5.src/lib/CMakeLists.txt =================================================================== ---- a/polly-16.0.4.src/lib/CMakeLists.txt -+++ b/polly-16.0.4.src/lib/CMakeLists.txt +--- a/polly-16.0.5.src/lib/CMakeLists.txt ++++ b/polly-16.0.5.src/lib/CMakeLists.txt @@ -74,7 +74,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-16.0.4.src.tar.xz -> llvm-docs-16.0.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm16/llvm-docs-16.0.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm16.new.15902/llvm-docs-16.0.5.src.tar.xz differ: char 43, line 1 ++++++ llvm-remove-clang-only-flags.patch ++++++ --- /var/tmp/diff_new_pack.jd4PMG/_old 2023-06-06 19:55:41.278270048 +0200 +++ /var/tmp/diff_new_pack.jd4PMG/_new 2023-06-06 19:55:41.282270071 +0200 @@ -1,8 +1,8 @@ -Index: llvm-16.0.4.src/cmake/modules/HandleLLVMOptions.cmake +Index: llvm-16.0.5.src/cmake/modules/HandleLLVMOptions.cmake =================================================================== ---- llvm-16.0.4.src.orig/cmake/modules/HandleLLVMOptions.cmake -+++ llvm-16.0.4.src/cmake/modules/HandleLLVMOptions.cmake -@@ -577,8 +577,6 @@ if( MSVC ) +--- llvm-16.0.5.src.orig/cmake/modules/HandleLLVMOptions.cmake ++++ llvm-16.0.5.src/cmake/modules/HandleLLVMOptions.cmake +@@ -578,8 +578,6 @@ if( MSVC ) # Specific default warnings-as-errors for compilers accepting GCC-compatible warning flags: if ( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) @@ -10,8 +10,8 @@ - add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW) endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" ) - if ( LLVM_COMPILER_IS_GCC_COMPATIBLE ) -@@ -741,7 +739,6 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPI + # Modules enablement for GCC-compatible compilers: +@@ -731,7 +729,6 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPI endif() add_flag_if_supported("-Wimplicit-fallthrough" IMPLICIT_FALLTHROUGH_FLAG) ++++++ openmp-16.0.4.src.tar.xz -> openmp-16.0.5.src.tar.xz ++++++ ++++++ polly-16.0.4.src.tar.xz -> polly-16.0.5.src.tar.xz ++++++ /work/SRC/openSUSE:Factory/llvm16/polly-16.0.4.src.tar.xz /work/SRC/openSUSE:Factory/.llvm16.new.15902/polly-16.0.5.src.tar.xz differ: char 27, line 1 ++++++ third-party-16.0.4.src.tar.xz -> third-party-16.0.5.src.tar.xz ++++++