Skip to content

release/20.x: [LoongArch] Pre-commit test for fixing tls-le symbol type #132361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Mar 21, 2025

Backport 87adafc

Requested by: @zhaoqi5

@llvmbot
Copy link
Member Author

llvmbot commented Mar 21, 2025

@llvm/pr-subscribers-backend-loongarch

Author: None (llvmbot)

Changes

Backport 87adafc

Requested by: @zhaoqi5


Full diff: https://github.com/llvm/llvm-project/pull/132361.diff

1 Files Affected:

  • (added) llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll (+24)
diff --git a/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll b/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll
new file mode 100644
index 0000000000000..fe5f2195f0dc7
--- /dev/null
+++ b/llvm/test/CodeGen/LoongArch/fix-tle-le-sym-type.ll
@@ -0,0 +1,24 @@
+; RUN: llc --mtriple=loongarch32 --filetype=obj %s -o %t-la32
+; RUN: llvm-readelf -s %t-la32 | FileCheck %s --check-prefix=LA32
+
+; RUN: llc --mtriple=loongarch64 --filetype=obj %s -o %t-la64
+; RUN: llvm-readelf -s %t-la64 | FileCheck %s --check-prefix=LA64
+
+; LA32:      Symbol table '.symtab' contains [[#]] entries:
+; LA32-NEXT:    Num:    Value  Size Type    Bind   Vis      Ndx Name
+; LA32:              00000000     0 NOTYPE  GLOBAL DEFAULT  UND tls_sym
+
+; LA64:      Symbol table '.symtab' contains [[#]] entries:
+; LA64-NEXT:    Num:    Value          Size Type    Bind   Vis      Ndx Name
+; LA64:              0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND tls_sym
+
+@tls_sym = external thread_local(localexec) global i32
+
+define dso_local signext i32 @test_tlsle() nounwind {
+entry:
+  %0 = call ptr @llvm.threadlocal.address.p0(ptr @tls_sym)
+  %1 = load i32, ptr %0
+  ret i32 %1
+}
+
+declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)

@zhaoqi5
Copy link
Contributor

zhaoqi5 commented Mar 21, 2025

#132324 cannot be automatically cherry-picked due to the conflict. I will open a pull request after this pr to backport it manually.

@github-project-automation github-project-automation bot moved this from Needs Triage to Needs Merge in LLVM Release Status Mar 24, 2025
The symbol type of tls-le must be `TLS`, it was incorrectly set
as `NOTYPE`.

A later commit will fix it.

(cherry picked from commit 87adafc)
@tstellar tstellar merged commit 6034661 into llvm:release/20.x Mar 25, 2025
7 of 9 checks passed
@github-project-automation github-project-automation bot moved this from Needs Merge to Done in LLVM Release Status Mar 25, 2025
Copy link

@zhaoqi5 (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants