Commit Graph

76 Commits

Author SHA1 Message Date
Misha Brukman
008248f2c0 Linker.h moved to include/llvm/Support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14351 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-23 17:33:09 +00:00
Chris Lattner
681692da43 Make gccld copy the llvm-stub program to be the execution wrapper for
bytecode files on win32 systems.  We keep the shell script on unix systems
because it is much more transparent for the users and supports -load
options.

This allows llvmgcc work correctly on win32 systems without the -native or
-native-cbe options.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13946 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-02 00:53:57 +00:00
Chris Lattner
0ebee7410f Move some functions out of gccld.cpp to GenerateCode.cpp. This allows us
to reduce the inter-file interface in the gccld tool and gets some
uninteresting code out of gccld.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13942 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-02 00:22:24 +00:00
Chris Lattner
7e88d418bb Refactor a bit of code into a function, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13941 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-02 00:10:19 +00:00
Chris Lattner
bed85ff010 Header file moved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13813 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 05:41:36 +00:00
Brian Gaeke
7532e34537 Allow the user to set the LLVMINTERP environment variable as a workaround, for
when they have to run a gccld shell script without having lli in their path.
This is intended to address Bug 289.

Also, emit the traditional syntax ${1+"$@"} for passing all of a shell script's
args to a subprocess. If you have arguments that have spaces in them, $* will
not preserve the quoting (i.e., the quoted string "foo bar" as an argument will
end up as two arguments "foo" "bar" to lli.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13414 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-07 21:47:36 +00:00
Chris Lattner
69e8d282bf Add a new gccld -native-cbe option which causes gccld to generate native code
for the application with the C backend instead of the native LLVM code generator


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12698 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 16:43:13 +00:00
Chris Lattner
364d1203e7 Make sure to print a stack trace whenever an error signal is delivered to
the tool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11633 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 20:32:39 +00:00
John Criswell
aa2a47d813 Added the -h option for compatibility with other linkers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10335 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-09 15:39:11 +00:00
Chris Lattner
9e6f686559 Fix compatibility with gcc 3.4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10262 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-29 19:45:47 +00:00
Misha Brukman
0d2459a49f I'm gonna be picky and say we don't really need that trailing slash "lib/"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10196 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-24 05:31:57 +00:00
Misha Brukman
3e15c7a976 Make sure we ONLY add a `-load' switch to the JIT command line if the file is
verified as having an ELF header. This fixes PR151.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10195 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-24 05:29:42 +00:00
Misha Brukman
3e25f2e1be When writing out the runner script, add -load=<lib> lines to pull in all the
shared objects automagically, so it doesn't have to be done by hand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10114 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 19:08:42 +00:00
Misha Brukman
9839969110 * Doxygenified comments, simplifying them and shortening in the process
* Eliminated extra space


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10104 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-20 06:21:54 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Brian Gaeke
00cc86a8fc Do not assume the first file is a bytecode file. Instead, construct a dummy
Module and link things into that.

Also, fix a typo in an error message.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9748 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 22:13:00 +00:00
Chris Lattner
fe32bf5d0d Make -r work, fixing PR 91
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9724 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 06:05:21 +00:00
Chris Lattner
fd35c6417d If linking a library, do not link other libraries, like libc, into it!
This fixes lots of annoying warnings and error messages


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9677 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-03 17:27:17 +00:00
Brian Gaeke
7c7a3a2d7f lli -q is history. Rebuild your gccld shell scripts, folks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9494 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-24 20:00:06 +00:00
Chris Lattner
1dd27b157b fix file header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9294 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 17:58:43 +00:00
John Criswell
7c0e022c5c Added copyright header to all C++ source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9291 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 17:47:21 +00:00
Misha Brukman
cf00c4ab3b Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9027 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-10 17:57:28 +00:00
Misha Brukman
e97fbed83a * Ordered includes according to LLVM style
* Put function signatures on one line if possible
* Deleted empty comment lines (^//$)
* Deleted braces around single statements
* Deleted space between function call and argument list


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8775 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 17:59:25 +00:00
Brian Gaeke
e98ddfce7e 1. Use better error messages in LinkFiles().
2. I think the caller of LinkFiles() should not ignore a true return value.
   (If you have a good reason why it ought to, feel free to revert
   this. It's just something that's been bugging me for a while.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8760 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 14:03:48 +00:00
Chris Lattner
6e271236a5 Minor cleanups:
* Local header file goes at top
 * Remove unneeded #includes
 * Wrap code at 80 columns
 * Declare variables where they are used
 * 'register' is not needed
 * Use 'unsigned' instead of 'int' variables where possible


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8657 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-22 20:21:34 +00:00
John Criswell
71478b7f72 Removed linking functionality from gccld.cpp and moved it to linker.cpp.
Renamed functions that were all lower-case.
Moved functions from util.cpp into linker.cpp or gccld.cpp.
Removed util.h and created gccld.h.
Refactored the linker functionality in linker.cpp so that it is easier to
follow, easier to modify, and it's library/object file search behavior is
easier to understand and document.
Added code to include library paths when doing native linking, but this
causes problems and is currently #ifdef'd out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8609 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-19 20:24:23 +00:00
John Criswell
dc0de4f07b Refactored gccld into three C++ source files.
Added code ignore bytecode link failures when generating native code.
Moved native code and bytecode generation out of the main() function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8595 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-18 16:22:26 +00:00
John Criswell
a589d31faa Replaced the call to strdup() with a new operator followed by a strcpy().
This should prevent calls to the new oerator and malloc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8587 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-17 19:14:41 +00:00
John Criswell
83ca6ec8a3 Added the use of the const keyword.
Have gccld find the path to llc and gcc instead of having the library do it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8586 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-17 19:04:22 +00:00
John Criswell
621727c29e Removed the use of the environ variable and instead use the environment array
passed into main().  This may (or may not) be more portable, but it looks
nicer.
Added functions to copy the environment array and modify the copy, thus
preserving the environment.
Switched from using system() to using ExecWait().
The code now removes the assembly file generated when using the -native option.
Fixed the remove_env() function: The previous revision truncated the
environment variable list.  This version just zaps the variable as intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8579 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-17 15:20:51 +00:00
John Criswell
dabaf7de39 Added the -native option.
With this option, gccld links the program into LLVM bytecode and a native code
binary.  This allows llvmgcc to correctly tell GNU configure scripts when
things aren't defined properly (because the native link will fail).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8570 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-16 21:27:35 +00:00
Brian Gaeke
5c9cd9564f -abort-on-exception is gone. Rebuild your gccld shell scripts, folks! :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8368 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 19:23:03 +00:00
John Criswell
22edc39046 Added code that makes the bytecode file readable (needed by the generated shell
script).
Removed the use of sys/types.h and sys/stat.h.
Modified FileExists() so that it uses the access() system call to check for
file existance.  This requires less header files and might even be a tad bit
faster.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8328 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-02 21:11:22 +00:00
John Criswell
d35b5b542d Modified the code so that it uses the MakeFileExecutable() method. The new
library code now adds all execute bits that are allowed by the umask value to
the file's current permission bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8325 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-02 20:17:20 +00:00
John Criswell
3a9ce67289 "Help keep our secrets secret."
Added code to respect the umask value.  Before, files were generated world
readable, which may not be desirable for all installations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8215 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-29 14:46:12 +00:00
Chris Lattner
a2b2dc9795 add preliminary support for -export-dynamic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8058 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-22 19:18:45 +00:00
Misha Brukman
c1fdca8045 Make the bytecode file executable as well for LLEE purposes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7992 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-20 20:38:15 +00:00
Chris Lattner
ad6ba3e071 Revert my last (accidental) checkin, but keep the typeo fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7879 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-15 04:56:47 +00:00
Chris Lattner
80df4638fe rename selection library to selectiondag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7878 91177308-0d34-0410-b5e6-96231b3b80d8
2003-08-15 04:56:09 +00:00
Chris Lattner
dc52353833 Run the simplify CFG pass after instcombine which has the effect of deleting
ALL of the global ctor/dtor stuff if it is not used!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6916 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:29:50 +00:00
Chris Lattner
293a33a911 Move the instcombine pass before globaldce, so that if globals are made dead by instcombine, that they can be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6910 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 04:32:31 +00:00
Chris Lattner
dccb6d017b Funcresolve no longer performs nicification of resolved functions
instcombine does this


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6787 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 17:03:51 +00:00
Chris Lattner
a34f440f69 Add new DAE pass to gccld. It does not add cause any regressions in the test-suite
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6770 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 16:29:02 +00:00
Chris Lattner
e68e4d59e8 Fix formatting in file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6398 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 15:13:15 +00:00
Chris Lattner
6ac79d115e Add compatibility option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6354 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 19:15:11 +00:00
Brian Gaeke
69a79600cb gccld.cpp:
Fix typo in header.
 Add IsArchive static method.
 Roll LoadLibraryFromDirectory() into LoadLibrary(), and factor
  LoadLibraryExactName() out of the result. Instead of treating the current
  directory specially, just insert it into LibPaths in the beginning of
  main().
 Make LoadLibrary() take a "search" flag that says whether to search for the
  correct library, or just trust that LibName is right.
 Make LinkLibrary() take a "search" flag, and pass it to LoadLibrary().
 Change the for-loop over InputFilenames to detect ar archives and link them
  in as libraries without searching.
 Change the for-loop over Libraries to explicitly turn on the "search" flag
  to LinkLibrary() that makes LoadLibrary() search for the correct library
  (i.e., when processing -lNAME options.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6316 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-23 20:27:07 +00:00
Chris Lattner
7cb77e188f Search LLVM_LIB_SEARCH_PATH for objects to allow it to find crtend.o
Implement minor library linking optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6181 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-13 22:14:13 +00:00
Chris Lattner
9c3b55ea9f Make sure to create a target data that matches the Module's target properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5904 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-24 19:13:02 +00:00
Chris Lattner
d34a51dbbe Add support for allowing the user to extend the GCCLD searchpath
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5825 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-21 19:53:24 +00:00
Chris Lattner
c65b104309 Eliminate useless duplicate libraries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5823 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-19 23:07:33 +00:00