Commit Graph

91 Commits

Author SHA1 Message Date
Chandler Carruth
f010c464a1 Sort the #include lines for tools/...
Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169252 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 10:44:52 +00:00
Rafael Espindola
fffb72470d libLTO has a bug in that it will keep every symbol if none is needed. We used
to hack around this in the gold plugin by deleting a module if no symbol was
needed. Unfortunately, the hack is wrong in the case of o module having no
visible symbols but still having side effects via static constructors.

The bug will have to be fixed in libLTO itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166745 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26 00:29:57 +00:00
Rafael Espindola
a16c2e3493 Pass -lLTO after gold-plugin.o so that it gets used in systems that default to
--as-needed.
Patch by Felix Geyer. Fixes pr13262.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27 03:03:07 +00:00
Rafael Espindola
4f81768d44 Use LTO_CODEGEN_PIC_MODEL_DYNAMIC for PIE. This requirest a git version of
gold to work. Since the enum value LDPO_PIE has just been added to plugin-api.h,
use a numeric constant for now so that we don't require an unreleased
version of gold to build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158402 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-13 13:30:24 +00:00
Dylan Noblesmith
9421406aad drop unneeded config.h includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147197 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-22 23:04:07 +00:00
Rafael Espindola
60e06d6ac2 Point to libLTO with -L/PATH/ -lLTO so that it is found in the install
directory.
Patch by Markus Trippelsdorf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145095 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-23 03:07:25 +00:00
Peter Collingbourne
5d0f76199b Use absolute path to exportsfile in gold plugin CMake build.
(Ninja generator requirement.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143783 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 04:17:20 +00:00
Daniel Dunbar
8c39c9647d build: Tidy up a bunch of tool Makefiles, and simplify where possible using the
new all-targets pseudo-component.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 19:27:24 +00:00
Ivan Krasin
71280b55a3 use 64-bit types instead of off_t/size_t to avoid the issue when
gold plugin is built with Large File Support (sizeof(off_t) == 64 on i686)
and the rest of LLVM is built w/o Large File Support
(sizeof(off_t) == 32 on i686) which corrupts the stack.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139873 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 23:13:00 +00:00
Ivan Krasin
ccb7c906d1 gold plugin: don't report error on non-bitcode (e.g. ELF) files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139544 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 21:47:50 +00:00
Ivan Krasin
c170f5f31c gold plugin: report errors occured in lto_module_create_from_*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 00:14:04 +00:00
Nick Lewycky
5e0ac58bef Don't try to dereference syms[0] on an empty vector. Reported by Todd Jackson
and Jeffrey Bosboom!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136066 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26 08:40:36 +00:00
Nick Lewycky
5d98c9ae71 Also remove -lLTO which should have been in r132349. I failed to apply this
from David Meyer's patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132352 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 20:00:45 +00:00
Nick Lewycky
471fa149d1 Make the gold plugin build on Cygwin as well as Linux. Patch by David Meyer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 19:53:26 +00:00
Oscar Fuentes
be5d9b0bdc CMake builds gold by default since revision 127466. This is
inconsistent with autoconf, which by default set BINUTILS_INCDIR to
empty and exclude gold from target list.

Based on a patch by Haitao Li!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131229 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-12 11:26:21 +00:00
Duncan Sands
2abb82b1d3 Remove an unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130860 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 19:13:01 +00:00
Rafael Espindola
e578252c27 If present, use gold's support for getting a file view. This prevents having
to map the file both in the linker and in the plugin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 21:11:00 +00:00
Rafael Espindola
6421a8815e Add a lto_codegen_compile_to_file to avoid producing a file, reading it to
memory and writing it back to disk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 20:57:13 +00:00
Rafael Espindola
f21b1058a1 Add support in the LTO library for loading an object from the middle
of an file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 00:36:11 +00:00
Oscar Fuentes
4839ded3bd Force re-linking of LLVMgold.so when its exports file changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127473 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 18:27:13 +00:00
Oscar Fuentes
aa1fbb40ad Fix processing of gold.exports.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127471 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 18:07:46 +00:00
Oscar Fuentes
1dc550b383 Add LTO and gold plugin to the CMake build. Linux-only, support for
other systems pending.

PR9456.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 15:44:24 +00:00
Rafael Espindola
d36fb9b5d4 Gold now rescans archives as needed, so the pass-through options are not
necessary anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126580 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 20:30:22 +00:00
Rafael Espindola
35358e02bb bfd was fixed, remove the work around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 20:15:37 +00:00
Rafael Espindola
981b1c4c62 LTO uses MC now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-26 16:44:13 +00:00
Rafael Espindola
8e04fc3adf Dispose modules early and only create codegen when the plugin is being
used by the linker and not by nm or ar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126089 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-20 18:28:29 +00:00
Rafael Espindola
37d42f8a50 Add modules to codegen as soon as possible. This reduces the link time
of libxul from 12m31.084s to 7m1.359s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 21:49:57 +00:00
Rafael Espindola
5a287d7a03 Add a debug obj-path option to make it easy to keep the .o produce by LTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125663 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 11:19:44 +00:00
Rafael Espindola
5d618ef7f1 Switch llvm to using comdats. For now always use groups with a single
section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 22:23:49 +00:00
Rafael Espindola
b4cc031a3e Don't open the file again in the gold plugin. To be able to do this, update
MemoryBuffer::getOpenFile to not close the file descriptor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:40:47 +00:00
Michael J. Spencer
8b1659e8bf gold: MinGW fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20 05:43:16 +00:00
Charles Davis
53ca1f3190 Now to chant the magical incantation that will exorcise the System library
from LLVM forever:

grep -lR "llvm/System" * | grep -v .svn | xargs sed -ie 's#llvm/System#llvm/Support#g'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 19:44:50 +00:00
Michael J. Spencer
3cc52ea33c I swear I did a make clean and make before committing all this...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:47:54 +00:00
Dan Gohman
e4f1a9b8a2 Move tool_output_file into its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 20:32:40 +00:00
NAKAMURA Takumi
49c193cc74 Don't build redundant libLLVMgold.a.
Building archive would be executed due to definition of BUILD_ARCHIVE,
even if BUILD_ARCHIVE = "0".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113578 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 06:26:57 +00:00
Nick Lewycky
59b4d2a371 Fix compile errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112808 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 05:44:31 +00:00
Dan Gohman
f29140106f Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111651 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 16:59:15 +00:00
Rafael Espindola
2d643ef328 Make it possible to set the cpu used for codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 00:15:13 +00:00
Rafael Espindola
98197e55c1 Make it possible to set the flags passed to the assembler.
Nick, please review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 18:55:09 +00:00
Rafael Espindola
15af387bff Fix silly bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 16:32:15 +00:00
Rafael Espindola
cbb170d057 Make it possible to set the target triple and expose that with an option in the
gold plugin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 21:09:46 +00:00
Rafael Espindola
53843f8edb s/libLLVMgold/LLVMgold/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110552 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-08 21:14:26 +00:00
Duncan Sands
51370298b8 Remove variables that are written by not read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 11:07:47 +00:00
Rafael Espindola
11f403cf2b Add an extra-library-path option to the plugin. This is used to support
having a library both as bitcode and native code. We want to use the
bitcode first, but if codegen produces new undefined references we have to use
the native code to satisfy those references.

Gold has no notion of bitcode and native search directories, so instead it has
an API where the plugin can instruct it to look for the libraries it is passing
to it. This patch uses that API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106674 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 20:20:59 +00:00
Rafael Espindola
bebb640b6b add_input_file and add_input_library now take const arguments, remove the
const_cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-21 02:23:12 +00:00
Rafael Espindola
dd76f18f90 Add a pass-through option to the plugin. The use case for this option is to
ask the linker to take another look into some library or object. The case when
one might want to do this is when codegen introduces a new undefined reference.
The canonical example is libgcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106303 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 19:18:58 +00:00
Rafael Espindola
38a979bf95 Don't produce output only if *all* files are unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-14 21:20:52 +00:00
Nick Lewycky
221aec60a7 Plug a leak in the non-error case by removing one level of indirection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105556 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 21:42:19 +00:00
Rafael Espindola
6c8099243a Misc cleanups to the gold plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 16:45:22 +00:00
Rafael Espindola
c4b55610d8 Add a emit-llvm option to the plugin and make the path argument to also-emit-llvm optional.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-03 21:11:20 +00:00