summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-29 22:53:01 +0800
committerruki <[email protected]>2022-12-29 22:53:01 +0800
commit5c6c01df191f9f59a32d2a392a9c04c225e9e792 (patch)
tree244607c19745c0f48fe96d7c32a8f882decad5f4 /xmake/modules/core/tools/gcc.lua
parentde6ac8dde75789da3164494cda26d0c402551d99 (diff)
improve rpath
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 8d8c67835..ba4723d86 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -283,10 +283,14 @@ end
function nf_rpathdir(self, dir)
dir = path.translate(dir)
if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
- return {"-Wl,-rpath=" .. (dir:gsub("@[%w_]+", function (name)
+ local flags = {"-Wl,-rpath=" .. (dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
end))}
+ if self:is_plat("bsd") then
+ table.insert(flags, 1, "-Wl,-zorigin")
+ end
+ return flags
elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir, "ldflags") then
return {"-Xlinker", "-rpath", "-Xlinker", (dir:gsub("%$ORIGIN", "@loader_path"))}
end