diff options
author | pg <pg@yandex-team.com> | 2025-02-26 19:22:42 +0300 |
---|---|---|
committer | pg <pg@yandex-team.com> | 2025-02-26 19:48:05 +0300 |
commit | 5a3aa70af58a490cada682b229eef368bd42340c (patch) | |
tree | 1b31107d99ee400f1ee96f3cd53a8bc88b5a7709 /build/scripts/go_tool.py | |
parent | 95821e1fe9a744181bc40019b20bfba422c8bb5c (diff) | |
download | ydb-5a3aa70af58a490cada682b229eef368bd42340c.tar.gz |
implement golang ld plugins
commit_hash:fb3ab9a0d420c781eb07bf3f791ba1f3fc1f2353
Diffstat (limited to 'build/scripts/go_tool.py')
-rw-r--r-- | build/scripts/go_tool.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/build/scripts/go_tool.py b/build/scripts/go_tool.py index e866468d1c..f7c4a19f9e 100644 --- a/build/scripts/go_tool.py +++ b/build/scripts/go_tool.py @@ -525,12 +525,7 @@ def do_link_exe(args): cmd.append('-extld={}'.format(args.extld)) if args.extldflags is not None: - filter_musl = bool - if args.musl: - cmd.append('-linkmode=external') - extldflags.append('-static') - filter_musl = lambda x: x not in ('-lc', '-ldl', '-lm', '-lpthread', '-lrt') - extldflags += [x for x in args.extldflags if filter_musl(x)] + extldflags.extend(args.extldflags) cgo_peers = [] if args.cgo_peers is not None and len(args.cgo_peers) > 0: is_group = args.targ_os == 'linux' @@ -545,6 +540,10 @@ def do_link_exe(args): except ValueError: extldflags.extend(cgo_peers) if len(extldflags) > 0: + for p in args.ld_plugins: + res = subprocess.check_output([sys.executable, p, sys.argv[0]] + extldflags, cwd=args.build_root).decode().strip() + if res: + extldflags = json.loads(res)[1:] cmd.append('-extldflags={}'.format(' '.join(extldflags))) cmd.append(compile_args.output) call(cmd, args.build_root) @@ -850,6 +849,7 @@ if __name__ == '__main__': parser.add_argument('++test_srcs', nargs='*') parser.add_argument('++xtest_srcs', nargs='*') parser.add_argument('++cover_info', nargs='*') + parser.add_argument('++ld_plugins', nargs='*') parser.add_argument('++output', nargs='?', default=None) parser.add_argument('++source-root', default=None) parser.add_argument('++build-root', required=True) @@ -881,7 +881,6 @@ if __name__ == '__main__': parser.add_argument('++vet-flags', nargs='*', default=None) parser.add_argument('++vet-info-ext', default=vet_info_ext) parser.add_argument('++vet-report-ext', default=vet_report_ext) - parser.add_argument('++musl', action='store_true') parser.add_argument('++skip-tests', nargs='*', default=None) parser.add_argument('++ydx-file', default='') parser.add_argument('++debug-root-map', default=None) |