summaryrefslogtreecommitdiff
path: root/tools/lto
Commit message (Collapse)AuthorAge
* Don't force the build of toos/lto as a static lib.Rafael Espindola2014-06-27
| | | | | | | | Any uses of tools/lto as a static lib should probably move to lib/LTO. This was also never implemented in the configure build, so this reduces the differences among the two. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211852 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused includes following r211294Alp Toker2014-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211297 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the c++ APIs.Rafael Espindola2014-06-19
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211294 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix gcc -pedantic warning in lto.cpp.Patrik Hagglund2014-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207959 91177308-0d34-0410-b5e6-96231b3b80d8
* Move LTOModule and LTOCodeGenerator to the llvm namespace.Rafael Espindola2014-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207911 91177308-0d34-0410-b5e6-96231b3b80d8
* Style update: don't duplicate comments, they were getting out of sync.Rafael Espindola2014-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207909 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an -mattr option to the gold plugin to support subtarget features in LTOTom Roeder2014-04-25
| | | | | | | | | | | | This adds support for an -mattr option to the gold plugin and to llvm-lto. This allows the caller to specify details of the subtarget architecture, like +aes, or +ssse3 on x86. Note that this requires a change to the include/llvm-c/lto.h interface: it adds a function lto_codegen_set_attr and it increments the version of the interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207279 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Reapply "LTO: add API to set strategy for -internalize""Duncan P. N. Exon Smith2014-04-02
| | | | | | | | | | | This reverts commit r199244. Conflicts: include/llvm-c/lto.h include/llvm/LTO/LTOCodeGenerator.h lib/LTO/LTOCodeGenerator.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205471 91177308-0d34-0410-b5e6-96231b3b80d8
* Centralize the handling of install_name and rpath.Rafael Espindola2014-02-28
| | | | | | | | | | | This centralizes the Makefile handling of -install_name and -rpath. It also moves the cmake build to using @rpath. The reason being that libclang needs it, and it works for everything else. A followup patch will move clang to using this and then there will be a single point to edit to support other systems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202499 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] llvm-c/lto.h should be installed if libLTO.a is built.NAKAMURA Takumi2014-02-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201859 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] libLTO: Use (SHARED|STATIC) to build both shared LTO and LTO_static.NAKAMURA Takumi2014-02-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201856 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor TargetOptions initialization into a single place.Eli Bendersky2014-02-19
| | | | | | | | | | | | | | The same code (~20 lines) for initializing a TargetOptions object from CodeGen cmdline flags is duplicated 4 times in 4 different tools. This patch moves it into a utility function. Since the CodeGen/CommandFlags.h file defines cl::opt flags in a header, it's a bit of a touchy situation because we should only link them into tools. So this patch puts the init function in the header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201699 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO API: add lto_module_create_from_memory_with_path.Manman Ren2014-02-10
| | | | | | | | | | | | | | This function adds an extra path argument to lto_module_create_from_memory. The path argument will be passed to makeBuffer to make sure the MemoryBuffer has a name and the created module has a module identifier. This is mainly for emitting warning messages from the linker. When we emit warning message on a module, we can use the module identifier. rdar://15985737 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201114 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r200560, "LTO itself hasn't depended on MCDisassembler any more."NAKAMURA Takumi2014-01-31
| | | | | | Oh sorry, I missed LTO.exports, ... I checked just only *.cpp(s). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200562 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO itself hasn't depended on MCDisassembler any more.NAKAMURA Takumi2014-01-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200560 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding new LTO APIs to parse metadata nodes and extract linker options andYunzhong Gao2014-01-21
| | | | | | | | | | dependent libraries from a bitcode module. Differential Revision: http://llvm-reviews.chandlerc.com/D2343 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199759 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r199361: Now, the sanitizer got the changeQuentin Colombet2014-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199362 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Modify lto.exports to force the sanitizer to rebuilt LTO.exportsQuentin Colombet2014-01-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199361 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Add a hook to map LLVM diagnostics into the clients of LTO.Quentin Colombet2014-01-15
| | | | | | | | | | | | | | | | | | | | Add a hook in the C API of LTO so that clients of the code generator can set their own handler for the LLVM diagnostics. The handler is defined like this: typedef void (*lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t severity, const char *diag, void *ctxt) - severity says how bad this is. - diag is a string that contains the diagnostic message. - ctxt is the registered context for this handler. This hook is more general than the lto_get_error_message, since this function keeps only the latest message and can only be queried when something went wrong (no warning for instance). <rdar://problem/15517596> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199338 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "LTO: add API to set strategy for -internalize"Duncan P. N. Exon Smith2014-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reapply r199191, reverted in r199197 because it carelessly broke Other/link-opts.ll. The problem was that calling createInternalizePass("main") would select createInternalizePass(bool("main")) instead of createInternalizePass(ArrayRef<const char *>("main")). This commit fixes the bug. The original commit message follows. Add API to LTOCodeGenerator to specify a strategy for the -internalize pass. This is a new attempt at Bill's change in r185882, which he reverted in r188029 due to problems with the gold linker. This puts the onus on the linker to decide whether (and what) to internalize. In particular, running internalize before outputting an object file may change a 'weak' symbol into an internal one, even though that symbol could be needed by an external object file --- e.g., with arclite. This patch enables three strategies: - LTO_INTERNALIZE_FULL: the default (and the old behaviour). - LTO_INTERNALIZE_NONE: skip -internalize. - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden visibility. LTO_INTERNALIZE_FULL should be used when linking an executable. Outputting an object file (e.g., via ld -r) is more complicated, and depends on whether hidden symbols should be internalized. E.g., for ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and LTO_INTERNALIZE_HIDDEN can be used otherwise. However, LTO_INTERNALIZE_FULL is inappropriate, since the output object file will eventually need to link with others. lto_codegen_set_internalize_strategy() sets the strategy for subsequent calls to lto_codegen_write_merged_modules() and lto_codegen_compile*(). <rdar://problem/14334895> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199244 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r199191, "LTO: add API to set strategy for -internalize"NAKAMURA Takumi2014-01-14
| | | | | | Please update also Other/link-opts.ll, in next time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199197 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: add API to set strategy for -internalizeDuncan P. N. Exon Smith2014-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add API to LTOCodeGenerator to specify a strategy for the -internalize pass. This is a new attempt at Bill's change in r185882, which he reverted in r188029 due to problems with the gold linker. This puts the onus on the linker to decide whether (and what) to internalize. In particular, running internalize before outputting an object file may change a 'weak' symbol into an internal one, even though that symbol could be needed by an external object file --- e.g., with arclite. This patch enables three strategies: - LTO_INTERNALIZE_FULL: the default (and the old behaviour). - LTO_INTERNALIZE_NONE: skip -internalize. - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden visibility. LTO_INTERNALIZE_FULL should be used when linking an executable. Outputting an object file (e.g., via ld -r) is more complicated, and depends on whether hidden symbols should be internalized. E.g., for ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and LTO_INTERNALIZE_HIDDEN can be used otherwise. However, LTO_INTERNALIZE_FULL is inappropriate, since the output object file will eventually need to link with others. lto_codegen_set_internalize_strategy() sets the strategy for subsequent calls to lto_codegen_write_merged_modules() and lto_codegen_compile*(). <rdar://problem/14334895> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199191 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-sort #include lines again, prior to moving headers around.Chandler Carruth2014-01-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199080 91177308-0d34-0410-b5e6-96231b3b80d8
* EXPORTED_SYMBOL_FILE support for cmakeNico Weber2013-12-28
| | | | | | | | | | | | | | The cmake build didn't support EXPORTED_SYMBOL_FILE. Instead, it had a Windows-only implementation in tools/lto/CMakeLists.txt, a linux-only implementation in tools/gold/CMakeLists.txt, and a darwin-only implementation in tools/clang/tools/libclang/CMakeLists.txt. This attempts to consolidate these one-offs into a single place. Clients can now just set LLVM_EXPORTED_SYMBOL_FILE and things (hopefully) Just Work, like in the make build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198136 91177308-0d34-0410-b5e6-96231b3b80d8
* Strip dead code when linking by default with BFD ld (linux, ...) and ld64 ↵Nico Weber2013-12-27
| | | | | | | | | | | | | | | (os x). This reduces the size of clang-format from 22 MB to 1.8 MB, diagtool goes from 21 MB to 2.8 MB, libclang.so goes from 29 MB to 20 MB, etc. The size of the bin/ folder shrinks from 270 MB to 200 MB. Targets that support plugins and don't already use EXPORTED_SYMBOL_FILE (which libclang and libLTO already do) can set NO_DEAD_STRIP to opt out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198087 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Add MCDisassembler to tools/lto. (has been removed since r196908)NAKAMURA Takumi2013-12-10
| | | | | | lto.exports really exports LLVM-C Disasm stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196911 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196908 91177308-0d34-0410-b5e6-96231b3b80d8
* Change libLTO back to linking with @executable_path instead of @rpath.Bob Wilson2013-11-11
| | | | | | | This partially reverts r187641 until ld64 adopts a change to link with an rpath setting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194418 91177308-0d34-0410-b5e6-96231b3b80d8
* Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list".Rafael Espindola2013-10-31
| | | | | | | | | | | | | | | | | | | | | | There are two ways one could implement hiding of linkonce_odr symbols in LTO: * LLVM tells the linker which symbols can be hidden if not used from native files. * The linker tells LLVM which symbols are not used from other object files, but will be put in the dso symbol table if present. GOLD's API is the second option. It was implemented almost 1:1 in llvm by passing the list down to internalize. LLVM already had partial support for the first option. It is also very similar to how ld64 handles hiding these symbols when *not* doing LTO. This patch then * removes the APIs for the DSO list. * marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr global values and other linkonce_odr whose address is not used. * makes the gold plugin responsible for handling the API mismatch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193800 91177308-0d34-0410-b5e6-96231b3b80d8
* lto.h: Use lto_bool_t instead of int to restore the ABIReid Kleckner2013-10-24
| | | | | | | | | | | | This reverts commit r193255 and instead creates an lto_bool_t typedef that points to bool, _Bool, or unsigned char depending on what is available. Only recent versions of MSVC provide a stdbool.h header. Reviewers: rafael.espindola Differential Revision: http://llvm-reviews.chandlerc.com/D2019 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193377 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-c/lto.h: Avoid use of bool.NAKAMURA Takumi2013-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193255 91177308-0d34-0410-b5e6-96231b3b80d8
* Only modify lto.exports.def when contents have changed.Rafael Espindola2013-10-08
| | | | | | Patch by Greg Bedwell. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192182 91177308-0d34-0410-b5e6-96231b3b80d8
* Add lto_codegen_add_dso_symbol to the export list.Rafael Espindola2013-10-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191970 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize linkonce_odr unnamed_addr functions during LTO.Rafael Espindola2013-10-03
| | | | | | | | | | | Generalize the API so we can distinguish symbols that are needed just for a DSO symbol table from those that are used from some native .o. The symbols that are only wanted for the dso symbol table can be dropped if llvm can prove every other dso has a copy (linkonce_odr) and the address is not important (unnamed_addr). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191922 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix option parsing in the gold plugin.Rafael Espindola2013-10-02
| | | | | | | | | This was broken when options were moved up in r191680. No test because this is specific LLVMgold.so/libLTO.so. Patch by Tom Roeder! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191829 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable building LTO on WIN32.Rafael Espindola2013-10-02
| | | | | | | | | Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with MSVC and Mingw as well as re-enabling the associated test. Patch by Greg Bedwell! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191823 91177308-0d34-0410-b5e6-96231b3b80d8
* Move command line options to the users of libLTO. Fixes --enable-shared build.Rafael Espindola2013-09-30
| | | | | | Patch by Richard Sandiford. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191680 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Enable building LTO on WIN32."Rafael Espindola2013-09-30
| | | | | | | | | | This reverts commit r191670. It was causing build failures on the msvc bots: http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/5166/steps/compile/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191679 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable building LTO on WIN32.Rafael Espindola2013-09-30
| | | | | | | | | Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with MSVC and Mingw as well as re-enabling the associated test. Patch by Greg Bedwell! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191670 91177308-0d34-0410-b5e6-96231b3b80d8
* Move LTO support library to a component, allowing it to be testedPeter Collingbourne2013-09-24
| | | | | | more reliably across platforms. Patch by Tom Roeder! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191343 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix LTO handling of module-level assembly (PR14152).Peter Collingbourne2013-09-19
| | | | | | Patch by Tom Roeder! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191042 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Fix the LTO tool, after my API breakage.Joey Gouly2013-09-12
| | | | | | | Thanks to Zonr Chang! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190602 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename some variables to match the style guide.Rafael Espindola2013-09-04
| | | | | | I am about to patch this code, and this makes the diff far more readable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189982 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename variables to match the style guide and clang-format.Rafael Espindola2013-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189962 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 189297, the original commit message is following. Shuxin Yang2013-08-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---- Add new API lto_codegen_compile_parallel(). This API is proposed by Nick Kledzik. The semantic is: -------------------------------------------------------------------------- Generate code for merged module into an array of native object files. On success returns a pointer to an array of NativeObjectFile. The count parameter returns the number of elements in the array. Each element is a pointer/length for a generated mach-o/ELF buffer. The buffer is owned by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, or lto_codegen_compile() is called again. On failure, returns NULL (check lto_get_error_message() for details). extern const struct NativeObjectFile* lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count); --------------------------------------------------------------------------- This API is currently only called on OSX platform. Linux or other Unixes using GNU gold are not supposed to call this function, because on these systems, object files are fed back to linker via disk file instead of memory buffer. In this commit, lto_codegen_compile_parallel() simply calls lto_codegen_compile() to return a single object file. In the near future, this function is the entry point for compilation with partition. Linker can blindly call this function even if partition is turned off; in this case, compiler will return only one object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189386 91177308-0d34-0410-b5e6-96231b3b80d8
* Add new API lto_codegen_compile_parallel().Shuxin Yang2013-08-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API is proposed by Nick Kledzik. The semantic is: -------------------------------------------------------------------------- Generate code for merged module into an array of native object files. On success returns a pointer to an array of NativeObjectFile. The count parameter returns the number of elements in the array. Each element is a pointer/length for a generated mach-o/ELF buffer. The buffer is owned by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, or lto_codegen_compile() is called again. On failure, returns NULL (check lto_get_error_message() for details). extern const struct NativeObjectFile* lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count); --------------------------------------------------------------------------- This API is currently only called on OSX platform. Linux or other Unixes using GNU gold are not supposed to call this function, because on these systems, object files are fed back to linker via disk file instead of memory buffer. In this commit, lto_codegen_compile_parallel() simply calls lto_codegen_compile() to return a single object file. In the near future, this function is the entry point for compilation with partition. Linker can blindly call this function even if partition is turned off; in this case, compiler will return only one object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189297 91177308-0d34-0410-b5e6-96231b3b80d8
* CMake: move lto.h install to tools/lto/CMakeLists.txtHans Wennborg2013-08-26
| | | | | | It looked misplaced in the main CMakeLists.txt file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189230 91177308-0d34-0410-b5e6-96231b3b80d8
* lto/CMakeLists.txt: Cut the dep to intrinsics_gen. LTO doesn't depend on it ↵NAKAMURA Takumi2013-08-23
| | | | | | and LTO_static doesn't depend on anything. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189086 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r188188 and r188200.Shuxin Yang2013-08-12
| | | | | | | | | In order to appease people (in Apple) who accuse me for committing "huge change" (?) without proper review. Thank Eric for fixing a compile-warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188204 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix warning about unused member.Eric Christopher2013-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188200 91177308-0d34-0410-b5e6-96231b3b80d8