未验证 提交 4227e8ca 编写于 作者: O openharmony_ci 提交者: Gitee

!537 修复emutls问题

Merge pull request !537 from dhy308/gl-fix_emutls
......@@ -2094,6 +2094,7 @@ musl_src_porting_file = [
"src/exit/atexit.c",
"crt/arm/crti.s",
"crt/aarch64/crti.s",
"crt/crtplus.c",
"ldso/ld_log.h",
"ldso/namespace.c",
"ldso/ns_config.c",
......
......@@ -210,6 +210,7 @@ template("musl_libs") {
"${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/crtn.s",
"${target_out_dir}/${musl_ported_dir}/crt/Scrt1.c",
"${target_out_dir}/${musl_ported_dir}/crt/crt1.c",
"${target_out_dir}/${musl_ported_dir}/crt/crtplus.c",
"${target_out_dir}/${musl_ported_dir}/crt/rcrt1.c",
]
......@@ -590,12 +591,28 @@ template("musl_libs") {
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/crt1.o",
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/rcrt1.o",
]
outputs = [ "${root_build_dir}/obj/third_party/musl/${_libs_out_dir}/{{source_file_part}}" ]
ldpath = []
if (is_mac) {
ldpath += [ "${clang_base_path}/bin/ld64.lld" ]
} else if (is_win) {
ldpath += [ "${clang_base_path}/bin/lld-link.exe" ]
} else {
ldpath += [ "${clang_base_path}/bin/ld.lld" ]
}
args = [
"--input",
"{{source}}",
]
args += [ "--output" ] + rebase_path(outputs, root_build_dir)
args += [ "--ldpath" ] + rebase_path(ldpath, root_build_dir)
args += [ "--crtplus" ] + rebase_path(
[ "${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/crtplus.o" ],
root_build_dir)
deps = [ ":soft_musl_crt" ]
}
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
__attribute__((weak, visibility("hidden")))
void __emutls_unregister_key(void)
{
}
__attribute__((destructor(0)))
static void __on_dlclose_late(void)
{
__emutls_unregister_key();
}
\ No newline at end of file
......@@ -3,8 +3,17 @@
import os
import sys
import argparse
import subprocess
from shutil import copy
def exec_command(cmd, log_path='out/build.log', **kwargs):
process = subprocess.Popen(cmd)
process.wait()
ret_code = process.returncode
if ret_code != 0:
raise Exception("{} failed, return code is {}".format(cmd, ret_code))
def musl_copy_file(src, dest):
dest_dir = os.path.dirname(dest)
if not os.path.exists(dest_dir):
......@@ -24,9 +33,23 @@ def main():
help = 'The output directory',
metavar = 'FILE')
parser.add_argument('--ldpath',
required = True,
help = 'The ld file path',
metavar = 'FILE')
parser.add_argument('--crtplus',
required = True,
help = 'The crtplus file path',
metavar = 'FILE')
args = parser.parse_args()
musl_copy_file(args.input, args.output)
if os.path.basename(args.input) == 'crtn.o':
ldargs = [args.ldpath, "-r", args.input, args.crtplus, "-o", args.output]
exec_command(ldargs)
else:
musl_copy_file(args.input, args.output)
if __name__ == "__main__":
sys.exit(main())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册