From db8a58688d83ee315f3bd184276b433b24af59fd Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 17 Apr 2015 20:05:17 +0000 Subject: Compute A-B if both A and B are in the same comdat section. Part of pr23272. A small annoyance with the assembly syntax we implement is that given an expression there is no way to know if what is desired is the value of that expression for the symbols in this file or for the final values of those symbols in a link. The first case is useful for use in sections that get discarded or ignored if the section they are describing is discarded. For axample, consider A-B where A and B are in the same comdat section. We can compute the value of the difference in the section that is present in the current .o and if that section survives to the final DSO the value will still will be correct. But the section is in a comdat. Another section from another object file might be used istead. We know that that section will define A and B, but we have no idea what the value of A-B might be. In practice we have to assume that the intention is to compute the value in the current section since otherwise the is no way to create something like the debug aranges section. llvm-svn: 235222 --- llvm/test/MC/ELF/relocation.s | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'llvm/test') diff --git a/llvm/test/MC/ELF/relocation.s b/llvm/test/MC/ELF/relocation.s index de2b43454ac..cd0cc45fc00 100644 --- a/llvm/test/MC/ELF/relocation.s +++ b/llvm/test/MC/ELF/relocation.s @@ -2,6 +2,13 @@ // Test that we produce the correct relocation. + + .section .pr23272,"aGw",@progbits,pr23272,comdat + .globl pr23272 +pr23272: +pr23272_2: + + .text bar: movl $bar, %edx # R_X86_64_32 movq $bar, %rdx # R_X86_64_32S @@ -43,6 +50,8 @@ bar: .long foo@gotpcrel .long foo@plt + + .quad pr23272_2 - pr23272 // CHECK: Section { // CHECK: Name: .rela.text // CHECK: Relocations [ @@ -89,5 +98,5 @@ bar: // CHECK-NEXT: Binding: Local // CHECK-NEXT: Type: Section // CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .text (0x1) +// CHECK-NEXT: Section: .text // CHECK-NEXT: } -- cgit v1.2.3