1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

1855 Commits

Author SHA1 Message Date
Alexei Starovoitov
1bae3607c8 fix crash
fix segfault by checking for UnknownArch, since
getArchTypePrefix() will return nullptr for UnknownArch.

This fixes regression caused by r238424.

llvm-svn: 239456
2015-06-10 03:06:06 +00:00
Rui Ueyama
e59fc0b2e5 Remove object_error::success and use std::error_code() instead
make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333

llvm-svn: 239409
2015-06-09 15:20:42 +00:00
Petar Jovanovic
6ef784bc64 [Mips64][mcjit] Add R_MIPS_PC32 relocation
This patch adds R_MIPS_PC32 relocation for Mips64.

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D10235

llvm-svn: 239301
2015-06-08 14:10:23 +00:00
Daniel Sanders
981274986f Re-commit r238838, r238844 with fix for host/target endian mismatch and windows buildbot.
The windows buildbot originally failed because the check expressions are
evaluated as 64-bit values, even for 32-bit symbols. Fixed this by comparing
bottom 32-bits of the expressions.

The host/target endian mismatch issue is that it's invalid to read/write target
values using a host pointer without taking care of endian differences between
the target and host. Most (if not all) instances of
reinterpret_cast<uint32_t*>() in the RuntimeDyld are examples of this bug.
This has been fixed for Mips using the endian aware read/write functions.

The original commits were:
r238838:
[mips] Add RuntimeDyld tests for currently supported O32 relocations.

Reviewers: petarj, vkalintiris

Reviewed By: vkalintiris

Subscribers: vkalintiris, llvm-commits

Differential Revision: http://reviews.llvm.org/D10126

r238844:
[mips][mcjit] Add support for R_MIPS_PC32.

Summary:
This allows us to resolve relocations for DW_EH_PE_pcrel TType encodings
in the exception handling LSDA.

Also fixed a nearby typo.

Reviewers: petarj, vkalintiris

Reviewed By: vkalintiris

Subscribers: vkalintiris, llvm-commits

Differential Revision: http://reviews.llvm.org/D10127

llvm-svn: 238915
2015-06-03 10:27:28 +00:00
Rafael Espindola
dfd8bd6f4d This reverts commit r238838, r238844 and r238888.
Trying to bring back a windows bot:

http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/1224/steps/ninja%20check%202/logs/FAIL%3A%20LLVM%3A%3AELF_O32_PIC_relocations.s

llvm-svn: 238903
2015-06-03 05:39:59 +00:00
Daniel Sanders
6d081f7d14 [mips][mcjit] Add support for R_MIPS_PC32.
Summary:
This allows us to resolve relocations for DW_EH_PE_pcrel TType encodings
in the exception handling LSDA.

Also fixed a nearby typo.

Reviewers: petarj, vkalintiris

Reviewed By: vkalintiris

Subscribers: vkalintiris, llvm-commits

Differential Revision: http://reviews.llvm.org/D10127

llvm-svn: 238844
2015-06-02 15:28:29 +00:00
Rafael Espindola
dc9a8f0f58 Simplify now that we always use an alignment of 2 for ELF files.
This saves 123144 bytes out of llvm-nm on powerpc64le.

llvm-svn: 238824
2015-06-02 12:05:27 +00:00
Davide Italiano
50913e6fa3 [RuntimeDydlELF] Use range-based loop.
Differential Revision:	http://reviews.llvm.org/D10165
Reviewed by:	rafael

llvm-svn: 238804
2015-06-02 01:52:28 +00:00
Sanjay Patel
7b6db28e8d add missing dependency for ExecutionEngine lib
This appears to be masked most of the time, but the problem
was exposed on some bots by r238051.

