aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/conf/linkers/ld.conf7
-rw-r--r--build/scripts/link_lib.py70
-rw-r--r--contrib/libs/openssl/ar.pyplugin73
-rw-r--r--contrib/libs/openssl/redef.h2
-rw-r--r--contrib/libs/openssl/ya.make11
5 files changed, 81 insertions, 82 deletions
diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf
index 2aa0f93b60..79006c21ab 100644
--- a/build/conf/linkers/ld.conf
+++ b/build/conf/linkers/ld.conf
@@ -354,13 +354,6 @@ _LD_LINK_LIB_EXTRA_INPUT=
_LD_TAIL_LINK_LIB=$AUTO_INPUT $_LD_LINK_LIB_EXTRA_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"}
_LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN -- $_LD_ARCHIVER_KV_PLUGIN --
-when ($MAPSMOBI_BUILD_TARGET == "yes") {
- _LD_ARCHIVER+= "no-openssl3"
-}
-otherwise {
- _LD_ARCHIVER+= "enable-openssl3"
-}
-
_LD_LIB_GENERATE_MF=$GENERATE_MF &&
when ($TIDY == "yes") {
_LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT --output-file
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:])
diff --git a/contrib/libs/openssl/ar.pyplugin b/contrib/libs/openssl/ar.pyplugin
new file mode 100644
index 0000000000..29d7e55c30
--- /dev/null
+++ b/contrib/libs/openssl/ar.pyplugin
@@ -0,0 +1,73 @@
+#!/usr/bin/env python3
+
+from __future__ import print_function
+
+import os
+import sys
+import subprocess
+
+
+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__':
+ rename_syms(os.path.dirname(sys.argv[3]) + '/', sys.argv[1])
diff --git a/contrib/libs/openssl/redef.h b/contrib/libs/openssl/redef.h
index 2044bcacf0..259b2124fd 100644
--- a/contrib/libs/openssl/redef.h
+++ b/contrib/libs/openssl/redef.h
@@ -1,6 +1,6 @@
#pragma once
-#if !defined(OPENSSL_BUILD) && !defined(_MSC_VER) && !defined(OPENSSL_DONT_ADD_VERSION_PREFIX)
+#if !defined(OPENSSL_BUILD) && defined(OPENSSL_RENAME_SYMBOLS)
#define a2d_ASN1_OBJECT v1_a2d_ASN1_OBJECT
#define a2i_ASN1_ENUMERATED v1_a2i_ASN1_ENUMERATED
#define a2i_ASN1_INTEGER v1_a2i_ASN1_INTEGER
diff --git a/contrib/libs/openssl/ya.make b/contrib/libs/openssl/ya.make
index 7d8ecf86fb..70c95e4732 100644
--- a/contrib/libs/openssl/ya.make
+++ b/contrib/libs/openssl/ya.make
@@ -48,12 +48,11 @@ ADDINCL(
CFLAGS(-DOPENSSL_BUILD=1)
-IF (EXPORT_CMAKE)
- CFLAGS(GLOBAL -DOPENSSL_DONT_ADD_VERSION_PREFIX)
-ENDIF()
-
-IF (MAPSMOBI_BUILD_TARGET)
- CFLAGS(GLOBAL -DOPENSSL_DONT_ADD_VERSION_PREFIX)
+IF (EXPORT_CMAKE OR OS_WINDOWS OR MAPSMOBI_BUILD_TARGET)
+ # DO NOT RENAME
+ELSE()
+ AR_PLUGIN(ar)
+ CFLAGS(GLOBAL -DOPENSSL_RENAME_SYMBOLS=1)
ENDIF()
IF (NOT EXPORT_CMAKE OR NOT OPENSOURCE_REPLACE_OPENSSL)