[lld] r268542 - Don't depend on dynamic relocatinos in ro sections.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 13:25:20 PDT 2016
Author: rafael
Date: Wed May 4 15:25:19 2016
New Revision: 268542
URL: http://llvm.org/viewvc/llvm-project?rev=268542&view=rev
Log:
Don't depend on dynamic relocatinos in ro sections.
Currently we don't check when creating relative relocations if the
section is read only or not. I am about to fix that, so first update the
patches that depend on the current behavior.
Modified:
lld/trunk/test/ELF/i386-merge.s
lld/trunk/test/ELF/i386-relative.s
lld/trunk/test/ELF/i386-tls-ie-shared.s
lld/trunk/test/ELF/merge-shared-str.s
lld/trunk/test/ELF/merge-shared.s
lld/trunk/test/ELF/merge-string-error.s
lld/trunk/test/ELF/relative-dynamic-reloc-pie.s
lld/trunk/test/ELF/relative-dynamic-reloc-ppc64.s
lld/trunk/test/ELF/relative-dynamic-reloc.s
lld/trunk/test/ELF/relocation-past-merge-end.s
lld/trunk/test/ELF/section-symbol.s
lld/trunk/test/ELF/startstop-shared.s
lld/trunk/test/ELF/startstop.s
Modified: lld/trunk/test/ELF/i386-merge.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-merge.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/i386-merge.s (original)
+++ lld/trunk/test/ELF/i386-merge.s Wed May 4 15:25:19 2016
@@ -21,26 +21,27 @@
// CHECK-NEXT: )
-// CHECK: Name: .text
+// CHECK: Name: .data
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_EXECINSTR
+// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x1000
-// CHECK-NEXT: Offset: 0x1000
+// CHECK-NEXT: Address: 0x2000
+// CHECK-NEXT: Offset: 0x2000
// CHECK-NEXT: Size: 4
// CHECK-NEXT: Link: 0
// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: 4
+// CHECK-NEXT: AddressAlignment: 1
// CHECK-NEXT: EntrySize: 0
// CHECK-NEXT: SectionData (
// CHECK-NEXT: 0000: 14010000 |
// CHECK-NEXT: )
-// The content of .text should be the address of .mysec. 14010000 is 0x114 in
+// The content of .data should be the address of .mysec. 14010000 is 0x114 in
// little endian.
+ .data
.long .mysec+4
.section .mysec,"aM", at progbits,4
Modified: lld/trunk/test/ELF/i386-relative.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-relative.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/i386-relative.s (original)
+++ lld/trunk/test/ELF/i386-relative.s Wed May 4 15:25:19 2016
@@ -9,5 +9,6 @@
// CHECK-NEXT: }
// CHECK-NEXT: ]
+ .data
foo:
.long foo
Modified: lld/trunk/test/ELF/i386-tls-ie-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-tls-ie-shared.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/i386-tls-ie-shared.s (original)
+++ lld/trunk/test/ELF/i386-tls-ie-shared.s Wed May 4 15:25:19 2016
@@ -13,8 +13,8 @@
// GOTRELSHARED-NEXT: SHF_ALLOC
// GOTRELSHARED-NEXT: SHF_WRITE
// GOTRELSHARED-NEXT: ]
-// GOTRELSHARED-NEXT: Address: 0x2050
-// GOTRELSHARED-NEXT: Offset: 0x2050
+// GOTRELSHARED-NEXT: Address: 0x1050
+// GOTRELSHARED-NEXT: Offset: 0x1050
// GOTRELSHARED-NEXT: Size: 16
// GOTRELSHARED-NEXT: Link: 0
// GOTRELSHARED-NEXT: Info: 0
@@ -23,43 +23,43 @@
// GOTRELSHARED-NEXT: }
// GOTRELSHARED: Relocations [
// GOTRELSHARED-NEXT: Section ({{.*}}) .rel.dyn {
-// GOTRELSHARED-NEXT: 0x1002 R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x2050 R_386_TLS_TPOFF tlslocal0 0x0
-// GOTRELSHARED-NEXT: 0x100A R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x1013 R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x101C R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x2054 R_386_TLS_TPOFF tlslocal1 0x0
-// GOTRELSHARED-NEXT: 0x1024 R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x102D R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x1036 R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x2058 R_386_TLS_TPOFF tlsshared0 0x0
-// GOTRELSHARED-NEXT: 0x103F R_386_RELATIVE - 0x0
-// GOTRELSHARED-NEXT: 0x205C R_386_TLS_TPOFF tlsshared1 0x0
+// GOTRELSHARED-NEXT: 0x2002 R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x1050 R_386_TLS_TPOFF tlslocal0 0x0
+// GOTRELSHARED-NEXT: 0x200A R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x2013 R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x201C R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x1054 R_386_TLS_TPOFF tlslocal1 0x0
+// GOTRELSHARED-NEXT: 0x2024 R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x202D R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x2036 R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x1058 R_386_TLS_TPOFF tlsshared0 0x0
+// GOTRELSHARED-NEXT: 0x203F R_386_RELATIVE - 0x0
+// GOTRELSHARED-NEXT: 0x105C R_386_TLS_TPOFF tlsshared1 0x0
// GOTRELSHARED-NEXT: }
// GOTRELSHARED-NEXT: ]
-// DISASMSHARED: Disassembly of section .text:
+// DISASMSHARED: Disassembly of section test:
// DISASMSHARED-NEXT: _start:
// (.got)[0] = 0x2050 = 8272
// (.got)[1] = 0x2054 = 8276
// (.got)[2] = 0x2058 = 8280
// (.got)[3] = 0x205C = 8284
-// DISASMSHARED-NEXT: 1000: 8b 0d 50 20 00 00 movl 8272, %ecx
-// DISASMSHARED-NEXT: 1006: 65 8b 01 movl %gs:(%ecx), %eax
-// DISASMSHARED-NEXT: 1009: a1 50 20 00 00 movl 8272, %eax
-// DISASMSHARED-NEXT: 100e: 65 8b 00 movl %gs:(%eax), %eax
-// DISASMSHARED-NEXT: 1011: 03 0d 50 20 00 00 addl 8272, %ecx
-// DISASMSHARED-NEXT: 1017: 65 8b 01 movl %gs:(%ecx), %eax
-// DISASMSHARED-NEXT: 101a: 8b 0d 54 20 00 00 movl 8276, %ecx
-// DISASMSHARED-NEXT: 1020: 65 8b 01 movl %gs:(%ecx), %eax
-// DISASMSHARED-NEXT: 1023: a1 54 20 00 00 movl 8276, %eax
-// DISASMSHARED-NEXT: 1028: 65 8b 00 movl %gs:(%eax), %eax
-// DISASMSHARED-NEXT: 102b: 03 0d 54 20 00 00 addl 8276, %ecx
-// DISASMSHARED-NEXT: 1031: 65 8b 01 movl %gs:(%ecx), %eax
-// DISASMSHARED-NEXT: 1034: 8b 0d 58 20 00 00 movl 8280, %ecx
-// DISASMSHARED-NEXT: 103a: 65 8b 01 movl %gs:(%ecx), %eax
-// DISASMSHARED-NEXT: 103d: 03 0d 5c 20 00 00 addl 8284, %ecx
-// DISASMSHARED-NEXT: 1043: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 2000: 8b 0d 50 10 00 00 movl 4176, %ecx
+// DISASMSHARED-NEXT: 2006: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 2009: a1 50 10 00 00 movl 4176, %eax
+// DISASMSHARED-NEXT: 200e: 65 8b 00 movl %gs:(%eax), %eax
+// DISASMSHARED-NEXT: 2011: 03 0d 50 10 00 00 addl 4176, %ecx
+// DISASMSHARED-NEXT: 2017: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 201a: 8b 0d 54 10 00 00 movl 4180, %ecx
+// DISASMSHARED-NEXT: 2020: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 2023: a1 54 10 00 00 movl 4180, %eax
+// DISASMSHARED-NEXT: 2028: 65 8b 00 movl %gs:(%eax), %eax
+// DISASMSHARED-NEXT: 202b: 03 0d 54 10 00 00 addl 4180, %ecx
+// DISASMSHARED-NEXT: 2031: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 2034: 8b 0d 58 10 00 00 movl 4184, %ecx
+// DISASMSHARED-NEXT: 203a: 65 8b 01 movl %gs:(%ecx), %eax
+// DISASMSHARED-NEXT: 203d: 03 0d 5c 10 00 00 addl 4188, %ecx
+// DISASMSHARED-NEXT: 2043: 65 8b 01 movl %gs:(%ecx), %eax
.type tlslocal0, at object
.section .tbss,"awT", at nobits
@@ -82,7 +82,7 @@ tlslocal1:
.type ___tls_get_addr, at function
___tls_get_addr:
-.section .text
+.section test, "axw"
.globl _start
_start:
movl tlslocal0 at indntpoff,%ecx
Modified: lld/trunk/test/ELF/merge-shared-str.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-shared-str.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-shared-str.s (original)
+++ lld/trunk/test/ELF/merge-shared-str.s Wed May 4 15:25:19 2016
@@ -8,7 +8,7 @@
.asciz "bar"
.asciz "ar"
- .text
+ .data
.quad foo + 4
Modified: lld/trunk/test/ELF/merge-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-shared.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-shared.s (original)
+++ lld/trunk/test/ELF/merge-shared.s Wed May 4 15:25:19 2016
@@ -7,7 +7,7 @@
.long 42
.long 42
- .text
+ .data
.quad foo + 6
Modified: lld/trunk/test/ELF/merge-string-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string-error.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-string-error.s (original)
+++ lld/trunk/test/ELF/merge-string-error.s Wed May 4 15:25:19 2016
@@ -5,7 +5,7 @@
.section .rodata.str1.1,"aMS", at progbits,1
.asciz "abc"
- .text
+ .data
.long .rodata.str1.1 + 4
// CHECK: entry is past the end of the section
Modified: lld/trunk/test/ELF/relative-dynamic-reloc-pie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relative-dynamic-reloc-pie.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/relative-dynamic-reloc-pie.s (original)
+++ lld/trunk/test/ELF/relative-dynamic-reloc-pie.s Wed May 4 15:25:19 2016
@@ -5,9 +5,9 @@
## Test that we create R_X86_64_RELATIVE relocations with -pie.
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-# CHECK-NEXT: 0x1001 R_X86_64_RELATIVE - 0x1001
-# CHECK-NEXT: 0x1009 R_X86_64_RELATIVE - 0x1009
-# CHECK-NEXT: 0x1011 R_X86_64_RELATIVE - 0x100A
+# CHECK-NEXT: 0x3000 R_X86_64_RELATIVE - 0x3000
+# CHECK-NEXT: 0x3008 R_X86_64_RELATIVE - 0x3008
+# CHECK-NEXT: 0x3010 R_X86_64_RELATIVE - 0x3009
# CHECK-NEXT: }
# CHECK-NEXT: ]
@@ -15,6 +15,7 @@
_start:
nop
+ .data
foo:
.quad foo
Modified: lld/trunk/test/ELF/relative-dynamic-reloc-ppc64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relative-dynamic-reloc-ppc64.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/relative-dynamic-reloc-ppc64.s (original)
+++ lld/trunk/test/ELF/relative-dynamic-reloc-ppc64.s Wed May 4 15:25:19 2016
@@ -10,10 +10,10 @@
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_PPC64_RELATIVE - 0x[[FOO_ADDR]]
// CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_PPC64_RELATIVE - 0x[[BAR_ADDR]]
-// CHECK-NEXT: 0x10010 R_PPC64_RELATIVE - 0x10009
+// CHECK-NEXT: 0x20010 R_PPC64_RELATIVE - 0x20009
// CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[ZED_ADDR:.*]]
// CHECK-NEXT: 0x{{.*}} R_PPC64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x30008 R_PPC64_ADDR64 external 0x0
+// CHECK-NEXT: 0x20028 R_PPC64_ADDR64 external 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -47,6 +47,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: ]
+ .data
foo:
.quad foo
Modified: lld/trunk/test/ELF/relative-dynamic-reloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relative-dynamic-reloc.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/relative-dynamic-reloc.s (original)
+++ lld/trunk/test/ELF/relative-dynamic-reloc.s Wed May 4 15:25:19 2016
@@ -9,10 +9,10 @@
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
// CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_X86_64_RELATIVE - 0x[[BAR_ADDR]]
-// CHECK-NEXT: 0x1010 R_X86_64_RELATIVE - 0x1009
+// CHECK-NEXT: 0x2010 R_X86_64_RELATIVE - 0x2009
// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]]
// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x3008 R_X86_64_64 external 0x0
+// CHECK-NEXT: 0x2028 R_X86_64_64 external 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -46,6 +46,7 @@
// CHECK-NEXT: }
// CHECK-NEXT: ]
+ .data
foo:
.quad foo
Modified: lld/trunk/test/ELF/relocation-past-merge-end.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-past-merge-end.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-past-merge-end.s (original)
+++ lld/trunk/test/ELF/relocation-past-merge-end.s Wed May 4 15:25:19 2016
@@ -3,5 +3,6 @@
// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
// CHECK: entry is past the end of the section
+ .data
.long .foo + 1
.section .foo,"aM", at progbits,4
Modified: lld/trunk/test/ELF/section-symbol.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/section-symbol.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/section-symbol.s (original)
+++ lld/trunk/test/ELF/section-symbol.s Wed May 4 15:25:19 2016
@@ -37,4 +37,4 @@
// CHECK-NEXT: ]
foo:
- .quad foo
+ .quad foo - .
Modified: lld/trunk/test/ELF/startstop-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/startstop-shared.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/startstop-shared.s (original)
+++ lld/trunk/test/ELF/startstop-shared.s Wed May 4 15:25:19 2016
@@ -3,8 +3,9 @@
// RUN: ld.lld %t.o -o %t.so -shared
// RUN: llvm-readobj -r -t %t.so | FileCheck %s
+ .data
.quad __start_foo
- .section foo,"a"
+ .section foo,"aw"
// By default the symbol is hidden.
// CHECK: R_X86_64_RELATIVE - 0x[[ADDR1:.*]]
Modified: lld/trunk/test/ELF/startstop.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/startstop.s?rev=268542&r1=268541&r2=268542&view=diff
==============================================================================
--- lld/trunk/test/ELF/startstop.s (original)
+++ lld/trunk/test/ELF/startstop.s Wed May 4 15:25:19 2016
@@ -22,10 +22,10 @@
// SYMBOL: Relocations [
// SYMBOL-NEXT: Section ({{.*}}) .rela.dyn {
-// SYMBOL-NEXT: 0x1015 R_X86_64_RELATIVE - 0x1035
-// SYMBOL-NEXT: 0x101D R_X86_64_RELATIVE - 0x1036
-// SYMBOL-NEXT: 0x1025 R_X86_64_RELATIVE - 0x1025
-// SYMBOL-NEXT: 0x102D R_X86_64_RELATIVE - 0x1026
+// SYMBOL-NEXT: 0x3000 R_X86_64_RELATIVE - 0x3020
+// SYMBOL-NEXT: 0x3008 R_X86_64_RELATIVE - 0x3021
+// SYMBOL-NEXT: 0x3010 R_X86_64_RELATIVE - 0x3010
+// SYMBOL-NEXT: 0x3018 R_X86_64_RELATIVE - 0x3011
// SYMBOL-NEXT: }
// SYMBOL-NEXT: ]
@@ -66,10 +66,10 @@ _start:
nop
nop
-.section zed1, "ax"
+.section zed1, "aw"
.quad __stop_zed2
.quad __stop_zed2 + 1
-.section zed2, "ax"
+.section zed2, "aw"
.quad __stop_zed1
.quad __stop_zed1 + 1
More information about the llvm-commits
mailing list