[lld] Make hashtable entry size configurable (PR #113431)
Dominik Steenken via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 08:08:04 PST 2024
https://github.com/dominik-steenken updated https://github.com/llvm/llvm-project/pull/113431
>From 1f40cdfb33ae08ab558d9d37501c576c09e1c1d6 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus at linux.ibm.com>
Date: Tue, 24 Sep 2024 14:05:43 +0200
Subject: [PATCH 1/2] [SystemZ] Make .hash entry size configurable. NFC
All but SystemZ use 32-bit .hash entries. SystemZ uses 64-bit .hash
entries. Make the .hash entry size configurable to correct the .hash
table for SystemZ with a subsequent commit.
Co-authored by: Dominik Steenken <dost at de.ibm.com>
Signed-off-by: Jens Remus <jremus at linux.ibm.com>
---
lld/ELF/SyntheticSections.cpp | 39 +++++++++++++++++++++++++----------
lld/ELF/SyntheticSections.h | 1 +
lld/ELF/Target.h | 3 +++
3 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 6c5f2a614639c8..baa3cefb6dec6c 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -2527,8 +2527,9 @@ void GnuHashTableSection::addSymbols(SmallVectorImpl<SymbolTableEntry> &v) {
}
HashTableSection::HashTableSection(Ctx &ctx)
- : SyntheticSection(ctx, ".hash", SHT_HASH, SHF_ALLOC, 4) {
- this->entsize = 4;
+ : SyntheticSection(ctx, ".hash", SHT_HASH, SHF_ALLOC,
+ ctx.target->hashEntrySize) {
+ this->entsize = ctx.target->hashEntrySize;
}
void HashTableSection::finalizeContents() {
@@ -2542,30 +2543,46 @@ void HashTableSection::finalizeContents() {
// Create as many buckets as there are symbols.
numEntries += symTab->getNumSymbols();
- this->size = numEntries * 4;
+ this->size = numEntries * this->entsize;
}
void HashTableSection::writeTo(uint8_t *buf) {
SymbolTableBaseSection *symTab = getPartition(ctx).dynSymTab.get();
unsigned numSymbols = symTab->getNumSymbols();
+ size_t size = this->entsize;
- uint32_t *p = reinterpret_cast<uint32_t *>(buf);
- write32(ctx, p++, numSymbols); // nbucket
- write32(ctx, p++, numSymbols); // nchain
+ uint8_t *p = buf;
+ this->writeHashTable(ctx, p, numSymbols); // nbucket
+ p += size;
+ this->writeHashTable(ctx, p, numSymbols); // nchain
+ p += size;
- uint32_t *buckets = p;
- uint32_t *chains = p + numSymbols;
+ uint8_t *buckets = p;
+ uint8_t *chains = p + numSymbols * size;
for (const SymbolTableEntry &s : symTab->getSymbols()) {
Symbol *sym = s.sym;
StringRef name = sym->getName();
unsigned i = sym->dynsymIndex;
- uint32_t hash = hashSysV(name) % numSymbols;
- chains[i] = buckets[hash];
- write32(ctx, buckets + hash, i);
+ uint64_t hash = hashSysV(name) % numSymbols;
+ // chains[i] = buckets[hash]
+ memcpy(chains + i * size, buckets + hash * size, size);
+ // buckets[hash] = i
+ this->writeHashTable(ctx, buckets + hash * size, i);
}
}
+inline void HashTableSection::writeHashTable(Ctx &ctx, uint8_t *buf,
+ uint64_t entry) const {
+ // All but SystemZ use 32-bit .hash entries.
+ if (this->entsize == 4)
+ write32(ctx, buf, entry);
+ else if (this->entsize == 8)
+ write64(ctx, buf, entry);
+ else
+ fatal("unsupported .hash entry size: " + Twine(this->entsize));
+}
+
PltSection::PltSection(Ctx &ctx)
: SyntheticSection(ctx, ".plt", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR,
16),
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 4b643e86335510..736abb49be99c6 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -723,6 +723,7 @@ class HashTableSection final : public SyntheticSection {
private:
size_t size = 0;
+ void writeHashTable(Ctx &ctx, uint8_t *buf, uint64_t entry) const;
};
// Used for PLT entries. It usually has a PLT header for lazy binding. Each PLT
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index fd1e5d33c438af..ce6ddc846a8b78 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -146,6 +146,9 @@ class TargetInfo {
// On PPC ELF V2 abi, the first entry in the .got is the .TOC.
unsigned gotHeaderEntriesNum = 0;
+ // All but SystemZ use 32-bit .hash entries.
+ unsigned hashEntrySize = 4;
+
// On PPC ELF V2 abi, the dynamic section needs DT_PPC64_OPT (DT_LOPROC + 3)
// to be set to 0x2 if there can be multiple TOC's. Although we do not emit
// multiple TOC's, there can be a mix of TOC and NOTOC addressing which
>From 2dca7b9c8e7f24bd9639d7178c8c5071e87fd08d Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus at linux.ibm.com>
Date: Fri, 13 Sep 2024 17:12:56 +0200
Subject: [PATCH 2/2] [SystemZ] Create 64-bit .hash entries on SystemZ This
commit also updates the relevant tests to correctly test the new .hash entry
sizes. Expected addresses had to change to acount for both growth and
displacement of the .hash section. In cases where the .data or .text sections
were affected, addresses in assembly code also had to be adapted.
Co-authored by: Dominik Steenken <dost at de.ibm.com>
Signed-off-by: Jens Remus <jremus at linux.ibm.com>
---
lld/ELF/Arch/SystemZ.cpp | 1 +
lld/test/ELF/basic-systemz.s | 34 +++++-----
lld/test/ELF/systemz-gotent-relax-und-dso.s | 38 +++++------
lld/test/ELF/systemz-pie.s | 10 +--
lld/test/ELF/systemz-reloc-got.s | 22 +++----
lld/test/ELF/systemz-reloc-gotrel.s | 10 +--
lld/test/ELF/systemz-tls-gd.s | 72 ++++++++++-----------
lld/test/ELF/systemz-tls-ie.s | 48 +++++++-------
lld/test/ELF/systemz-tls-ld.s | 30 ++++-----
9 files changed, 133 insertions(+), 132 deletions(-)
diff --git a/lld/ELF/Arch/SystemZ.cpp b/lld/ELF/Arch/SystemZ.cpp
index e0c6feb6031fc0..74f2fc286dac28 100644
--- a/lld/ELF/Arch/SystemZ.cpp
+++ b/lld/ELF/Arch/SystemZ.cpp
@@ -67,6 +67,7 @@ SystemZ::SystemZ(Ctx &ctx) : TargetInfo(ctx) {
pltHeaderSize = 32;
pltEntrySize = 32;
ipltEntrySize = 32;
+ hashEntrySize = 8; // On SystemZ, .hash entries are 64 bit in size.
// This "trap instruction" is used to fill gaps between sections.
// On SystemZ, the behavior of the GNU ld is to fill those gaps
diff --git a/lld/test/ELF/basic-systemz.s b/lld/test/ELF/basic-systemz.s
index f7bb0e8cbd020d..1a530322b6cb17 100644
--- a/lld/test/ELF/basic-systemz.s
+++ b/lld/test/ELF/basic-systemz.s
@@ -20,7 +20,7 @@
# CHECK-NEXT: Version: 0x1
# CHECK-NEXT: Entry point address: 0x0
# CHECK-NEXT: Start of program headers: 64 (bytes into file)
-# CHECK-NEXT: Start of section headers: 768 (bytes into file)
+# CHECK-NEXT: Start of section headers: 784 (bytes into file)
# CHECK-NEXT: Flags: 0x0
# CHECK-NEXT: Size of this header: 64 (bytes)
# CHECK-NEXT: Size of program headers: 56 (bytes)
@@ -33,31 +33,31 @@
# CHECK-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
# CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
# CHECK-NEXT: [ 1] .dynsym DYNSYM 00000000000001c8 0001c8 000018 18 A 3 1 8
-# CHECK-NEXT: [ 2] .hash HASH 00000000000001e0 0001e0 000010 04 A 1 0 4
-# CHECK-NEXT: [ 3] .dynstr STRTAB 00000000000001f0 0001f0 000001 00 A 0 0 1
-# CHECK-NEXT: [ 4] .text PROGBITS 00000000000011f4 0001f4 000006 00 AX 0 0 4
-# CHECK-NEXT: [ 5] .dynamic DYNAMIC 0000000000002200 000200 000060 10 WA 3 0 8
-# CHECK-NEXT: [ 6] .relro_padding NOBITS 0000000000002260 000260 000da0 00 WA 0 0 1
-# CHECK-NEXT: [ 7] .comment PROGBITS 0000000000000000 000260 000008 01 MS 0 0 1
-# CHECK-NEXT: [ 8] .symtab SYMTAB 0000000000000000 000268 000030 18 10 2 8
-# CHECK-NEXT: [ 9] .shstrtab STRTAB 0000000000000000 000298 000058 00 0 0 1
-# CHECK-NEXT: [10] .strtab STRTAB 0000000000000000 0002f0 00000a 00 0 0 1
+# CHECK-NEXT: [ 2] .hash HASH 00000000000001e0 0001e0 000020 08 A 1 0 8
+# CHECK-NEXT: [ 3] .dynstr STRTAB 0000000000000200 000200 000001 00 A 0 0 1
+# CHECK-NEXT: [ 4] .text PROGBITS 0000000000001204 000204 000006 00 AX 0 0 4
+# CHECK-NEXT: [ 5] .dynamic DYNAMIC 0000000000002210 000210 000060 10 WA 3 0 8
+# CHECK-NEXT: [ 6] .relro_padding NOBITS 0000000000002270 000270 000d90 00 WA 0 0 1
+# CHECK-NEXT: [ 7] .comment PROGBITS 0000000000000000 000270 000008 01 MS 0 0 1
+# CHECK-NEXT: [ 8] .symtab SYMTAB 0000000000000000 000278 000030 18 10 2 8
+# CHECK-NEXT: [ 9] .shstrtab STRTAB 0000000000000000 0002a8 000058 00 0 0 1
+# CHECK-NEXT: [10] .strtab STRTAB 0000000000000000 000300 00000a 00 0 0 1
# CHECK: Program Headers:
# CHECK-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# CHECK-NEXT: PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x000188 0x000188 R 0x8
-# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
-# CHECK-NEXT: LOAD 0x0001f4 0x00000000000011f4 0x00000000000011f4 0x000006 0x000006 R E 0x1000
-# CHECK-NEXT: LOAD 0x000200 0x0000000000002200 0x0000000000002200 0x000060 0x000e00 RW 0x1000
-# CHECK-NEXT: DYNAMIC 0x000200 0x0000000000002200 0x0000000000002200 0x000060 0x000060 RW 0x8
-# CHECK-NEXT: GNU_RELRO 0x000200 0x0000000000002200 0x0000000000002200 0x000060 0x000e00 R 0x1
+# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000201 0x000201 R 0x1000
+# CHECK-NEXT: LOAD 0x000204 0x0000000000001204 0x0000000000001204 0x000006 0x000006 R E 0x1000
+# CHECK-NEXT: LOAD 0x000210 0x0000000000002210 0x0000000000002210 0x000060 0x000df0 RW 0x1000
+# CHECK-NEXT: DYNAMIC 0x000210 0x0000000000002210 0x0000000000002210 0x000060 0x000060 RW 0x8
+# CHECK-NEXT: GNU_RELRO 0x000210 0x0000000000002210 0x0000000000002210 0x000060 0x000df0 R 0x1
# CHECK-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x0
-# CHECK: Dynamic section at offset 0x200 contains 6 entries:
+# CHECK: Dynamic section at offset 0x210 contains 6 entries:
# CHECK-NEXT: Tag Type Name/Value
# CHECK-NEXT: 0x0000000000000006 (SYMTAB) 0x1c8
# CHECK-NEXT: 0x000000000000000b (SYMENT) 24 (bytes)
-# CHECK-NEXT: 0x0000000000000005 (STRTAB) 0x1f0
+# CHECK-NEXT: 0x0000000000000005 (STRTAB) 0x200
# CHECK-NEXT: 0x000000000000000a (STRSZ) 1 (bytes)
# CHECK-NEXT: 0x0000000000000004 (HASH) 0x1e0
# CHECK-NEXT: 0x0000000000000000 (NULL) 0x0
diff --git a/lld/test/ELF/systemz-gotent-relax-und-dso.s b/lld/test/ELF/systemz-gotent-relax-und-dso.s
index e8b88056299cbf..b2433a3bbe1af7 100644
--- a/lld/test/ELF/systemz-gotent-relax-und-dso.s
+++ b/lld/test/ELF/systemz-gotent-relax-und-dso.s
@@ -7,9 +7,9 @@
# RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck --check-prefix=DISASM %s
# RELOC-LABEL: Relocation section '.rela.dyn' at offset {{.*}} contains 3 entries:
-# RELOC: 00000000000023f8 000000010000000a R_390_GLOB_DAT 00000000000012d8 foo + 0
-# RELOC: 0000000000002400 000000030000000a R_390_GLOB_DAT 0000000000000000 und + 0
-# RELOC: 0000000000002408 000000040000000a R_390_GLOB_DAT 0000000000000000 dsofoo + 0
+# RELOC: 0000000000002428 000000010000000a R_390_GLOB_DAT 0000000000001308 foo + 0
+# RELOC: 0000000000002430 000000030000000a R_390_GLOB_DAT 0000000000000000 und + 0
+# RELOC: 0000000000002438 000000040000000a R_390_GLOB_DAT 0000000000000000 dsofoo + 0
# DISASM: Disassembly of section .text:
# DISASM-EMPTY:
@@ -18,22 +18,22 @@
# DISASM: <hid>:
# DISASM-NEXT: nop
# DISASM: <_start>:
-# DISASM-NEXT: lgrl %r1, 0x2400
-# DISASM-NEXT: lgrl %r1, 0x2400
-# DISASM-NEXT: lgrl %r1, 0x2408
-# DISASM-NEXT: lgrl %r1, 0x2408
-# DISASM-NEXT: larl %r1, 0x12dc
-# DISASM-NEXT: larl %r1, 0x12dc
-# DISASM-NEXT: lgrl %r1, 0x23f8
-# DISASM-NEXT: lgrl %r1, 0x23f8
-# DISASM-NEXT: lgrl %r1, 0x2400
-# DISASM-NEXT: lgrl %r1, 0x2400
-# DISASM-NEXT: lgrl %r1, 0x2408
-# DISASM-NEXT: lgrl %r1, 0x2408
-# DISASM-NEXT: larl %r1, 0x12dc
-# DISASM-NEXT: larl %r1, 0x12dc
-# DISASM-NEXT: lgrl %r1, 0x23f8
-# DISASM-NEXT: lgrl %r1, 0x23f8
+# DISASM-NEXT: lgrl %r1, 0x2430
+# DISASM-NEXT: lgrl %r1, 0x2430
+# DISASM-NEXT: lgrl %r1, 0x2438
+# DISASM-NEXT: lgrl %r1, 0x2438
+# DISASM-NEXT: larl %r1, 0x130c
+# DISASM-NEXT: larl %r1, 0x130c
+# DISASM-NEXT: lgrl %r1, 0x2428
+# DISASM-NEXT: lgrl %r1, 0x2428
+# DISASM-NEXT: lgrl %r1, 0x2430
+# DISASM-NEXT: lgrl %r1, 0x2430
+# DISASM-NEXT: lgrl %r1, 0x2438
+# DISASM-NEXT: lgrl %r1, 0x2438
+# DISASM-NEXT: larl %r1, 0x130c
+# DISASM-NEXT: larl %r1, 0x130c
+# DISASM-NEXT: lgrl %r1, 0x2428
+# DISASM-NEXT: lgrl %r1, 0x2428
.text
.globl foo
diff --git a/lld/test/ELF/systemz-pie.s b/lld/test/ELF/systemz-pie.s
index bb971a82fb8ced..57ae10bff57393 100644
--- a/lld/test/ELF/systemz-pie.s
+++ b/lld/test/ELF/systemz-pie.s
@@ -19,13 +19,13 @@
# CHECK: Program Headers:
# CHECK-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# CHECK-NEXT: PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x000188 0x000188 R 0x8
-# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00020d 0x00020d R 0x1000
-# CHECK-NEXT: LOAD 0x000210 0x0000000000002210 0x0000000000002210 0x000090 0x000df0 RW 0x1000
-# CHECK-NEXT: DYNAMIC 0x000210 0x0000000000002210 0x0000000000002210 0x000090 0x000090 RW 0x8
-# CHECK-NEXT: GNU_RELRO 0x000210 0x0000000000002210 0x0000000000002210 0x000090 0x000df0 R 0x1
+# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000221 0x000221 R 0x1000
+# CHECK-NEXT: LOAD 0x000228 0x0000000000002228 0x0000000000002228 0x000090 0x000dd8 RW 0x1000
+# CHECK-NEXT: DYNAMIC 0x000228 0x0000000000002228 0x0000000000002228 0x000090 0x000090 RW 0x8
+# CHECK-NEXT: GNU_RELRO 0x000228 0x0000000000002228 0x0000000000002228 0x000090 0x000dd8 R 0x1
# CHECK-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x0
-# CHECK: Dynamic section at offset 0x210 contains 9 entries:
+# CHECK: Dynamic section at offset 0x228 contains 9 entries:
# CHECK-NEXT: Tag Type Name/Value
# CHECK-NEXT: 0x000000006ffffffb (FLAGS_1) PIE
diff --git a/lld/test/ELF/systemz-reloc-got.s b/lld/test/ELF/systemz-reloc-got.s
index 4b9ac16481f4cb..5e5f442791b992 100644
--- a/lld/test/ELF/systemz-reloc-got.s
+++ b/lld/test/ELF/systemz-reloc-got.s
@@ -8,20 +8,20 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISASM
# CHECK: Section Headers:
-# CHECK: .got PROGBITS 0000000000002458
-# CHECK: .got.plt PROGBITS 0000000000002480
+# CHECK: .got PROGBITS 0000000000002478
+# CHECK: .got.plt PROGBITS 00000000000024a0
## Note: _GLOBAL_OFFSET_TABLE is at .got
-## GOT (foo) is at .got + 24 == 0x2470
-## GOT (bar) is at .got + 32 == 0x2478
-## GOTPLT (foo) is at .got.plt + 0 == .got + 40 == 0x2480
-## GOTPLT (bar) is at .got.plt + 8 == .got + 48 == 0x2488
+## GOT (foo) is at .got + 24 == 0x2490
+## GOT (bar) is at .got + 32 == 0x2498
+## GOTPLT (foo) is at .got.plt + 0 == .got + 40 == 0x24a0
+## GOTPLT (bar) is at .got.plt + 8 == .got + 48 == 0x24a8
-# DISASM: larl %r12, 0x2458
-# DISASM-NEXT: larl %r1, 0x2470
-# DISASM-NEXT: larl %r1, 0x2478
-# DISASM-NEXT: larl %r1, 0x2480
-# DISASM-NEXT: larl %r1, 0x2488
+# DISASM: larl %r12, 0x2478
+# DISASM-NEXT: larl %r1, 0x2490
+# DISASM-NEXT: larl %r1, 0x2498
+# DISASM-NEXT: larl %r1, 0x24a0
+# DISASM-NEXT: larl %r1, 0x24a8
# DISASM-NEXT: l %r1, 24(%r12)
# DISASM-NEXT: l %r1, 32(%r12)
diff --git a/lld/test/ELF/systemz-reloc-gotrel.s b/lld/test/ELF/systemz-reloc-gotrel.s
index 46669ecfa7fd01..1e24ea196e6cc8 100644
--- a/lld/test/ELF/systemz-reloc-gotrel.s
+++ b/lld/test/ELF/systemz-reloc-gotrel.s
@@ -5,15 +5,15 @@
# RUN: llvm-readelf -S -s -x .data %t.so | FileCheck %s
# CHECK: Section Headers:
-# CHECK: .plt PROGBITS 0000000000001290
-# CHECK: .got PROGBITS 0000000000002390
+# CHECK: .plt PROGBITS 00000000000012b0
+# CHECK: .got PROGBITS 00000000000023b0
# CHECK: Symbol table '.symtab'
-# CHECK: 0000000000001288 {{.*}} bar
+# CHECK: 00000000000012a8 {{.*}} bar
## Note: foo is the first (and only) PLT entry, which resides at .plt + 32
-## PLTOFF (foo) is (.plt + 32) - .got == 0x12b0 - 0x2390 == 0xffffef20
-## GOTOFF (bar) is bar - .got == 0x1288 - 0x2390 == 0xffffeef8
+## PLTOFF (foo) is (.plt + 32) - .got == 0x12d0 - 0x23b0 == 0xffffef20
+## GOTOFF (bar) is bar - .got == 0x12a8 - 0x23b0 == 0xffffeef8
# CHECK: Hex dump of section '.data':
# CHECK-NEXT: eef8ef20 ffffeef8 ffffef20 ffffffff
# CHECK-NEXT: ffffeef8 ffffffff ffffef20
diff --git a/lld/test/ELF/systemz-tls-gd.s b/lld/test/ELF/systemz-tls-gd.s
index 742797e2d62e4f..4bf7a59262410b 100644
--- a/lld/test/ELF/systemz-tls-gd.s
+++ b/lld/test/ELF/systemz-tls-gd.s
@@ -19,37 +19,37 @@
# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.ie | FileCheck --check-prefix=IE-DATA %s
# GD-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 6 entries:
-# GD-REL: 0000000000002570 0000000200000036 R_390_TLS_DTPMOD 0000000000000008 a + 0
-# GD-REL-NEXT: 0000000000002578 0000000200000037 R_390_TLS_DTPOFF 0000000000000008 a + 0
-# GD-REL-NEXT: 0000000000002580 0000000300000036 R_390_TLS_DTPMOD 000000000000000c b + 0
-# GD-REL-NEXT: 0000000000002588 0000000300000037 R_390_TLS_DTPOFF 000000000000000c b + 0
-# GD-REL-NEXT: 0000000000002590 0000000400000036 R_390_TLS_DTPMOD 0000000000000010 c + 0
-# GD-REL-NEXT: 0000000000002598 0000000400000037 R_390_TLS_DTPOFF 0000000000000010 c + 0
-
-## _GLOBAL_OFFSET_TABLE is at 0x2558
-# GD: larl %r12, 0x2558
-
-## GOT offset of the TLS module ID / offset pair for a is at 0x2460
-# GD-NEXT: lgrl %r2, 0x2460
-# GD-NEXT: brasl %r14, 0x1440
+# GD-REL: 00000000000025a0 0000000200000036 R_390_TLS_DTPMOD 0000000000000008 a + 0
+# GD-REL-NEXT: 00000000000025a8 0000000200000037 R_390_TLS_DTPOFF 0000000000000008 a + 0
+# GD-REL-NEXT: 00000000000025b0 0000000300000036 R_390_TLS_DTPMOD 000000000000000c b + 0
+# GD-REL-NEXT: 00000000000025b8 0000000300000037 R_390_TLS_DTPOFF 000000000000000c b + 0
+# GD-REL-NEXT: 00000000000025c0 0000000400000036 R_390_TLS_DTPMOD 0000000000000010 c + 0
+# GD-REL-NEXT: 00000000000025c8 0000000400000037 R_390_TLS_DTPOFF 0000000000000010 c + 0
+
+## _GLOBAL_OFFSET_TABLE is at 0x2588
+# GD: larl %r12, 0x2588
+
+## GOT offset of the TLS module ID / offset pair for a is at 0x2490
+# GD-NEXT: lgrl %r2, 0x2490
+# GD-NEXT: brasl %r14, 0x1470
# GD-NEXT: lgf %r2, 0(%r2,%r7)
## GOT offset of the TLS module ID / offset pair for b is at 0x2468
-# GD-NEXT: lgrl %r2, 0x2468
-# GD-NEXT: brasl %r14, 0x1440
+# GD-NEXT: lgrl %r2, 0x2498
+# GD-NEXT: brasl %r14, 0x1470
# GD-NEXT: lgf %r2, 0(%r2,%r7)
## GOT offset of the TLS module ID / offset pair for c is at 0x2470
-# GD-NEXT: lgrl %r2, 0x2470
-# GD-NEXT: brasl %r14, 0x1440
+# GD-NEXT: lgrl %r2, 0x24a0
+# GD-NEXT: brasl %r14, 0x1470
# GD-NEXT: lgf %r2, 0(%r2,%r7)
## Constant pool holding GOT offsets of TLS module ID / offset pairs:
-# a: 0x2570 / 0x18
-# b: 0x2580 / 0x28
-# c: 0x2590 / 0x38
-# GD-DATA: 2460 00000000 00000018 00000000 00000028
-# GD-DATA-NEXT: 2470 00000000 00000038
+# a: 0x25a0 / 0x18
+# b: 0x25b0 / 0x28
+# c: 0x25c0 / 0x38
+# GD-DATA: 2490 00000000 00000018 00000000 00000028
+# GD-DATA-NEXT: 24a0 00000000 00000038
# NOREL: no relocations
@@ -80,33 +80,33 @@
# IE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
-# IE-REL: 0000000001002430 0000000200000038 R_390_TLS_TPOFF 0000000000000000 b + 0
-# IE-REL-NEXT: 0000000001002438 0000000300000038 R_390_TLS_TPOFF 0000000000000000 c + 0
+# IE-REL: 0000000001002460 0000000200000038 R_390_TLS_TPOFF 0000000000000000 b + 0
+# IE-REL-NEXT: 0000000001002468 0000000300000038 R_390_TLS_TPOFF 0000000000000000 c + 0
-## _GLOBAL_OFFSET_TABLE is at 0x1002418
-# IE: larl %r12, 0x1002418
+## _GLOBAL_OFFSET_TABLE is at 0x1002448
+# IE: larl %r12, 0x1002448
-## TP offset of a is at 0x1002340
-# IE-NEXT: lgrl %r2, 0x1002340
+## TP offset of a is at 0x1002370
+# IE-NEXT: lgrl %r2, 0x1002370
# IE-NEXT: jgnop
# IE-NEXT: lgf %r2, 0(%r2,%r7)
-## GOT offset of the TP offset for b is at 0x1002348
-# IE-NEXT: lgrl %r2, 0x1002348
+## GOT offset of the TP offset for b is at 0x1002378
+# IE-NEXT: lgrl %r2, 0x1002378
# IE-NEXT: lg %r2, 0(%r2,%r12)
# IE-NEXT: lgf %r2, 0(%r2,%r7)
-## GOT offset of the TP offset for c is at 0x1002350
-# IE-NEXT: lgrl %r2, 0x1002350
+## GOT offset of the TP offset for c is at 0x1002380
+# IE-NEXT: lgrl %r2, 0x1002380
# IE-NEXT: lg %r2, 0(%r2,%r12)
# IE-NEXT: lgf %r2, 0(%r2,%r7)
## TP offsets (a) / GOT offset of TP offsets (b, c)
# a: -4
-# b: 0x1002430 / 0x18
-# c: 0x1002438 / 0x20
-# IE-DATA: 1002340 ffffffff fffffffc 00000000 00000018
-# IE-DATA-NEXT: 1002350 00000000 00000020
+# b: 0x1002460 / 0x18
+# c: 0x1002468 / 0x20
+# IE-DATA: 1002370 ffffffff fffffffc 00000000 00000018
+# IE-DATA-NEXT: 1002380 00000000 00000020
ear %r7,%a0
diff --git a/lld/test/ELF/systemz-tls-ie.s b/lld/test/ELF/systemz-tls-ie.s
index 85e2f24cb61f62..0702fdf4040ce8 100644
--- a/lld/test/ELF/systemz-tls-ie.s
+++ b/lld/test/ELF/systemz-tls-ie.s
@@ -21,25 +21,25 @@
# RUN: llvm-objdump --section .got --full-contents %t.pie | FileCheck --check-prefix=PIE-GOT %s
# IE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 4 entries:
-# IE-REL: 0000000000003478 000000000000000c R_390_RELATIVE 2460
-# IE-REL: 0000000000002460 0000000100000038 R_390_TLS_TPOFF 0000000000000008 a + 0
-# IE-REL: 0000000000002468 0000000200000038 R_390_TLS_TPOFF 000000000000000c b + 0
-# IE-REL: 0000000000002470 0000000300000038 R_390_TLS_TPOFF 0000000000000010 c + 0
+# IE-REL: 00000000000034a0 000000000000000c R_390_RELATIVE 2488
+# IE-REL: 0000000000002488 0000000100000038 R_390_TLS_TPOFF 0000000000000008 a + 0
+# IE-REL: 0000000000002490 0000000200000038 R_390_TLS_TPOFF 000000000000000c b + 0
+# IE-REL: 0000000000002498 0000000300000038 R_390_TLS_TPOFF 0000000000000010 c + 0
-## TP offset for a is at 0x2460
-# IE: lgrl %r1, 0x2460
+## TP offset for a is at 0x2488
+# IE: lgrl %r1, 0x2488
# IE-NEXT: lgf %r1, 0(%r1,%r7)
-## TP offset for b is at 0x2468
-# IE-NEXT: lgrl %r1, 0x2468
+## TP offset for b is at 0x2490
+# IE-NEXT: lgrl %r1, 0x2490
# IE-NEXT: lgf %r1, 0(%r1,%r7)
-## TP offset for c is at 0x2470
-# IE-NEXT: lgrl %r1, 0x2470
+## TP offset for c is at 0x2498
+# IE-NEXT: lgrl %r1, 0x2498
# IE-NEXT: lgf %r1, 0(%r1,%r7)
-## Data element: TP offset for a is at 0x2460 (relocated via R_390_RELATIVE above)
-# IE-DATA: 3478 00000000 00000000
+## Data element: TP offset for a is at 0x2488 (relocated via R_390_RELATIVE above)
+# IE-DATA: 34a0 00000000 00000000
# NOREL: no relocations
@@ -67,30 +67,30 @@
# LE-GOT: 1002258 ffffffff fffffffc 00000000 00000000
# PIE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
-# PIE-REL: 00000000000033d0 000000000000000c R_390_RELATIVE 23b8
+# PIE-REL: 00000000000033e8 000000000000000c R_390_RELATIVE 23d0
-## TP offset for a is at 0x23b8
-# PIE: lgrl %r1, 0x23b8
+## TP offset for a is at 0x23d0
+# PIE: lgrl %r1, 0x23d0
# PIE-NEXT: lgf %r1, 0(%r1,%r7)
-## TP offset for b is at 0x23c0
-# PIE-NEXT: lgrl %r1, 0x23c0
+## TP offset for b is at 0x23d8
+# PIE-NEXT: lgrl %r1, 0x23d8
# PIE-NEXT: lgf %r1, 0(%r1,%r7)
-## TP offset for c is at 0x23c8
-# PIE-NEXT: lgrl %r1, 0x23c8
+## TP offset for c is at 0x23e0
+# PIE-NEXT: lgrl %r1, 0x23e0
# PIE-NEXT: lgf %r1, 0(%r1,%r7)
-## Data element: TP offset for a is at 0x23b8 (relocated via R_390_RELATIVE above)
-# PIE-DATA: 33d0 00000000 00000000
+## Data element: TP offset for a is at 0x23d0 (relocated via R_390_RELATIVE above)
+# PIE-DATA: 33e8 00000000 00000000
## TP offsets in GOT:
# a: -8
# b: -4
# c: 0
-# PIE-GOT: 23a0 00000000 000022d0 00000000 00000000
-# PIE-GOT: 23b0 00000000 00000000 ffffffff fffffff8
-# PIE-GOT: 23c0 ffffffff fffffffc 00000000 00000000
+# PIE-GOT: 23b8 00000000 000022e8 00000000 00000000
+# PIE-GOT: 23c8 00000000 00000000 ffffffff fffffff8
+# PIE-GOT: 23d8 ffffffff fffffffc 00000000 00000000
ear %r7,%a0
sllg %r7,%r1,32
diff --git a/lld/test/ELF/systemz-tls-ld.s b/lld/test/ELF/systemz-tls-ld.s
index ef104b82644ce0..23b13e9ae164e9 100644
--- a/lld/test/ELF/systemz-tls-ld.s
+++ b/lld/test/ELF/systemz-tls-ld.s
@@ -12,35 +12,35 @@
# RUN: llvm-objdump --section .data.rel.ro --full-contents %t | FileCheck --check-prefix=LE-DATA %s
# LD-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
-# LD-REL: 00000000000024f8 0000000000000036 R_390_TLS_DTPMOD 0
+# LD-REL: 0000000000002528 0000000000000036 R_390_TLS_DTPMOD 0
-## _GLOBAL_OFFSET_TABLE is at 0x24e0
-# LD: larl %r12, 0x24e0
+## _GLOBAL_OFFSET_TABLE is at 0x2510
+# LD: larl %r12, 0x2510
-## GOT offset of the LDM TLS module ID is at 0x23e0
-# LD-NEXT: lgrl %r2, 0x23e0
-# LD-NEXT: brasl %r14, 0x13c0
+## GOT offset of the LDM TLS module ID is at 0x2410
+# LD-NEXT: lgrl %r2, 0x2410
+# LD-NEXT: brasl %r14, 0x13f0
# LD-NEXT: la %r2, 0(%r2,%r7)
-## DTP offset for a is at 0x23e8
-# LD-NEXT: lgrl %r1, 0x23e8
+## DTP offset for a is at 0x2418
+# LD-NEXT: lgrl %r1, 0x2418
# LD-NEXT: lgf %r1, 0(%r1,%r2)
-## DTP offset for b is at 0x23f0
-# LD-NEXT: lgrl %r1, 0x23f0
+## DTP offset for b is at 0x2420
+# LD-NEXT: lgrl %r1, 0x2420
# LD-NEXT: lgf %r1, 0(%r1,%r2)
-## DTP offset for c is at 0x23f8
-# LD-NEXT: lgrl %r1, 0x23f8
+## DTP offset for c is at 0x2428
+# LD-NEXT: lgrl %r1, 0x2428
# LD-NEXT: lgf %r1, 0(%r1,%r2)
## Constant pool holding GOT offsets of TLS module ID and DTP offsets:
-# TLS module ID: 0x24f8 / 0x18
+# TLS module ID: 0x2528 / 0x18
# a: 8
# b: 12
# c: 16
-# LD-DATA: 23e0 00000000 00000018 00000000 00000008
-# LD-DATA: 23f0 00000000 0000000c 00000000 00000010
+# LD-DATA: 2410 00000000 00000018 00000000 00000008
+# LD-DATA: 2420 00000000 0000000c 00000000 00000010
# NOREL: no relocations
More information about the llvm-commits
mailing list