本文整理汇总了Python中build_options.OPTIONS.is_arm方法的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS.is_arm方法的具体用法?Python OPTIONS.is_arm怎么用?Python OPTIONS.is_arm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类build_options.OPTIONS
的用法示例。
在下文中一共展示了OPTIONS.is_arm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_bare_metal_flags
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _set_bare_metal_flags(n):
asmflags = _remove_isystem(CNinjaGenerator.get_asmflags())
# We do not use Bionic for Bare Metal loader. So, we remove all
# adjustments for include flags.
asmflags = asmflags.replace(' -nostdinc', '')
asmflags = asmflags.replace(' -D__ANDROID__', '')
n.variable('asmflags', asmflags)
use_64bit_offsets = ' -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64'
# We always use "hard" ABI on ARM for the helper process.
if OPTIONS.is_arm():
use_hard_abi = ' -mfloat-abi=hard'
else:
use_hard_abi = ''
cflags = _remove_isystem(CNinjaGenerator.get_cflags())
cflags += use_64bit_offsets
cflags += use_hard_abi
cflags += ' -Werror'
n.variable('cflags', cflags)
cxxflags = _remove_isystem(CNinjaGenerator.get_cxxflags())
cxxflags = cxxflags.replace(' -nostdinc++', '')
cxxflags += use_64bit_offsets
cxxflags += use_hard_abi
cxxflags += ' -Werror'
n.variable('cxxflags', cxxflags)
ninja_generator.CNinjaGenerator.emit_optimization_flags(n)
n.add_ppapi_compile_flags()
n.add_libchromium_base_compile_flags()
n.add_defines('_GNU_SOURCE')
示例2: _get_nacl_helper_nonsfi_pid
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _get_nacl_helper_nonsfi_pid(parent_pid, expected_num_processes):
"""Returns pid of nacl_helper, or None if not exist."""
try:
# On ARM, nacl_helper is wrapped by nacl_helper_bootstrap so the
# exact match fails. (pgrep -x nacl_helper_bootstrap also fails
# for some reason). So, we do not do the exact match on ARM. It
# should be safe as ARM device (i.e., Chrome OS) does not run
# multiple Chrome when we run launch_chrome.
exact_flag = [] if OPTIONS.is_arm() else ['-x']
# TODO(crbug.com/376666): Change nacl_helper to nacl_helper_nonsfi
# and update the comment below.
command = ['pgrep', '-P', str(parent_pid)] + exact_flag + ['nacl_helper']
pids = subprocess.check_output(command).splitlines()
assert len(pids) <= expected_num_processes
# Note that we need to wait until the number of pids is equal to
# expected_num_processes. Otherwise, we may find SFI nacl_helper
# because Chrome launches the SFI version first and there is a
# time window where only SFI nacl_helper is running.
if len(pids) != expected_num_processes:
return None
# nacl_helper has two zygotes. One for SFI mode and the other
# for non-SFI. As Chrome launches nacl_helper for SFI first, we
# pick the newer PID by pgrep -n.
command.insert(1, '-n')
return int(subprocess.check_output(command))
except subprocess.CalledProcessError:
return None
示例3: _filter
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _filter(vars):
if vars.is_shared():
return False
make_to_ninja.Filters.convert_to_shared_lib(vars)
_add_bare_metal_flags_to_make_to_ninja_vars(vars)
# Builtin rint and rintf call lrint and lrintf,
# respectively. However, Bionic calls rint and rintf to implement
# lrint and lrintf and this causes an infinite recurision.
# TODO(crbug.com/357564): Change this to -fno-builtin.
vars.get_cflags().append('-fno-builtin-rint')
vars.get_cflags().append('-fno-builtin-rintf')
sources = vars.get_sources()
_remove_assembly_source(sources)
if OPTIONS.is_arm():
vars.get_includes().append('android/bionic/libc/arch-arm/include')
else:
# TODO(crbug.com/414583): "L" has arch-x86_64 directory so we
# should have this include path only for i686 targets.
vars.get_includes().append('android/bionic/libc/arch-x86/include')
if OPTIONS.is_x86_64():
vars.get_includes().insert(0, 'android/bionic/libc/arch-amd64/include')
sources.remove(
'android/bionic/libm/upstream-freebsd/lib/msun/src/e_sqrtf.c')
sources.remove('android/bionic/libm/i387/fenv.c')
sources.extend(['android/bionic/libm/amd64/e_sqrtf.S',
'android/bionic/libm/amd64/fenv.c'])
if OPTIONS.is_bare_metal_i686():
# long double is double on other architectures. For them,
# s_nextafter.c defines nextafterl.
sources.append(
'android/bionic/libm/upstream-freebsd/lib/msun/src/s_nextafterl.c')
vars.get_generator_args()['is_system_library'] = True
vars.get_shared_deps().append('libc')
return True
示例4: _generate_check_symbols_ninja
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _generate_check_symbols_ninja():
# If we do not use NDK direct execution, the compatibility is less
# important.
if not build_common.use_ndk_direct_execution():
return
n = ninja_generator.NinjaGenerator('check_symbols')
script = staging.as_staging('src/build/check_symbols.py')
rule_name = 'check_symbols'
n.rule(rule_name,
command=('python %s $android_lib $in %s' % (
script, build_common.get_test_output_handler())),
description=(rule_name + ' $in'))
assert OPTIONS.is_arm(), 'Only ARM supports NDK direct execution'
arch_subdir = 'arch-arm'
lib_dir = os.path.join(_ANDROID_SYSTEM_IMAGE_DIR, arch_subdir, 'usr/lib')
for so_file in build_common.find_all_files(lib_dir, suffixes='.so'):
lib_name = os.path.basename(so_file)
if lib_name not in ['libc.so', 'libdl.so', 'libm.so']:
# For now, we only check Bionic.
# TODO(crbug.com/408548): Extend this for other libraries.
continue
result_path = os.path.join(build_common.get_build_dir(),
'check_symbols',
'check_symbols.%s.result' % lib_name)
n.build(result_path, rule_name,
build_common.get_build_path_for_library(lib_name),
variables={'android_lib': staging.as_staging(so_file)},
implicit=[script, staging.as_staging(so_file)])
示例5: _generate_runnable_ld_ninja
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _generate_runnable_ld_ninja():
linker_script = _generate_linker_script_for_runnable_ld()
# Not surprisingly, bionic's loader is built with a special hack to
# Android's build system so we cannot use MakefileNinjaTranslator.
n = ninja_generator.ExecNinjaGenerator('runnable-ld.so',
base_path='android/bionic/linker',
install_path='/lib',
is_system_library=True)
_add_runnable_ld_cflags(n)
n.add_library_deps('libc_bionic_linker.a') # logging functions
n.add_library_deps('libc_common_linker.a')
n.add_library_deps('libc_freebsd_linker.a') # __swsetup etc.
sources = n.find_all_sources()
sources.extend(['android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c',
'android/bionic/libc/bionic/__errno.c',
'android/bionic/libc/bionic/pthread.c',
'android/bionic/libc/bionic/pthread_create.cpp',
'android/bionic/libc/bionic/pthread_internals.cpp',
'android/bionic/libc/bionic/pthread_key.cpp'])
if OPTIONS.is_bare_metal_build():
# Remove SFI NaCl specific dynamic code allocation.
sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_alloc.c')
sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_map.c')
_remove_assembly_source(sources)
# NaCl has no signals so debugger support cannot be implemented.
sources.remove('android/bionic/linker/debugger.cpp')
# n.find_all_sources() picks up this upstream file regardless of the
# current target. For ARM, the file is obviously irrelevant. For i686
# and x86_64, we use our own begin.c.
sources.remove('android/bionic/linker/arch/x86/begin.c')
ldflags = n.get_ldflags()
if OPTIONS.is_nacl_build():
ldflags += (' -T ' + linker_script +
' -Wl,-Ttext,' + _LOADER_TEXT_SECTION_START_ADDRESS)
else:
# We need to use recent linkers for __ehdr_start.
ldflags += ' -pie'
# See the comment in linker/arch/nacl/begin.c.
ldflags += ' -Wl,--defsym=__linker_base=0'
# --gc-sections triggers an assertion failure in GNU ld for ARM for
# --opt build. The error message is very similar to the message in
# https://sourceware.org/bugzilla/show_bug.cgi?id=13990
# Once NaCl team updates the version of their binutils, we might be
# able to remove this.
if not OPTIONS.is_arm():
ldflags += ' -Wl,--gc-sections'
if not OPTIONS.is_debug_info_enabled():
ldflags += ' -Wl,--strip-all'
n.add_library_deps(*ninja_generator.get_libgcc_for_bionic())
n.add_library_deps('libbionic_ssp.a')
n.build_default(sources, base_path=None)
n.link(variables={'ldflags': ldflags}, implicit=linker_script)
示例6: _generate_bionic_tests
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _generate_bionic_tests():
n = ninja_generator.TestNinjaGenerator('bionic_test',
base_path='android/bionic/tests')
_add_bare_metal_flags_to_ninja_generator(n)
def relevant(f):
if f.find('/fundamental/') >= 0:
return False
if re.search(r'(_benchmark|/benchmark_main)\.cpp$', f):
return False
if OPTIONS.enable_valgrind():
# A few tests in these files fail under valgrind probably due to
# a valgrind's bug around rounding mode. As it is not important
# to run these tests under valgrind, we simply do not build them.
if f in ['android/bionic/tests/fenv_test.cpp',
'android/bionic/tests/math_test.cpp']:
return False
excludes = [
# We do not support eventfd.
'android/bionic/tests/eventfd_test.cpp',
# We do not compile this as this test does not pass the NaCl
# validation.
# TODO(crbug.com/342292): Enable stack protector on BMM.
'android/bionic/tests/stack_protector_test.cpp',
# We do not support death tests.
'android/bionic/tests/stack_unwinding_test.cpp',
# Neither NaCl nor Bare Metal supports statvfs and fstatvfs.
'android/bionic/tests/statvfs_test.cpp',
]
return f not in excludes
sources = filter(relevant, n.find_all_sources(include_tests=True))
n.build_default(sources, base_path=None)
# Set the same flag as third_party/android/bionic/tests/Android.mk.
# This is necessary for dlfcn_test.cpp as it calls dlsym for this symbol.
ldflags = '$ldflags -Wl,--export-dynamic -Wl,-u,DlSymTestFunction'
if OPTIONS.is_arm():
# Disables several pthread tests because pthread is flaky on qemu-arm.
disabled_tests = ['pthread.pthread_attr_setguardsize',
'pthread.pthread_attr_setstacksize',
'pthread.pthread_create',
'pthread.pthread_getcpuclockid__no_such_thread',
'pthread.pthread_join__multijoin',
'pthread.pthread_join__no_such_thread',
'pthread.pthread_no_join_after_detach',
'pthread.pthread_no_op_detach_after_join',
'string.strsignal_concurrent',
'string.strerror_concurrent']
n.add_qemu_disabled_tests(*disabled_tests)
n.add_compiler_flags('-W', '-Wno-unused-parameter', '-Werror')
# GCC's builtin ones should be disabled when testing our own ones.
# TODO(crbug.com/357564): Change this to -fno-builtin.
for f in ['bzero', 'memcmp', 'memset', 'nearbyint', 'nearbyintf',
'nearbyintl', 'sqrt', 'strcmp', 'strcpy', 'strlen']:
n.add_compiler_flags('-fno-builtin-' + f)
n.run(n.link(variables={'ldflags': ldflags}))
示例7: get_bionic_arch_subdir_name
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def get_bionic_arch_subdir_name():
"""Returns Bionic's architecture sub directory name.
The architecture name is used in sub directories like
android/bionic/libc/kernel/arch-arm.
"""
if OPTIONS.is_arm():
return 'arch-arm'
else:
return 'arch-x86'
示例8: get_android_config_header
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def get_android_config_header(is_host):
if is_host:
arch_subdir = 'linux-x86'
elif OPTIONS.is_arm():
arch_subdir = 'linux-arm'
else:
arch_subdir = 'target_linux-x86'
return os.path.join(get_staging_root(),
'android/build/core/combo/include/arch',
arch_subdir,
'AndroidConfig.h')
示例9: __init__
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def __init__(self, test_binary_name, inputs, output, build_commands):
self._test_binary_name = test_binary_name
self._build_commands = build_commands
out = os.path.join(BionicFundamentalTest._get_out_dir(), test_binary_name)
asmflags = ninja_generator.CNinjaGenerator.get_archasmflags()
if OPTIONS.is_bare_metal_build():
asmflags += ' -DBARE_METAL_BIONIC '
cflags = ninja_generator.CNinjaGenerator.get_archcflags()
cxxflags = ninja_generator.CNinjaGenerator.get_cxxflags()
cflags = asmflags + cflags + ' $commonflags -g -fPIC -Wall -W -Werror '
cxxflags = cflags + cxxflags
ldflags = ('-Wl,-rpath-link=' + build_common.get_load_library_path() +
' -Wl,--hash-style=sysv')
# Use -Bsymbolic to have similar configuration as other NaCl
# executables in ARC.
soflags = '-shared -Wl,-Bsymbolic'
if OPTIONS.is_arm():
# For ARM, we need to link libgcc.a into shared objects. See the comment
# in SharedObjectNinjaGenerator.
# TODO(crbug.com/283798): Build libgcc by ourselves and remove this.
soflags += ' ' + ' '.join(
ninja_generator.get_libgcc_for_bionic())
text_segment_address = (ninja_generator.ExecNinjaGenerator.
get_nacl_text_segment_address())
if OPTIONS.is_bare_metal_build():
execflags = '-pie'
# Goobuntu's linker emits RWX pages for small PIEs. Use gold
# instead. We cannot specify -fuse-ld=gold. As we are building
# executables directly from .c files, the -fuse-ld flag will be
# passed to cc1 and it does not recognize this flag.
ldflags += ' -Bthird_party/gold'
else:
# This is mainly for ARM. See src/build/ninja_generator.py for detail.
execflags = '-Wl,-Ttext-segment=' + text_segment_address
self._variables = {
'name': self._test_binary_name,
'cc': toolchain.get_tool(OPTIONS.target(), 'cc'),
'cxx': toolchain.get_tool(OPTIONS.target(), 'cxx'),
'lib_dir': build_common.get_load_library_path(),
'in_dir': BionicFundamentalTest._get_src_dir(),
'out_dir': BionicFundamentalTest._get_out_dir(),
'out': out,
'crtbegin_exe': build_common.get_bionic_crtbegin_o(),
'crtbegin_so': build_common.get_bionic_crtbegin_so_o(),
'crtend_exe': build_common.get_bionic_crtend_o(),
'crtend_so': build_common.get_bionic_crtend_so_o(),
'cflags': cflags,
'cxxflags': cxxflags,
'ldflags': ldflags,
'soflags': soflags,
'execflags': execflags
}
self._inputs = map(self._expand_vars, inputs)
self._output = self._expand_vars(output)
示例10: _link_for_bare_metal
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _link_for_bare_metal(n):
ldflags = n.get_ldflags()
# We use glibc in host, so need to drop -nostdlib.
ldflags = ldflags.replace(' -nostdlib', '')
if OPTIONS.is_arm():
# Expand $commonflags and remove -mfloat-abi=softfp, because passing both
# -mfloat-abi=softfp and hard can confuse the linker.
ldflags = ldflags.replace('$commonflags', CNinjaGenerator.get_commonflags())
ldflags = ldflags.replace(' -mfloat-abi=softfp', '')
# We always use "hard" ABI for the helper process.
ldflags += ' -mfloat-abi=hard'
return n.link(variables={'ldflags': ldflags, 'ldadd': '-lrt'})
示例11: _add_runnable_ld_cflags
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _add_runnable_ld_cflags(n):
n.add_c_flags('-std=gnu99')
if OPTIONS.is_arm():
# If we specify -fstack-protector, the ARM compiler emits code
# which requires relocation even for the code to be executed
# before the self relocation. We disable the stack smashing
# protector for the Bionic loader for now.
# TODO(crbug.com/342292): Enable stack protector for the Bionic
# loader on Bare Metal ARM.
n.add_compiler_flags('-fno-stack-protector')
n.add_compiler_flags(
'-ffunction-sections', '-fdata-sections',
# The loader does not need to export any symbols.
'-fvisibility=hidden',
'-W', '-Wno-unused', '-Wno-unused-parameter', '-Werror')
# TODO(crbug.com/243244): Consider using -Wsystem-headers.
n.add_include_paths('android/bionic/libc',
'android/bionic/libc/private',
'android/bionic/linker/arch/nacl')
if OPTIONS.is_debug_code_enabled() or OPTIONS.is_bionic_loader_logging():
n.add_defines('LINKER_DEBUG=1')
else:
n.add_defines('LINKER_DEBUG=0')
n.add_defines('ANDROID_SMP=1')
if OPTIONS.is_arm():
n.add_defines('ANDROID_ARM_LINKER')
elif OPTIONS.is_x86_64():
n.add_defines('ANDROID_X86_64_LINKER')
n.add_c_flags('-Wno-pointer-to-int-cast')
n.add_c_flags('-Wno-int-to-pointer-cast')
else:
n.add_defines('ANDROID_X86_LINKER')
if build_common.use_ndk_direct_execution():
n.add_defines('USE_NDK_DIRECT_EXECUTION')
if OPTIONS.is_bionic_loader_logging():
n.add_defines('BIONIC_LOADER_LOGGING')
_add_bare_metal_flags_to_ninja_generator(n)
示例12: main
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def main(args):
OPTIONS.parse_configure_file()
# TODO(crbug.com/378196): Make qemu-arm available in open source in order to
# run any unit tests there.
if open_source.is_open_source_repo() and OPTIONS.is_arm():
return 0
test_runner = BionicFundamentalTestRunner()
test_runner.run()
if not test_runner.is_ok():
return 1
return 0
示例13: extend_chrome_params
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def extend_chrome_params(parsed_args, params):
# Do not show the New Tab Page because showing NTP during perftest makes the
# benchmark score look unnecessarily bad especially on ARM Chromebooks where
# CPU resource is very limited.
# TODO(yusukes): Use this option on Windows/Mac/Linux too. We might need to
# use --keep-alive-for-test then.
params.append('--no-startup-window')
# Login as a fake test user.
params.append('--login-user=' + _FAKE_TEST_USER)
if OPTIONS.is_arm() and parsed_args.mode in ('atftest', 'system'):
# On ARM Chromebooks, there is a bug (crbug.com/270064) that causes X server
# to hang when multiple ash host windows are displayed in the size of the
# screen, which is the default ash host window size on Chrome OS. In order
# to workaround this issue, show the ash host window in the size 1 pixel
# wider than the original screen size.
# TODO(crbug.com/314050): Remove the workaround once the upstream issue is
# fixed.
output = subprocess.check_output(['xdpyinfo', '-display', ':0.0'])
m = re.search(r'dimensions: +([0-9]+)x([0-9]+) pixels', output)
if not m:
raise Exception('Cannot get the screen size')
width, height = int(m.group(1)) + 1, int(m.group(2))
params.append('--ash-host-window-bounds=0+0-%dx%d' % (width, height))
assert os.path.exists(_CHROME_COMMAND_LINE_FILE), (
'%s does not exist.' % _CHROME_COMMAND_LINE_FILE)
with open(_CHROME_COMMAND_LINE_FILE) as f:
chrome_command_line = f.read().rstrip()
params_str = re.sub('^%s ' % _REMOTE_CHROME_EXE_BINARY, '',
chrome_command_line)
# Use ' -' instead of ' ' to split the command line flags because the flag
# values can contain spaces.
new_params = params_str.split(' -')
new_params[1:] = ['-' + param for param in new_params[1:]]
# Check if _UNNEEDED_PARAM_PREFIXES is up to date.
for unneeded_param in _UNNEEDED_PARAM_PREFIXES:
if not any(p.startswith(unneeded_param) for p in new_params):
print 'WARNING: _UNNEEDED_PARAM_PREFIXES is outdated. Remove %s.' % (
unneeded_param)
# Append the flags that are not set by our scripts.
for new_param in new_params:
if not _is_param_set(new_param, params) and _is_param_needed(new_param):
params.append(new_param)
示例14: main
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def main():
OPTIONS.parse_configure_file()
test_args = sys.argv[1:]
if not test_args:
print 'Usage: %s test_binary [test_args...]' % sys.argv[0]
sys.exit(1)
# This script must not die by Ctrl-C while GDB is running. We simply
# ignore SIGINT. Note that GDB will still handle Ctrl-C properly
# because GDB sets its signal handler by itself.
signal.signal(signal.SIGINT, signal.SIG_IGN)
runner_args = toolchain.get_tool(OPTIONS.target(), 'runner').split()
if OPTIONS.is_nacl_build():
_run_gdb_for_nacl(runner_args, test_args)
elif OPTIONS.is_bare_metal_build():
if OPTIONS.is_arm():
_run_gdb_for_bare_metal_arm(runner_args, test_args)
else:
_run_gdb_for_bare_metal(runner_args, test_args)
示例15: _generate_crt_bionic_ninja
# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_arm [as 别名]
def _generate_crt_bionic_ninja():
n = ninja_generator.CNinjaGenerator('bionic_crt')
_add_bare_metal_flags_to_ninja_generator(n)
# Needed to access private/__dso_handle.h from crtbegin_so.c.
n.add_include_paths('android/bionic/libc')
rule_name = 'build_bionic_crt'
n.rule(rule_name,
deps='gcc',
depfile='$out.d',
command=(toolchain.get_tool(OPTIONS.target(), 'cc') +
' $cflags -W -Werror '
' -I' + staging.as_staging('android/bionic/libc/private') +
' -fPIC -g -O -MD -MF $out.d -c $in -o'
' $out'),
description=rule_name + ' $in')
# crts is a list of tuples whose first element is the source code
# and the second element is the name of the output object.
if OPTIONS.is_arm():
crts = [
('android/bionic/libc/arch-arm/bionic/crtbegin.c', 'crtbegin.o'),
('android/bionic/libc/arch-arm/bionic/crtbegin_so.c', 'crtbeginS.o'),
('android/bionic/libc/arch-arm/bionic/crtend.S', 'crtend.o'),
('android/bionic/libc/arch-arm/bionic/crtend_so.S', 'crtendS.o'),
]
else:
# We use arch-nacl directory for x86 mainly because we use GCC
# 4.4.3 for x86 NaCl. Recent GCC (>=4.7) uses .init_array and
# .fini_array instead of .ctors and .dtors and the upstream code
# expects we use recent GCC. We can use crtend.c for both crtend.o
# and crtendS.o. Unlike ARM, we do not have .preinit_array,
# which is not allowed in shared objects.
crts = [
('android/bionic/libc/arch-nacl/bionic/crtbegin.c', 'crtbegin.o'),
('android/bionic/libc/arch-nacl/bionic/crtbegin_so.c', 'crtbeginS.o'),
('android/bionic/libc/arch-nacl/bionic/crtend.c', 'crtend.o'),
('android/bionic/libc/arch-nacl/bionic/crtend.c', 'crtendS.o'),
]
for crt_src, crt_o in crts:
source = staging.as_staging(crt_src)
n.build(os.path.join(build_common.get_load_library_path(), crt_o),
rule_name, source)