1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

679 Commits

Author SHA1 Message Date
Douglas Gregor
0f306eba2f Alternative fix to make sure that the extern declarations used by
DynamicLibrary::SearchForAddressOfSymbol refer to declarations in the
global namespace.

llvm-svn: 92023
2009-12-23 19:12:50 +00:00
Douglas Gregor
44f2fe915f Revert 92020 until I figure out a more portable fix
llvm-svn: 92021
2009-12-23 19:04:10 +00:00
Douglas Gregor
9f306d1b18 Move the extern symbol declarations outside of
DynamicLibrary::SearchForAddressOfSymbol and force them to have "C"
linkage. 

Interestingly, GCC treats the block-scoped "extern" declarations we
previously had as if they were extern "C" declarations (or, at least,
were in the global namespace), so that GCC bug papered over this LLVM
bug. Clang and EDG get the linkage correct; this new variant seems to
work for both GCC and Clang.

llvm-svn: 92020
2009-12-23 18:56:27 +00:00
Nuno Lopes
6abe311a0f move a few more symbols to .rodata
llvm-svn: 92011
2009-12-23 17:48:10 +00:00
Daniel Dunbar
01ebbb9844 Fix Win32 Path.inc for API update.
llvm-svn: 91706
2009-12-18 19:59:48 +00:00
Jeffrey Yasskin
d43aca2c4d Make Path use StringRef instead of std::string where possible.
llvm-svn: 91620
2009-12-17 21:02:39 +00:00
Chris Lattner
9581391002 remove use of SmallVector from Path::makeUnique. Path::makeUnique
is not used by anything performance sensitive, so just use std::string.

llvm-svn: 91528
2009-12-16 08:40:44 +00:00
Chris Lattner
4b57931af3 eliminate an extraneous use of SmallVector in a case where
a fixed size buffer is perfectly fine.

llvm-svn: 91527
2009-12-16 08:35:54 +00:00
Torok Edwin
388463f7c4 Add "generic" fallback.
gcc warned that the function may not have a return value, indeed
for non-intel and non-amd X86 CPUs it is right (VIA, etc.).

llvm-svn: 91276
2009-12-14 12:38:18 +00:00
Torok Edwin
57fe66cf5b Using _MSC_VER there was wrong, better just use the already existing ifdefs for
x86 CPU detection for the X86 getHostCPUName too, and create a simple
getHostCPUName that returns "generic" for all else.

llvm-svn: 91240
2009-12-13 08:59:40 +00:00
Torok Edwin
6c46ee4a5b Enable CPU detection when using MS VS 2k8 too.
MSVS2k8 doesn't define __i386__, hence all the CPU detection code was disabled.
Enable it by looking for _MSC_VER.

llvm-svn: 91217
2009-12-12 12:42:31 +00:00
Daniel Dunbar
3d073e0978 Remove spurious extern.
llvm-svn: 90937
2009-12-09 03:26:33 +00:00
Oscar Fuentes
d4427a6b63 Fixes the Atomic implementation if compiled by MSVC compiler.
sys::cas_flag should be long on this platform, InterlockedAdd() is
defined only for the Itanium architecture (according to MSDN).

Patch by Michael Beck!

llvm-svn: 90748
2009-12-07 05:29:59 +00:00
Benjamin Kramer
34f2bcd0ae Remove dead returns.
llvm-svn: 90083
2009-11-29 17:42:58 +00:00
Kovarththanan Rajaratnam
435a9894a7 This patch ensures that Path::GetMainExecutable is able to handle the
case where realpath() fails. When this occurs we segfault trying to
create a std::string from a NULL pointer.

Fixes PR5635.

llvm-svn: 90082
2009-11-29 17:19:48 +00:00
Edward O'Callaghan
43864a3136 API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
llvm-svn: 89848
2009-11-25 06:32:19 +00:00
Daniel Dunbar
740136a956 Remove bogus error handling code.
llvm-svn: 89786
2009-11-24 19:03:33 +00:00
Edward O'Callaghan
69ba53657a Provide Path::isSpecialFile interface for PR5568.
llvm-svn: 89765
2009-11-24 15:19:10 +00:00
Oscar Fuentes
88c6014eb8 Use CMAKE_DL_LIBS instead of raw library name. Fixes bug 5536.
Patch by Tobias Grosser!