llvm-svn: 238788
2015-06-01 21:56:56 +00:00
Rafael Espindola
1aab75a797 Try to fix the build of IntelJITEventListener.
llvm-svn: 238709
2015-06-01 02:18:14 +00:00
Rafael Espindola
5d79b3bd90 Simplify another function that doesn't fail.
llvm-svn: 238703
2015-06-01 00:27:26 +00:00
Rafael Espindola
2344d876ac Simplify interface of function that doesn't fail.
llvm-svn: 238700
2015-05-31 23:52:50 +00:00
Benjamin Kramer
0e31955b32 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238602
2015-05-29 19:43:39 +00:00
Petar Jovanovic
e26f67279e [Mips64] Add support for MCJIT for MIPS64r2 and MIPS64r6
Add support for resolving MIPS64r2 and MIPS64r6 relocations in MCJIT.

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D9667

llvm-svn: 238424
2015-05-28 13:48:41 +00:00
Lang Hames
16f88f770b [RuntimeDyld] Fix MachO i386 SECTDIFF relocation to support non-zero addends.
Previously, relocations of the form 'A - B + C' would fail on i386 when C was
non-zero.

llvm-svn: 238356
2015-05-27 20:50:01 +00:00
Akira Hatanaka
6f08fc2ca6 Remove NoFramePointerElim and NoFramePointerElimOverride from TargetOptions and
remove ExecutionEngine's dependence on CodeGen. NFC.

This is a follow-up to r238080.

Differential Revision: http://reviews.llvm.org/D9830

llvm-svn: 238244
2015-05-26 20:17:20 +00:00
NAKAMURA Takumi
41f02245ee Update ExecutionEngine/LLVMBuild.txt, to add LLVMCodeGen.
llvm-svn: 238096
2015-05-23 10:44:30 +00:00
Akira Hatanaka
626316f0c3 Stop resetting NoFramePointerElim in TargetMachine::resetTargetOptions.
This is part of the work to remove TargetMachine::resetTargetOptions.

In this patch, instead of updating global variable NoFramePointerElim in
resetTargetOptions, its use in DisableFramePointerElim is replaced with a call
to TargetFrameLowering::noFramePointerElim. This function determines on a
per-function basis if frame pointer elimination should be disabled.

There is no change in functionality except that cl:opt option "disable-fp-elim"
can now override function attribute "no-frame-pointer-elim". 

llvm-svn: 238080
2015-05-23 01:14:08 +00:00
NAKAMURA Takumi
a4f3670279 Reapply part of r237975, "Fix Clang -Wmissing-override warning", except for DIContext.h, to apease g++-4.7.
llvm-svn: 238012
2015-05-22 10:11:07 +00:00
Tobias Grosser
e4d1b4e7ed Revert "Fix Clang -Wmissing-override warning"
This reverts commit r237975. This seems also to break with gcc 4.7

llvm-svn: 238004
2015-05-22 06:01:04 +00:00
David Blaikie
fa9311be80 Fix Clang -Wmissing-override warning
& remove the duplication by introducing a CRTP base to implement the
clone behavior.

llvm-svn: 237975
2015-05-22 00:00:00 +00:00
Keno Fischer
e81cbbea60 Make it easier to use DwarfContext with MCJIT
Summary:
This supersedes http://reviews.llvm.org/D4010, hopefully properly
dealing with the JIT case and also adds an actual test case.
DwarfContext was basically already usable for the JIT (and back when
we were overwriting ELF files it actually worked out of the box by
accident), but in order to resolve relocations correctly it needs
to know the load address of the section.
Rather than trying to get this out of the ObjectFile or requiring
the user to create a new ObjectFile just to get some debug info,
this adds the capability to pass in that info directly.
As part of this I separated out part of the LoadedObjectInfo struct
from RuntimeDyld, since it is now required at a higher layer.

Reviewers: lhames, echristo

Reviewed By: echristo

Subscribers: vtjnash, friss, rafael, llvm-commits

Differential Revision: http://reviews.llvm.org/D6961

