summaryrefslogtreecommitdiff
path: root/xmake/core/base/binutils.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-19 23:59:04 +0800
committerruki <[email protected]>2025-12-19 23:59:04 +0800
commitb6f59585662d051459b6660d397a9b41941738da (patch)
tree1b362ffdbff61bb01bda8260f117799c22144472 /xmake/core/base/binutils.lua
parentdee8082d12241d69cf370c7f566c48c0ca8827bd (diff)
improve rpath
Diffstat (limited to 'xmake/core/base/binutils.lua')
-rw-r--r--xmake/core/base/binutils.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/xmake/core/base/binutils.lua b/xmake/core/base/binutils.lua
index 5bed5de21..9258f99a3 100644
--- a/xmake/core/base/binutils.lua
+++ b/xmake/core/base/binutils.lua
@@ -32,6 +32,9 @@ binutils._bin2elf = binutils._bin2elf or binutils.bin2elf
binutils._readsyms = binutils._readsyms or binutils.readsyms
binutils._deplibs = binutils._deplibs or binutils.deplibs
binutils._rpath_list = binutils._rpath_list or binutils.rpath_list
+binutils._rpath_insert = binutils._rpath_insert or binutils.rpath_insert
+binutils._rpath_remove = binutils._rpath_remove or binutils.rpath_remove
+binutils._rpath_clean = binutils._rpath_clean or binutils.rpath_clean
binutils._extractlib = binutils._extractlib or binutils.extractlib
-- generate c/c++ code from the binary file
@@ -121,6 +124,33 @@ function binutils.rpath_list(binaryfile)
end
end
+-- insert rpath to binary file (auto-detect format: ELF or Mach-O)
+function binutils.rpath_insert(binaryfile, rpath)
+ if binutils._rpath_insert then
+ return binutils._rpath_insert(binaryfile, rpath)
+ else
+ return false, "binutils: internal rpath_insert not supported!"
+ end
+end
+
+-- remove rpath from binary file (auto-detect format: ELF or Mach-O)
+function binutils.rpath_remove(binaryfile, rpath)
+ if binutils._rpath_remove then
+ return binutils._rpath_remove(binaryfile, rpath)
+ else
+ return false, "binutils: internal rpath_remove not supported!"
+ end
+end
+
+-- clean rpaths from binary file (auto-detect format: ELF or Mach-O)
+function binutils.rpath_clean(binaryfile)
+ if binutils._rpath_clean then
+ return binutils._rpath_clean(binaryfile)
+ else
+ return false, "binutils: internal rpath_clean not supported!"
+ end
+end
+
-- extract static library to directory
-- Supports AR format (.a) and MSVC lib format (.lib)
-- @param libraryfile the static library file path (.a or .lib)