llvm-svn: 89406
2009-11-19 23:21:43 +00:00
Benjamin Kramer
3c00bced85 Unbreak x64 MSVC build. Patch by Nicolas Capens!
llvm-svn: 89341
2009-11-19 12:17:31 +00:00
Benjamin Kramer
f3f063a58e Revert CPU detection code to return "generic" instead of an empty string in case
of failure. The x86 target didn't like empty cpu names and broke x86 tests on
non-x86 buildbots.

llvm-svn: 89111
2009-11-17 17:57:04 +00:00
Daniel Dunbar
40aeab3d33 Remove bogus corei7 and atom entries, the family was incorrect.
llvm-svn: 88818
2009-11-14 22:04:42 +00:00
Daniel Dunbar
27b218d88f Fill out X86 table, although we are missing lots of names for things. We now
properly detect my Xeon box though.

llvm-svn: 88814
2009-11-14 21:36:19 +00:00
Daniel Dunbar
59040c2825 Add llvm::sys::getHostCPUName, for detecting the LLVM name for the host CPU.
- This is an initial step towards -march=native support in Clang, and towards
   eliminating host dependencies in the targets. See PR5389.

 - Patch by Roman Divacky!

llvm-svn: 88768
2009-11-14 10:09:12 +00:00
Duncan Sands
de498ef6ec Revert commit 81144, and add a comment. It caused bugpoint timeouts
not to work any more on linux.

llvm-svn: 86481
2009-11-08 20:55:48 +00:00
Benjamin Kramer
ac39e59ede Path::createDirectoryOnDisk should ignore existing directories on win32 too.
llvm-svn: 86132
2009-11-05 14:32:40 +00:00
Edward O'Callaghan
ad76c7541b Fix malloc.h is deprecated warning on DragonFly BSD.
llvm-svn: 85782
2009-11-02 03:20:57 +00:00
Dan Gohman
84554e8eb2 Most stack straces don't need 3 digits worth of levels.
llvm-svn: 85575
2009-10-30 02:45:10 +00:00
Chandler Carruth
766362c707 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Chandler Carruth
6e9cf74969 Remove unused includes.
llvm-svn: 85074
2009-10-25 22:38:41 +00:00
Ted Kremenek
b9ff937285 Use 'waitpid' instead of 'wait'. Basing Program::Wait() on 'wait()' prevents it being correct within a multithreaded context.
This address: PR 5277 (Program::Wait is unsafe to call from multiple threads).

Note: If waitpid() turns out to be non-portable, we can add more autoconf magic, or look into
another solution.

llvm-svn: 84903
2009-10-22 22:16:17 +00:00
Edward O'Callaghan
00f4a355eb Haiku porting patches, Credit to Paul Davey.
llvm-svn: 83823
2009-10-12 04:57:20 +00:00
Benjamin Kramer
8cebbc5761 MingW build fixes
- MingW needs -lpsapi (in ${LIBS}) linked after -lLLVMSystem.
  Noticed by Ronald Pijnacker!

- Some parts of the System library must be build with exceptions on windows.
  Based on a patch by Jay Foad!

llvm-svn: 83251
2009-10-02 19:36:31 +00:00
Daniel Dunbar
eb22aecd0b ... missed hiding a variable for MSVC only.
llvm-svn: 82552
2009-09-22 16:10:35 +00:00
Daniel Dunbar
e4ec127dcd Hide MSVC specific CRT interaction behind _MSC_VER.
llvm-svn: 82551
2009-09-22 15:58:35 +00:00
Mikhail Glushenkov
4cd6a6887f Remove the GetProcessId() call from Win32/Program.inc, take 2.
GetProcessId() was introduced only in Windows XP, and we want to support earlier
versions.

llvm-svn: 82548
2009-09-22 15:40:32 +00:00
Daniel Dunbar
06695b3ea1 Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHandler and use to disable the Win32 crash dialogs. These are a major blocker to any kind of automated testing.
Also, tweak the 'lit' test runner to set this variable unconditionally.

llvm-svn: 82537
2009-09-22 09:50:28 +00:00
Daniel Dunbar
badca39b69 Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

