init_array.carbon 928 B

123456789101112131415161718192021222324
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // ARGS: compile foo.carbon --asm-output --output=- --target=x86_64-linux-gnu
  6. //
  7. // NOAUTOUPDATE
  8. // SET-CHECK-SUBSET
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/target_machine.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/target_machine.carbon
  13. // --- foo.carbon
  14. import Cpp inline '''
  15. int f();
  16. inline int n = f();
  17. ''';
  18. // We should use init_array, overriding LLVM's default of using ctors, as Clang
  19. // does.
  20. // CHECK:STDOUT: {{\s*}}.section{{\s+}}.init_array,{{.*}}
  21. // CHECK:STDOUT: {{\s*}}.quad{{\s+}}__cxx_global_var_init