summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp6
-rw-r--r--llvm/test/MC/AArch64/error-location.s3
-rw-r--r--llvm/test/MC/ARM/error-location.s3
-rw-r--r--llvm/test/MC/ELF/relocation.s6
4 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 23d0e28324c..20ad41659f4 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -655,12 +655,6 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
return;
}
- if (::isWeak(SymB)) {
- Ctx.reportError(Fixup.getLoc(),
- "Cannot represent a subtraction with a weak symbol");
- return;
- }
-
uint64_t SymBOffset = Layout.getSymbolOffset(SymB);
uint64_t K = SymBOffset - FixupOffset;
IsPCRel = true;
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: }
OpenPOWER on IntegriCloud