[PATCH] Linking of shared libraries for MIPS little-endian 32-bit target

Simon Atanasyan simon at atanasyan.com
Tue Nov 12 13:14:35 PST 2013


Hi Bigcheese, shankarke, ruiu,

The patch implements linking of shared libraries for MIPS little-endian 32-bit target. Now supported a limited set of relocations and linking is possible in trivial cases only.

The following are the most significant peculiarities of MIPS target:
 - MIPS ABI requires some special tags in the dynamic table.
 - GOT consists of two parts local and global. The local part contains entries refer locally visible symbols. The global part contains entries refer global symbols.
 - Entries in the .dynsym section which have corresponded entries in the GOT should be:
  # Emitted at the end of .dynsym section
  # Sorted accordingly to theirs GOT counterparts
 - There are “paired” relocations. One or more R_MIPS_HI16 and R_MIPS_GOT16 relocations should be followed by R_MIPS_LO16 relocation. To calculate result of R_MIPS_HI16 and R_MIPS_GOT16 relocations we need to combine addends from these relocations and paired R_MIPS_LO16 relocation.

Could you please review the patch? Any suggestions or objections are very appreciated.

http://llvm-reviews.chandlerc.com/D2156

Files:
  lib/ReaderWriter/ELF/CMakeLists.txt
  lib/ReaderWriter/ELF/DefaultTargetHandler.h
  lib/ReaderWriter/ELF/ELFLinkingContext.cpp
  lib/ReaderWriter/ELF/Mips/CMakeLists.txt
  lib/ReaderWriter/ELF/Mips/MipsELFTypes.h
  lib/ReaderWriter/ELF/Mips/MipsGOT.cpp
  lib/ReaderWriter/ELF/Mips/MipsGOT.h
  lib/ReaderWriter/ELF/Mips/MipsLinkingContext.cpp
  lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
  lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
  lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h
  lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
  lib/ReaderWriter/ELF/Mips/MipsTarget.h
  lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
  lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
  lib/ReaderWriter/ELF/OutputELFWriter.h
  lib/ReaderWriter/ELF/SectionChunks.h
  lib/ReaderWriter/ELF/TargetHandler.h
  lib/ReaderWriter/ELF/Targets.h
  lib/ReaderWriter/ELF/X86/X86TargetHandler.h
  test/elf/Mips/Inputs/dynobj.c
  test/elf/Mips/Inputs/dynobj.o
  test/elf/Mips/dynlib-dynamic.test
  test/elf/Mips/dynlib-dynsym.test
  test/elf/Mips/dynlib-fileheader.test
  test/elf/Mips/dynlib-gotsym.test
  test/elf/Mips/dynlib-text-sec.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2156.1.patch
Type: text/x-patch
Size: 47561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131112/e8c9c232/attachment.bin>


More information about the llvm-commits mailing list