[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 11:19:19 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 59f7f35a9047cccded7b8d3a01926e03f1e10efa b02fb3abb3a808bb432790524a8c04b579fba5d7 -- lld/ELF/Arch/SystemZ.cpp lld/ELF/Driver.cpp lld/ELF/InputFiles.cpp lld/ELF/InputSection.cpp lld/ELF/Relocations.cpp lld/ELF/Relocations.h lld/ELF/ScriptParser.cpp lld/ELF/SyntheticSections.cpp lld/ELF/Target.cpp lld/ELF/Target.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/ELF/Arch/SystemZ.cpp b/lld/ELF/Arch/SystemZ.cpp
index 80a65cf32b..b170344170 100644
--- a/lld/ELF/Arch/SystemZ.cpp
+++ b/lld/ELF/Arch/SystemZ.cpp
@@ -41,6 +41,7 @@ public:
void relocate(uint8_t *loc, const Relocation &rel,
uint64_t val) const override;
int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override;
+
private:
void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) const;
void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
@@ -279,9 +280,9 @@ void SystemZ::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
// ear %rX,%a0
// sllg %rX,%rX,32
// ear %rX,%a1
- // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_
- // lgrl %r2,.LC0 R_390_PC32DBL .LC0
- // brasl %r14,__tls_get_offset at plt R_390_TLS_GDCALL x
+ // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_ lgrl
+ // %r2,.LC0 R_390_PC32DBL .LC0 brasl
+ // %r14,__tls_get_offset at plt R_390_TLS_GDCALL x
// :tls_gdcall:x R_390_PLT32DBL __tls_get_offset
// la %r2,0(%r2,%rX)
//
@@ -315,9 +316,9 @@ void SystemZ::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
// ear %rX,%a0
// sllg %rX,%rX,32
// ear %rX,%a1
- // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_
- // lgrl %r2,.LC0 R_390_PC32DBL .LC0
- // brasl %r14,__tls_get_offset at plt R_390_TLS_GDCALL x
+ // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_ lgrl
+ // %r2,.LC0 R_390_PC32DBL .LC0 brasl
+ // %r14,__tls_get_offset at plt R_390_TLS_GDCALL x
// :tls_gdcall:x R_390_PLT32DBL __tls_get_offset
// la %r2,0(%r2,%rX)
//
@@ -351,9 +352,9 @@ void SystemZ::relaxTlsLdToLe(uint8_t *loc, const Relocation &rel,
// ear %rX,%a0
// sllg %rX,%rX,32
// ear %rX,%a1
- // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_
- // lgrl %r2,.LC0 R_390_PC32DBL .LC0
- // brasl %r14,__tls_get_offset at plt R_390_TLS_LDCALL <sym>
+ // larl %r12,_GLOBAL_OFFSET_TABLE_ R_390_GOTPCDBL _GLOBAL_OFFSET_TABLE_ lgrl
+ // %r2,.LC0 R_390_PC32DBL .LC0 brasl
+ // %r14,__tls_get_offset at plt R_390_TLS_LDCALL <sym>
// :tls_ldcall:<sym> R_390_PLT32DBL __tls_get_offset
// la %r2,0(%r2,%rX)
// lgrl %rY,.LC1 R_390_PC32DBL .LC1
@@ -451,7 +452,8 @@ void SystemZ::relaxGot(uint8_t *loc, const Relocation &rel,
}
}
-void SystemZ::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
+void SystemZ::relocate(uint8_t *loc, const Relocation &rel,
+ uint64_t val) const {
switch (rel.expr) {
case R_RELAX_GOT_PC:
return relaxGot(loc, rel, val);
@@ -505,8 +507,8 @@ void SystemZ::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const
case R_390_GOTPLT20:
case R_390_TLS_GOTIE20:
checkInt(loc, val, 20, rel);
- write32be(loc, (read32be(loc) & 0xF00000FF)
- | ((val & 0xFFF) << 16) | ((val & 0xFF000) >> 4));
+ write32be(loc, (read32be(loc) & 0xF00000FF) | ((val & 0xFFF) << 16) |
+ ((val & 0xFF000) >> 4));
break;
case R_390_PC24DBL:
case R_390_PLT24DBL:
@@ -568,7 +570,8 @@ void SystemZ::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const
case R_390_TLS_LDCALL:
break;
default:
- error(getErrorLocation(loc) + "unknown relocation (" + Twine(rel.type) + ")");
+ error(getErrorLocation(loc) + "unknown relocation (" + Twine(rel.type) +
+ ")");
llvm_unreachable("unknown relocation");
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/75643
More information about the llvm-commits
mailing list