Commit Graph

20 Commits

Author SHA1 Message Date
Rafael Espindola
3fd7e37b34 Rewrite the gold plugin to fix pr19901.
There is a fundamental difference between how the gold API and lib/LTO view
the LTO process.

The gold API talks about a particular symbol in a particular file. The lib/LTO
API talks about a symbol in the merged module.

The merged module is then defined in terms of the IR semantics. In particular,
a linkonce_odr GV is only copied if it is used, since it is valid to drop
unused linkonce_odr GVs.

In the testcase in pr19901 both properties collide. What happens is that gold
asks us to keep a particular linkonce_odr symbol, but the IR linker doesn't
copy it to the merged module and we never have a chance to ask lib/LTO to keep
it.

This patch fixes it by having a more direct implementation of the gold API. If
it asks us to keep a symbol, we change the linkage so it is not linkonce. If it
says we can drop a symbol, we do so. All of this before we even send the module
to lib/Linker.

Since now we don't have to produce LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN,
during symbol resolution we can use a temporary LLVMContext and do lazy
module loading. This allows us to keep the minimum possible amount of
allocated memory around. This should also allow as much parallelism as
we want, since there is no shared context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216215 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 20:28:55 +00:00
Alexey Volkov
9316a78fdd Fix unresolved symbols when loading gold plugin
Differential Revision: http://reviews.llvm.org/D4275


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211675 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 08:04:58 +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
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
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
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
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
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
Rafael Espindola
bbe03f8d29 Avoid renaming loadable modules at install time. Now the gold plugin is named
LLVMgold.so both in both the build and install directories.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-16 03:13:23 +00:00
Dan Gohman
aa08c55e18 Create an exports file, so that the plugin only exports the onload symbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101431 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 00:43:25 +00:00
Chris Lattner
43b5f9312d make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-24 20:43:08 +00:00
Chris Lattner
e73a31f667 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94164 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 06:49:46 +00:00
Nick Lewycky
c469e9fd22 Fix Makefile to build correctly on Darwin. Patch by Sandeep Patel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 23:10:09 +00:00
Chris Lattner
929a49356e remove dead makefile flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 05:29:56 +00:00
Duncan Sands
10287438e1 Make sure the CXXFLAGS setting is picked up by
the common Makefile.  Not sure why this suddenly
started causing problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 04:00:00 +00:00
Nick Lewycky
dcd158af27 Force 'llvm-config' to go first, optionally followed by lto and gold mixed in
with the rest of the parallel directories.

Build lto when possible on all platforms. Make gold to explicitly depend on
libLTO.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 07:56:49 +00:00
Duncan Sands
7a2e7e5c20 Revert the previous commit. It seems it didn't
really solve the problem.  Also it changed the
name from libLLVMgold to LLVMgold (correcting
the name resulted in the original problem
suddenly reappearing).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 10:21:34 +00:00
Duncan Sands
105de28dab Stop llvm-config thinking that there are circular
dependencies between libraries due to __dso_handle
when doing "make install".  I don't know what the
LINK_COMPONENTS stuff is about, so I left it alone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 09:54:02 +00:00
Nick Lewycky
3e62b2dc93 Add LLVM plugin for gold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:13:24 +00:00