[mips] Fix relocation record format and ELF header for N32 ABI
authorSimon Atanasyan <simon@atanasyan.com>
Thu, 21 Sep 2017 10:44:26 +0000 (10:44 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Thu, 21 Sep 2017 10:44:26 +0000 (10:44 +0000)
commit11766558d7d120c607172c8269c8bd56230972c4
tree2b2e79fd9281114a3e260e69ce3ebe41ff930771
parent2b029e830f6a4b6bcca815cd64d94e7ab9788f3a
[mips] Fix relocation record format and ELF header for N32 ABI

The N32 ABI uses RELA relocation format, do not use 3-in-1 relocation's
encoding, and uses ELFCLASS32. This change passes the `IsN32` flag
to the `MCAsmBackend` to distinguish usage of N32 ABI.

We still do not handle some cases like providing the `-target-abi=o32`
command line option with the `mips64` target triple. That's why
elf_header.s contains some "FIXME" strings. This case will be fixed in
a separate patch.

Differential revision: https://reviews.llvm.org/D37960

llvm-svn: 313873
llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.h
llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.h
llvm/test/MC/Mips/cpsetup.s
llvm/test/MC/Mips/elf_header.s [new file with mode: 0644]
llvm/test/MC/Mips/expansion-j-sym-pic.s
llvm/test/MC/Mips/expansion-jal-sym-pic.s
llvm/test/MC/Mips/reloc-directive.s