[lld] r370192 - [ELF][RISCV] Allow PT_LOAD to have overlapping p_offset ranges on EM_RISCV
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 05:06:06 PDT 2019
Author: maskray
Date: Wed Aug 28 05:06:06 2019
New Revision: 370192
URL: http://llvm.org/viewvc/llvm-project?rev=370192&view=rev
Log:
[ELF][RISCV] Allow PT_LOAD to have overlapping p_offset ranges on EM_RISCV
Port the D64906 technique to RISC-V. It deletes 3 alignments at
PT_LOAD boundaries for the default case: the size of a RISC-V binary
decreases by at most 12kb.
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/riscv-gp.s
lld/trunk/test/ELF/riscv-plt.s
lld/trunk/test/ELF/riscv-reloc-copy.s
lld/trunk/test/ELF/riscv-reloc-got.s
lld/trunk/test/ELF/riscv-tls-gd.s
lld/trunk/test/ELF/riscv-tls-ie.s
lld/trunk/test/ELF/riscv-tls-ld.s
lld/trunk/test/ELF/riscv32-reloc-32-pic.s
lld/trunk/test/ELF/riscv64-reloc-64-pic.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Aug 28 05:06:06 2019
@@ -2224,9 +2224,9 @@ template <class ELFT> void Writer<ELFT>:
// and non-executable segments.
//
// TODO Enable this technique on all targets.
- bool enable =
- config->emachine != EM_HEXAGON && config->emachine != EM_MIPS &&
- config->emachine != EM_RISCV && config->emachine != EM_X86_64;
+ bool enable = config->emachine != EM_HEXAGON &&
+ config->emachine != EM_MIPS &&
+ config->emachine != EM_X86_64;
if (!enable || (config->zSeparateCode && prev &&
(prev->p_flags & PF_X) != (p->p_flags & PF_X)))
Modified: lld/trunk/test/ELF/riscv-gp.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-gp.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-gp.s (original)
+++ lld/trunk/test/ELF/riscv-gp.s Wed Aug 28 05:06:06 2019
@@ -1,19 +1,22 @@
# REQUIRES: riscv
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o
# RUN: ld.lld -pie %t.32.o -o %t.32
-# RUN: llvm-readelf -s %t.32 | FileCheck --check-prefix=SYM %s
-# RUN: llvm-readelf -S %t.32 | FileCheck --check-prefix=SEC %s
+# RUN: llvm-readelf -s %t.32 | FileCheck --check-prefix=SYM32 %s
+# RUN: llvm-readelf -S %t.32 | FileCheck --check-prefix=SEC32 %s
# RUN: not ld.lld -shared %t.32.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o
# RUN: ld.lld -pie %t.64.o -o %t.64
-# RUN: llvm-readelf -s %t.64 | FileCheck --check-prefix=SYM %s
-# RUN: llvm-readelf -S %t.64 | FileCheck --check-prefix=SEC %s
+# RUN: llvm-readelf -s %t.64 | FileCheck --check-prefix=SYM64 %s
+# RUN: llvm-readelf -S %t.64 | FileCheck --check-prefix=SEC64 %s
# RUN: not ld.lld -shared %t.64.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
-## __global_pointer$ = .sdata+0x800 = 0x3800
-# SEC: [ 7] .sdata PROGBITS {{0*}}00003000
-# SYM: {{0*}}00003800 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
+## __global_pointer$ = .sdata+0x800 = 0x39b8
+# SEC32: [ 7] .sdata PROGBITS {{0*}}000031b8
+# SYM32: {{0*}}000039b8 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
+
+# SEC64: [ 7] .sdata PROGBITS {{0*}}000032d0
+# SYM64: {{0*}}00003ad0 0 NOTYPE GLOBAL DEFAULT 7 __global_pointer$
## __global_pointer$ - 0x1000 = 4096*3-2048
# DIS: 1000: auipc gp, 3
Modified: lld/trunk/test/ELF/riscv-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-plt.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-plt.s (original)
+++ lld/trunk/test/ELF/riscv-plt.s Wed Aug 28 05:06:06 2019
@@ -2,18 +2,18 @@
# RUN: echo '.globl bar, weak; .type bar, at function; .type weak, at function; bar: weak:' > %t1.s
# RUN: llvm-mc -filetype=obj -triple=riscv32 %t1.s -o %t1.32.o
-# RUN: ld.lld -shared %t1.32.o -o %t1.32.so
+# RUN: ld.lld -shared %t1.32.o -soname=t1.32.so -o %t1.32.so
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o
-# RUN: ld.lld %t.32.o %t1.32.so -o %t.32
+# RUN: ld.lld %t.32.o %t1.32.so -z separate-code -o %t.32
# RUN: llvm-readelf -S -s %t.32 | FileCheck --check-prefixes=SEC,NM %s
# RUN: llvm-readobj -r %t.32 | FileCheck --check-prefix=RELOC32 %s
# RUN: llvm-readelf -x .got.plt %t.32 | FileCheck --check-prefix=GOTPLT32 %s
# RUN: llvm-objdump -d --no-show-raw-insn %t.32 | FileCheck --check-prefixes=DIS,DIS32 %s
# RUN: llvm-mc -filetype=obj -triple=riscv64 %t1.s -o %t1.64.o
-# RUN: ld.lld -shared %t1.64.o -o %t1.64.so
+# RUN: ld.lld -shared %t1.64.o -soname=t1.64.so -o %t1.64.so
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o
-# RUN: ld.lld %t.64.o %t1.64.so -o %t.64
+# RUN: ld.lld %t.64.o %t1.64.so -z separate-code -o %t.64
# RUN: llvm-readelf -S -s %t.64 | FileCheck --check-prefixes=SEC,NM %s
# RUN: llvm-readobj -r %t.64 | FileCheck --check-prefix=RELOC64 %s
# RUN: llvm-readelf -x .got.plt %t.64 | FileCheck --check-prefix=GOTPLT64 %s
@@ -29,34 +29,34 @@
## The .got.plt slots relocated by .rela.plt point to .plt
## This is required by glibc.
# RELOC32: .rela.plt {
-# RELOC32-NEXT: 0x13008 R_RISCV_JUMP_SLOT bar 0x0
-# RELOC32-NEXT: 0x1300C R_RISCV_JUMP_SLOT weak 0x0
+# RELOC32-NEXT: 0x13070 R_RISCV_JUMP_SLOT bar 0x0
+# RELOC32-NEXT: 0x13074 R_RISCV_JUMP_SLOT weak 0x0
# RELOC32-NEXT: }
# GOTPLT32: section '.got.plt'
-# GOTPLT32-NEXT: 0x00013000 00000000 00000000 30100100 30100100
+# GOTPLT32-NEXT: 0x00013068 00000000 00000000 30100100 30100100
# RELOC64: .rela.plt {
-# RELOC64-NEXT: 0x13010 R_RISCV_JUMP_SLOT bar 0x0
-# RELOC64-NEXT: 0x13018 R_RISCV_JUMP_SLOT weak 0x0
+# RELOC64-NEXT: 0x130E0 R_RISCV_JUMP_SLOT bar 0x0
+# RELOC64-NEXT: 0x130E8 R_RISCV_JUMP_SLOT weak 0x0
# RELOC64-NEXT: }
# GOTPLT64: section '.got.plt'
-# GOTPLT64-NEXT: 0x00013000 00000000 00000000 00000000 00000000
-# GOTPLT64-NEXT: 0x00013010 30100100 00000000 30100100 00000000
+# GOTPLT64-NEXT: 0x000130d0 00000000 00000000 00000000 00000000
+# GOTPLT64-NEXT: 0x000130e0 30100100 00000000 30100100 00000000
# DIS: _start:
## Direct call
## foo - . = 0x11020-0x11000 = 32
-# DIS-NEXT: auipc ra, 0
-# DIS-NEXT: 11004: jalr 32(ra)
-## bar at plt - . = 0x11050-0x1100c = 72
-# DIS-NEXT: auipc ra, 0
-# DIS-NEXT: 1100c: jalr 72(ra)
-## bar at plt - . = 0x11050-0x11014 = 64
-# DIS-NEXT: auipc ra, 0
-# DIS-NEXT: 11014: jalr 64(ra)
-## weak at plt - . = 0x11060-0x1101c = 72
-# DIS-NEXT: auipc ra, 0
-# DIS-NEXT: 1101c: jalr 72(ra)
+# DIS-NEXT: 11000: auipc ra, 0
+# DIS-NEXT: jalr 32(ra)
+## bar at plt - . = 0x11050-0x11008 = 72
+# DIS-NEXT: 11008: auipc ra, 0
+# DIS-NEXT: jalr 72(ra)
+## bar at plt - . = 0x11050-0x11010 = 64
+# DIS-NEXT: 11010: auipc ra, 0
+# DIS-NEXT: jalr 64(ra)
+## weak at plt - . = 0x11060-0x11018 = 72
+# DIS-NEXT: 11018: auipc ra, 0
+# DIS-NEXT: jalr 72(ra)
# DIS: foo:
# DIS-NEXT: 11020:
@@ -64,28 +64,29 @@
# DIS: .plt:
# DIS-NEXT: auipc t2, 2
# DIS-NEXT: sub t1, t1, t3
-## .got.plt - .plt = 0x13000 - 0x11030 = 4096*2-48
-# DIS32-NEXT: lw t3, -48(t2)
-# DIS64-NEXT: ld t3, -48(t2)
+## .got.plt - .plt = 0x13068 - 0x11030 = 4096*2+56
+# DIS32-NEXT: lw t3, 56(t2)
+# DIS64-NEXT: ld t3, 160(t2)
# DIS-NEXT: addi t1, t1, -44
-# DIS-NEXT: addi t0, t2, -48
+# DIS32-NEXT: addi t0, t2, 56
+# DIS64-NEXT: addi t0, t2, 160
# DIS32-NEXT: srli t1, t1, 2
# DIS64-NEXT: srli t1, t1, 1
# DIS32-NEXT: lw t0, 4(t0)
# DIS64-NEXT: ld t0, 8(t0)
# DIS-NEXT: jr t3
-## 32-bit: &.got.plt[bar]-. = 0x13008-0x11050 = 4096*2-72
+## 32-bit: &.got.plt[bar]-. = 0x13070-0x11050 = 4096*2+32
# DIS: 11050: auipc t3, 2
-# DIS32-NEXT: lw t3, -72(t3)
-# DIS64-NEXT: ld t3, -64(t3)
+# DIS32-NEXT: lw t3, 32(t3)
+# DIS64-NEXT: ld t3, 144(t3)
# DIS-NEXT: jalr t1, t3
# DIS-NEXT: nop
-## 32-bit: &.got.plt[weak]-. = 0x1300c-0x11060 = 4096*2-84
+## 32-bit: &.got.plt[weak]-. = 0x13074-0x11060 = 4096*2+20
# DIS: 11060: auipc t3, 2
-# DIS32-NEXT: lw t3, -84(t3)
-# DIS64-NEXT: ld t3, -72(t3)
+# DIS32-NEXT: lw t3, 20(t3)
+# DIS64-NEXT: ld t3, 136(t3)
# DIS-NEXT: jalr t1, t3
# DIS-NEXT: nop
Modified: lld/trunk/test/ELF/riscv-reloc-copy.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-reloc-copy.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-reloc-copy.s (original)
+++ lld/trunk/test/ELF/riscv-reloc-copy.s Wed Aug 28 05:06:06 2019
@@ -1,23 +1,24 @@
# REQUIRES: riscv
# RUN: llvm-mc -filetype=obj -triple=riscv32 %p/Inputs/relocation-copy.s -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t1.so
+# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.o
# RUN: ld.lld %t.o %t1.so -o %t
-# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
+# RUN: llvm-readobj -r %t | FileCheck --check-prefixes=REL,REL32 %s
# RUN: llvm-nm -S %t | FileCheck --check-prefix=NM32 %s
# RUN: llvm-mc -filetype=obj -triple=riscv64 %p/Inputs/relocation-copy.s -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t1.so
+# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
# RUN: ld.lld %t.o %t1.so -o %t
-# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
+# RUN: llvm-readobj -r %t | FileCheck --check-prefixes=REL,REL64 %s
# RUN: llvm-nm -S %t | FileCheck --check-prefix=NM64 %s
-# RELOC: .rela.dyn {
-# RELOC-NEXT: 0x13000 R_RISCV_COPY x 0x0
-# RELOC-NEXT: }
+# REL: .rela.dyn {
+# REL32-NEXT: 0x13210 R_RISCV_COPY x 0x0
+# REL64-NEXT: 0x13360 R_RISCV_COPY x 0x0
+# REL-NEXT: }
-# NM32: 00013000 00000004 B x
-# NM64: 0000000000013000 0000000000000004 B x
+# NM32: 00013210 00000004 B x
+# NM64: 0000000000013360 0000000000000004 B x
la a0, x
Modified: lld/trunk/test/ELF/riscv-reloc-got.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-reloc-got.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-reloc-got.s (original)
+++ lld/trunk/test/ELF/riscv-reloc-got.s Wed Aug 28 05:06:06 2019
@@ -1,59 +1,63 @@
# REQUIRES: riscv
# RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=riscv32 - -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t1.so
+# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
# RUN: llvm-mc -filetype=obj -triple=riscv32 -position-independent %s -o %t.o
# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC32 %s
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC32 %s
-# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM32 %s
# RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX32 %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DIS32 %s
# RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=riscv64 - -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t1.so
+# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
# RUN: llvm-mc -filetype=obj -triple=riscv64 -position-independent %s -o %t.o
# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC64 %s
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC64 %s
-# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM64 %s
# RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX64 %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DIS64 %s
-# SEC: .got PROGBITS 00012060 020060 00000c
+# SEC32: .got PROGBITS 0001220c 00020c 00000c
+# SEC64: .got PROGBITS 0000000000012358 000358 000018
# RELOC32: .rela.dyn {
-# RELOC32-NEXT: 0x12068 R_RISCV_32 b 0x0
+# RELOC32-NEXT: 0x12214 R_RISCV_32 b 0x0
# RELOC32-NEXT: }
# RELOC64: .rela.dyn {
-# RELOC64-NEXT: 0x120D0 R_RISCV_64 b 0x0
+# RELOC64-NEXT: 0x12368 R_RISCV_64 b 0x0
# RELOC64-NEXT: }
-# NM: 00013000 d a
+# NM32: 00013218 d a
+# NM64: 0000000000013370 d a
## .got[0] = _DYNAMIC
## .got[1] = a (filled at link time)
## .got[2] = 0 (relocated by R_RISCV_64 at runtime)
# HEX32: section '.got':
-# HEX32: 0x00012060 00200100 00300100 00000000
+# HEX32: 0x0001220c ac210100 18320100 00000000
# HEX64: section '.got':
-# HEX64: 0x000120c0 00200100 00000000 00300100 00000000
-# HEX64: 0x000120d0 00000000 00000000
+# HEX64: 0x00012358 98220100 00000000 70330100 00000000
+# HEX64: 0x00012368 00000000 00000000
-## &.got[1]-. = 0x12060-0x11000 = 4096*1+100
-# DIS32: 11000: auipc a0, 1
-# DIS32-NEXT: lw a0, 100(a0)
-## &.got[2]-. = 0x12064-0x11008 = 4096*1+96
-# DIS32: 11008: auipc a0, 1
-# DIS32-NEXT: lw a0, 96(a0)
-
-## &.got[1]-. = 0x120c8-0x11000 = 4096*1+100
-# DIS64: 11000: auipc a0, 1
-# DIS64-NEXT: ld a0, 200(a0)
-## &.got[2]-. = 0x120d0-0x11008 = 4096*1+200
-# DIS64: 11008: auipc a0, 1
-# DIS64-NEXT: ld a0, 200(a0)
+## &.got[1]-. = 0x12210-0x1119c = 4096*1+116
+# DIS32: 1119c: auipc a0, 1
+# DIS32-NEXT: lw a0, 116(a0)
+## &.got[2]-. = 0x12214-0x111a4 = 4096*1+112
+# DIS32: 111a4: auipc a0, 1
+# DIS32-NEXT: lw a0, 112(a0)
+
+## &.got[1]-. = 0x12360-0x11288 = 4096*1+216
+# DIS64: 11288: auipc a0, 1
+# DIS64-NEXT: ld a0, 216(a0)
+## &.got[2]-. = 0x12368-0x11290 = 4096*1+216
+# DIS64: 11290: auipc a0, 1
+# DIS64-NEXT: ld a0, 216(a0)
la a0,a
la a0,b
Modified: lld/trunk/test/ELF/riscv-tls-gd.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-tls-gd.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-tls-gd.s (original)
+++ lld/trunk/test/ELF/riscv-tls-gd.s Wed Aug 28 05:06:06 2019
@@ -46,42 +46,42 @@
# RUN: llvm-readelf -x .got %t.64 | FileCheck --check-prefix=IE64-GOT %s
# GD32-REL: .rela.dyn {
-# GD32-REL-NEXT: 0x2070 R_RISCV_TLS_DTPMOD32 a 0x0
-# GD32-REL-NEXT: 0x2074 R_RISCV_TLS_DTPREL32 a 0x0
-# GD32-REL-NEXT: 0x2078 R_RISCV_TLS_DTPMOD32 b 0x0
-# GD32-REL-NEXT: 0x207C R_RISCV_TLS_DTPREL32 b 0x0
+# GD32-REL-NEXT: 0x2310 R_RISCV_TLS_DTPMOD32 a 0x0
+# GD32-REL-NEXT: 0x2314 R_RISCV_TLS_DTPREL32 a 0x0
+# GD32-REL-NEXT: 0x2318 R_RISCV_TLS_DTPMOD32 b 0x0
+# GD32-REL-NEXT: 0x231C R_RISCV_TLS_DTPREL32 b 0x0
# GD32-REL-NEXT: }
-## &DTPMOD(a) - . = 0x2070 - 0x1000 = 4096*1+112
-# GD32: 1000: auipc a0, 1
-# GD32-NEXT: addi a0, a0, 112
+## &DTPMOD(a) - . = 0x2310 - 0x1250 = 4096*1+192
+# GD32: 1250: auipc a0, 1
+# GD32-NEXT: addi a0, a0, 192
# GD32-NEXT: auipc ra, 0
# GD32-NEXT: jalr 56(ra)
-## &DTPMOD(b) - . = 0x2078 - 0x1010 = 4096*1+104
-# GD32: 1010: auipc a0, 1
-# GD32-NEXT: addi a0, a0, 104
+## &DTPMOD(b) - . = 0x2318 - 0x1260 = 4096*1+184
+# GD32: 1260: auipc a0, 1
+# GD32-NEXT: addi a0, a0, 184
# GD32-NEXT: auipc ra, 0
# GD32-NEXT: jalr 40(ra)
# GD64-REL: .rela.dyn {
-# GD64-REL-NEXT: 0x20E0 R_RISCV_TLS_DTPMOD64 a 0x0
-# GD64-REL-NEXT: 0x20E8 R_RISCV_TLS_DTPREL64 a 0x0
-# GD64-REL-NEXT: 0x20F0 R_RISCV_TLS_DTPMOD64 b 0x0
-# GD64-REL-NEXT: 0x20F8 R_RISCV_TLS_DTPREL64 b 0x0
+# GD64-REL-NEXT: 0x24D0 R_RISCV_TLS_DTPMOD64 a 0x0
+# GD64-REL-NEXT: 0x24D8 R_RISCV_TLS_DTPREL64 a 0x0
+# GD64-REL-NEXT: 0x24E0 R_RISCV_TLS_DTPMOD64 b 0x0
+# GD64-REL-NEXT: 0x24E8 R_RISCV_TLS_DTPREL64 b 0x0
# GD64-REL-NEXT: }
-## &DTPMOD(a) - . = 0x20e0 - 0x1000 = 4096*1+224
-# GD64: 1000: auipc a0, 1
-# GD64-NEXT: addi a0, a0, 224
+## &DTPMOD(a) - . = 0x24d0 - 0x1398 = 4096*1+312
+# GD64: 1398: auipc a0, 1
+# GD64-NEXT: addi a0, a0, 312
# GD64-NEXT: auipc ra, 0
-# GD64-NEXT: jalr 56(ra)
+# GD64-NEXT: jalr 64(ra)
-## &DTPMOD(b) - . = 0x20f0 - 0x1010 = 4096*1+224
-# GD64: 1010: auipc a0, 1
-# GD64-NEXT: addi a0, a0, 224
+## &DTPMOD(b) - . = 0x24e0 - 0x13a8 = 4096*1+312
+# GD64: 13a8: auipc a0, 1
+# GD64-NEXT: addi a0, a0, 312
# GD64-NEXT: auipc ra, 0
-# GD64-NEXT: jalr 40(ra)
+# GD64-NEXT: jalr 48(ra)
# NOREL: no relocations
@@ -97,19 +97,19 @@
## a is local - relaxed to LE - its DTPMOD/DTPREL slots are link-time constants.
## b is external - DTPMOD/DTPREL dynamic relocations are required.
# IE32-REL: .rela.dyn {
-# IE32-REL-NEXT: 0x12068 R_RISCV_TLS_DTPMOD32 b 0x0
-# IE32-REL-NEXT: 0x1206C R_RISCV_TLS_DTPREL32 b 0x0
+# IE32-REL-NEXT: 0x12230 R_RISCV_TLS_DTPMOD32 b 0x0
+# IE32-REL-NEXT: 0x12234 R_RISCV_TLS_DTPREL32 b 0x0
# IE32-REL-NEXT: }
# IE32-GOT: section '.got':
-# IE32-GOT-NEXT: 0x00012060 01000000 08f8ffff 00000000 00000000
+# IE32-GOT-NEXT: 0x00012228 01000000 08f8ffff 00000000 00000000
# IE64-REL: .rela.dyn {
-# IE64-REL-NEXT: 0x120D0 R_RISCV_TLS_DTPMOD64 b 0x0
-# IE64-REL-NEXT: 0x120D8 R_RISCV_TLS_DTPREL64 b 0x0
+# IE64-REL-NEXT: 0x12390 R_RISCV_TLS_DTPMOD64 b 0x0
+# IE64-REL-NEXT: 0x12398 R_RISCV_TLS_DTPREL64 b 0x0
# IE64-REL-NEXT: }
# IE64-GOT: section '.got':
-# IE64-GOT-NEXT: 0x000120c0 01000000 00000000 08f8ffff ffffffff
-# IE64-GOT-NEXT: 0x000120d0 00000000 00000000 00000000 00000000
+# IE64-GOT-NEXT: 0x00012380 01000000 00000000 08f8ffff ffffffff
+# IE64-GOT-NEXT: 0x00012390 00000000 00000000 00000000 00000000
la.tls.gd a0,a
call __tls_get_addr at plt
Modified: lld/trunk/test/ELF/riscv-tls-ie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-tls-ie.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-tls-ie.s (original)
+++ lld/trunk/test/ELF/riscv-tls-ie.s Wed Aug 28 05:06:06 2019
@@ -23,28 +23,28 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t.64 | FileCheck --check-prefixes=LE,LE64 %s
# IE32-REL: .rela.dyn {
-# IE32-REL-NEXT: 0x205C R_RISCV_TLS_TPREL32 - 0xC
-# IE32-REL-NEXT: 0x2058 R_RISCV_TLS_TPREL32 a 0x0
+# IE32-REL-NEXT: 0x2218 R_RISCV_TLS_TPREL32 - 0xC
+# IE32-REL-NEXT: 0x2214 R_RISCV_TLS_TPREL32 a 0x0
# IE32-REL-NEXT: }
# IE32-REL: FLAGS STATIC_TLS
# IE64-REL: .rela.dyn {
-# IE64-REL-NEXT: 0x20B8 R_RISCV_TLS_TPREL64 - 0xC
-# IE64-REL-NEXT: 0x20B0 R_RISCV_TLS_TPREL64 a 0x0
+# IE64-REL-NEXT: 0x2370 R_RISCV_TLS_TPREL64 - 0xC
+# IE64-REL-NEXT: 0x2368 R_RISCV_TLS_TPREL64 a 0x0
# IE64-REL-NEXT: }
# IE64-REL: FLAGS STATIC_TLS
-## rv32: &.got[1] - . = 0x2058 - . = 4096*1+88
-## rv64: &.got[1] - . = 0x20B0 - . = 4096*1+176
-# IE: 1000: auipc a4, 1
-# IE32-NEXT: lw a4, 88(a4)
-# IE64-NEXT: ld a4, 176(a4)
+## rv32: &.got[0] - . = 0x2214 - . = 4096*1+112
+## rv64: &.got[0] - . = 0x2368 - . = 4096*1+200
+# IE: auipc a4, 1
+# IE32-NEXT: lw a4, 112(a4)
+# IE64-NEXT: ld a4, 200(a4)
# IE-NEXT: add a4, a4, tp
-## rv32: &.got[0] - . = 0x205C - . = 4096*1+80
-## rv64: &.got[0] - . = 0x20B8 - . = 4096*1+172
-# IE: 100c: auipc a5, 1
-# IE32-NEXT: lw a5, 80(a5)
-# IE64-NEXT: ld a5, 172(a5)
+## rv32: &.got[1] - . = 0x2218 - . = 4096*1+104
+## rv64: &.got[1] - . = 0x2370 - . = 4096*1+196
+# IE: auipc a5, 1
+# IE32-NEXT: lw a5, 104(a5)
+# IE64-NEXT: ld a5, 196(a5)
# IE-NEXT: add a5, a5, tp
# NOREL: no relocations
@@ -52,21 +52,23 @@
# a at tprel = st_value(a) = 0x8
# b at tprel = st_value(a) = 0xc
# LE32-GOT: section '.got':
-# LE32-GOT-NEXT: 0x00012000 08000000 0c000000
+# LE32-GOT-NEXT: 0x0001212c 08000000 0c000000
# LE64-GOT: section '.got':
-# LE64-GOT-NEXT: 0x00012000 08000000 00000000 0c000000 00000000
+# LE64-GOT-NEXT: 0x000121e0 08000000 00000000 0c000000 00000000
-## rv32: &.got[0] - . = 0x12000 - 0x11000 = 4096*1+0
-## rv64: &.got[0] - . = 0x12000 - 0x11000 = 4096*1+0
-# LE: 11000: auipc a4, 1
-# LE32-NEXT: lw a4, 0(a4)
-# LE64-NEXT: ld a4, 0(a4)
+## rv32: &.got[0] - . = 0x1212c - 0x11114 = 4096*1+24
+## rv64: &.got[0] - . = 0x121e0 - 0x111c8 = 4096*1+24
+# LE32: 11114: auipc a4, 1
+# LE32-NEXT: lw a4, 24(a4)
+# LE64: 111c8: auipc a4, 1
+# LE64-NEXT: ld a4, 24(a4)
# LE-NEXT: add a4, a4, tp
-## rv32: &.got[1] - . = 0x12004 - 0x1100c = 4096*1-8
-## rv64: &.got[1] - . = 0x12008 - 0x1100c = 4096*1-4
-# LE: 1100c: auipc a5, 1
-# LE32-NEXT: lw a5, -8(a5)
-# LE64-NEXT: ld a5, -4(a5)
+## rv32: &.got[1] - . = 0x12130 - 0x11120 = 4096*1+16
+## rv64: &.got[1] - . = 0x121e8 - 0x111d4 = 4096*1+20
+# LE32: 11120: auipc a5, 1
+# LE32-NEXT: lw a5, 16(a5)
+# LE64: 111d4: auipc a5, 1
+# LE64-NEXT: ld a5, 20(a5)
# LE-NEXT: add a5, a5, tp
la.tls.ie a4,a
Modified: lld/trunk/test/ELF/riscv-tls-ld.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv-tls-ld.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv-tls-ld.s (original)
+++ lld/trunk/test/ELF/riscv-tls-ld.s Wed Aug 28 05:06:06 2019
@@ -35,44 +35,46 @@
## a at dtprel = st_value(a)-0x800 = 0xfffff808 is a link-time constant.
# LD32-REL: .rela.dyn {
-# LD32-REL-NEXT: 0x2084
-# LD32-REL-NEXT: 0x207C R_RISCV_TLS_DTPMOD32 - 0x0
+# LD32-REL-NEXT: 0x22B4
+# LD32-REL-NEXT: 0x22AC R_RISCV_TLS_DTPMOD32 - 0x0
# LD32-REL-NEXT: }
# LD32-GOT: section '.got':
-# LD32-GOT-NEXT: 0x00002078 00200000 00000000 00f8ffff 00000000
+# LD32-GOT-NEXT: 0x000022a8 30220000 00000000 00f8ffff 00000000
# LD64-REL: .rela.dyn {
-# LD64-REL-NEXT: 0x2108
-# LD64-REL-NEXT: 0x20F8 R_RISCV_TLS_DTPMOD64 - 0x0
+# LD64-REL-NEXT: 0x2458
+# LD64-REL-NEXT: 0x2448 R_RISCV_TLS_DTPMOD64 - 0x0
# LD64-REL-NEXT: }
# LD64-GOT: section '.got':
-# LD64-GOT-NEXT: 0x000020f0 00200000 00000000 00000000 00000000
-# LD64-GOT-NEXT: 0x00002100 00f8ffff ffffffff 00000000 00000000
+# LD64-GOT-NEXT: 0x00002440 50230000 00000000 00000000 00000000
+# LD64-GOT-NEXT: 0x00002450 00f8ffff ffffffff 00000000 00000000
-## rv32: &DTPMOD(a) - . = 0x207c - 0x1000 = 4096*1+124
-## rv64: &DTPMOD(a) - . = 0x20e0 - 0x1000 = 4096*1+248
-# LD: 1000: auipc a0, 1
-# LD32-NEXT: addi a0, a0, 124
-# LD64-NEXT: addi a0, a0, 248
+## rv32: &DTPMOD(a) - . = 0x22ac - 0x11d8 = 4096*1+212
+## rv64: &DTPMOD(a) - . = 0x2448 - 0x12f8 = 4096*1+336
+# LD32: 11d8: auipc a0, 1
+# LD32-NEXT: addi a0, a0, 212
+# LD64: 12f8: auipc a0, 1
+# LD64-NEXT: addi a0, a0, 336
# LD-NEXT: auipc ra, 0
-# LD-NEXT: jalr 56(ra)
+# LD-NEXT: jalr 64(ra)
# NOREL: no relocations
## a is local - its DTPMOD/DTPREL slots are link-time constants.
## a at dtpmod = 1 (main module)
# LE32-GOT: section '.got':
-# LE32-GOT-NEXT: 0x00012000 00000000 01000000 00f8ffff 00200100
+# LE32-GOT-NEXT: 0x00012134 00000000 01000000 00f8ffff 34210100
# LE64-GOT: section '.got':
-# LE64-GOT-NEXT: 0x00012000 00000000 00000000 01000000 00000000
-# LE64-GOT-NEXT: 0x00012010 00f8ffff ffffffff 00200100 00000000
+# LE64-GOT-NEXT: 0x000121e8 00000000 00000000 01000000 00000000
+# LE64-GOT-NEXT: 0x000121f8 00f8ffff ffffffff e8210100 00000000
-## rv32: DTPMOD(.LANCHOR0) - . = 0x12004 - 0x11000 = 4096*1+4
-## rv64: DTPMOD(.LANCHOR0) - . = 0x12008 - 0x11000 = 4096*1+8
-# LE: 11000: auipc a0, 1
-# LE32-NEXT: addi a0, a0, 4
-# LE64-NEXT: addi a0, a0, 8
+## rv32: DTPMOD(.LANCHOR0) - . = 0x12138 - 0x11114 = 4096*1+36
+## rv64: DTPMOD(.LANCHOR0) - . = 0x121f0 - 0x111c8 = 4096*1+40
+# LE32: 11114: auipc a0, 1
+# LE32-NEXT: addi a0, a0, 36
+# LE64: 111c8: auipc a0, 1
+# LE64-NEXT: addi a0, a0, 40
# LE-NEXT: auipc ra, 0
# LE-NEXT: jalr 24(ra)
Modified: lld/trunk/test/ELF/riscv32-reloc-32-pic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv32-reloc-32-pic.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv32-reloc-32-pic.s (original)
+++ lld/trunk/test/ELF/riscv32-reloc-32-pic.s Wed Aug 28 05:06:06 2019
@@ -7,11 +7,11 @@
## R_RISCV_32 is an absolute relocation type.
## In PIC mode, it creates a relative relocation if the symbol is non-preemptable.
-# NM: 00002004 d b
+# NM: 000031fc d b
# RELOC: .rela.dyn {
-# RELOC-NEXT: 0x2004 R_RISCV_RELATIVE - 0x2004
-# RELOC-NEXT: 0x2000 R_RISCV_32 a 0
+# RELOC-NEXT: 0x31FC R_RISCV_RELATIVE - 0x31FC
+# RELOC-NEXT: 0x31F8 R_RISCV_32 a 0
# RELOC-NEXT: }
.globl a, b
Modified: lld/trunk/test/ELF/riscv64-reloc-64-pic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/riscv64-reloc-64-pic.s?rev=370192&r1=370191&r2=370192&view=diff
==============================================================================
--- lld/trunk/test/ELF/riscv64-reloc-64-pic.s (original)
+++ lld/trunk/test/ELF/riscv64-reloc-64-pic.s Wed Aug 28 05:06:06 2019
@@ -7,11 +7,11 @@
## R_RISCV_64 is an absolute relocation type.
## In PIC mode, it creates a relative relocation if the symbol is non-preemptable.
-# NM: 0000000000002008 d b
+# NM: 0000000000003350 d b
# RELOC: .rela.dyn {
-# RELOC-NEXT: 0x2008 R_RISCV_RELATIVE - 0x2008
-# RELOC-NEXT: 0x2000 R_RISCV_64 a 0
+# RELOC-NEXT: 0x3350 R_RISCV_RELATIVE - 0x3350
+# RELOC-NEXT: 0x3348 R_RISCV_64 a 0
# RELOC-NEXT: }
.globl a, b
More information about the llvm-commits
mailing list