diff options
| author | ruki <[email protected]> | 2024-05-11 16:11:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-05-11 16:11:10 +0800 |
| commit | 6b447fe2a874c79cc681daf8c7d934ad10da7a22 (patch) | |
| tree | 2772c2a11f3b804c921982f06ec4564bf3219c83 /xmake/rules/c++/build_optimization | |
| parent | 32bb7f1cfaa79fdd12ca24d4f46ec8cb57143ee5 (diff) | |
load lto plugin
Diffstat (limited to 'xmake/rules/c++/build_optimization')
| -rw-r--r-- | xmake/rules/c++/build_optimization/config.lua | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/xmake/rules/c++/build_optimization/config.lua b/xmake/rules/c++/build_optimization/config.lua index f252f78c7..357c3cf76 100644 --- a/xmake/rules/c++/build_optimization/config.lua +++ b/xmake/rules/c++/build_optimization/config.lua @@ -21,28 +21,6 @@ -- imports import("core.tool.compiler") import("core.project.project") -import("lib.detect.find_file") - --- get liblto_plugin.so path of gcc -function _get_gcc_liblto_plugin_path(target, gcc) - local cachekey = "lto_plugin_" .. gcc - local plugin_path = target:data(cachekey) - if plugin_path == nil then - local outdata = try { function() return os.iorunv(gcc, {"-print-prog-name=lto-wrapper"}) end } - if outdata then - local lto_plugindir = path.directory(outdata:trim()) - if os.isdir(lto_plugindir) then - if is_host("windows") then - plugin_path = find_file("liblto_plugin*.dll", lto_plugindir) - else - plugin_path = find_file("liblto_plugin.so", lto_plugindir) - end - end - end - target:data_set(cachekey, plugin_path or false) - end - return plugin_path or nil -end -- add lto optimization function _add_lto_optimization(target, sourcekind) @@ -70,13 +48,6 @@ function _add_lto_optimization(target, sourcekind) target:add("ldflags", "-flto") target:add("shflags", "-flto") - -- @see https://github.com/xmake-io/xmake/issues/5015 - -- add lto_plugin.so to ar - local lto_plugin = _get_gcc_liblto_plugin_path(target, program) - if lto_plugin then - target:add("arflags", {"--plugin", lto_plugin}, {force = true, expand = false}) - end - -- to use the link-time optimizer, -flto and optimization options should be specified at compile time and during the final link. -- @see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html local optimize = target:get("optimize") |
