Commit Graph

11 Commits

Author SHA1 Message Date
Simon Atanasyan 9e0297b8bc [ELF][MIPS] N32 ABI support
In short the patch introduces support for linking object file conform
MIPS N32 ABI [1]. This ABI is similar to N64 ABI but uses 32-bit
pointer size.

The most non-trivial requirement of this ABI is one more relocation
packing format. N64 ABI puts multiple relocation type into the single
relocation record. The N32 ABI uses series of successive relocations
with the same offset for this purpose. In this patch, new function
`mergeMipsN32RelTypes` handle this case and "convert" N32 relocation to
the N64 relocation so the rest of the code keep unchanged.

For now, linker does not support series of relocations applied to sections
without SHF_ALLOC bit. Probably later I will add the support or insert
some sort of assert into the `relocateNonAlloc` routine to catch this
case.

[1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf

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

llvm-svn: 286052
2016-11-05 22:58:01 +00:00
George Rimar e252538107 [ELF] - Do not crash on MIPS if there is no object files in input.
If we have input without object files, for example if we have only .so
code crashes in checkFlags(), getPicFlags(), getArchFlags() functions.

Patch fixes the issue.

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

llvm-svn: 283226
2016-10-04 15:19:20 +00:00
Rui Ueyama d31e13f287 Rename warning -> warn.
It's better because it's a verb.

llvm-svn: 282763
2016-09-29 21:00:23 +00:00
Rui Ueyama 38dbd3eea9 Simplify InputFile ownership management.
Previously, all input files were owned by the symbol table.
Files were created at various places, such as the Driver, the lazy
symbols, or the bitcode compiler, and the ownership of new files
was transferred to the symbol table using std::unique_ptr.
All input files were then free'd when the symbol table is freed
which is on program exit.

I think we don't have to transfer ownership just to free all
instance at once on exit.

In this patch, all instances are automatically collected to a
vector and freed on exit. In this way, we no longer have to
use std::unique_ptr.

Differential Revision: https://reviews.llvm.org/D24493

llvm-svn: 281425
2016-09-14 00:05:51 +00:00
Simon Atanasyan 85c6b44817 [ELF][MIPS] Support .MIPS.abiflags section
This section supersedes .reginfo and .MIPS.options sections. But for now
we have to support all three sections for ABI transition period.

llvm-svn: 278482
2016-08-12 06:28:49 +00:00
Simon Atanasyan 6be57b3fb1 [ELF][MIPS] Fix the comment
llvm-svn: 278480
2016-08-12 05:43:42 +00:00
Rui Ueyama fbcec353ab Add comments.
llvm-svn: 278473
2016-08-12 04:28:20 +00:00
Rui Ueyama eefffedc51 Split getArchName. NFC.
llvm-svn: 278392
2016-08-11 19:22:34 +00:00
Simon Atanasyan a782f16ace [ELF][MIPS] Recognize and print machine name in case of input incompatibility
llvm-svn: 278352
2016-08-11 16:25:17 +00:00
Simon Atanasyan 9ef1215c80 [ELF][MIPS] Take into account combination of EF_MIPS_ARCH and EF_MIPS_MACH flags while checking ISA compatibility
MIPS ISA encoded using two ELF flags: general architecture flag like
EF_MIPS_ARCH_32, EF_MIPS_ARCH_64R6 etc and optional machine variant flag
like EF_MIPS_MACH_4111, EF_MIPS_MACH_OCTEON3 etc. When we check
compatibility between two input files and deduce ELF flags for generated
output we need to take into account both of these flags.

llvm-svn: 278230
2016-08-10 15:06:45 +00:00
Rui Ueyama 31f32fa62a Refactor getMipsEFlags.
Previously, we incrementally updated the reuslting flag as we check
file flags, so it was not very clear who is updating what flags.
This patch makes them pure functions -- that has no side effect and
don't update arguments to improve readability.

Now each function construct a patial result, and all resutls are then
bitwise-OR'ed to construct the final result.

This patch also creates a new file, Mips.cpp, to move all these
MIPS functions to a separate file.

Differential Revision: https://reviews.llvm.org/D23249

llvm-svn: 278042
2016-08-08 19:39:45 +00:00