diff options
| author | ruki <[email protected]> | 2025-12-19 13:48:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-19 13:48:46 +0800 |
| commit | 5df20ea1dafb3c19e95b8bcd2df6cbbbf03fde81 (patch) | |
| tree | d7554bec8522d1be9eb6e7e45953b1d8010bf522 /xmake/core | |
| parent | bbe585b9b8927d71f79f8c723110224e31348381 (diff) | |
| parent | 68be1c62a74322993a6b21f74476a716cb3a6963 (diff) | |
Merge pull request #7149 from xmake-io/rpath
Add rpath in binutils
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/base/binutils.lua | 10 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/binutils.lua | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/xmake/core/base/binutils.lua b/xmake/core/base/binutils.lua index af71e8ae7..5bed5de21 100644 --- a/xmake/core/base/binutils.lua +++ b/xmake/core/base/binutils.lua @@ -31,6 +31,7 @@ binutils._bin2macho = binutils._bin2macho or binutils.bin2macho 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._extractlib = binutils._extractlib or binutils.extractlib -- generate c/c++ code from the binary file @@ -111,6 +112,15 @@ function binutils.deplibs(binaryfile) end end +-- get rpath list from binary file (auto-detect format: ELF or Mach-O) +function binutils.rpath_list(binaryfile) + if binutils._rpath_list then + return binutils._rpath_list(binaryfile) + else + return nil, "binutils: internal rpath_list 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) diff --git a/xmake/core/sandbox/modules/import/core/base/binutils.lua b/xmake/core/sandbox/modules/import/core/base/binutils.lua index 11f432340..b7b8a1792 100644 --- a/xmake/core/sandbox/modules/import/core/base/binutils.lua +++ b/xmake/core/sandbox/modules/import/core/base/binutils.lua @@ -62,6 +62,16 @@ function sandbox_core_base_binutils.deplibs(binaryfile) end end +-- get rpath list from binary file (auto-detect format: ELF or Mach-O) +function sandbox_core_base_binutils.rpath_list(binaryfile) + local rpaths, errors = binutils.rpath_list(binaryfile) + if rpaths then + return rpaths + else + raise("rpath_list: %s", errors or "unknown errors") + end +end + -- extract static library to directory function sandbox_core_base_binutils.extractlib(libraryfile, outputdir, opt) local ok, errors = binutils.extractlib(libraryfile, outputdir, opt) |
