summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-27 17:09:33 +0800
committerruki <[email protected]>2024-04-27 17:09:33 +0800
commitf2be7ce1227e0214aa6cd4a245dc92048e2290c1 (patch)
tree6f5ff4d1ba4429412499e6c483fc176e0612e159
parenteab39cddb2fef56e3c5e716ff0bcb9c9b3a5bc3a (diff)
fix old gcc/ar for lto #3015
-rw-r--r--xmake/modules/core/tools/gcc_ar.lua22
-rw-r--r--xmake/toolchains/cross/load.lua3
-rw-r--r--xmake/toolchains/cross/xmake.lua9
3 files changed, 24 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/gcc_ar.lua b/xmake/modules/core/tools/gcc_ar.lua
new file mode 100644
index 000000000..ecfdca92a
--- /dev/null
+++ b/xmake/modules/core/tools/gcc_ar.lua
@@ -0,0 +1,22 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file gcc_ar.lua
+--
+
+inherit("ar")
+
diff --git a/xmake/toolchains/cross/load.lua b/xmake/toolchains/cross/load.lua
index dc0fd1b12..9ee9adc99 100644
--- a/xmake/toolchains/cross/load.lua
+++ b/xmake/toolchains/cross/load.lua
@@ -41,7 +41,8 @@ function main(toolchain)
toolchain:add("toolset", "as", cross .. "gcc", cross .. "clang")
toolchain:add("toolset", "ld", cross .. "g++", cross .. "gcc", cross .. "clang++", cross .. "clang")
toolchain:add("toolset", "sh", cross .. "g++", cross .. "gcc", cross .. "clang++", cross .. "clang")
- toolchain:add("toolset", "ar", cross .. "ar")
+ -- old gcc need gcc-ar for lto, @see https://github.com/xmake-io/xmake/issues/5015
+ toolchain:add("toolset", "gcc-ar", cross .. "gcc-ar", "ar", cross .. "ar")
toolchain:add("toolset", "ranlib", cross .. "ranlib")
toolchain:add("toolset", "strip", cross .. "strip")
diff --git a/xmake/toolchains/cross/xmake.lua b/xmake/toolchains/cross/xmake.lua
index 1e694e2b3..5c0ac0d1f 100644
--- a/xmake/toolchains/cross/xmake.lua
+++ b/xmake/toolchains/cross/xmake.lua
@@ -18,17 +18,8 @@
-- @file xmake.lua
--
--- define toolchain
toolchain("cross")
-
- -- set description
set_description("Common cross compilation toolchain")
-
- -- mark as cross-compilation toolchain
set_kind("cross")
-
- -- check toolchain
on_check("check")
-
- -- load toolchain
on_load("load")