https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/85817

>From 123c0bdd085169ce7d63c96fc3c62cf6c0bc6d45 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Tue, 19 Mar 2024 16:50:05 +0000
Subject: [PATCH 1/2] Remove unrelated whitespace change

Created using spr 1.3.4
---
 lld/ELF/Relocations.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 241a5b82d35f4a..0301041ed48ecc 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1280,6 +1280,7 @@ static unsigned handleTlsRelocation(RelType type, Symbol 
&sym,
   if (config->emachine == EM_MIPS)
     return handleMipsTlsRelocation(type, sym, c, offset, addend, expr);
   bool isRISCV = config->emachine == EM_RISCV;
+
   if (oneof<R_AARCH64_TLSDESC_PAGE, R_TLSDESC, R_TLSDESC_CALL, R_TLSDESC_PC,
             R_TLSDESC_GOTPLT>(expr) &&
       config->shared) {

>From 40439e2ad1673ebe16f5f149de0b261ff74e42bb Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Fri, 22 Mar 2024 17:40:18 +0000
Subject: [PATCH 2/2] Update description and address comments

Created using spr 1.3.4
---
 lld/ELF/Relocations.cpp      | 11 ++++-------
 lld/test/ELF/riscv-tlsdesc.s | 11 +++++------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 0301041ed48ecc..92a1b9baaca3dd 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1480,13 +1480,10 @@ template <class ELFT, class RelTy> void 
RelocationScanner::scanOne(RelTy *&i) {
 
   // Process TLS relocations, including TLS optimizations. Note that
   // R_TPREL and R_TPREL_NEG relocations are resolved in processAux.
-  if (sym.isTls() ||
-      // These RISCV TLSDESC relocations reference a local symbol that won't be
-      // a TLS symbol, but we need to process them in handleTlsRelocation the
-      // same as other TLS relocations.
-      (config->emachine == EM_RISCV &&
-       (type == R_RISCV_TLSDESC_CALL || type == R_RISCV_TLSDESC_LOAD_LO12 ||
-        type == R_RISCV_TLSDESC_ADD_LO12))) {
+  //
+  // Some RISCV TLSDESC relocations reference a local NOTYPE symbol,
+  // but we need to process them in handleTlsRelocation.
+  if (sym.isTls() || oneof<R_TLSDESC_PC, R_TLSDESC_CALL>(expr)) {
     if (unsigned processed =
             handleTlsRelocation(type, sym, *sec, offset, addend, expr)) {
       i += processed - 1;
diff --git a/lld/test/ELF/riscv-tlsdesc.s b/lld/test/ELF/riscv-tlsdesc.s
index f041d2f290c3b9..935ecbddfbfffd 100644
--- a/lld/test/ELF/riscv-tlsdesc.s
+++ b/lld/test/ELF/riscv-tlsdesc.s
@@ -29,11 +29,13 @@
 # RUN: ld.lld -e 0 -z now a.32.o c.32.so -o a.32.ie
 # RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32.ie | FileCheck 
%s --check-prefix=IE32
 
-# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o
-# RUN: ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck %s 
--check-prefix=BADTLSLABEL --allow-empty
+## Prior to https://github.com/llvm/llvm-project/pull/85817 the local TLSDESC
+## labels would be marked STT_TLS, resulting in an error "has an STT_TLS 
symbol but doesn't have an SHF_TLS section"
 
+# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o
+# RUN: ld.lld -shared -soname=d.64.so -o d.64.so d.64.o --fatal-warnings
 # RUN: llvm-mc -triple=riscv32 -filetype=obj d.s -o d.32.o --defsym ELF32=1
-# RUN: ld.lld -shared -soname=d.32.so -o d.32.so d.32.o 2>&1 | FileCheck %s 
--check-prefix=BADTLSLABEL --allow-empty
+# RUN: ld.lld -shared -soname=d.32.so -o d.32.so d.32.o --fatal-warnings
 
 # GD64-RELA:      .rela.dyn {
 # GD64-RELA-NEXT:   0x2408 R_RISCV_TLSDESC - 0x7FF
@@ -162,9 +164,6 @@
 # IE32-NEXT:         lw      a0, 0x80(a0)
 # IE32-NEXT:         add     a0, a0, tp
 
-# At one point the local TLSDESC labels would be marked STT_TLS, so make sure 
we don't regress
-# BADTLSLABEL-NOT: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an 
SHF_TLS section
-
 #--- a.s
 .macro load dst, src
 .ifdef ELF32

_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to