summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-02-23 00:23:38 +0800
committerruki <[email protected]>2018-02-22 20:21:48 +0800
commit0c051195985a1f43311d1d29c756a6b02531799d (patch)
tree90fb8da1f5dbc79485cfd5f96d34499429eb7f27
parent658c0ccdc65b63658a21735b21f806923f2fa70b (diff)
fix strip all bug for clang/macho
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/modules/core/tools/clang.lua18
-rw-r--r--xmake/modules/core/tools/gcc.lua14
3 files changed, 16 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b191f12a..80e04bd7f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
* Fix force to add flags bug
* [#157](https://github.com/tboox/xmake/issues/157): Fix generate pdb file error if it's output directory does not exists
+* Fix strip all symbols bug for macho target file
## v2.1.9
@@ -443,6 +444,7 @@
* 修复无法通过`add_ldflags("xx", "xx", {force = true})`强制设置多个flags的问题
* [#157](https://github.com/tboox/xmake/issues/157): 修复pdb符号输出目录不存在情况下编译失败问题
+* 修复对macho格式目标strip all符号失效问题
## v2.1.9
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua
index 29e28cc9d..692fc559c 100644
--- a/xmake/modules/core/tools/clang.lua
+++ b/xmake/modules/core/tools/clang.lua
@@ -35,22 +35,4 @@ function init(self)
_super._g.cxflags = {"-Qunused-arguments"}
_super._g.mxflags = {"-Qunused-arguments"}
_super._g.asflags = {"-Qunused-arguments"}
-
- -- init flags map
- _super._g.mapflags["-s"] = "-Wl,-S"
- _super._g.mapflags["-S"] = "-Wl,-S"
-end
-
--- make the strip flag
-function nf_strip(self, level)
-
- -- the maps
- local maps =
- {
- debug = "-Wl,-S"
- , all = "-Wl,-S"
- }
-
- -- make it
- return maps[level]
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index d25a0b9ea..963517af0 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -67,6 +67,13 @@ function init(self)
, ["-S"] = "-S"
}
+ -- for macho target
+ local plat = config.plat()
+ if plat == "macosx" or plat == "iphoneos" then
+ _g.mapflags["-s"] = "-Wl,-x"
+ _g.mapflags["-S"] = "-Wl,-S"
+ end
+
-- init buildmodes
_g.buildmodes =
{
@@ -91,6 +98,13 @@ function nf_strip(self, level)
, all = "-s"
}
+ -- for macho target
+ local plat = config.plat()
+ if plat == "macosx" or plat == "iphoneos" then
+ maps.all = "-Wl,-x"
+ maps.debug = "-Wl,-S"
+ end
+
-- make it
return maps[level]
end