llvm-svn: 237961
2015-05-21 21:24:32 +00:00
David Majnemer
a1fa49368b [RuntimeDyld] Use isInt to assert that a relocation didn't overflow
isInt is a little easier to read, let's use that more consistently.
Incidentally, this also silences a warning for shifting a negative
number.

This fixes PR23532.

llvm-svn: 237476
2015-05-15 20:32:25 +00:00
David Blaikie
ca9f6b8a86 Readdress r236990, use of static members on a non-static variable.
The TargetRegistry is just a namespace-like class, instantiated in one
place to use a range-based for loop. Instead, expose access to the
registry via a range-based 'targets()' function instead. This makes most
uses a bit awkward/more verbose - but eventually we should just add a
range-based find_if function which will streamline these functions. I'm
happy to mkae them a bit awkward in the interim as encouragement to
improve the algorithms in time.

llvm-svn: 237059
2015-05-11 22:20:48 +00:00
Lang Hames
a366b4ef77 [Orc] Reapply r236465 with fixes for the MSVC bots.
llvm-svn: 236506
2015-05-05 17:37:18 +00:00
Lang Hames
1ee1ff3529 [Orc] Revert r236465 - It broke the Windows bots.
Looks like the usual missing explicit move-constructor issue with MSVC. I should
have a fix shortly.

llvm-svn: 236472
2015-05-04 23:30:01 +00:00
Lang Hames
63e2fcbb79 [Orc] Refactor the compile-on-demand layer to make module partitioning lazy,
and avoid cloning unused decls into every partition.

Module partitioning showed up as a source of significant overhead when I
profiled some trivial test cases. Avoiding the overhead of partitionging
for uncalled functions helps to mitigate this.

This change also means that it is no longer necessary to have a
LazyEmittingLayer underneath the CompileOnDemand layer, since the
CompileOnDemandLayer will not extract or emit function bodies until they are
called.

llvm-svn: 236465
2015-05-04 22:03:10 +00:00
Keno Fischer
a825c0d371 Reapply [RuntimeDyldELF] Fold Placeholder into Addend
This reapplies r235060 and 235070, which were reverted because of test failures
in LLDB. The failure was caused because at  moment RuntimeDyld is processing
relocations for all sections, irrespective of whether we actually load them
into memory or not, but RuntimeDyld was not actually remembering where in memory
the unrelocated section is. This commit includes a fix for that issue by
remembering that pointer, though the longer term fix should be to stop processing
unneeded sections.

Original Summary:

This allows us to get rid of the original unrelocated object file after
we're done processing relocations (but before applying them).
MachO and COFF already do not require this (currently we have temporary hacks
to prevent ownership from being released, but those are brittle and should be
removed soon).

The placeholder mechanism allowed the relocation resolver to look at original
object file to obtain more information that are required to apply the
relocations. This is usually necessary in two cases:

- For relocations targetting sub-word memory locations, there may be pieces
  of the instruction at the target address which we should not override.
- Some relocations on some platforms allow an extra addend to be encoded in
  their immediate fields.

The problem is that in the second case the information cannot be recovered
after the relocations have been applied once because they will have been
overridden. In the first case we also need to be careful to not use any bits
that aren't fixed and may have been overriden by applying a first relocation.

In the past both have been fixed by just looking at original object file. This
patch attempts to recover the information from the first by looking at the
relocated object file, while the extra addend in the second case is read
upon relocation processing and addend to the regular addend.

I have tested this on X86. Other platforms represent my best understanding
of how those relocations should work, but I may have missed something because
I do not have access to those platforms.
We will keep the ugly workarounds in place for a couple of days, so this commit
can be reverted if it breaks the bots.

Differential Revision: http://reviews.llvm.org/D9028

llvm-svn: 236341
2015-05-01 20:21:45 +00:00
David Blaikie
0f91b70796 [opaque pointer type] Pass GlobalAlias the actual pointer type rather than decomposing it into pointee type + address space
Many of the callers already have the pointer type anyway, and for the
couple of callers that don't it's pretty easy to call PointerType::get
on the pointee type and address space.

