本文整理汇总了Python中build_options.OPTIONS.is_i686方法的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS.is_i686方法的具体用法?Python OPTIONS.is_i686怎么用?Python OPTIONS.is_i686使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类build_options.OPTIONS
的用法示例。
在下文中一共展示了OPTIONS.is_i686方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _generate_libgcc_ninja
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_i686 [as 别名]
def _generate_libgcc_ninja():
# Currently, we need to generate libgcc.a only for Bare Metal mode.
if not OPTIONS.is_bare_metal_build():
return
# TODO(crbug.com/283798): Build libgcc by ourselves.
rule_name = 'generate_libgcc'
n = ninja_generator.NinjaGenerator(rule_name)
if OPTIONS.is_i686():
# We use libgcc.a in Android NDK for Bare Metal mode as it is
# compatible with Bionic.
orig_libgcc = ('third_party/ndk/toolchains/x86-4.6/prebuilt/'
'linux-x86/lib/gcc/i686-linux-android/4.6/libgcc.a')
# This libgcc has unnecessary symbols such as __CTORS__ in
# _ctors.o. We define this symbol in crtbegin.o, so we need to
# remove this object from the archive.
# Functions in generic-morestack{,-thread}.o and morestack.o are not
# needed if one is not using split stacks and it interferes with our
# process emulation code.
remove_object = ('_ctors.o generic-morestack.o generic-morestack-thread.o '
'morestack.o')
elif OPTIONS.is_arm():
# NDK's libgcc.a is not compatible with Bare Metal mode because
# Android NDK does not use -mfloat-abi=hard. We just use libgcc
# from Goobuntu.
# TODO(crbug.com/340598): Check if we can use NDK's libgcc.a if we
# decide to use softfp.
orig_libgcc = os.path.join(
ninja_generator.get_libgcc_installed_dir_for_bare_metal(), 'libgcc.a')
# This object depends on some glibc specific symbols around
# stdio. As no objects in libgcc.a use _eprintf, we can simply
# remove this object.
remove_object = '_eprintf.o'
n.rule(rule_name,
command=('cp $in $out.tmp && ar d $out.tmp %s && mv $out.tmp $out' %
remove_object),
description=rule_name + ' $out')
n.build(ninja_generator.get_libgcc_for_bare_metal(), rule_name, orig_libgcc)
示例2: _filter_libc
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_i686 [as 别名]
def _filter_libc(vars):
if vars.is_static():
return False
vars.get_sources().remove('android/bionic/libc/bionic/pthread_debug.cpp')
vars.get_sources().extend([
'android/bionic/libc/arch-nacl/bionic/atexit.c',
'android/bionic/libc/arch-nacl/syscalls/clock_nanosleep.c',
'android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c',
'android/bionic/libc/arch-nacl/syscalls/nanosleep.c',
'android/bionic/libc/arch-nacl/syscalls/sched_yield.c',
'android/bionic/libc/arch-nacl/tmp/libc_stubs.c',
'android/bionic/libc/string/rindex.c'
])
if OPTIONS.is_i686():
vars.get_sources().append(
'android/bionic/libc/arch-x86/bionic/setjmp.S')
if OPTIONS.is_x86_64():
vars.get_sources().append(
'android/bionic/libc/arch-amd64/bionic/setjmp.S')
vars.get_includes().insert(0, 'android/bionic/libc/arch-amd64/include')
if OPTIONS.is_arm():
vars.get_sources().append(
'android/bionic/libc/arch-arm/bionic/setjmp.S')
# Remove the sources that contain the functions we implement.
vars.get_sources().remove(
'android/bionic/libc/arch-arm/bionic/atexit_legacy.c')
if OPTIONS.is_bare_metal_build():
# TODO(crbug.com/319020): Use Bare Metal IRT instead of
# calling a syscall directly.
vars.get_sources().extend([
'android/bionic/libc/arch-arm/bionic/_setjmp.S',
'android/bionic/libc/arch-arm/bionic/sigsetjmp.S',
'android/bionic/libc/arch-nacl/syscalls/cacheflush.c'])
vars.get_includes().append('android/bionic/libc/arch-nacl/syscalls')
vars.get_implicit_deps().extend([build_common.get_bionic_crtbegin_so_o(),
build_common.get_bionic_crtend_o()])
# This looks weird libc depends on libdl, but the upstream
# bionic also does the same thing. Note that libdl.so just has
# stub functions and their actual implementations are in the
# loader (see third_party/android/bionic/linker/dlfcn.c).
vars.get_shared_deps().append('libdl')
vars.get_whole_archive_deps().append('libc_bionic')
vars.get_whole_archive_deps().append('libc_freebsd')
vars.get_whole_archive_deps().append('libc_netbsd')
# We do not support stack protector on NaCl, but NDK may require a
# symbol in this file. So, we always link this.
vars.get_whole_archive_deps().append('libbionic_ssp')
vars.get_whole_archive_deps().append('libc_tzcode')
# Let dlmalloc not use sbrk as NaCl Bionic does not provide brk/sbrk.
vars.get_cflags().append('-DHAVE_MORECORE=0')
_remove_unnecessary_defines(vars)
if OPTIONS.is_arm():
# libc/upstream-dlmalloc/malloc.c checks "linux" to check if
# mremap is available, which we do not have. We need this fix
# only for Bare Metal ARM because NaCl toolchain does not
# define "linux" and Android undefines "linux" by default for
# x86 (android/build/core/combo/TARGET_linux-x86.mk).
vars.get_cflags().append('-Ulinux')
vars.get_generator_args()['is_system_library'] = True
if OPTIONS.is_arm():
# Set False to 'link_crtbegin' because Android.mk for libc.so
# compiles android/bionic/libc/arch-arm/bionic/crtbegin_so.c by
# default with -DCRT_LEGACY_WORKAROUND to export the __dso_handle
# symbol.
#
# __dso_handle is passed to __cxa_atexit so that libc knows which
# atexit handler belongs to which module. In general, __dso_handle
# should be a private symbol. Otherwise, a module (say A) can
# depend on __dso_handle in another module (B), and the atexit
# handler in A will not be called when the module A is unloaded.
#
# However, it seems the old version of Android had a bug and
# __dso_handle was exposed. Several NDKs depend on __dso_handle
# in libc.so. To execute such binaries directly, we need to define
# a public __dso_handle, too. This effectively means atexit
# handlers in such NDKs will never be called, as we will never
# unload libc.so. This is a known upstream issue. See
# third_party/android/bionic/ABI-bugs.txt.
#
# Note it is OK not to have crtbegin_so.o as the first object when
# we link libc.so because we are using init_array/fini_array,
# which do not require specific watchdogs, for ARM.
vars.get_generator_args()['link_crtbegin'] = False
return True
示例3: _filter_libc_common
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_i686 [as 别名]
def _filter_libc_common(vars):
sources = vars.get_sources()
_remove_assembly_source(sources)
# libc_common is used from both the loader and libc.so. Functions
# which are necessary for the bionic loader must be in this list.
sources.extend([
# TODO(crbug.com/243244): If possible, move arch-nacl/ files into a
# separate archive and build them with -Werror.
'android/bionic/libc/arch-nacl/bionic/__get_sp.c',
'android/bionic/libc/arch-nacl/bionic/__set_tls.c',
'android/bionic/libc/arch-nacl/bionic/clone.c',
'android/bionic/libc/arch-nacl/bionic/popcount.c',
'android/bionic/libc/arch-nacl/syscalls/__getcwd.c',
'android/bionic/libc/arch-nacl/syscalls/__open.c',
'android/bionic/libc/arch-nacl/syscalls/_exit.c',
'android/bionic/libc/arch-nacl/syscalls/_exit_thread.c',
'android/bionic/libc/arch-nacl/syscalls/clock_getres.c',
'android/bionic/libc/arch-nacl/syscalls/clock_gettime.c',
'android/bionic/libc/arch-nacl/syscalls/close.c',
'android/bionic/libc/arch-nacl/syscalls/dup.c',
'android/bionic/libc/arch-nacl/syscalls/dup2.c',
'android/bionic/libc/arch-nacl/syscalls/enosys.c',
'android/bionic/libc/arch-nacl/syscalls/fdatasync.c',
'android/bionic/libc/arch-nacl/syscalls/fstat.c',
'android/bionic/libc/arch-nacl/syscalls/fsync.c',
'android/bionic/libc/arch-nacl/syscalls/futex.c',
'android/bionic/libc/arch-nacl/syscalls/getdents.c',
'android/bionic/libc/arch-nacl/syscalls/getpid.c',
'android/bionic/libc/arch-nacl/syscalls/gettid.c',
'android/bionic/libc/arch-nacl/syscalls/gettimeofday.c',
'android/bionic/libc/arch-nacl/syscalls/getuid.c',
'android/bionic/libc/arch-nacl/syscalls/lseek.c',
'android/bionic/libc/arch-nacl/syscalls/lseek64.c',
'android/bionic/libc/arch-nacl/syscalls/lstat.c',
'android/bionic/libc/arch-nacl/syscalls/mmap.c',
'android/bionic/libc/arch-nacl/syscalls/mprotect.c',
'android/bionic/libc/arch-nacl/syscalls/munmap.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_stat.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_timespec.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_timeval.c',
'android/bionic/libc/arch-nacl/syscalls/read.c',
'android/bionic/libc/arch-nacl/syscalls/stat.c',
'android/bionic/libc/arch-nacl/syscalls/unlink.c',
'android/bionic/libc/arch-nacl/syscalls/write.c',
'android/bionic/libc/arch-nacl/syscalls/writev.c',
'android/bionic/libc/arch-nacl/tmp/raw_print.c',
# TODO(crbug.com/352917): Use assembly version on Bare Metal ARM.
'android/bionic/libc/bionic/memcmp.c',
'android/bionic/libc/bionic/memcpy.c',
'android/bionic/libc/bionic/property_service.c',
'android/bionic/libc/string/ffs.c',
'android/bionic/libc/string/strcat.c',
'android/bionic/libc/string/strcmp.c',
'android/bionic/libc/string/strlen.c'])
if OPTIONS.is_nacl_build():
# They define SFI NaCl specific functions for dynamic code.
sources.extend([
'android/bionic/libc/arch-nacl/syscalls/__allocate_nacl_dyncode.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_dyncode_create.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_dyncode_delete.c',
'android/bionic/libc/arch-nacl/syscalls/nacl_list_mappings.c'])
if OPTIONS.is_arm():
# TODO(crbug.com/352917): Use assembly version on Bare Metal ARM.
sources.extend([
'android/bionic/libc/bionic/__memcpy_chk.cpp',
'android/bionic/libc/bionic/__memset_chk.cpp',
'android/bionic/libc/bionic/__strcat_chk.cpp',
'android/bionic/libc/bionic/__strcpy_chk.cpp'])
else:
sources.extend([
'android/bionic/libc/bionic/memchr.c',
'android/bionic/libc/bionic/memrchr.c',
'android/bionic/libc/bionic/memmove.c',
'android/bionic/libc/bionic/strnlen.c',
'android/bionic/libc/string/bcopy.c',
'android/bionic/libc/string/index.c',
'android/bionic/libc/string/strncmp.c',
'android/bionic/libc/string/strrchr.c',
'android/bionic/libc/upstream-freebsd/lib/libc/string/wcschr.c',
'android/bionic/libc/upstream-freebsd/lib/libc/string/wcsrchr.c',
'android/bionic/libc/upstream-freebsd/lib/libc/string/wcscmp.c',
'android/bionic/libc/upstream-freebsd/lib/libc/string/wcslen.c'])
if OPTIONS.is_arm():
_filter_libc_common_for_arm(vars, sources)
elif OPTIONS.is_i686():
_filter_libc_common_for_i686(vars, sources)
elif OPTIONS.is_x86_64():
_filter_libc_common_for_x86_64(vars, sources)
# NaCl does not have fork so we do not need the fork wrapper
# which does preparation before we actually run fork system call.
sources.remove('android/bionic/libc/bionic/fork.c')
# lseek64 in this file splits off64_t into two integer values to
# make assembly code easier. We can define lseek64 in C so we do
# not need this wrapper.
sources.remove('android/bionic/libc/bionic/lseek64.c')
if OPTIONS.is_x86_64() or OPTIONS.is_bare_metal_i686():
# We define __get_tls in nacl_read_tp.c.
#.........这里部分代码省略.........