summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-12-25 09:23:47 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-12-25 09:23:47 +0000
commite473df2bf6584f97e7408d14e2048937114ed41b (patch)
tree846b7d39f169bfbf6c44d2ae8f64a241dddc87f8
parent9af53992c82940f650998c68f029be29daa6985a (diff)
downloadbcm5719-llvm-e473df2bf6584f97e7408d14e2048937114ed41b.tar.gz
bcm5719-llvm-e473df2bf6584f97e7408d14e2048937114ed41b.zip
[Mips] Replace stderr output by the `llvm_unreachable` call
If a regular symbol has microMIPS-bit we need to stop linking. Now the LLD does not check the `applyRelocation` return value and continues linking anyway. As a temporary workaround use the `llvm_unreachable` call to stop the linker. llvm-svn: 224831
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp8
-rw-r--r--lld/test/elf/Mips/jalx-bit-err.test48
2 files changed, 4 insertions, 52 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
index c236dfe6452..3963ec1dec7 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
@@ -135,14 +135,14 @@ static void fixJumpOpCode(uint32_t &ins, uint64_t tgt, bool isMicro) {
uint32_t opNative = isMicro ? 0x3d : 0x03;
uint32_t opCross = isMicro ? 0x3c : 0x1d;
+ // FIXME (simon): Convert this into the regular fatal error.
+ if ((tgt & 1) == isMicro)
+ llvm_unreachable("Incorrect bit 0 for the jalx target");
+
if (tgt & 2)
llvm::errs() << "The jalx target " << llvm::format_hex(tgt, 10)
<< " is not word-aligned.\n";
- if ((tgt & 1) == isMicro)
- llvm::errs() << "Incorrect bit 0 for the jalx target "
- << llvm::format_hex(tgt, 10) << ".\n";
-
uint8_t op = ins >> 26;
if (op != opNative && op != opCross)
llvm::errs() << "Unsupported jump opcode (" << llvm::format_hex(op, 4)
diff --git a/lld/test/elf/Mips/jalx-bit-err.test b/lld/test/elf/Mips/jalx-bit-err.test
deleted file mode 100644
index d93f5ef6df6..00000000000
--- a/lld/test/elf/Mips/jalx-bit-err.test
+++ /dev/null
@@ -1,48 +0,0 @@
-# Check that LLD shows an error if jalx target value has incorrect 0 bit.
-
-# RUN: yaml2obj -format=elf %s > %t-obj
-# RUN: lld -flavor gnu -target mipsel -e T0 -o %t-exe %t-obj 2>&1 | FileCheck %s
-
-# CHECK: Incorrect bit 0 for the jalx target 0x00400115.
-
-!ELF
-FileHeader: !FileHeader
- Class: ELFCLASS32
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_MIPS
- Flags: [ EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2,
- EF_MIPS_MICROMIPS ]
-
-Sections:
-- Name: .text
- Type: SHT_PROGBITS
- Size: 8
- AddressAlign: 16
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
-
-- Name: .rel.text
- Type: SHT_REL
- Info: .text
- AddressAlign: 4
- Relocations:
- - Offset: 0
- Symbol: T1
- Type: R_MICROMIPS_26_S1
- - Offset: 5
- Symbol: T0
- Type: R_MIPS_26
-
-Symbols:
- Global:
- - Name: T0
- Section: .text
- Type: STT_FUNC
- Value: 0
- Size: 4
- Other: [ STO_MIPS_MICROMIPS ]
- - Name: T1
- Section: .text
- Type: STT_FUNC
- Value: 5
- Size: 3
OpenPOWER on IntegriCloud