[lld] r224831 - [Mips] Replace stderr output by the `llvm_unreachable` call
Simon Atanasyan
simon at atanasyan.com
Thu Dec 25 01:23:47 PST 2014
Author: atanasyan
Date: Thu Dec 25 03:23:47 2014
New Revision: 224831
URL: http://llvm.org/viewvc/llvm-project?rev=224831&view=rev
Log:
[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.
Removed:
lld/trunk/test/elf/Mips/jalx-bit-err.test
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp?rev=224831&r1=224830&r2=224831&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Thu Dec 25 03:23:47 2014
@@ -135,14 +135,14 @@ static void fixJumpOpCode(uint32_t &ins,
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)
Removed: lld/trunk/test/elf/Mips/jalx-bit-err.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/jalx-bit-err.test?rev=224830&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/jalx-bit-err.test (original)
+++ lld/trunk/test/elf/Mips/jalx-bit-err.test (removed)
@@ -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
More information about the llvm-commits
mailing list