This avoids LLParser from using PointerType::getElementType when parsing
GlobalAliases from IR.

llvm-svn: 236160
2015-04-29 21:22:39 +00:00
Zachary Turner
c307249d18 Move DIContext.h to common DebugInfo location.
This will enable us to create a PDBContext so as to expose some
amount of debug info functionality through a common interace.

Differential Revision: http://reviews.llvm.org/D9205
Reviewed by: Alexey Samsonov

llvm-svn: 235612
2015-04-23 17:37:47 +00:00
Lang Hames
22a89eb5d6 [RuntimeDyld][COFF] Add external symbol resolution support to RuntimeDyldCOFF.
Patch by Andy Ayers. Thanks Andy!

llvm-svn: 235554
2015-04-22 21:38:37 +00:00
Lang Hames
c39c3c89e5 [Orc] Make the makeStub function propagate argument attributes onto the call to
the function body.

This is necessary for correctness when lazily compiling.

Also, flesh out the Orc unit test infrastructure slightly, and add a unit test
for this.

llvm-svn: 235347
2015-04-20 20:41:45 +00:00
Lang Hames
e77a58f25d [Orc] Use the 64-bit versions of FXSAVE/FXRSTOR for JIT reentry.
llvm-svn: 235325
2015-04-20 18:25:44 +00:00
Pavel Labath
b9727845ef Revert "[RuntimeDyldELF] Fold Placeholder into Addend"
This reverts commit cbbeac14f0ddca71f6d8ff91cd05522bd23908e5.

llvm-svn: 235082
2015-04-16 08:58:15 +00:00
Pavel Labath
2981ca5194 Revert "[RuntimeDyldELF] Fix missing cases in Placeholder processing"
This reverts commit ec0a34f850eca0d97e0592236e0ac14083aa1c3d.

llvm-svn: 235081
2015-04-16 08:58:11 +00:00
Keno Fischer
dd615bff10 [RuntimeDyldELF] Fix missing cases in Placeholder processing
Try to appease the build bots. We should write rtdyld test cases for these
to make them testible on other platforms.

llvm-svn: 235070
2015-04-16 02:00:38 +00:00
Keno Fischer
40027f8eda [RuntimeDyldELF] Fold Placeholder into Addend
Summary:

This allows us to get rid of the original unrelocated object file after
we're done processing relocations (but before applying them).
MachO and COFF already do not require this (currently we have temporary hacks
to prevent ownership from being released, but those are brittle and should be
removed soon).

The placeholder mechanism allowed the relocation resolver to look at original
object file to obtain more information that are required to apply the
relocations. This is usually necessary in two cases:

- For relocations targetting sub-word memory locations, there may be pieces
  of the instruction at the target address which we should not override.
- Some relocations on some platforms allow an extra addend to be encoded in
  their immediate fields.

The problem is that in the second case the information cannot be recovered
after the relocations have been applied once because they will have been
overridden. In the first case we also need to be careful to not use any bits
that aren't fixed and may have been overriden by applying a first relocation.

In the past both have been fixed by just looking at original object file. This
patch attempts to recover the information from the first by looking at the
relocated object file, while the extra addend in the second case is read
upon relocation processing and addend to the regular addend.

I have tested this on X86. Other platforms represent my best understanding
of how those relocations should work, but I may have missed something because
I do not have access to those platforms.
We will keep the ugly workarounds in place for a couple of days, so this commit
can be reverted if it breaks the bots.

Reviewers: petarj, t.p.northover, lhames

Reviewed By: lhames

Subscribers: aemerson, llvm-commits

Differential Revision: http://reviews.llvm.org/D9028

llvm-svn: 235060
2015-04-15 23:49:29 +00:00
Lang Hames
922165b836 [RuntimeDyld] Add casts to make delta computation 64-bit.
Hopefully this will fix the i686/msvc build failure described at:
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/803

