aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/link_lib.py
diff options
context:
space:
mode:
authorpg <pg@yandex-team.com>2025-02-12 10:51:53 +0300
committerpg <pg@yandex-team.com>2025-02-12 11:12:16 +0300
commitfdebd34b580c0027c5fd658f8591736840f41ad5 (patch)
tree2582409f65282fc3da23aa1762a67e41006415eb /build/scripts/link_lib.py
parent68ee082e0346a833fb5a5dcead60e46e8801c52b (diff)
downloadydb-fdebd34b580c0027c5fd658f8591736840f41ad5.tar.gz
simplify after
commit_hash:4d91c6379cf9f4b3a49a60b7500e1d8f809ad712
Diffstat (limited to 'build/scripts/link_lib.py')
-rw-r--r--build/scripts/link_lib.py70
1 files changed, 2 insertions, 68 deletions
diff --git a/build/scripts/link_lib.py b/build/scripts/link_lib.py
index b792540fd0..5db51d7c69 100644
--- a/build/scripts/link_lib.py
+++ b/build/scripts/link_lib.py
@@ -25,9 +25,8 @@ class Opts(object):
self.llvm_ar_format = args[2]
self.build_root = args[3]
self.plugin = args[4]
- self.enable_openssl3 = args[5]
- self.output = args[6]
- auto_input = args[7:]
+ self.output = args[5]
+ auto_input = args[6:]
self.need_modify = False
self.extra_args = []
@@ -66,68 +65,6 @@ def get_opts(args):
return Opts(args)
-def run(*args):
- return subprocess.check_output(list(args), shell=False).strip()
-
-
-def gen_renames_1(d):
- for l in d.split('\n'):
- l = l.strip()
-
- if ' ' in l:
- yield l.split(' ')[-1]
-
-
-def have_prefix(l, p):
- for x in l:
- if not x.startswith(p):
- return False
-
- return True
-
-
-def gen_renames_2(p, d):
- l = list(gen_renames_1(d))
- a = have_prefix(l, '_')
-
- for s in l:
- if 'asan_globals' in s:
- continue
-
- if s in ['HMAC', 'SHA1', 'SHA256', 'SHA256', 'SHA512', 'RC4', 'MD5', 'SHA384']:
- continue
-
- if a and s[1:] in ['HMAC', 'SHA1', 'SHA256', 'SHA256', 'SHA512', 'RC4', 'MD5', 'SHA384']:
- continue
-
- if a:
- yield s + ' _' + p + s[1:]
- else:
- yield s + ' ' + p + s
-
-
-def gen_renames(p, d):
- return '\n'.join(gen_renames_2(p, d)).strip() + '\n'
-
-
-def rename_syms(where, ret):
- p = 'v1_'
-
- # find symbols to rename
- syms = run(where + 'llvm-nm', '--extern-only', '--defined-only', '-A', ret)
-
- # prepare rename plan
- renames = gen_renames(p, syms)
- tmp = ret + '.syms'
-
- with open(tmp, 'w') as f:
- f.write(renames)
-
- # rename symbols
- run(where + 'llvm-objcopy', '--redefine-syms=' + tmp, ret)
- os.unlink(tmp)
-
-
if __name__ == "__main__":
opts = get_opts(sys.argv[1:])
@@ -176,8 +113,5 @@ if __name__ == "__main__":
if exit_code != 0:
raise Exception('{0} returned non-zero exit code {1}. Stop.'.format(' '.join(cmd), exit_code))
- if opts.enable_openssl3 != 'no-openssl3' and os.path.basename(opts.output) in ['libcontrib-libs-openssl.a', 'liblibs-openssl-crypto.a']:
- rename_syms(os.path.dirname(opts.archiver) + '/', opts.output)
-
if opts.ar_plugin:
subprocess.check_call([sys.executable, opts.ar_plugin, opts.output, '--'] + sys.argv[1:])