2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
8 # force inclusion of entire library, so that we can validate it
9 # NOTE: This approach does not work for -lc because of tons of
10 # undefined symbols which would have to be stubbed out
11 DEP_LIBS = ['nacl', 'srpc', 'imc_syscalls', 'platform', 'gio', 'pthread', 'm']
13 # -lgcc is not exposed to the bitcode in PNaCl
14 if env.Bit('bitcode'):
19 DEP_LINKFLAGS = (['-Wl,--whole-archive'] + LIBGCC +
20 ['-l' + name for name in DEP_LIBS] +
21 ['-Wl,--no-whole-archive'])
23 # TODO(robertm): get rid of -allow-asm once we can distinguish
24 # real asms from the redirect ones used here
25 if env.Bit('bitcode'):
26 env.Append(CCFLAGS=['-allow-asm'])
28 # Test C++11 code with both supported C++ standard libraries.
29 cpp11_libs = ['libstdc++', 'libc++']
31 for lib in cpp11_libs:
32 cpp11_envs[lib] = env.Clone()
33 cpp11_envs[lib].Append(CCFLAGS=['-std=c++11', '-stdlib=' + lib])
34 cpp11_envs[lib].Append(LINKFLAGS=['-stdlib=' + lib])
36 # All the libraries were already included via -l switches in LINKFLAGS.
37 # But we use them again in LIBS so scons knows about the dependencies.
38 # _LIBFLAGS is the internal variable that puts the expansion of LIBS
39 # into the command line; so by clearing that, we prevent scons from
40 # adding repeated -l switches at the end of the link.
41 nexe = env.ComponentProgram('dummy', 'dummy.c',
42 EXTRA_LINKFLAGS=DEP_LINKFLAGS,
45 node = env.CommandValidatorTestNacl('whole_archive_test.out',
47 env.AddNodeToTestSuite(node,
48 ['toolchain_tests', 'small_tests'],
49 'run_whole_archive_test',
50 # The old ncval doesn't like the new linker's style
51 # of padding the code segment. TODO(mcgrathr):
52 # Remove this is_broken= when we the old ncval is no
53 # longer ever built and used for this test.
54 is_broken=(env.Bit('target_x86') and
55 not env.Bit('validator_ragel')))
58 def AddIntrinsicTest(test_env, src, exit_status,
59 golden_file=None, test_suffix='', is_broken=False,
61 name = src.split('.')[0]
64 obj = test_env.ComponentObject(name, src)
65 nexe = test_env.ComponentProgram(
66 name, obj, EXTRA_LIBS=['${NONIRT_LIBS}'] + EXTRA_LIBS)
67 node = test_env.CommandSelLdrTestNacl(name + '.out',
69 exit_status=exit_status,
70 stdout_golden=golden_file)
71 test_env.AddNodeToTestSuite(node,
72 ['toolchain_tests','small_tests'],
73 'run_' + name + '_test',
77 # Test various intrinsics.
78 AddIntrinsicTest(env, 'intrinsics.cc', '55'),
79 AddIntrinsicTest(env, 'float2.c', '0', golden_file=env.File('float2.stdout'))
80 AddIntrinsicTest(env, 'synchronization_sync.c', '0',
81 # TODO(jfb) Blocked on bugs 3579 and 2981. This should
82 # work on PNaCl because it avoids the broken 16-bit
83 # instructions on x86-32 by using 32-bit instructions.
84 # The test also exercises instructions that confuse valgrind.
85 is_broken=((env.Bit('target_x86_32') and
86 not env.Bit('bitcode')) or
87 env.IsRunningUnderValgrind()))
88 AddIntrinsicTest(env, 'synchronization_volatile.c', '0')
89 if env.Bit('bitcode'):
90 # The following tests were only made to work on LLVM for
91 # PNaCl. Command-line flags and libraries need to be updated for GCC
93 # pthread is needed when building with libc++.
94 for lib in cpp11_envs:
95 AddIntrinsicTest(cpp11_envs[lib], 'condition_variable_cpp11.cc', '0',
96 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
97 AddIntrinsicTest(cpp11_envs[lib], 'future_cpp11.cc', '0',
98 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
99 AddIntrinsicTest(cpp11_envs[lib], 'mutex_cpp11.cc', '0',
100 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
101 AddIntrinsicTest(cpp11_envs[lib], 'synchronization_cpp11.cc', '0',
102 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
103 AddIntrinsicTest(cpp11_envs[lib], 'thread_cpp11.cc', '0',
104 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
105 if lib != 'libstdc++':
106 # TODO(jfb) Can't compile with libstdc++.
107 AddIntrinsicTest(cpp11_envs[lib], 'long_double_cpp11.cc', '0',
108 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
110 # This test redirects C function calls to llvm instrinsic functions,
111 # so they only work w/ PNaCl.
112 if env.Bit('bitcode'):
113 AddIntrinsicTest(env, 'llvm_bitmanip_intrinsics.c', '0',
114 golden_file=env.File('llvm_bitmanip_intrinsics.stdout'))
115 AddIntrinsicTest(env, 'llvm_math_intrinsics.c', '0',
116 golden_file=env.File('llvm_math_intrinsics.stdout'))
117 # Also test the math functions with -ffast-math, so we are a tiny bit more
118 # confident that sin() or __builtin_sin() doesn't get turned into
119 # something like llvm.sin.f64.
120 fastmath_env = env.Clone()
121 fastmath_env.Append(CCFLAGS=['-ffast-math'])
122 AddIntrinsicTest(fastmath_env, 'llvm_math_intrinsics.c', '0',
123 golden_file=env.File('llvm_math_intrinsics.stdout'),
124 test_suffix='_fast_math')
126 # Some of the intrinsic tests cover intrinsics that we do not want to
127 # support. For example, llvm.frameaddress. If that is the case, we will
128 # use the nonstable_env as our test_env in AddIntrinsicTest.
129 nonstable_env = env.Clone()
130 if env.Bit('bitcode'):
131 nonstable_env.Append(LINKFLAGS=['--pnacl-disable-abi-check'])
132 if nonstable_env.AllowNonStableBitcode():
133 # Consider llvm.frameaddress and llvm.returnaddress non-stable,
134 # since we may want to hide return and stack addresses in the future.
135 AddIntrinsicTest(nonstable_env, 'frame_addresses.c', '0'),
136 AddIntrinsicTest(nonstable_env, 'return_address.c', '55')
140 initfini_obj = env.ComponentObject('initfini.c')
142 def AddInitFiniTest(env, name, extra_libs):
143 nexe = env.ComponentProgram(name,
145 EXTRA_LIBS=extra_libs + ['${NONIRT_LIBS}'])
146 golden_file = env.File(name + '.stdout')
147 node = env.CommandSelLdrTestNacl(name + '.out',
149 stdout_golden=golden_file)
150 # This test checks the ".init_array" and ".fini_array" sections,
151 # which are an internal detail of how the toolchain works. We do
152 # not support these sections in PNaCl's static linking ABI, because
153 # PNaCl connects up initializers at bitcode linking time. PNaCl
154 # does support __attribute__((constructor)) and
155 # __attribute__((destructor)) which are tested via
156 # run_initfini_attributes_test below.
157 is_broken = env.Bit('bitcode') and env.Bit('nacl_static_link')
158 env.AddNodeToTestSuite(node,
159 ['toolchain_tests', 'small_tests'],
160 'run_' + name + '_test',
163 AddInitFiniTest(env, 'initfini_static', [])
164 if env.Bit('nacl_glibc') and not env.Bit('nacl_disable_shared'):
165 # Additional case: Add initfini_shared.c as a shared object.
166 # For a shared object, the init/fini arrays are executed by
167 # the dynamic loader. This exercises a different code path.
168 env.NaClSdkLibrary('initfini_s', 'initfini_shared.c')
169 AddInitFiniTest(env, 'initfini_shared', ['initfini_s'])
172 nexe = env.ComponentProgram(
173 'initfini_attributes', ['initfini_attributes.c'],
174 EXTRA_LIBS=['${NONIRT_LIBS}'])
175 node = env.CommandSelLdrTestNacl(
176 'initfini_attributes.out', nexe,
177 stdout_golden=env.File('initfini_attributes.stdout'))
178 env.AddNodeToTestSuite(
179 node, ['toolchain_tests', 'small_tests'],
180 'run_initfini_attributes_test',
181 # __attribute__((destructor)) is broken in nacl-glibc on x86-64.
182 # See http://code.google.com/p/nativeclient/issues/detail?id=3056
183 # TODO(mseaborn): Enable this test there when this is fixed.
184 is_broken=env.Bit('nacl_glibc') and env.Bit('target_x86_64'))
187 bias_env = env.Clone()
188 # PNaCl bias is needed until __jmp_buf (defined in bits/setjmp.h) has
189 # the same size on X86-32 and X86-64.
190 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=2490
191 if env.Bit('bitcode'):
192 bias_env.AddBiasForPNaCl()
193 nexe = bias_env.ComponentProgram('pthread_cleanup', 'pthread_cleanup.c',
194 EXTRA_LIBS=['${PTHREAD_LIBS}',
196 node = bias_env.CommandSelLdrTestNacl('pthread_cleanup.out', nexe)
197 bias_env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'],
198 'run_pthread_cleanup_test')
201 # NOTE: the tests below break easily under valgrid and since
202 # they do not exercise malloc/free we exclude
203 if env.IsRunningUnderValgrind():
207 # NOTE: we assume that the incoming env contains '-O2', '-fomit-frame-pointer'
208 def MakeEnv(env, use_opts, use_frames):
209 new_env = env.Clone()
210 # AddBiasForPNaCl() is only needed for stack_frame.cc and eh_return.c.
211 if new_env.Bit('bitcode'):
212 new_env.AddBiasForPNaCl()
213 new_env.FilterOut(CFLAGS=['-pedantic'])
214 new_env.FilterOut(CCFLAGS=['-pedantic'])
216 new_env.FilterOut(CFLAGS=['-fomit-frame-pointer'])
217 new_env.FilterOut(CCFLAGS=['-fomit-frame-pointer'])
218 if env.Bit('bitcode'):
219 # To use frame pointers for PNaCl, we need to change the translate-flags.
220 new_env.Append(TRANSLATEFLAGS=[
221 '--pnacl-driver-set-LLC_FLAGS_EXTRA=-disable-fp-elim'])
223 new_env.Append(CFLAGS=['-fomit-frame-pointer'])
224 new_env.Append(CCFLAGS=['-fomit-frame-pointer'])
226 new_env.Append(CFLAGS=['-O2'])
227 new_env.Append(CCFLAGS=['-O2'])
229 new_env.FilterOut(CFLAGS=['-O2'])
230 new_env.FilterOut(CCFLAGS=['-O2'])
231 new_env.FilterOut(LINKFLAGS=['-O3'])
234 EH_ENVIRONMENTS_TO_TRY = []
236 base_eh_env = env.Clone()
237 supports_cxx11 = env.Bit('bitcode') or env.Bit('target_arm')
238 base_eh_env.Append(CPPDEFINES=[['SUPPORTS_CXX11', str(int(supports_cxx11))]])
240 # This flag is necessary for testing std::rethrow_exception(), at
241 # least when using libstdc++.
242 base_eh_env.Append(CXXFLAGS=['-std=gnu++11'])
244 if env.Bit('bitcode') and env['TOOLCHAIN_FEATURE_VERSION'] >= 1:
245 for lib in ('libstdc++', 'libc++'):
246 sjlj_eh_env = base_eh_env.Clone()
247 sjlj_eh_env.Append(LINKFLAGS=['--pnacl-exceptions=sjlj',
249 sjlj_eh_env.Append(CCFLAGS=['-stdlib=%s' % lib])
250 EH_ENVIRONMENTS_TO_TRY.append(('sjlj_%s' % lib, sjlj_eh_env))
252 if env.Bit('bitcode'):
253 zerocost_eh_env = base_eh_env.Clone()
254 zerocost_eh_env.Append(LINKFLAGS=['--pnacl-allow-exceptions'])
255 zerocost_eh_env.Append(TRANSLATEFLAGS=['--pnacl-allow-exceptions'])
257 zerocost_eh_env = base_eh_env
258 # Zero-cost C++ exception handling is not currently supported in
259 # PNaCl's stable ABI.
260 if zerocost_eh_env.AllowNonStableBitcode():
261 EH_ENVIRONMENTS_TO_TRY.extend(
262 [('noopt_frame', MakeEnv(zerocost_eh_env, False, True)),
263 ('noopt_noframe', MakeEnv(zerocost_eh_env, False, False)),
264 ('opt_frame', MakeEnv(zerocost_eh_env, True, True)),
265 ('opt_noframe', MakeEnv(zerocost_eh_env, True, False))])
267 for tag, env_to_try in EH_ENVIRONMENTS_TO_TRY:
268 for src in ['stack_frame.cc',
270 'eh_virtual_dtor.cc',
275 'eh_floating_point.cc',
276 'eh_uncaught_exception.cc',
280 if not env.Bit('bitcode') and src in ['eh_return.c']:
281 # for some reason gcc does not allow us to use
282 # __builtin_eh_return
286 if (env.Bit('bitcode') and
287 env.Bit('pnacl_generate_pexe') and
288 src in ['stack_frame.cc', 'eh_return.c']):
289 # stack_frame.cc and eh_return.c have bias see above
292 if not env.Bit('bitcode') and src in ['stack_frame.cc']:
293 # This test makes pnacl specific assumptions which
294 # may not hold for the nacl-gcc TC
297 # The following tests don't work as PNaCl ABI-stable pexes.
298 non_abi_stable_tests = [
299 'eh_floating_point.cc', # Uses vector types
300 'stack_frame.cc', # Uses llvm.eh.dwarf.cfa
301 'eh_return.c', # Uses llvm.eh.dwarf.cfa, and llvm.eh.return.i32
303 if tag.startswith('sjlj_') and src in non_abi_stable_tests:
306 if '--pnacl-exceptions=sjlj' in env_to_try['LINKFLAGS']:
307 if (src == 'eh_uncaught_exception.cc' and
308 env_to_try['TOOLCHAIN_FEATURE_VERSION'] < 2):
310 if (src == 'eh_throw_tests.cc' and
311 env_to_try['TOOLCHAIN_FEATURE_VERSION'] < 3):
314 name = src.split('.')[0] + '_' + tag
315 nobj = env_to_try.ComponentObject(name + '.o', src)
316 nexe = env_to_try.ComponentProgram(name, nobj,
317 EXTRA_LIBS=['${NONIRT_LIBS}'])
318 node = env_to_try.CommandSelLdrTestNacl(name + '.out',
321 env_to_try.AddNodeToTestSuite(
322 node, ['eh_tests', 'toolchain_tests', 'small_tests'],
323 'run_' + name +'_test', is_broken=is_broken)
326 # Test that Exception Handling works with the calling conventions that
327 # match the PPAPI PNaCl IRT shim's calling conventions.
328 exc_env = env.Clone()
329 if exc_env.Bit('bitcode') and exc_env.AllowNonStableBitcode():
330 # Test what happens when all objects are bitcode w/ bitcode linking.
331 exc_env.Append(LINKFLAGS=['--pnacl-allow-exceptions'])
332 exc_env.Append(TRANSLATEFLAGS=['--pnacl-allow-exceptions'])
333 bobj1 = exc_env.ComponentObject('eh_separate_files1_bc.o',
334 'eh_separate_files1.cc')
335 bobj2 = exc_env.ComponentObject('eh_separate_files2_bc.o',
336 'eh_separate_files2.cc')
337 nexe = exc_env.ComponentProgram('eh_separate_files_bc',
339 EXTRA_LIBS=['${NONIRT_LIBS}'])
340 node = exc_env.CommandSelLdrTestNacl('eh_separate_files_bc.out',
343 env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'],
344 'run_eh_separate_files_bc_test')
345 # Also test ahead of time translation, which may be used when debugging.
346 if not env.Bit('pnacl_generate_pexe'):
347 native_env = exc_env.Clone()
348 native_env.PNaClForceNative()
349 testsuite = ['toolchain_tests', 'small_tests', 'nonpexe_tests']
350 nobj1 = native_env.ComponentObject('eh_separate_files1_native.o',
351 'eh_separate_files1.cc')
352 nobj2 = native_env.ComponentObject('eh_separate_files2_native.o',
353 'eh_separate_files2.cc')
354 nexe = native_env.ComponentProgram('eh_separate_files_native',
356 EXTRA_LIBS=['${NONIRT_LIBS}'])
357 node = native_env.CommandSelLdrTestNacl('eh_separate_files_native.out',
360 env.AddNodeToTestSuite(node,
362 'run_eh_separate_files_native_test')
363 # Test mixed objects, one native, one bitcode.
364 nexe = native_env.ComponentProgram('eh_separate_files_mixed1',
366 EXTRA_LIBS=['${NONIRT_LIBS}'])
367 node = native_env.CommandSelLdrTestNacl('eh_separate_files_mixed1.out',
370 env.AddNodeToTestSuite(node,
372 'run_eh_separate_files_mixed1_test')
373 # Test having the bitcode and native objects swapped.
374 nexe = native_env.ComponentProgram('eh_separate_files_mixed2',
376 EXTRA_LIBS=['${NONIRT_LIBS}'])
377 node = native_env.CommandSelLdrTestNacl('eh_separate_files_mixed2.out',
380 env.AddNodeToTestSuite(node,
382 'run_eh_separate_files_mixed2_test')
386 abi_types_nexe = env.ComponentProgram('abi_types',
388 EXTRA_LIBS=['${NONIRT_LIBS}'])
390 node = env.CommandSelLdrTestNacl('abi_types_test.out',
392 env.AddNodeToTestSuite(node,
393 ['toolchain_tests', 'small_tests'],
394 'run_abi_types_test')
396 getpagesize_test_nexe = env.ComponentProgram(
397 'getpagesize_test', 'getpagesize_test.c',
398 EXTRA_LIBS=['${NONIRT_LIBS}'])
399 node = env.CommandSelLdrTestNacl('getpagesize_test.out', getpagesize_test_nexe)
400 env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'],
401 'run_getpagesize_test')
404 # Test that local variable dwarf info is preserved with linking and LTO.
405 # Force '-g' on in case it was not turned on for some reason, and lower
406 # optimization settings to prevent some optimizations that would convert
407 # locals from llvm allocas to registers.
408 # We may be able to remove this test once LLVM has an upstream regression test.
409 debug_env = env.Clone()
410 debug_env.Append(CFLAGS=['-g', '-O0'])
411 debug_env.Append(CCFLAGS=['-g', '-O0'])
412 debug_env.Append(LINKFLAGS=['-O0'])
413 # This requires preserving nonstable bitcode debug metadata.
414 if debug_env.AllowNonStableBitcode():
415 dwarf_local_var_nexe = debug_env.ComponentProgram(
417 ['dwarf_local_var.c',
418 'dwarf_local_var_dummy.c'],
419 EXTRA_LIBS=['${NONIRT_LIBS}'])
420 # Sanity-check -- make sure it runs.
421 node = debug_env.CommandSelLdrTestNacl('dwarf_local_var_run.out',
422 dwarf_local_var_nexe,
424 debug_env.AddNodeToTestSuite(node,
425 ['toolchain_tests', 'small_tests'],
426 'run_dwarf_local_var_run_test')
427 node = debug_env.CommandTestFileDumpCheck('dwarf_local_var_objdump.out',
428 dwarf_local_var_nexe,
429 debug_env.File('dwarf_local_var.c'),
431 debug_env.AddNodeToTestSuite(node,
432 ['small_tests', 'toolchain_tests'],
433 'run_dwarf_local_var_objdump_test')
435 if env.Bit('nacl_glibc'):
436 nexe = env.ComponentProgram('byteswap64', 'byteswap64.c',
437 EXTRA_LIBS=['${NONIRT_LIBS}'])
438 node = env.CommandSelLdrTestNacl('byteswap64.out', nexe)
439 env.AddNodeToTestSuite(node,
440 ['toolchain_tests', 'small_tests'],
441 'run_byteswap64_test')
443 if env.Bit('nacl_glibc') or not env.Bit('bitcode'):
444 def AddAlignedCodeTest(name, object_file):
445 node = env.CommandTest(name + '.out',
446 ['${PYTHON}', env.File('aligned_code.py'),
448 # don't run ${PYTHON} under the emulator.
449 direct_emulation=False)
450 env.AddNodeToTestSuite(node,
451 ['toolchain_tests', 'small_tests'],
452 'run_' + name + '_test')
453 AddAlignedCodeTest('aligned_code',
454 env.ComponentProgram('aligned_code', ['aligned_code.c'],
455 EXTRA_LIBS=['${NONIRT_LIBS}']))
456 if not env.Bit('nacl_disable_shared'):
457 AddAlignedCodeTest('aligned_code_lib',
458 env.NaClSharedLibrary('aligned_code_lib',
459 ['aligned_code_lib.c']))
461 nexe = env.ComponentProgram('method_pointer_repr', 'method_pointer_repr.cc',
462 EXTRA_LIBS=['${NONIRT_LIBS}'])
463 node = env.CommandSelLdrTestNacl('method_pointer_repr.out', nexe)
464 env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'],
465 'run_method_pointer_repr_test')
467 c99_env = env.Clone()
468 c99_env.Append(CFLAGS=['-std=c99'])
469 # VLA test is broken on nacl-gcc x86-64 (segfaults in test_two_recursion()).
470 # http://code.google.com/p/nativeclient/issues/detail?id=3527
471 vla_is_broken = not env.Bit('bitcode') and env.Bit('target_x86_64')
472 nexe = c99_env.ComponentProgram('vla', 'vla.c',
473 EXTRA_LIBS=['${NONIRT_LIBS}'])
474 node = env.CommandSelLdrTestNacl('vla.out', nexe,
475 stdout_golden=env.File('vla.stdout'))
476 env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'],
478 is_broken=vla_is_broken)
480 if not env.Bit('pnacl_generate_pexe'):
481 asm_env = env.Clone()
482 if env.Bit('bitcode'):
483 asm_env.PNaClForceNative()
484 asm_env.AddBiasForPNaCl()
485 testsuite = ['toolchain_tests', 'small_tests', 'nonpexe_tests']
487 def FarCallObjects(env, suffix=''):
488 return [env.ComponentObject(file[:-2] + suffix + '.o', file)
489 for file in ['far_caller.c', 'far_padding.S', 'far_callee.c']]
490 nexe = asm_env.ComponentProgram('far_call', FarCallObjects(asm_env),
491 EXTRA_LIBS=['${NONIRT_LIBS}'])
492 node = asm_env.CommandSelLdrTestNacl('far_call.out', nexe)
493 # TODO(mcgrathr): Broken for bitcode pending fixes to gold; see
494 # https://code.google.com/p/nativeclient/issues/detail?id=3568
495 asm_env.AddNodeToTestSuite(node, testsuite,
497 is_broken=env.Bit('bitcode'))
499 # TODO(mcgrathr): Disabled for bitcode because pnacl-ld doesn't grok
500 # --pic-veneer. Another tack to test this would be to generate a shared
501 # object and validate it, but -shared is not really supported either.
502 # Since PNaCl has no reason to generate PIC at all until there is some
503 # form of ELF shared object support (if that ever happens at all),
504 # perhaps we'll never really need to test this.
505 if not env.Bit('bitcode'):
506 pic_env = asm_env.Clone()
507 pic_env.Append(CFLAGS=['-fPIC'])
508 if pic_env.Bit('target_arm'):
509 pic_env.Append(LINKFLAGS=['-Wl,--pic-veneer'])
510 nexe = pic_env.ComponentProgram('far_call_pic',
511 FarCallObjects(pic_env, '_pic'),
512 EXTRA_LIBS=['${NONIRT_LIBS}'])
513 node = pic_env.CommandSelLdrTestNacl('far_call_pic.out', nexe)
514 pic_env.AddNodeToTestSuite(node, testsuite,
515 'run_far_call_pic_test')
517 dummy_obj = asm_env.ComponentObject('nop_test_main.o', 'dummy.c')
518 nexe = asm_env.ComponentProgram('nop_test', [dummy_obj, 'nop_test.S'],
519 EXTRA_LIBS=['${NONIRT_LIBS}'])
520 node = asm_env.CommandSelLdrTestNacl('nop_test.out', nexe)
521 asm_env.AddNodeToTestSuite(node, testsuite,
524 # Test that both the layout and the nops are not munged by stripping.
525 stripped_nexe = asm_env.Command('strip_test.nexe', nexe,
526 '${STRIP} -o ${TARGET} ${SOURCES}')
527 node = asm_env.CommandSelLdrTestNacl('strip_test.out', stripped_nexe)
528 asm_env.AddNodeToTestSuite(node, testsuite,
531 if not env.Bit('nacl_disable_shared') and not env.Bit('nacl_static_link'):
532 env.NaClSharedLibrary('pic_constant_lib', ['pic_constant_lib.c'])
533 nexe = env.ComponentProgram('pic_constant', ['pic_constant.c'],
534 EXTRA_LIBS=['pic_constant_lib', '${NONIRT_LIBS}'])
535 node = env.CommandSelLdrTestNacl('pic_constant.out', nexe)
536 env.AddNodeToTestSuite(node, testsuite,
537 'run_pic_constant_test')
539 WRAP_LINK_FLAGS = ['-Wl,--wrap=foo', '-Wl,--wrap=bar']
540 env.ComponentLibrary('wrap_lib', ['wrap_lib1.c', 'wrap_lib2.c'])
541 nexe = env.ComponentProgram('wrap', ['wrap_main.c'],
542 EXTRA_LINKFLAGS=WRAP_LINK_FLAGS,
543 EXTRA_LIBS=['wrap_lib', '${NONIRT_LIBS}'])
544 node = env.CommandSelLdrTestNacl('wrap.out', nexe,
545 stdout_golden=env.File('wrap.stdout'))
546 env.AddNodeToTestSuite(node, ['toolchain_tests','small_tests'], 'run_wrap_test')