llvm-svn: 234977
2015-04-15 04:46:01 +00:00
Lang Hames
78fb616ba9 [RuntimeDyld] Make sure we emit MachO __eh_frame and __gcc_except_tab sections,
even if there are no references to them in the code.

This allows exceptions thrown from JIT'd code to be caught by the JIT itself.

llvm-svn: 234975
2015-04-15 03:39:22 +00:00
Lang Hames
2051723280 [RuntimeDyld] Make SectionEntry's Name field a std::string.
StringRef is unsafe here, since SectionEntry instances can outlive the
ObjectFile instances they are created from.

llvm-svn: 234910
2015-04-14 17:13:10 +00:00
Keno Fischer
21f2950167 [RuntimeDyldELF] Improve GOT support
Summary:
This is the first in a series of patches to eventually add support for TLS relocations to RuntimeDyld. This patch resolves an issue in the current GOT handling, where GOT entries would be reused between object files, which leads to the same situation that necessitates the GOT in the first place, i.e. that the 32-bit offset can not cover all of the address space. Thus this patch makes the GOT object-file-local.
Unfortunately, this still isn't quite enough, because the MemoryManager does not yet guarantee that sections are allocated sufficiently close to each other, even if they belong to the same object file. To address this concern, this patch also adds a small API abstraction on top of the GOT allocation mechanism that will allow (temporarily, until the MemoryManager is improved) using the stub mechanism instead of allocating a different section. The actual switch from separate section to stub mechanism will be part of a follow-on commit, so that it can be easily reverted independently at the appropriate time.

Test Plan: Includes a test case where the GOT of two object files is artificially forced to be apart by several GB.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8813

llvm-svn: 234839
2015-04-14 02:10:35 +00:00
Lang Hames
2846a6ae44 [Orc] During module partitioning, rename anonymous and asm-private globals.
If they're not (re)named, these globals will fail to resolve when the
partitioned modules are linked.

llvm-svn: 234707
2015-04-12 20:05:51 +00:00
Alexander Kornienko
71412ece39 Use 'override/final' instead of 'virtual' for overridden methods
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' \
    -j=32 -fix -format

http://reviews.llvm.org/D8925

llvm-svn: 234679
2015-04-11 02:11:45 +00:00
Lang Hames
5392926f32 [Orc] Tidy up IndirectionUtils API a little, add some comments. NFC.
llvm-svn: 234669
2015-04-11 00:23:49 +00:00
Benjamin Kramer
f6149322d4 Reduce dyn_cast<> to isa<> or cast<> where possible.
No functional change intended.

llvm-svn: 234586
2015-04-10 11:24:51 +00:00
Benjamin Kramer
823cb1fd04 [jitlistener] Remove unused code
llvm-svn: 234404
2015-04-08 13:17:48 +00:00
Lang Hames
e074b328d5 [RuntimeDyld] Always allocate at least 1 byte for object sections in the JIT to
ensure that section addresses are distinct.

mapSectionAddress will fail if two sections are allocated the same address,
which can happen if any section has zero size (since malloc(0) is implementation
defined). Unfortunately I've been unable to repro this with a simple test case.

Fixes <rdar://problem/20314015>.

llvm-svn: 234299
2015-04-07 06:27:56 +00:00
Lang Hames
f675ff48dd [Orc] Save all the x86-64 GPRs before re-entering the JIT.
The re-entry code should work for all calling conventions.

llvm-svn: 234298
2015-04-07 06:12:21 +00:00
Lang Hames
286487f927 [Orc] Tidy up the assembly for the x86-64 resolver block.
llvm-svn: 234138
2015-04-06 03:01:29 +00:00
Lang Hames
ecdf9920d8 [Orc] Fix local-linkage handling in the CompileOnDemand layer.
llvm-svn: 233895
2015-04-02 05:28:10 +00:00