[arch-commits] Commit in lld/trunk (2 files)
Evangelos Foutras
foutrelis at archlinux.org
Thu May 27 03:37:19 UTC 2021
Date: Thursday, May 27, 2021 @ 03:37:19
Author: foutrelis
Revision: 416506
upgpkg: lld 12.0.0-1: new upstream release
Added:
lld/trunk/dont-set-versionId-on-undefined-weak-lazy-symbols.patch
Modified:
lld/trunk/PKGBUILD
---------------------------------------------------------+
PKGBUILD | 23 +++--
dont-set-versionId-on-undefined-weak-lazy-symbols.patch | 62 ++++++++++++++
2 files changed, 79 insertions(+), 6 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-05-27 03:07:51 UTC (rev 416505)
+++ PKGBUILD 2021-05-27 03:37:19 UTC (rev 416506)
@@ -2,7 +2,7 @@
# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
pkgname=lld
-pkgver=11.1.0
+pkgver=12.0.0
pkgrel=1
pkgdesc="Linker from the LLVM project"
arch=('x86_64')
@@ -12,17 +12,28 @@
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})
-sha256sums=('017a788cbe1ecc4a949abf10755870519086d058a2e99f438829aef24f0c66ce'
+ $_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'
- 'ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5'
- '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() {
@@ -31,12 +42,12 @@
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
- -DPYTHON_EXECUTABLE=/usr/bin/python \
-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
Added: dont-set-versionId-on-undefined-weak-lazy-symbols.patch
===================================================================
--- dont-set-versionId-on-undefined-weak-lazy-symbols.patch (rev 0)
+++ dont-set-versionId-on-undefined-weak-lazy-symbols.patch 2021-05-27 03:37:19 UTC (rev 416506)
@@ -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