[lld] r240260 - [Mips] Support R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations handling
Simon Atanasyan
simon at atanasyan.com
Mon Jun 22 02:26:06 PDT 2015
Author: atanasyan
Date: Mon Jun 22 04:26:05 2015
New Revision: 240260
URL: http://llvm.org/viewvc/llvm-project?rev=240260&view=rev
Log:
[Mips] Support R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations handling
Added:
lld/trunk/test/elf/Mips/rel-high-02.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=240260&r1=240259&r2=240260&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Mon Jun 22 04:26:05 2015
@@ -144,6 +144,8 @@ static MipsRelocationParams getRelocatio
case R_MICROMIPS_HI16:
return {4, 0xffff, 0, true, gpDispCheck<16>};
case R_MICROMIPS_LO16:
+ case R_MICROMIPS_HIGHER:
+ case R_MICROMIPS_HIGHEST:
return {4, 0xffff, 0, true, dummyCheck};
case R_MICROMIPS_PC16_S1:
return {4, 0xffff, 1, true, signedCheck<17>};
@@ -393,8 +395,10 @@ static ErrorOr<int64_t> calculateRelocat
case R_MICROMIPS_CALL_HI16:
return getHi16(tgtAddr - gpAddr);
case R_MIPS_HIGHER:
+ case R_MICROMIPS_HIGHER:
return getHigher16(tgtAddr + addend);
case R_MIPS_HIGHEST:
+ case R_MICROMIPS_HIGHEST:
return getHighest16(tgtAddr + addend);
case R_MIPS_EH:
case R_MIPS_GOT16:
Added: lld/trunk/test/elf/Mips/rel-high-02.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-high-02.test?rev=240260&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-high-02.test (added)
+++ lld/trunk/test/elf/Mips/rel-high-02.test Mon Jun 22 04:26:05 2015
@@ -0,0 +1,55 @@
+# Check handling R_MICROMIPS_HIGHER / R_MICROMIPS_HIGHEST relocations.
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target mips64el -e T0 -o %t.exe %t.o
+# RUN: llvm-nm %t.exe | FileCheck -check-prefix=SYM %s
+# RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=RAW %s
+
+# SYM: 00000001200001a0 T T0
+# SYM: 00000001200001a8 T T1
+
+# RAW: Contents of section .text:
+# RAW-NEXT: 1200001a0 00000280 00000000 00000140 00000000
+
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+ Flags: [EF_MIPS_PIC, EF_MIPS_CPIC, EF_MIPS_ARCH_64]
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 16
+ Size: 16
+
+ - Name: .rela.text
+ Type: SHT_RELA
+ Flags: [ SHF_INFO_LINK ]
+ Link: .symtab
+ AddressAlign: 8
+ Info: .text
+ Relocations:
+ - Offset: 0
+ Symbol: T1
+ Type: R_MICROMIPS_HIGHER
+ Addend: 0x0000800100000000
+ - Offset: 8
+ Symbol: T1
+ Type: R_MICROMIPS_HIGHEST
+ Addend: 0x4001000000000000
+
+Symbols:
+ Global:
+ - Name: T0
+ Type: STT_FUNC
+ Section: .text
+ Value: 0
+ Size: 8
+ - Name: T1
+ Type: STT_FUNC
+ Section: .text
+ Value: 8
+ Size: 8
More information about the llvm-commits
mailing list