diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-20 18:57:48 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-20 18:57:48 +0000 |
| commit | b718237dfc05aa4c0c8c284f79fe41a2a4a14574 (patch) | |
| tree | dab809b308668c6811b8d9ee1c9325ef89c52c00 /llvm/test | |
| parent | 18b1de3ec6b33199d168807276db95c50f6faab8 (diff) | |
| download | bcm5719-llvm-b718237dfc05aa4c0c8c284f79fe41a2a4a14574.tar.gz bcm5719-llvm-b718237dfc05aa4c0c8c284f79fe41a2a4a14574.zip | |
Accept subtractions involving a weak symbol.
When a symbol S shows up in an expression in assembly there are two
possible interpretations
* The expression is referring to the value of S in this file.
* The expression is referring to the value after symbol resolution.
In the first case the assembler can reason about the value and try to
produce a relocation.
In the second case, that is only possible if the symbol cannot be
preempted.
Assemblers are not very consistent about which interpretation gets used.
This changes MC to agree with GAS in the case of an expression of the
form "Sym - WeakSym".
llvm-svn: 258329
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/MC/AArch64/error-location.s | 3 | ||||
| -rw-r--r-- | llvm/test/MC/ARM/error-location.s | 3 | ||||
| -rw-r--r-- | llvm/test/MC/ELF/relocation.s | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/llvm/test/MC/AArch64/error-location.s b/llvm/test/MC/AArch64/error-location.s index 02504368f00..c629e0a50de 100644 --- a/llvm/test/MC/AArch64/error-location.s +++ b/llvm/test/MC/AArch64/error-location.s @@ -16,9 +16,6 @@ // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a difference across sections .word x_a - y_a -// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a subtraction with a weak symbol - .word a - w - // CHECK: <unknown>:0: error: expression could not be evaluated .set v1, -undef diff --git a/llvm/test/MC/ARM/error-location.s b/llvm/test/MC/ARM/error-location.s index 112acf318ed..2f70f294b57 100644 --- a/llvm/test/MC/ARM/error-location.s +++ b/llvm/test/MC/ARM/error-location.s @@ -16,9 +16,6 @@ @ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a difference across sections .word x_a - y_a -@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a subtraction with a weak symbol - .word a - w - @ CHECK: <unknown>:0: error: expression could not be evaluated .set v1, -undef diff --git a/llvm/test/MC/ELF/relocation.s b/llvm/test/MC/ELF/relocation.s index 0fec7679281..e0313904563 100644 --- a/llvm/test/MC/ELF/relocation.s +++ b/llvm/test/MC/ELF/relocation.s @@ -63,6 +63,11 @@ pr24486: .code16 call pr23771 + .weak weak_sym +weak_sym: + .long pr23272-weak_sym + + // CHECK: Section { // CHECK: Name: .rela.text // CHECK: Relocations [ @@ -101,5 +106,6 @@ pr24486: // CHECK-NEXT: 0xDC R_X86_64_PLT32 foo 0x0 // CHECK-NEXT: 0xF0 R_X86_64_32 .text 0xF0 // CHECK-NEXT: 0xF5 R_X86_64_PC16 pr23771 0xFFFFFFFFFFFFFFFE +// CHECK-NEXT: 0xF7 R_X86_64_PC32 pr23272 0x0 // CHECK-NEXT: ] // CHECK-NEXT: } |

