1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

23 Commits

Author SHA1 Message Date
Lang Hames
61140d8e80 [MCJIT] Turn the getSymbolAddress free function created in r218626 into a static
member of RTDyldMemoryManager (and rename to getSymbolAddressInProcess).

The functionality this provides is very specific to RTDyldMemoryManager, so it
makes sense to keep it in that class to avoid accidental re-use.

No functional change.

llvm-svn: 218741
2014-10-01 04:11:13 +00:00
David Blaikie
f2a0f2c76a Unit test r218187, changing RTDyldMemoryManager::getSymbolAddress's behavior favor mangled lookup over unmangled lookup.
The contract of this function seems problematic (fallback in either
direction seems like it could produce bugs in one client or another),
but here's some tests for its current behavior, at least. See the
commit/review thread of r218187 for more discussion.

llvm-svn: 218626
2014-09-29 21:25:13 +00:00
Lang Hames
1b33e275fd Remove redundant if test.
llvm-svn: 218220
2014-09-21 17:21:56 +00:00
NAKAMURA Takumi
7b2bdb6758 RTDyldMemoryManager::getSymbolAddress(): Make sure to return 0 if symbol name is not met. [-Wreturn-type]
llvm-svn: 218195
2014-09-20 23:58:13 +00:00
Lang Hames
fe0e8bf41a [MCJIT] Make RTDyldMemoryManager::getSymbolAddress's behaviour more consistent.
This patch modifies RTDyldMemoryManager::getSymbolAddress(Name)'s behavior to
make it consistent with how clients are using it: Name should be mangled, and
getSymbolAddress should demangle it on the caller's behalf before looking the
name up in the process. This patch also fixes the one client
(MCJIT::getPointerToFunction) that had been passing unmangled names (by having
it pass mangled names instead).

Background:

RTDyldMemoryManager::getSymbolAddress(Name) has always used a re-try mechanism
when looking up symbol names in the current process. Prior to this patch
getSymbolAddress first tried to look up 'Name' exactly as the user passed it in
and then, if that failed, tried to demangle 'Name' and re-try the look up. The
implication of this behavior is that getSymbolAddress expected to be called with
unmangled names, and that handling mangled names was a fallback for convenience.
This is inconsistent with how clients (particularly the RuntimeDyldImpl
subclasses, but also MCJIT) usually use this API. Most clients pass in mangled
names, and succeed only because of the fallback case. For clients passing in
mangled names, getSymbolAddress's old behavior was actually dangerous, as it
could cause unmangled names in the process to shadow mangled names being looked
up.

For example, consider:

foo.c:

int _x = 7;
int x() { return _x; }

foo.o:

000000000000000c D __x
0000000000000000 T _x

