diff options
| author | ruki <[email protected]> | 2019-10-30 22:44:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-10-30 10:27:01 +0800 |
| commit | ef055ce4ca8ba96422488e115ab43a3fb981ea21 (patch) | |
| tree | a78a3e2b20a9c307bbe71fd2c810c0a53cc33fdf /xmake/modules/core/tools/gcc.lua | |
| parent | e51e92ebd5c96f88223556912c56bebf594d2432 (diff) | |
fix libunwind and link for windows
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 301f13ec3..1dffd8743 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -296,7 +296,7 @@ function nf_pcxxheader(self, pcheaderfile, target) end -- make the link arguments list -function linkargv(self, objectfiles, targetkind, targetfile, flags) +function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib local flags_extra = {} @@ -310,8 +310,20 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags) table.insert(flags_extra, "-Wl,--out-implib," .. os.args(path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib"))) end - -- make link args - return self:program(), table.join("-o", targetfile, objectfiles, flags, flags_extra) + -- init arguments + local argv = table.join("-o", targetfile, objectfiles, flags, flags_extra) + + -- too long arguments for windows? + if is_host("windows") then + opt = opt or {} + local args = os.args(argv) + if #args > 1024 and not opt.rawargs then + local argsfile = os.tmpfile(args) .. ".args.txt" + io.writefile(argsfile, args) + argv = {"@" .. argsfile} + end + end + return self:program(), argv end -- link the target file |
