aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
Commit message (Collapse)AuthorAge
* Implement objc archiving in the crosstool. This involves a few steps:Gravatar Cal Peyser2016-08-12
| | | | | | | | | | | 1) In ExperimentalObjcLibrary, if static linking is required, signal CcLibraryHelper to create a static link action and pass in the necessary variables/link action input. 2) Add a new link type (Link.LinkTargetType.OBJC_STATIC_LIBRARY). This involves changes to Link and LinkCommandLine. 3) For this new link type, implement static linking the OSX CROSSTOOL. Also add tools in the crosstool package that point at libtool, which performs the archiving. -- MOS_MIGRATED_REVID=130022410
* Record the category of the artifact to be linked in LinkerInput.Gravatar Lukacs Berki2016-08-12
| | | | | | | | | It's currently only used for sanity checks, but the idea is that we'll use this field to decide what to do with a given linker input instead of inferring things from its file name. Also make artifact name creation a bit simpler by using the same set of variables for compiler and linker outputs. -- MOS_MIGRATED_REVID=129990944
* Add the repository name as a parameter to the output path functionsGravatar Kristina Chodorow2016-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't do anything yet, it's in preparation for the execroot rearranging change. The execroot will have one bazel-out per repo, so it'll look like: execroot/ repo1/ bazel-out/ local-fastbuild/ bin/ repo2/ bazel-out/ local-fastbuild/ bin/ genfiles/ repo3/ bazel-out/ local-fastbuild/ testlogs/ and so on. Thus, any output path (getBinDirectory() & friends) needs to know what the repo name is. This changes so many places in the code I thought it would be good to do separately, then just flip the functionality in the execroot-rearranging commit. While I was poking around, I changed all of the refs I could from getPackageRelativeArtifact() to getBin/GenfilesArtifact(), so that 1) rule implementation don't have to know as much about roots and 2) they'll be more isolated from other output dir changes. `bazel info` and similar just return roots for the main repository. The only "change" is passing around a target label in the Java rules. Continues work on #1262. -- MOS_MIGRATED_REVID=129985336
* Store non-code inputs to link actions separately.Gravatar Lukacs Berki2016-08-11
| | | | | | | | | | | | This is a re-submission of commit 99de0d07574f808fee36826289cb1f5c83e3b3e0 (rolled back in commit eff8b365c172b7e904ac6f7bba0c893fed7c91a8) and a few tweaks: - The fix for the bug that caused the rollback (see line 888 in CppModel.java -- we now use addNonCodeInputs() instead of addObjectFiles() to pass in the processed header tokens) - A few extra assertions - A test case - The re-submission of the parts of commit 603b540bbcd7414cd3e2c0b92c1c8985b035e41b that were also rolled back as collateral damage. The bug report didn't contain a precise reproduction, but the bug is trivial enough that I'm comfortable with things this way. -- MOS_MIGRATED_REVID=129872117
* Rollback of commit 99de0d07574f808fee36826289cb1f5c83e3b3e0.Gravatar Googler2016-08-10
| | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Makes blaze unable to build //third_party/stl IllegalArgumentException: complex.h.processed at com.google.common.base.Preconditions.checkArgument(Preconditions.java:127) at com.google.devtools.build.lib.util.Preconditions.checkArgument(Preconditions.java:38) at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.addObjectFile(CppLinkActionBuilder.java:831) NOT a clean rollback; conflict in one file (CppCompilationContext.java). So this also partially rolls back commit 603b540bbcd7414cd3e2c0b92c1c8985b035e41b (just the change in that file). *** Original change description *** Cleanup: store non-code inputs to link actions separately. -- MOS_MIGRATED_REVID=129798636
* Cleanup: store non-code inputs to link actions separately.Gravatar Lukacs Berki2016-08-10
| | | | | -- MOS_MIGRATED_REVID=129743936
* Extract CppLinkAction.Builder to its own top level class.Gravatar Cal Peyser2016-07-13
| | | | | -- MOS_MIGRATED_REVID=127221256
* RELNOTES: Use the correct build configuration for shared native deps during ↵Gravatar Googler2016-07-01
| | | | | | | Android split transitions. -- MOS_MIGRATED_REVID=126378169
* ThinLTO changes for upstreamed compiler implementation and other fixes to ↵Gravatar Googler2016-07-01
| | | | | | | | | | | blaze handling. - Converted to correct upstreamed options - Handling of bitcode when creating dynamic libraries - New LTOBackendAction derived from SpawnAction that discovers and adds the imported bitcode files identified by the LTO indexing step. -- MOS_MIGRATED_REVID=126344132
* If an action_config is given for a particular type of link action, use that ↵Gravatar Cal Peyser2016-06-01
| | | | | | | | | action_config to configure the build. Otherwise, revert to hard-coded behavior. This change is designed to provide backwards-compatible support for crosstools that describe platform-specific linking semantics. -- MOS_MIGRATED_REVID=123748494
* Make linkstamp info use NestedSet.Gravatar Manuel Klimek2016-05-25
| | | | | | | | Before this patch we would store expanded transitive include files in CcLinkParams. -- MOS_MIGRATED_REVID=123103815
* The link command line API can consume a feature configuration to configure ↵Gravatar Cal Peyser2016-05-19
| | | | | | | flags and environment variables. -- MOS_MIGRATED_REVID=122735641
* Action configs are activated like features (instead of being activated by ↵Gravatar Cal Peyser2016-05-11
| | | | | | | default). Action configs can imply features. -- MOS_MIGRATED_REVID=122032003
* Add mechanism to crosstool language to specify action-specific execution ↵Gravatar Cal Peyser2016-04-25
| | | | | | | requirements. Uses this mechanism to configure c/c++ compilation and linking for darwin execution from the crosstool. -- MOS_MIGRATED_REVID=120701108
* --Gravatar Michael Staib2016-04-21
| | | | MOS_MIGRATED_REVID=120353718
* Add mechanism to crosstool language to specify action-specific execution ↵Gravatar Cal Peyser2016-04-19
| | | | | | | requirements. Uses this mechanism to configure c/c++ compilation and linking for darwin execution from the crosstool. -- MOS_MIGRATED_REVID=120218079
* Move FDO support to the analysis phase by wrapping FdoSupport in its own ↵Gravatar Lukacs Berki2016-04-07
| | | | | | | | | | | SkyFunction. This removes one of the two reasons for the existence of BuildConfiguration#prepareToBuild() which makes implementing dynamic configurations impossible and also makes FDO support halfway sane; now FDO is exactly as ugly as remote repositories, that is to say, reasonably okay. Ideally, we'd implement the zip extraction as an Action and make it a TreeArtifact, but support for TreeArtifacts is not mature yet enough, so it's not possible at the moment. -- MOS_MIGRATED_REVID=119150223
* Make The Build Faster: Drop the describeStrategy() and strategyLocality() ↵Gravatar Philipp Wollermann2016-02-03
| | | | | | | | | methods, as we can simply pass an ActionStatusMessage to the EventBus instead. All SpawnActionContexts now send an appropriate message when they execute a Spawn. This also gets rid of the idiom that an Action knows which strategy will be used to execute it - this decision and knowledge belongs to the executor, not the action. -- MOS_MIGRATED_REVID=113731846
* Remove Constants.ALLOW_CC_INCLUDE_SCANNING and handle the logic in ↵Gravatar Philipp Wollermann2016-01-07
| | | | | | | CppSemantics instead. -- MOS_MIGRATED_REVID=111406721
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Retrieve Android native link flag features from the right toolchain.Gravatar Brian Silverman2015-11-19
| | | | | | | | | | | | | Previously, the feature-based flags for links of native code for Android were coming from the standard TARGET toolchain, which is wrong. This went unnoticed because Bazel's CROSSTOOL (and mine until recently) don't add any flags that way in either, which means getting the flags either way results in none. -- Change-Id: I74cd18ff56e3aea7ca61fabe62cb2246100ee59a Reviewed-on: https://bazel-review.googlesource.com/#/c/2322 MOS_MIGRATED_REVID=108234274
* bazel: support linking accumulated libraries into C++ binariesGravatar Googler2015-11-06
| | | | | | | | | | | | | This CL permits a cc_binary to have a set of dependencies that are all gathered together when the cc_binary is linked, producing a set of LibraryToLink objects to link into the cc_binary. Each such dependency will an instance of a class that extends BuildLibraryToLink to a CcLinkParams. All instances of the same class will be gathered together. At link time the BuildLibraryToLink method buildLibraries will be called to build the LibraryToLink objects. -- MOS_MIGRATED_REVID=107242331
* Allow C++ compile actions to run in a sandbox by replacing the ↵Gravatar Philipp Wollermann2015-10-27
| | | | | | | | | LocalGccStrategy / LocalLinkStrategy with SpawnGccStrategy / SpawnLinkStrategy. RELNOTES: C++ compile actions run in a sandbox now on systems that support sandboxed execution. -- MOS_MIGRATED_REVID=106299043
* LTO: Don't choke on cc_library without srcs.Gravatar Han-Wen Nienhuys2015-10-12
| | | | | -- MOS_MIGRATED_REVID=105204997
* Collect .o files compiled from C(++), and skip the rest for the LTO backend ↵Gravatar Han-Wen Nienhuys2015-10-07
| | | | | | | | | | step. This should make ThinLTO work with .o files that are not generated by compiling C++ in a cc_library() -- MOS_MIGRATED_REVID=104764111
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Fix some warnings.Gravatar Ulf Adams2015-09-04
| | | | | -- MOS_MIGRATED_REVID=102332437
* Code cleanupGravatar Laurent Le Brun2015-09-03
| | | | | -- MOS_MIGRATED_REVID=102239051
* Clean up the link command action code a bit.Gravatar Ulf Adams2015-08-27
| | | | | -- MOS_MIGRATED_REVID=101568873
* Abstract away artifact creation in CppLinkAction so that we can create most ↵Gravatar Lukacs Berki2015-08-24
| | | | | | | | | of the artifacts in a way that checks that they are under the package directory. The exception is nativedeps, whose link actions are shared, and thus they cannot be at a package-specific location. -- MOS_MIGRATED_REVID=101216949
* Patch the PATH for linker on Windows, in the same way as for compiler.Gravatar Dmitry Lomov2015-08-12
| | | | | -- MOS_MIGRATED_REVID=100368051
* Experimental support LLVM ThinLTO.Gravatar Han-Wen Nienhuys2015-08-11
| | | | | | | | | | | | | | | | | | | | | | ThinLTO is a Link Time Opimization strategy, where the inlining step operates on LLVM intermediate code, and is sharded across multiple compiler invocations, so they can be parallelized. For more information, see http://llvm.org/devmtg/2015-04/slides/ThinLTO_EuroLLVM2015.pdf Using this features requires an experimental LLVM toolchain, with the following stanza in CROSSTOOL feature { name: "thin_lto" flag_set { action: "c-compile" action: "c++-compile" flag_group { flag: "-Xclang-only=-Wno-inconsistent-missing-override" flag: "-flto" flag: "-O2" } } } -- MOS_MIGRATED_REVID=100269776
* Use pic mode for cc_fake_binary if pic actions are used for binaries.Gravatar Manuel Klimek2015-08-05
| | | | | | | | | | | | | | | | | | | | | To allow the commands in the cc_fake_binary to work with modules (which is a precondition to writing nocompile tests for modules), we need to create header modules in the same pic/nopic mode as the rest of the commandline indicates. There are two ways to resolve this problem: a) Make cc_fake_binary use the same pic mode as other binaries. b) Make sure fake compile actions get all their inputs in non-pic mode. This patch proposes solution a), as that makes sure cc_fake_binary is as close to the actual compilation going on as possible; for example, if we decide to always use pic in the future, this will simply work; additionally, we will currently get more test coverage through different compilation modes. RELNOTES: 'cc_fake_binary' uses the same pic/nopic mode as other binaries. -- MOS_MIGRATED_REVID=99902738
* Remove all calls to AnalysisEnvironment.getDerivedArtifact() from the C++ ↵Gravatar Lukacs Berki2015-08-04
| | | | | | | | | | | | rules that can be removed. What is left: - The outputs of ExtractInclusionsAction. I think this action is shared between multiple rules that have the same generated file in srcs, so this call site is legitimate. - Creating the solib symlinks. This is not a shared action, but these need to be in the same directory so that the RPATH is not too long, so we must live with this for the time being. - FDO, which is beyond salvation. The artifacts under the FDO root don't really conform to the usual "only under the package directory" convention. -- MOS_MIGRATED_REVID=99551394
* Refactor C++ link action creation.Gravatar Ulf Adams2015-07-27
| | | | | | | | | Remove an unnecessary intermediate method in CcBinary and provide a helper method in CcLinkAction.Builder that simplifies several call sites that just want to add CcLinkParams to the link action. -- MOS_MIGRATED_REVID=99172303
* Setup FDO command-line options via feature configurations.Gravatar Googler2015-06-25
| | | | | -- MOS_MIGRATED_REVID=96835732
* Move split/no-split command-line decision to CppLinkAction.Gravatar Han-Wen Nienhuys2015-06-18
| | | | | -- MOS_MIGRATED_REVID=96301836
* Migrate C++ link action .params files to the Blaze-standard ↵Gravatar Eric Fellheimer2015-06-15
| | | | | | | | | | | ParameterFileWriteAction. Performance changes: - output files of actions require an extra system call + incremental builds no longer require re-writing the .param file (typically) -- MOS_MIGRATED_REVID=95842983
* Redirect the getBuildInfo method calls through RuleContext.Gravatar Ulf Adams2015-04-23
| | | | | | | | This simplifies the callers and we get better consistency - the getBuildInfo must use matching AnalysisEnvironment and RuleContext objects. -- MOS_MIGRATED_REVID=91815339
* Convert ResourceSet ctor calls to factory methodGravatar Mark Schaller2015-02-20
| | | | | | | | | | Most current invocations of the ResourceSet constructor shouldn't care about any new dimensions we add to restrict test execution. This change allows us to make those changes, keep the ResourceSet ctor symmetrical, and avoid contaminating those ctor call sites with noise. -- MOS_MIGRATED_REVID=86826112
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957