llvm-svn: 82522
2009-09-22 04:44:56 +00:00
Mikhail Glushenkov
3b1f94a1fc Get rid of GetProcessId in Win32/Program.inc.
GetProcessId was introduced only in XP. As a bonus, this change makes Program
objects copyable, since Program is now basically a PID.

llvm-svn: 81826
2009-09-15 03:39:45 +00:00
Daniel Dunbar
4f8ae87a63 Experimental fix for PR4960.
- Could we just always implement this as __clear_cache for __GNUC__?

llvm-svn: 81655
2009-09-12 23:29:02 +00:00
Dan Gohman
149ac38d37 Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't
working. To support this, add an is_displayed() function to raw_ostream,
and generalize Process::StandardOutIsDisplayed and friends in order to
support it.

Also, call RemoveFileOnSignal before creating a file instead of after, so
that the file isn't left behind if the program is interrupted between when
the file is created and RemoveFileOnSignal is called.

While here, add a -S to llvm-extract and port it to IRReader so that it
supports assembly input.

llvm-svn: 81568
2009-09-11 20:46:33 +00:00
Benjamin Kramer
0dd04b9b27 Add a shortcut for OS X to Path::GetMainExecutable. This gives a nice speedup on
clang's testsuite.

llvm-svn: 81333
2009-09-09 12:09:08 +00:00
Mikhail Glushenkov
13ec8a3393 Check that the 'kill' call succeeded.
Thanks to Duncan Sands for spotting this.

llvm-svn: 81328
2009-09-09 09:51:47 +00:00
Mikhail Glushenkov
7c0f06c19e This should unbreak the build on 64-bit Linux.
llvm-svn: 81252
2009-09-08 20:31:27 +00:00
Mikhail Glushenkov
eaf0f7f20b Const-correctness.
llvm-svn: 81249
2009-09-08 19:51:39 +00:00
Mikhail Glushenkov
d5ee80a911 Get rid of the Pid_ member in the Program class.
llvm-svn: 81247
2009-09-08 19:50:55 +00:00
Mikhail Glushenkov
bd38dc207a Add a Kill() function to the Program class.
llvm-svn: 81246
2009-09-08 19:50:27 +00:00
Duncan Sands
5c77da0572 Using a signal handler that does nothing should be
equivalent to SIG_IGN.

