diff options
author | Dan Albert <danalbert@google.com> | 2018-04-26 12:57:52 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2018-05-02 15:08:52 -0700 |
commit | 2491b2c04a3ad4f58ef8bff3c68e0d0cd4b4a5fb (patch) | |
tree | e53e847b3801ba69836270d63444264184dedea3 /build/tools | |
parent | a2589fbc537e37bb0e933a1b26313ec11635812e (diff) | |
download | ndk-2491b2c04a3ad4f58ef8bff3c68e0d0cd4b4a5fb.tar.gz |
Generate a libc++ linker script per API level.
In r19 we'll end up having roughly the same thing, but the scripts
will be in the sysroot.
Test: ./checkbuild.py
Bug: https://github.com/android-ndk/ndk/issues/672
Change-Id: Ica3f1a3d220939da2c2da9d73d6a3d4151d9df14
Diffstat (limited to 'build/tools')
-rwxr-xr-x | build/tools/make_standalone_toolchain.py | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py index 6ac758584..d70042806 100755 --- a/build/tools/make_standalone_toolchain.py +++ b/build/tools/make_standalone_toolchain.py @@ -305,19 +305,6 @@ def get_dest_libdir(dst_dir, triple, abi): return dst_libdir -def fix_linker_script(path): - """Remove libandroid_support from the given linker script. - - See https://github.com/android-ndk/ndk/issues/672 or the comment in - copy_libcxx_libs for more details. - """ - with open(path, 'r+') as script: - contents = script.read() - script.seek(0) - script.write(contents.replace('-landroid_support', '')) - script.truncate() - - def copy_libcxx_libs(src_dir, dst_dir, abi, api): shutil.copy2(os.path.join(src_dir, 'libc++_shared.so'), dst_dir) shutil.copy2(os.path.join(src_dir, 'libc++_static.a'), dst_dir) @@ -339,22 +326,11 @@ def copy_libcxx_libs(src_dir, dst_dir, abi, api): # Unlike the other STLs, also copy libc++.so (another linker script) over # as libstdc++.so. Since it's a linker script, the linker will still get # the right DT_NEEDED from the SONAME of the actual linked object. - shutil.copy2(os.path.join(src_dir, 'libc++.a'), + shutil.copy2(os.path.join(src_dir, 'libc++.a.{}'.format(api)), os.path.join(dst_dir, 'libstdc++.a')) - shutil.copy2(os.path.join(src_dir, 'libc++.so'), + shutil.copy2(os.path.join(src_dir, 'libc++.so.{}'.format(api)), os.path.join(dst_dir, 'libstdc++.so')) - # TODO: Find a better fix for r18. - # https://github.com/android-ndk/ndk/issues/672 - # The linker scripts in the NDK distribution are not correct for LP32 API - # 21+. In this case, rewrite the linker script to not link - # libandroid_support. We do this rather than generating our own linker - # scripts to avoid issues of updating one template and forgetting the - # other. - if '64' not in abi and api >= 21: - fix_linker_script(os.path.join(dst_dir, 'libstdc++.a')) - fix_linker_script(os.path.join(dst_dir, 'libstdc++.so')) - def create_toolchain(install_path, arch, api, gcc_path, clang_path, platforms_path, host_tag): |