If foo.c becomes part of the process (E.g. via dlopen("libfoo.dylib")) it will
add symbols 'x' (the function) and '_x' (the variable) to the process. However
jit clients looking for the function 'x' will be using the mangled function name
'_x' (note how function 'x' appears in foo.o). When getSymbolAddress goes
looking for '_x' it will find the variable instead, and return its address and
in place of the function, leading to JIT'd code calling the variable and
crashing (if we're lucky).

By requiring that getSymbolAddress be called with mangled names, and demangling
only when we're about to do a lookup in the process, the new behavior
implemented in this patch should eliminate any chance of names being shadowed
during lookup.

There's no good way to test this at the moment: This issue only arrises when
looking up process symbols (not JIT'd symbols). Any test case would have to
generate a platform-appropriate dylib to pass to llvm-rtdyld, and I'm not
aware of any in-tree tool for doing this in a portable way.

llvm-svn: 218187
2014-09-20 17:44:56 +00:00
Chandler Carruth
87f14b4eec Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

llvm-svn: 198685
2014-01-07 11:48:04 +00:00
Yaron Keren
d6c4c048ce There are no __register_frame and __deregister_frame functions
when using structured exception handling (SEH) on Windows 64.

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

Patch by Jonathan Liu!

llvm-svn: 197483
2013-12-17 08:40:11 +00:00
Andrew Kaylor
c1ce905bad Resolve JIT runtime linking problems on Android.
Patch by James Lyon!

llvm-svn: 194832
2013-11-15 17:59:43 +00:00
Yaron Keren
58ee34d35b The FIXME was indeed fixed in the linker, comment removed.
llvm-svn: 193402
2013-10-25 12:01:53 +00:00
Craig Topper
e3641ad5a3 Really fix build warning/error that I think r192756 was trying to fix.
llvm-svn: 192773
2013-10-16 06:50:36 +00:00
Andrew Kaylor
3bd371f677 Fixing build warning/error
llvm-svn: 192756
2013-10-16 01:01:15 +00:00
Andrew Kaylor
3291bcae8d Adding support for deregistering EH frames with MCJIT.
Patch by Yaron Keren

llvm-svn: 192753
2013-10-16 00:14:21 +00:00
Andrew Kaylor
0f28749d52 Adding multiple object support to MCJIT EH frame handling
llvm-svn: 192504
2013-10-11 21:25:48 +00:00
Andrew Kaylor
b068069d0c Adding multiple module support for MCJIT.
Tests to follow.

PIC with small code model and  EH frame handling will not work with multiple modules.  There are also some rough edges to be smoothed out for remote target support.

llvm-svn: 191722
2013-10-01 01:47:35 +00:00
Sylvestre Ledru
3b61f1fcff Fix the build issue under ia64. Close bug #5715
Thanks to Luca Falavigna for the help and most of the patch.

llvm-svn: 189324
2013-08-27 06:49:46 +00:00
Benjamin Kramer
c1f93b748b Preserve const correctness.
GCC complains about casting away const.

llvm-svn: 183216
2013-06-04 09:09:15 +00:00
Michael J. Spencer
c6b4ffa8f8 Add missing header for atexit.
llvm-svn: 182672
2013-05-24 20:54:11 +00:00
Filip Pizlo
4640fd7653 Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

This is a fixed version of r182407 and r182411. That first revision 
broke builds because I forgot to move the conditional includes of 
various POSIX headers from SectionMemoryManager into 
RTDyldMemoryManager. Those includes are necessary because of how 
getPointerToNamedFunction works around the glibc libc_nonshared.a thing. 
The latter revision still broke things because I forgot to include 
llvm/Config/config.h.

llvm-svn: 182418
2013-05-21 20:24:07 +00:00
Filip Pizlo
1c9d15ee4e Roll out r182411 and 182412 because it's still broken.
llvm-svn: 182415
2013-05-21 20:17:14 +00:00
Filip Pizlo
2751de0ec2 Fix busted comment. This conditional include block used to be in SectionMemoryManager, but is now in RTDyldMemoryManager.
llvm-svn: 182412
2013-05-21 20:11:01 +00:00
Filip Pizlo
cb086f2a4f Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

This is a fixed version of r182407. That revision broke builds because I 
forgot to move the conditional includes of various POSIX headers from 
SectionMemoryManager into RTDyldMemoryManager. Those includes are 
necessary because of how getPointerToNamedFunction works around the 
glibc libc_nonshared.a thing.

llvm-svn: 182411
2013-05-21 20:07:12 +00:00
Filip Pizlo
40c1832484 Roll out r182407 and r182408 because they broke builds.
llvm-svn: 182409
2013-05-21 20:03:01 +00:00
Filip Pizlo
2f5df80a2d Put RTDyldMemoryManager into its own file, and make it linked into
libExecutionEngine. Move method implementations that aren't specific to 
allocation out of SectionMemoryManager and into RTDyldMemoryManager.

This is in preparation for exposing RTDyldMemoryManager through the C 
API.

llvm-svn: 182407
2013-05-21 19:56:00 +00:00