[arch-commits] Commit in lld/repos (3 files)

Evangelos Foutras foutrelis at archlinux.org
Thu May 27 03:37:24 UTC 2021


    Date: Thursday, May 27, 2021 @ 03:37:23
  Author: foutrelis
Revision: 416507

archrelease: copy trunk to staging-x86_64

Added:
  lld/repos/staging-x86_64/
  lld/repos/staging-x86_64/PKGBUILD
    (from rev 416506, lld/trunk/PKGBUILD)
  lld/repos/staging-x86_64/dont-set-versionId-on-undefined-weak-lazy-symbols.patch
    (from rev 416506, lld/trunk/dont-set-versionId-on-undefined-weak-lazy-symbols.patch)

---------------------------------------------------------+
 PKGBUILD                                                |   74 ++++++++++++++
 dont-set-versionId-on-undefined-weak-lazy-symbols.patch |   62 +++++++++++
 2 files changed, 136 insertions(+)

Copied: lld/repos/staging-x86_64/PKGBUILD (from rev 416506, lld/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2021-05-27 03:37:23 UTC (rev 416507)
@@ -0,0 +1,74 @@
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+
+pkgname=lld
+pkgver=12.0.0
+pkgrel=1
+pkgdesc="Linker from the LLVM project"
+arch=('x86_64')
+url="https://lld.llvm.org/"
+license=('custom:Apache 2.0 with LLVM Exception')
+depends=('llvm-libs')
+makedepends=('llvm' 'cmake' 'ninja' 'python-sphinx')
+_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
+source=($_source_base/$pkgname-$pkgver.src.tar.xz{,.sig}
+        $_source_base/llvm-$pkgver.src.tar.xz{,.sig}
+        $_source_base/libunwind-$pkgver.src.tar.xz{,.sig}
+        dont-set-versionId-on-undefined-weak-lazy-symbols.patch)
+sha256sums=('2cb7d497f3ce33ce8a2c50ad26ec93a8c45f57268d4d96953cd0f25566f753fd'
+            'SKIP'
+            '49dc47c8697a1a0abd4ee51629a696d7bfe803662f2a7252a3b16fc75f3a8b50'
+            'SKIP'
+            '9ed2a5b28853f7f58be9d04836ff43d6e4132df5a2c058b690dc3e9d75bd1cf5'
+            'SKIP'
+            '0a2e30617a5c2a3bead0638d7f77f5915d800b7d11e5962b8ca0e525ca744843')
+validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
+validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
+
+prepare() {
+  # https://bugs.llvm.org/show_bug.cgi?id=49228
+  mv libunwind{-$pkgver.src,}
+
+  cd "$srcdir/$pkgname-$pkgver.src"
+  mkdir build
+
+  # https://bugs.llvm.org/show_bug.cgi?id=49915
+  patch -Np2 -i ../dont-set-versionId-on-undefined-weak-lazy-symbols.patch
+}
+
+build() {
+  cd "$srcdir/$pkgname-$pkgver.src/build"
+
+  cmake .. -G Ninja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DLLVM_LINK_LLVM_DYLIB=ON \
+    -DLLVM_INCLUDE_TESTS=ON \
+    -DLLVM_BUILD_TESTS=ON \
+    -DLLVM_BUILD_DOCS=ON \
+    -DLLVM_ENABLE_SPHINX=ON \
+    -DSPHINX_WARNINGS_AS_ERRORS=OFF \
+    -DLLVM_EXTERNAL_LIT=/usr/bin/lit \
+    -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
+  ninja
+}
+
+check() {
+  cd "$srcdir/$pkgname-$pkgver.src/build"
+  ninja check-lld
+}
+
+package() {
+  cd "$srcdir/$pkgname-$pkgver.src/build"
+
+  DESTDIR="$pkgdir" ninja install
+  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+  # https://bugs.llvm.org/show_bug.cgi?id=42455
+  install -Dm644 -t "$pkgdir/usr/share/man/man1" ../docs/ld.lld.1
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
+}
+
+# vim:set ts=2 sw=2 et:

Copied: lld/repos/staging-x86_64/dont-set-versionId-on-undefined-weak-lazy-symbols.patch (from rev 416506, lld/trunk/dont-set-versionId-on-undefined-weak-lazy-symbols.patch)
===================================================================
--- staging-x86_64/dont-set-versionId-on-undefined-weak-lazy-symbols.patch	                        (rev 0)
+++ staging-x86_64/dont-set-versionId-on-undefined-weak-lazy-symbols.patch	2021-05-27 03:37:23 UTC (rev 416507)
@@ -0,0 +1,62 @@
+From 6912082cfd129bbc2bd60f293371e20140d50b86 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i at maskray.me>
+Date: Tue, 20 Apr 2021 11:23:10 -0700
+Subject: [PATCH] [ELF] Don't set versionId on undefined weak lazy symbols
+
+An unfetched lazy symbol (undefined weak) should be considered to have its
+original versionId which is VER_NDX_GLOBAL, instead of the lazy symbol's
+versionId. (The original versionId cannot be non-VER_NDX_GLOBAL because a
+undefined versioned symbol is an error.)
+
+The regression was introduced in D77280 when making version scripts work
+with lazy symbols fetched by LTO calls.
+
+Fix PR49915
+
+Differential Revision: https://reviews.llvm.org/D100624
+
+(cherry picked from commit 1c00530b30e21fd0f5b316401f6485bee08ce850)
+---
+ lld/ELF/SyntheticSections.cpp      |  4 +++-
+ lld/test/ELF/version-script-weak.s | 13 +++++++++++++
+ 2 files changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
+index 9a875bd7ec3e..70c36c63d101 100644
+--- a/lld/ELF/SyntheticSections.cpp
++++ b/lld/ELF/SyntheticSections.cpp
+@@ -3110,7 +3110,9 @@ size_t VersionTableSection::getSize() const {
+ void VersionTableSection::writeTo(uint8_t *buf) {
+   buf += 2;
+   for (const SymbolTableEntry &s : getPartition().dynSymTab->getSymbols()) {
+-    write16(buf, s.sym->versionId);
++    // Use the original versionId for an unfetched lazy symbol (undefined weak),
++    // which must be VER_NDX_GLOBAL (an undefined versioned symbol is an error).
++    write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
+     buf += 2;
+   }
+ }
+diff --git a/lld/test/ELF/version-script-weak.s b/lld/test/ELF/version-script-weak.s
+index 7c902eb98bf4..cfa2455ee2bd 100644
+--- a/lld/test/ELF/version-script-weak.s
++++ b/lld/test/ELF/version-script-weak.s
+@@ -24,6 +24,19 @@
+ # CHECK-NEXT:   Section: Undefined
+ # CHECK-NEXT: }
+ 
++## The version of an unfetched lazy symbol is VER_NDX_GLOBAL. It is not affected by version scripts.
++# RUN: echo "v1 { *; };" > %t2.script
++# RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib -o %t2.so
++# RUN: llvm-readelf --dyn-syms %t2.so | FileCheck %s --check-prefix=CHECK2
++
++# CHECK2: NOTYPE WEAK DEFAULT UND foo{{$}}
++
++# RUN: ld.lld -shared --soname=tshared --version-script %t2.script %t1.o -o %tshared.so
++# RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib %tshared.so -o %t3.so
++# RUN: llvm-readelf --dyn-syms %t3.so | FileCheck %s --check-prefix=CHECK3
++
++# CHECK3: NOTYPE WEAK DEFAULT UND foo at v1
++
+ .text
+  callq foo at PLT
+ .weak foo



More information about the arch-commits mailing list