llvm-svn: 81144
2009-09-07 05:58:25 +00:00
Duncan Sands
598fe699d0 Remove some not-really-used variables, as warned
about by icc (#593, partial).  Patch by Erick Tryzelaar.

llvm-svn: 81115
2009-09-06 12:41:19 +00:00
Duncan Sands
4b92376ba8 Tweak code into an equivalent form for which icc
doesn't warn about unreachable instructions.  Patch
by Erick Tryzelaar (#111).

llvm-svn: 81110
2009-09-06 10:53:22 +00:00
Daniel Dunbar
ac461a55ce Improve llvm::getHostTriple for some cases where the LLVM_HOSTTRIPLE is not
reliable.

llvm-svn: 80863
2009-09-03 01:10:13 +00:00
Torok Edwin
fbeacd1ab7 Fix ExplicitSymbols leak.
llvm-svn: 80589
2009-08-31 16:12:29 +00:00
Chris Lattner
11f509336c remove the last uses of Config/alloca.h
llvm-svn: 79873
2009-08-23 22:57:38 +00:00
Chris Lattner
3203639c35 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Owen Anderson
bbc67a90d5 Get rid of a helgrind warning. If this is _actually_ a performance problem,
we can find a way to cache the answer that isn't racy.

llvm-svn: 79472
2009-08-19 21:48:34 +00:00
Owen Anderson
ed218e5820 Add locking around signal handler registration.
llvm-svn: 79254
2009-08-17 17:07:22 +00:00
Dan Gohman
bc6b14ba00 This void is implicit in C++.
llvm-svn: 78848
2009-08-12 22:10:57 +00:00
Chris Lattner
660497ce3b improve win32 path support, patch by Baptiste Lepilleur!
llvm-svn: 78823
2009-08-12 17:47:06 +00:00
Dan Gohman
1c41d60c4a Fix a bunch of namespace pollution.
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Dan Gohman
50e5bf5aa4 Minor code simplification.
llvm-svn: 78239
2009-08-05 20:16:55 +00:00
Dan Gohman
38208563e9 Update a comment to reflect the current code.
llvm-svn: 78215
2009-08-05 17:32:39 +00:00
Dan Gohman
587b5b9682 Remove needless uses of std::flush in the parent process after a
fork call. This eliminates a need for <iostream>. Also remove
needless fsync calls.

llvm-svn: 78131
2009-08-05 00:17:00 +00:00
Dan Gohman
a8cb86c0f5 Use _exit rather than exit in the child process after a failed exec.
Add a comment explaining why.

llvm-svn: 78128
2009-08-05 00:09:12 +00:00
Dan Gohman
a9ceec3d38 Follow Unix behavior and return 127 if the command is not found,
and 126 if it is not executable.

llvm-svn: 78120
2009-08-04 23:15:49 +00:00
Daniel Dunbar
6a5b6a721e When exec() fails, return 127 instead of errno; the parent process has no way to
distinguish that the result is errno, so it can't use it to provide more
information about the error (it also exposes the numeric value of errno).

llvm-svn: 78098
2009-08-04 20:32:25 +00:00
Daniel Dunbar
c5047d9d96 Fix a race condition in getting the process exit code on Win32.
llvm-svn: 77953
2009-08-03 05:02:46 +00:00
Daniel Dunbar
70cf813a05 Empty arguments need to be quoted on Win32.
llvm-svn: 77913
2009-08-02 20:41:09 +00:00
Chris Lattner
190b319c4c eXtensible Systems doesn't exist any more and Reid donated this to the
project under the normal license, yay. :)

llvm-svn: 77823
2009-08-01 22:54:17 +00:00
Dan Gohman
454f9dc117 Remove another F_OK.
llvm-svn: 77405
2009-07-29 00:02:58 +00:00
Dan Gohman
94bc13beac On "Unix", if Program::FindProgramByName is given a name containing
slashes, just go with it, regardless of whether it looks like it will
be executable. This follows the behavior of sh(1) more closely.

llvm-svn: 77396
2009-07-28 23:25:18 +00:00
Dan Gohman
3341edff8b It isn't necessary to use F_OK when using R_OK or similar.
llvm-svn: 77392
2009-07-28 23:22:01 +00:00
Benjamin Kramer
c5d38b51da Fix a fixme; don't take binaries from the working directory.
This fixes clang on non-darwin platforms if a file called 'ld' or 'as'
is in the working directory. Based on patch by Pawel Worach!

llvm-svn: 77379
2009-07-28 22:08:15 +00:00
Douglas Gregor
a16477fe59 CMake: make sure that the *.inc files for libSystem show up in the resulting
project.

llvm-svn: 77213
2009-07-27 17:55:55 +00:00
Daniel Dunbar
dda1b60b4b Don't use llvm_report_error in libSystem, this is a layering violation.
llvm-svn: 77169
2009-07-26 21:16:42 +00:00
Reid Kleckner
3f197c850d Re-committing r76828 with the JIT memory manager changes now that the build
bots like the BumpPtrAllocator changes.

llvm-svn: 76902
2009-07-23 21:46:56 +00:00
Reid Kleckner
6f9bf7f028 Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
llvm-svn: 76838
2009-07-23 01:40:54 +00:00
Reid Kleckner
b500f07edf Make the JIT code emitter properly retry and ask for more memory when it runs
out of memory, and also make the default memory manager allocate more memory
when it runs out.

Also, switch function stubs and global data over to using the BumpPtrAllocator.

This makes it so the JIT no longer mmaps (or the equivalent on Windows) 16 MB
of memory, and instead allocates in 512K slabs.  I suspect this size could go
lower, especially on embedded platforms, now that more slabs can be allocated.

llvm-svn: 76828
2009-07-23 00:49:59 +00:00
Mikhail Glushenkov
583e23d726 Remove duplication in Program::Execute{And,No}Wait.
Implemented by moving the code out of static functions into methods of Program
class.

llvm-svn: 76340
2009-07-18 21:43:12 +00:00
Mikhail Glushenkov
d44eba5166 Trailing whitespace.
llvm-svn: 76229
2009-07-17 20:38:17 +00:00
Ted Kremenek
1ebb7e72fa Lexically order files in CMakeLists.txt files.
llvm-svn: 75831
2009-07-15 21:08:16 +00:00
Daniel Dunbar
4aa12d4330 Use llvm_report_error, not llvm_unreachable.
llvm-svn: 75429
2009-07-12 21:01:49 +00:00
Daniel Dunbar
995f9a8a15 Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!

 - Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths.

llvm-svn: 75424
2009-07-12 20:23:56 +00:00
Chris Lattner
cf99e77cc3 "UNIX paths can contain non-ASCII characters, so Path::isValid() should not reject paths with such characters in them. The attached patch removes the check from Path::isValid()."
patch by Benjamin Kramer!

llvm-svn: 75421
2009-07-12 19:01:16 +00:00
Chris Lattner
99ea095329 eraseFromDisk no longer throws.
llvm-svn: 75139
2009-07-09 16:17:28 +00:00
David Greene
87dbe0a3b5 Add an ExecuteNoWait interface to support asynchronous process spawning.
llvm-svn: 75055
2009-07-08 21:46:40 +00:00
Chris Lattner
54e86ad77c remove two methods that no longer exist.
llvm-svn: 74982
2009-07-08 01:07:39 +00:00
Chris Lattner
d28d16bc57 more getting windows to build.
llvm-svn: 74981
2009-07-08 00:52:12 +00:00
Chris Lattner
00c23b1d9e hopefully fix the build on windows.
llvm-svn: 74977
2009-07-08 00:29:32 +00:00
Chris Lattner
ccaba64332 Eliminate the static constructors and locks from DynamicLibrary.cpp.
This fixes PR4512 and eliminating static ctors is always good.  Losing
thread safety is unfortunate, but the code is just incredibly poorly
designed.

If someone is interested, the "right" solution is to split
DynamicLibrary.cpp into two separate pieces: a stateless piece in
libsystem, and a simple support file in libsupport that has the
"state" (e.g.  AddSymbol) in managed static objects.

Doing this would both fix memory leaks we already have, as well as make
the code thread safe again.  it would also make sense to move all the
unix specific code in System/DynamicLibrary.cpp into 
System/Unix/DynamicLibrary.inc.

llvm-svn: 74927
2009-07-07 18:17:07 +00:00
Chris Lattner
b11fca33f8 remove dead code, noone creates instances of "DynamicLibrary", so the ctor and dtor are dead.
llvm-svn: 74926
2009-07-07 18:01:58 +00:00
Chris Lattner
5d45e95584 we don't use libtool anymore, update comments.
llvm-svn: 74924
2009-07-07 17:50:11 +00:00
Owen Anderson
70fe80ea5e No need to double-include config.h
llvm-svn: 74854
2009-07-06 21:24:37 +00:00
Owen Anderson
8c9cecfed5 We need to include config.h to get the proper setting to LLVM_MULTITHREADED.
Patch by Xerxes Ranby.

llvm-svn: 74846
2009-07-06 18:50:47 +00:00
Chris Lattner
dc35f5434f improve portability to windows, patch by Xerces Ranby!
llvm-svn: 74835
2009-07-06 17:24:48 +00:00
Jeffrey Yasskin
b21c8333a6 Oops, I #included errno.h from inside the llvm::sys namespace.
llvm-svn: 74834
2009-07-06 16:50:27 +00:00
Duncan Sands
961ee9b54e Fix windows build, patch by Howard Su.
llvm-svn: 74697
2009-07-02 12:09:50 +00:00
Jeffrey Yasskin
29ea777c1e Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes the
Windows variant, strerror_s, but I couldn't test that.

I'll update configure and config.h.in in a subsequent patch.

llvm-svn: 74621
2009-07-01 18:11:20 +00:00
Owen Anderson
250c7e1a54 Try again at making this work on OpenBSD.
llvm-svn: 74612
2009-07-01 16:19:23 +00:00
Owen Anderson
a006b0212a Fix the build on OpenBSD.
llvm-svn: 74597
2009-07-01 06:53:29 +00:00
Oscar Fuentes
88c3197f7c Fixed assert that checks return value of TlsSetValue.
See http://msdn.microsoft.com/en-us/library/ms686818(VS.85).aspx

Patch by Olaf Krzikalla!

llvm-svn: 74526
2009-06-30 14:12:28 +00:00