about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-28 15:03:52 +0000
committerbors <bors@rust-lang.org>2021-05-28 15:03:52 +0000
commit6f9df55a782c5373c75dfa23e6ba50f8b42318ef (patch)
tree6bd6e3ebc2dc34ae95699d2b2ae73757c7a1a115 /src
parentce0d64e03ef9875e0935bb60e989542b7ec29579 (diff)
parent4a76934aa7e46acad5f150ff394601c0b6d6d53f (diff)
downloadrust-6f9df55a782c5373c75dfa23e6ba50f8b42318ef.tar.gz
rust-6f9df55a782c5373c75dfa23e6ba50f8b42318ef.zip
Auto merge of #85700 - Bobo1239:dso_local_ppc64, r=nagisa
Fix static relocation model for PowerPC64

We now also use `should_assume_dso_local()` for declarations and port two
additional cases from clang:
- Exclude PPC64 [1]
- Exclude thread-local variables [2]

[1]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1038-L1040
[2]: https://github.com/llvm/llvm-project/blob/033138ea452f5f493fb5095e5963419905ad12e1/clang/lib/CodeGen/CodeGenModule.cpp#L1048-L1050

Tbh I don't know enough about PowerPC(64) to explain why the TOC (table of contents; like the GOT in x86?) is still needed even with the static relocation model. But with these changes [Rust-For-Linux](https://github.com/Rust-for-Linux/linux) runs again on ppc64le. (instead of [getting loaded successfully but crashing](https://github.com/Bobo1239/linux/runs/2646478783?check_suite_focus=true#step:47:358))

r? `@nagisa`
Diffstat (limited to 'src')
-rw-r--r--src/test/assembly/static-relocation-model.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test/assembly/static-relocation-model.rs b/src/test/assembly/static-relocation-model.rs
index ce2b3b1cfa4..2cd74a01c84 100644
--- a/src/test/assembly/static-relocation-model.rs
+++ b/src/test/assembly/static-relocation-model.rs
@@ -1,9 +1,10 @@
 // min-llvm-version: 12.0.0
-// needs-llvm-components: aarch64 x86
-// revisions:x64 A64
+// needs-llvm-components: aarch64 x86 powerpc
+// revisions: x64 A64 ppc64le
 // assembly-output: emit-asm
 // [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static
 // [A64] compile-flags: --target aarch64-unknown-linux-gnu -Crelocation-model=static
+// [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static
 
 #![feature(no_core, lang_items)]
 #![no_core]
@@ -75,3 +76,9 @@ pub fn mango() -> u8 {
 pub fn orange() -> &'static u8 {
     &PIERIS
 }
+
+// For ppc64 we need to make sure to generate TOC entries even with the static relocation model
+// ppc64le: .tc chaenomeles[TC],chaenomeles
+// ppc64le: .tc banana[TC],banana
+// ppc64le: .tc EXOCHORDA[TC],EXOCHORDA
+// ppc64le: .tc PIERIS[TC],PIERIS