Lines Matching +full:- +full:- +full:set +full:- +full:config
2 # SPDX-License-Identifier: BSD-3-Clause
4 # Copyright © 2019-2021 Keith Packard
55 # cc -print-search-dirs
58 foreach _line : run_command(cc.cmd_array() + ['-print-search-dirs'], check : false).stdout().split('\n')
74 if not get_option('use-stdlib')
75 core_c_args += cc.get_supported_arguments(['-nostdlib'])
120 # Make sure we have meson build support for the machine-specific files
149 multilib_list = get_option('multilib-list')
150 multilib_exclude = get_option('multilib-exclude')
153 enable_picocrt_lib = get_option('picocrt-lib')
156 if get_option('tests-cdefs') == 'auto'
159 enable_cdefs_tests = get_option('tests-cdefs') == 'true'
161 enable_native_tests = get_option('native-tests')
162 enable_native_math_tests = enable_native_tests and get_option('native-math-tests')
163 tests_enable_stack_protector = get_option('tests-enable-stack-protector')
164 tests_enable_full_malloc_stress = get_option('tests-enable-full-malloc-stress')
165 tests_enable_posix_io = get_option('tests-enable-posix-io')
166 have_alias_attribute_option = get_option('have-alias-attribute')
167 have_format_attribute_option = get_option('have-format-attribute')
168 have_weak_attribute_option = get_option('have-weak-attribute')
180 newlib_iconv_encodings = get_option('newlib-iconv-encodings')
181 newlib_iconv_encodings_exclude = get_option('newlib-iconv-encodings-exclude')
182 newlib_iconv_from_encodings = get_option('newlib-iconv-from-encodings')
183 newlib_iconv_to_encodings = get_option('newlib-iconv-to-encodings')
184 newlib_iconv_external_ccs = get_option('newlib-iconv-external-ccs')
186 newlib_atexit_dynamic_alloc = get_option('newlib-atexit-dynamic-alloc')
187 newlib_nano_malloc = get_option('newlib-nano-malloc')
188 lite_exit = get_option('lite-exit')
190 newlib_elix_level = get_option('newlib-elix-level')
192 native_common_args = ['-DNO_NEWLIB']
195 c_args += ['-pg', '-no-pie']
199 c_args += ['-ffreestanding']
204 cpp_flags = cpp.get_supported_arguments(['-fno-common', '-frounding-math', '-fsignaling-nans',
205 '-Wno-unsupported-floating-point-opt',
206 '-fno-builtin-copysignl'])
213 c_flags = cc.get_supported_arguments(['-fno-common', '-frounding-math', '-fsignaling-nans',
214 '-Wno-unsupported-floating-point-opt',
215 '-fno-builtin-copysignl'])
217 c_sanitize_bounds_flags = cc.get_supported_arguments(['-fsanitize=bounds'])
218 c_sanitize_trap_flags = cc.get_supported_arguments(['-fsanitize-undefined-trap-on-error'])
219 c_sanitize_no_trap_flags = cc.get_supported_arguments(['-fno-sanitize-undefined-trap-on-error', '-static-libubsan'])
224 sanitize_bounds = get_option('sanitize-bounds')
225 sanitize_trap_on_error = get_option('sanitize-trap-on-error')
229 error('sanitize-bounds option selected but -fsanitize=bounds is not supported')
245 fast_strcmp = get_option('fast-strcmp')
247 newlib_mb = get_option('newlib-mb')
248 newlib_locale_info = get_option('newlib-locale-info')
250 newlib_obsolete_math = get_option('newlib-obsolete-math')
251 newlib_obsolete_math_float = get_option('newlib-obsolete-math-float')
252 newlib_obsolete_math_double = get_option('newlib-obsolete-math-double')
254 sysroot_install = get_option('sysroot-install')
255 system_libc = get_option('system-libc')
263 duplicate_names = find_program('scripts/duplicate-names', required : true)
267 validate_cdefs = find_program ('scripts/validate-cdefs', required : true)
274 io_long_long = get_option('io-long-long')
275 newlib_io_long_long = get_option('newlib-io-long-long')
280 io_c99_formats = get_option('io-c99-formats')
281 newlib_io_c99_formats = get_option('newlib-io-c99-formats')
286 io_pos_args = get_option('io-pos-args')
287 newlib_io_pos_args = get_option('newlib-io-pos-args')
296 cc.has_link_argument('-Wl,--defsym=' + 'start=0') or
297 cc.has_link_argument('-Wl,--defsym=' + '_start=0') or
298 cc.has_link_argument('-Wl,--defsym=' + '__start=0') or
299 cc.has_link_argument('-Wl,--defsym=' + '___start=0') )
300 has_link_alias = meson.get_cross_property('has_link_alias', cc.has_link_argument('-Wl,-alias,' + global_prefix + 'main,testalias'))
301 lib_gcc = meson.get_cross_property('libgcc', '-lgcc')
304 posix_console = tinystdio and get_option('posix-console')
305 posix_io = tinystdio and (get_option('posix-io') or posix_console)
306 io_float_exact = not tinystdio or get_option('io-float-exact')
307 atomic_ungetc = tinystdio and get_option('atomic-ungetc')
308 atomic_signal = get_option('atomic-signal')
309 format_default = get_option('format-default')
310 printf_aliases = get_option('printf-aliases')
311 io_percent_b = tinystdio and get_option('io-percent-b')
312 io_long_double = get_option('io-long-double') or get_option('newlib-io-long-double')
313 printf_small_ultoa = tinystdio and get_option('printf-small-ultoa')
314 printf_percent_n = tinystdio and get_option('printf-percent-n')
315 minimal_io_long_long = tinystdio and get_option('minimal-io-long-long')
316 fast_bufio = tinystdio and get_option('fast-bufio')
317 io_wchar = tinystdio and get_option('io-wchar')
321 double_printf_compile_args=['-DPICOLIBC_DOUBLE_PRINTF_SCANF']
322 float_printf_compile_args=['-DPICOLIBC_FLOAT_PRINTF_SCANF']
323 llong_printf_compile_args=['-DPICOLIBC_LONG_LONG_PRINTF_SCANF']
324 int_printf_compile_args=['-DPICOLIBC_INTEGER_PRINTF_SCANF']
325 min_printf_compile_args=['-DPICOLIBC_MINIMAL_PRINTF_SCANF']
355 double_printf_link_args += '-Wl,--defsym=' + vfprintf_symbol + '=' + __d_vfprintf_symbol
356 double_printf_link_args += '-Wl,--defsym=' + vfscanf_symbol + '=' + __d_vfscanf_symbol
359 float_printf_link_args += '-Wl,--defsym=' + vfprintf_symbol + '=' + __f_vfprintf_symbol
360 float_printf_link_args += '-Wl,--defsym=' + vfscanf_symbol + '=' + __f_vfscanf_symbol
362 if format_default != 'long-long'
363 llong_printf_link_args += '-Wl,--defsym=' + vfprintf_symbol + '=' + __l_vfprintf_symbol
364 llong_printf_link_args += '-Wl,--defsym=' + vfscanf_symbol + '=' + __l_vfscanf_symbol
367 int_printf_link_args += '-Wl,--defsym=' + vfprintf_symbol + '=' + __i_vfprintf_symbol
368 int_printf_link_args += '-Wl,--defsym=' + vfscanf_symbol + '=' + __i_vfscanf_symbol
371 min_printf_link_args += '-Wl,--defsym=' + vfprintf_symbol + '=' + __m_vfprintf_symbol
372 min_printf_link_args += '-Wl,--defsym=' + vfscanf_symbol + '=' + __m_vfscanf_symbol
376 float_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __d_vfprintf_symbol
377 float_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __d_vfscanf_symbol
378 llong_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __d_vfprintf_symbol
379 llong_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __d_vfscanf_symbol
380 int_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __d_vfprintf_symbol
381 int_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __d_vfscanf_symbol
382 min_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __d_vfprintf_symbol
383 min_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __d_vfscanf_symbol
386 double_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __f_vfprintf_symbol
387 double_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __f_vfscanf_symbol
388 llong_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __f_vfprintf_symbol
389 llong_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __f_vfscanf_symbol
390 int_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __f_vfprintf_symbol
391 int_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __f_vfscanf_symbol
392 min_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __f_vfprintf_symbol
393 min_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __f_vfscanf_symbol
395 if format_default == 'long-long'
396 double_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __l_vfprintf_symbol
397 double_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __l_vfscanf_symbol
398 float_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __l_vfprintf_symbol
399 float_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __l_vfscanf_symbol
400 int_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __l_vfprintf_symbol
401 int_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __l_vfscanf_symbol
402 min_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __l_vfprintf_symbol
403 min_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __l_vfscanf_symbol
406 double_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __i_vfprintf_symbol
407 double_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __i_vfscanf_symbol
408 float_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __i_vfprintf_symbol
409 float_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __i_vfscanf_symbol
410 llong_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __i_vfprintf_symbol
411 llong_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __i_vfscanf_symbol
412 min_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __i_vfprintf_symbol
413 min_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __i_vfscanf_symbol
416 double_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __m_vfprintf_symbol
417 double_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __m_vfscanf_symbol
418 float_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __m_vfprintf_symbol
419 float_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __m_vfscanf_symbol
420 llong_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __m_vfprintf_symbol
421 llong_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __m_vfscanf_symbol
422 int_printf_link_args += '-Wl,-alias,' + vfprintf_symbol + ',' + __m_vfprintf_symbol
423 int_printf_link_args += '-Wl,-alias,' + vfscanf_symbol + ',' + __m_vfscanf_symbol
426 double_printf_link_args += '-Wl,-alias,' + __d_vfprintf_symbol + ',' + vfprintf_symbol
427 double_printf_link_args += '-Wl,-alias,' + __d_vfscanf_symbol + ',' + vfscanf_symbol
430 float_printf_link_args += '-Wl,-alias,' + __f_vfprintf_symbol + ',' + vfprintf_symbol
431 float_printf_link_args += '-Wl,-alias,' + __f_vfscanf_symbol + ',' + vfscanf_symbol
433 if format_default != 'long-long'
434 llong_printf_link_args += '-Wl,-alias,' + __l_vfprintf_symbol + ',' + vfprintf_symbol
435 llong_printf_link_args += '-Wl,-alias,' + __l_vfscanf_symbol + ',' + vfscanf_symbol
438 int_printf_link_args += '-Wl,-alias,' + __i_vfprintf_symbol + ',' + vfprintf_symbol
439 int_printf_link_args += '-Wl,-alias,' + __i_vfscanf_symbol + ',' + vfscanf_symbol
442 min_printf_link_args += '-Wl,-alias,' + __m_vfprintf_symbol + ',' + vfprintf_symbol
443 min_printf_link_args += '-Wl,-alias,' + __m_vfscanf_symbol + ',' + vfscanf_symbol
449 error('Symbol alias linker flag not supported - printf tests will fail!')
454 # A bunch of newlib-stdio only options
455 newlib_global_stdio_streams = get_option('newlib-global-stdio-streams')
456 newlib_fvwrite_in_streamio = get_option('newlib-fvwrite-in-streamio')
457 newlib_fseek_optimization = get_option('newlib-fseek-optimization')
458 newlib_nano_formatted_io = get_option('newlib-nano-formatted-io')
459 newlib_io_float = get_option('newlib-io-float')
460 newlib_stdio64 = get_option('newlib-stdio64')
461 newlib_wide_orient = get_option('newlib-wide-orient')
462 newlib_have_fcntl = get_option('newlib-have-fcntl')
464 # Check for a bunch of newlib-stdio only options and complain
469 error('tinystdio uses a run-time mechanism to select floating point io (newlib-io-float)')
472 error('tinystdio always has (reentrant) global stdio streams (newlib-global-stdio-streams)')
475 error('tinystdio has no fvwrite support (newlib-fvwrite-in-streamio)')
478 error('tinystdio has no fseek support (newlib-fseek-optimization)')
481 error('tinystdio uses a run-time mechanism to select smaller printf code (newlib-nano-formatted-io)')
484 error('tinystdio does not support the wide-orient option (newlib-wide-orient)')
488 error('newlib stdio does not support the posix-console option (posix-console)')
491 error('newlib stdio has bugs with positional arguments (io-pos-args)')
496 host_cc_machine=run_command(cc.cmd_array() + ['-dumpmachine'], check : true).stdout().strip().split('-')
521 thread_local_storage_option = get_option('thread-local-storage')
529 thread_local_storage = get_option('thread-local-storage') == 'true'
532 tls_model_spec = '%{!ftls-model:-ftls-model=' + get_option('tls-model') + '}'
537 sysroot = run_command(cc.cmd_array() + ['-print-sysroot'], check : true).stdout().split('\n')[0]
542 if not get_option('sysroot-install-skip-checks')
546 # Since toolchain may be moved and to another directory, let's get actual path using "gcc -print-search-dirs"
547 # Note that the "install path" obtained with this command points to the "$GCC_EXEC_PREFIX/$ARCH/$GCC-VERSION"
549 sysroot = run_command(cc.cmd_array() + ['-print-search-dirs'], check : true).stdout().split('\n')[0].split(' ')[1]
570 if not get_option('sysroot-install-skip-checks')
571 error('sysroot install requires sysroot(' + sysroot + ') to be a subdirectory of --prefix=<PATH>(' + prefix + ')')
579 build_type_subdir = get_option('build-type-subdir')
585 newlib_iconv_dir = get_option('newlib-iconv-dir')
590 newlib_iconv_runtime_dir = get_option('newlib-iconv-runtime-dir')
616 additional_libs_list += '-lcompcert'
622 # Extract -mhwmult-selection-snippet from GCC.
623 dumped_specs = run_command(cc.cmd_array() + '-dumpspecs').stdout()
625 hwmult_snippet = '%{mhwmult=auto' + hwmult_start.split('-lc')[0]
637 specs_printf=('%{DPICOLIBC_DOUBLE_PRINTF_SCANF:--defsym=vfprintf=' + __d_vfprintf_symbol + '}' +
638 ' %{DPICOLIBC_DOUBLE_PRINTF_SCANF:--defsym=vfscanf=' + __d_vfscanf_symbol + '}' +
639 ' %{DPICOLIBC_FLOAT_PRINTF_SCANF:--defsym=vfprintf=' + __f_vfprintf_symbol + '}' +
640 ' %{DPICOLIBC_FLOAT_PRINTF_SCANF:--defsym=vfscanf=' + __f_vfscanf_symbol + '}' +
641 ' %{DPICOLIBC_LONG_LONG_PRINTF_SCANF:--defsym=vfprintf=' + __l_vfprintf_symbol + '}' +
642 ' %{DPICOLIBC_LONG_LONG_PRINTF_SCANF:--defsym=vfscanf=' + __l_vfscanf_symbol + '}' +
643 ' %{DPICOLIBC_INTEGER_PRINTF_SCANF:--defsym=vfprintf=' + __i_vfprintf_symbol + '}' +
644 ' %{DPICOLIBC_INTEGER_PRINTF_SCANF:--defsym=vfscanf=' + __i_vfscanf_symbol + '}' +
645 ' %{DPICOLIBC_MINIMAL_PRINTF_SCANF:--defsym=vfprintf=' + __m_vfprintf_symbol + '}' +
646 ' %{DPICOLIBC_MINIMAL_PRINTF_SCANF:--defsym=vfscanf=' + __m_vfscanf_symbol + '}')
649 crt0_expr = '%{-crt0=*:crt0-%*%O%s; :crt0%O%s}'
660 # Each of these needs to handle --picolibc-prefix and
661 # --picolibc-buildtype options, system-root vs absolute paths and
665 # (corresponding to --picolibc-prefix), the 'buildtype' value
666 # (corresponding to --picolibc-buildtype) and the 'gen' value (for
677 # How to format each of the three option-selected
680 picolibc_prefix_format = '-picolibc-prefix=*:@0@'
681 picolibc_buildtype_format = '-picolibc-buildtype=*:@0@'
690 # Build the -isystem value
702 specs_isystem = '-isystem ' + specs_option_format.format(isystem_prefix, isystem_buildtype, isystem_gen)
705 # Build the non-multilib -L value
717 specs_libpath = '-L' + specs_option_format.format(lib_prefix, lib_buildtype, lib_gen)
720 # Build the non-multilib *startfile options
733 # Now build multilib versions of the -L and *startfile values
738 # Build the multilib -L value
749 specs_multilibpath = '-L' + specs_option_format.format(multilib_prefix, multilib_buildtype, multilib_gen)
752 # Prepend the multilib -L option to the non-multilib option
772 # multilib path or the non-multilib path
778 specs_data.set('SPECS_ISYSTEM', specs_isystem)
779 specs_data.set('SPECS_LIBPATH', specs_libpath)
780 specs_data.set('SPECS_STARTFILE', specs_startfile)
781 specs_data.set('TLSMODEL', tls_model_spec)
782 specs_data.set('LINK_SPEC', meson.get_cross_property('link_spec', ''))
783 specs_data.set('CC1_SPEC', meson.get_cross_property('cc1_spec', ''))
784 specs_data.set('CC1PLUS_SPEC', meson.get_cross_property('cc1plus_spec', ''))
785 specs_data.set('ADDITIONAL_LIBS', additional_libs)
786 specs_data.set('SPECS_EXTRA', specs_extra)
787 specs_data.set('SPECS_PRINTF', specs_printf)
795 specs_c_data.set('PICOLIBC_LD', 'picolibc.ld')
796 specs_c_data.set('CRTBEGIN', '')
797 specs_c_data.set('CRTEND', '')
801 specs_cpp_data.set('PICOLIBC_LD', 'picolibcpp.ld')
802 specs_cpp_data.set('CRTBEGIN', 'crtbegin%O%s')
803 specs_cpp_data.set('CRTEND', 'crtend%O%s')
821 '-Werror=vla',
822 '-Warray-bounds',
823 '-Werror=double-promotion',
824 '-Wno-missing-braces',
825 '-Wno-return-type',
826 '-Wno-unused-command-line-argument',
827 '-Wmissing-prototypes',
828 '-Wmissing-declarations',
829 '-Werror=implicit-fallthrough=5',
830 '-Werror=unreachable-code-fallthrough',
834 '-fanalyzer',
838 '-Werror=implicit-function-declaration',
839 '-Wold-style-definition',
840 '-Wno-implicit-int',
848 c_args += ['-D_LIBC', '-U_FORTIFY_SOURCE']
851 fortify_source = get_option('fortify-source')
853 test_fortify_arg = '-U_FORTIFY_SOURCE'
855 test_fortify_arg = '-D_FORTIFY_SOURCE=' + fortify_source
859 c_args += cc.get_supported_arguments(['-fno-stack-protector'])
865 cpp_flags = cpp.get_supported_arguments(['-fno-exceptions', '-fno-unwind-tables', '-fno-stack-protector'])
873 unsigned int foobar (const struct test *p) { return p->part; }
917 werror_c_args = core_c_args + cc.get_supported_arguments('-Werror')
928 # attributes constructor/destructor are a GNU extension - if the compiler doesn't have them, don't test them.
938 # Ask the compiler for the set of available multilib configurations,
939 # set up the build system to compile for all desired ones
941 target_list = run_command(cc.cmd_array() + get_option('c_args') + ['--print-multi-lib'], check : true).stdout().strip().split('\n')
974 # Hacks for NIOS II to get rid of -fsingle-precision-constant
976 # doesn't set the single precision constant flag
977 if flag == 'mcustom-fpu-cfg=60-1'
978 flags += ['-mcustom-fmuls=252', '-mcustom-fadds=253',
979 '-mcustom-fsubs=254']
980 elif flag == 'mcustom-fpu-cfg=60-2'
981 flags += ['-mcustom-fmuls=252', '-mcustom-fadds=253',
982 '-mcustom-fsubs=254', '-mcustom-fdivs=255']
983 elif flag == 'mcustom-fpu-cfg=72-3'
984 flags += ['-mcustom-floatus=243', '-mcustom-fixsi=244',
985 '-mcustom-floatis=245','-mcustom-fcmpgts=246',
986 '-mcustom-fcmples=249', '-mcustom-fcmpeqs=250',
987 '-mcustom-fcmpnes=251', '-mcustom-fmuls=252',
988 '-mcustom-fadds=253', '-mcustom-fsubs=254',
989 '-mcustom-fdivs=255']
991 flags += '-' + flag
994 flags += '-' + flag
1008 # rv64 needs to use a non-default mcmodel so that variables can
1011 flags += [ '-mcmodel=medany' ]
1036 foreach target : ['default-target'] + targets
1040 if target != 'default-target'
1049 if target == 'default-target' or custom_mem_config != ''
1054 # (ALIGN(__tls_align), which is rejected as non-constant by ld.bfd), so we use
1057 picolibc_linker_type_data.set('BFD_START', '/* For ld.bfd: ')
1058 picolibc_linker_type_data.set('BFD_END', '*/')
1059 picolibc_linker_type_data.set('LLD_START', '')
1060 picolibc_linker_type_data.set('LLD_END', '')
1061 picolibc_linker_type_data.set('TLS_PHDRS', 'tls PT_TLS;')
1062 picolibc_linker_type_data.set('TLS_INIT_SEG', 'tls')
1068 # Note: --version still checks for valid arguments so this works.
1069 if not cc.has_link_argument('-Wl,--package-metadata=1,--version')
1070 message('Linking for RISCV with ld.lld < 15, forcing -mno-relax')
1071 c_args += ['-mno-relax']
1075 picolibc_linker_type_data.set('BFD_START', '')
1076 picolibc_linker_type_data.set('BFD_END', '')
1077 picolibc_linker_type_data.set('LLD_START', '/* For ld.lld: ')
1078 picolibc_linker_type_data.set('LLD_END', '*/')
1079 picolibc_linker_type_data.set('TLS_PHDRS', '''tls_init PT_TLS;
1081 picolibc_linker_type_data.set('TLS_INIT_SEG', 'tls_init')
1166 picolibc_linker_type_data.set('INIT_MEMORY', init_memory)
1167 picolibc_linker_type_data.set('INIT_PHDRS', init_phdrs)
1168 picolibc_linker_type_data.set('INIT_SECTIONS', init_sections)
1170 picolibc_linker_type_data.set(
1177 picolibc_linker_type_data.set(
1184 picolibc_linker_type_data.set(
1190 picolibc_linker_type_data.set(
1196 picolibc_linker_type_data.set(
1202 picolibc_linker_type_data.set(
1210 picolibc_ld_data.set('CPP_START', '/*')
1211 picolibc_ld_data.set('CPP_END', '*/')
1212 picolibc_ld_data.set('C_START', '')
1213 picolibc_ld_data.set('C_END', '')
1214 picolibc_ld_data.set('PREFIX', global_prefix)
1216 if target == 'default-target'
1247 picolibcpp_ld_data.set('CPP_START', '')
1248 picolibcpp_ld_data.set('CPP_END', '')
1249 picolibcpp_ld_data.set('C_START', '/*')
1250 picolibcpp_ld_data.set('C_END', '*/')
1251 picolibcpp_ld_data.set('PREFIX', global_prefix)
1301 conf_data.set('_HAVE_' + builtin[0].to_upper(), have_current_builtin, description: 'The compiler supports __' + builtin[0])
1309 if get_option('newlib-retargetable-locking') != get_option('newlib-multithread')
1310 error('newlib-retargetable-locking and newlib-multithread must be set to the same value')
1313 conf_data.set('_HAVE_CC_INHIBIT_LOOP_TO_LIBCALL',
1314 cc.has_argument('-fno-tree-loop-distribute-patterns'),
1317 conf_data.set('_HAVE_NO_BUILTIN_ATTRIBUTE',
1323 conf_data.set('_HAVE_LONG_DOUBLE', have_long_double,
1325 conf_data.set('_HAVE_ALIAS_ATTRIBUTE', have_alias_attribute)
1326 conf_data.set('_HAVE_FORMAT_ATTRIBUTE', have_format_attribute)
1327 conf_data.set('_HAVE_WEAK_ATTRIBUTE', have_weak_attribute)
1328 conf_data.set('_WANT_REGISTER_FINI', get_option('newlib-register-fini'))
1329 conf_data.set('_WANT_IO_LONG_LONG', io_long_long)
1330 conf_data.set('_WANT_MINIMAL_IO_LONG_LONG', minimal_io_long_long)
1331 conf_data.set('_WANT_FAST_BUFIO', fast_bufio)
1332 conf_data.set('_WANT_IO_POS_ARGS', io_pos_args)
1333 conf_data.set('_WANT_IO_C99_FORMATS', io_c99_formats)
1334 conf_data.set('_IO_FLOAT_EXACT', io_float_exact)
1335 conf_data.set('_WANT_IO_PERCENT_B', io_percent_b)
1336 conf_data.set('_WANT_IO_LONG_DOUBLE', io_long_double)
1337 conf_data.set('_WANT_IO_WCHAR', io_wchar)
1338 conf_data.set('_ASSERT_VERBOSE', get_option('assert-verbose'))
1341 conf_data.set('NO_FLOATING_POINT', not newlib_io_float)
1342 conf_data.set('FLOATING_POINT', newlib_io_float)
1343 conf_data.set('_WANT_REENT_GLOBAL_STDIO_STREAMS', newlib_global_stdio_streams)
1344 conf_data.set('__LARGE64_FILES', newlib_stdio64)
1346 conf_data.set('_WANT_REENT_SMALL', get_option('newlib-reent-small'))
1347 conf_data.set('_MB_CAPABLE', newlib_mb)
1348 conf_data.set('__SINGLE_THREAD__', get_option('newlib-multithread') == false)
1349 conf_data.set('_ICONV_ENABLE_EXTERNAL_CCS', newlib_iconv_external_ccs)
1350 conf_data.set('_ELIX_LEVEL', newlib_elix_level)
1354 conf_data.set('_ATEXIT_DYNAMIC_ALLOC', newlib_atexit_dynamic_alloc)
1355 conf_data.set('_REENT_GLOBAL_ATEXIT', get_option('newlib-global-atexit'))
1356 conf_data.set('_FVWRITE_IN_STREAMIO', newlib_fvwrite_in_streamio)
1357 conf_data.set('_FSEEK_OPTIMIZATION', newlib_fseek_optimization)
1358 conf_data.set('_WIDE_ORIENT', newlib_wide_orient)
1359 conf_data.set('_HAVE_FCNTL', newlib_have_fcntl)
1360 conf_data.set('_NANO_MALLOC', newlib_nano_malloc)
1361 conf_data.set('_UNBUF_STREAM_OPT', get_option('newlib-unbuf-stream-opt'))
1362 conf_data.set('_LITE_EXIT', lite_exit)
1363 conf_data.set('_PICO_EXIT', picoexit)
1364 conf_data.set('_NANO_FORMATTED_IO', newlib_nano_formatted_io)
1365 conf_data.set('_RETARGETABLE_LOCKING', get_option('newlib-retargetable-locking'))
1366 conf_data.set('TINY_STDIO', tinystdio, description: 'Use tiny stdio from gcc avr')
1367 conf_data.set('_IEEE_LIBM', not get_option('want-math-errno'), description: 'math library does not set errno (offering only ieee semantics)')
1368 conf_data.set('_WANT_MATH_ERRNO', get_option('want-math-errno'), description: 'math library sets errno')
1369 conf_data.set('PREFER_SIZE_OVER_SPEED', get_option('optimization') == 's', description: 'Optimize for space over speed')
1370 conf_data.set('FAST_STRCMP', fast_strcmp, description: 'Always optimize strcmp for performance')
1371 conf_data.set('__HAVE_LOCALE_INFO__', newlib_locale_info, description: 'locale support')
1372 conf_data.set('__HAVE_LOCALE_INFO_EXTENDED__', get_option('newlib-locale-info-extended'), description: 'extended locale support')
1373 conf_data.set('NEWLIB_GLOBAL_ERRNO', get_option('newlib-global-errno'), description: 'use global errno variable')
1374 conf_data.set('_HAVE_INITFINI_ARRAY', get_option('newlib-initfini-array'), description: 'compiler supports INIT_ARRAY sections')
1375 conf_data.set('_HAVE_INIT_FINI', get_option('newlib-initfini'), description: 'Support _init() and _fini() functions')
1376 conf_data.set('NEWLIB_TLS', thread_local_storage, description: 'use thread local storage')
1377 conf_data.set('PICOLIBC_TLS', thread_local_storage, description: 'use thread local storage')
1378 conf_data.set('_HAVE_PICOLIBC_TLS_API', thread_local_storage and have_picolibc_tls_api, description: '_set_tls and _init_tls functions available')
1379 conf_data.set('_HAVE_PICOLIBC_TLS_RP2040', get_option('tls-rp2040'),
1381 conf_data.set('POSIX_IO', posix_io, description: 'Use open/close/read/write in tinystdio')
1382 conf_data.set('_PRINTF_SMALL_ULTOA', printf_small_ultoa, description: 'avoid software division in decimal conversion')
1383 conf_data.set('_PRINTF_PERCENT_N', printf_percent_n, description: 'support %n in printf format strings')
1384 conf_data.set('ATOMIC_UNGETC', atomic_ungetc, description: 'Use atomics for fgetc/ungetc for re-entrancy')
1385 conf_data.set('_PICOLIBC_ATOMIC_SIGNAL', atomic_signal, description: 'Use atomics for signal/raise for re-entrancy')
1386 conf_data.set('_HAVE_BITFIELDS_IN_PACKED_STRUCTS', have_bitfields_in_packed_structs, description: 'Use bitfields in packed structs')
1387 conf_data.set('_HAVE_BUILTIN_MUL_OVERFLOW', have_builtin_mul_overflow, description: 'Compiler has __builtin_mul_overflow')
1388 conf_data.set('_HAVE_BUILTIN_ADD_OVERFLOW', have_builtin_add_overflow, description: 'Compiler has __builtin_add_overflow')
1389 conf_data.set('_HAVE_COMPLEX', have_complex, description: 'Compiler supports _Complex')
1390 conf_data.set('_HAVE_BUILTIN_COMPLEX', have_builtin_complex, description: 'Compiler has __builtin_complex')
1391 conf_data.set('_HAVE_BUILTIN_EXPECT', have_builtin_expect, description: 'Compiler has __builtin_expect')
1392 conf_data.set('_HAVE_ALLOC_SIZE', have_alloc_size, description: 'The compiler REALLY has the attribute __alloc_size__')
1393 conf_data.set('_HAVE_ATTRIBUTE_ALWAYS_INLINE',
1396 conf_data.set('_HAVE_ATTRIBUTE_GNU_INLINE',
1399 conf_data.set('__PICOLIBC_CRT_RUNTIME_SIZE',
1400 get_option('crt-runtime-size'),
1403 conf_data.set('_FORMAT_DEFAULT_DOUBLE',
1406 conf_data.set('_FORMAT_DEFAULT_FLOAT',
1409 conf_data.set('_FORMAT_DEFAULT_INTEGER',
1412 conf_data.set('_FORMAT_DEFAULT_MINIMAL',
1416 errno_function=get_option('errno-function')
1441 conf_data.set('__PICOLIBC_ERRNO_FUNCTION', errno_function)
1445 conf_data.set('_WANT_USE_LONG_TIME_T', get_option('newlib-long-time_t'), description: 'Obsoleted. Define time_t to long instead of using a 64-bit type')
1446 conf_data.set('REENTRANT_SYSCALLS_PROVIDED', get_option('newlib-reentrant-syscalls-provided'), description: 'Obsoleted. Reentrant syscalls provided for us')
1447 conf_data.set('MISSING_SYSCALL_NAMES', get_option('newlib-missing-syscall-names'), description: 'Obsoleted. Use regular syscalls')
1473 conf_data.set('__OBSOLETE_MATH', obsolete_math_value, description: 'Use old math code (undef auto, 0 no, 1 yes)')
1474 conf_data.set('__OBSOLETE_MATH_FLOAT', obsolete_math_float_value, description: 'Use old math code for float funcs (undef auto, 0 no, 1 yes)')
1475 conf_data.set('__OBSOLETE_MATH_DOUBLE', obsolete_math_double_value, description: 'Use old math code for double funcs (undef auto, 0 no, 1 yes)')
1477 # Check if compiler has -fno-builtin
1480 if cc.has_argument('-fno-builtin')
1481 arg_fnobuiltin = ['-fno-builtin']
1499 _available_encodings = run_command(['sed', '-e', '/^#/d', '-e', '/^$/d', '-e', 's/ .*$//', files('newlib/libc/iconv/encoding.aliases')[0]], check : true).stdout().split('\n')
1524 # Set config variables for each requested 'from' encoding
1533 conf_data.set('_ICONV_FROM_ENCODING_' + from.to_upper(), true)
1537 # Set config variables for each requested 'to' encoding
1544 conf_data.set('_ICONV_TO_ENCODING_' + to.to_upper(), true)
1556 conf_data.set('__PICOLIBC_VERSION__', '"@0@"'.format(meson.project_version()), description: 'The Picolibc version in string format.')
1557 conf_data.set('__PICOLIBC__', version_array[0], description: 'The Picolibc major version number.')
1558 conf_data.set('__PICOLIBC_MINOR__', version_array[1], description: 'The Picolibc minor version number.')
1559 conf_data.set('__PICOLIBC_PATCHLEVEL__', picolibc_patch_level, description: 'The Picolibc patch level.')
1564 conf_data.set('_PICOLIBC_VERSION', '"@0@"'.format(meson.project_version()), description: 'The Picolibc version in string format.')
1565 conf_data.set('_PICOLIBC__', version_array[0], description: 'The Picolibc major version number.')
1566 conf_data.set('_PICOLIBC_MINOR__', version_array[1], description: 'The Picolibc minor version number.')
1568 conf_data.set('_NEWLIB_VERSION', '"@0@"'.format(NEWLIB_VERSION), description: 'The newlib version in string format.')
1569 conf_data.set('__NEWLIB__', NEWLIB_MAJOR_VERSION, description: 'The newlib major version number.')
1570 conf_data.set('__NEWLIB_MINOR__', NEWLIB_MINOR_VERSION, description: 'The newlib minor version number.')
1571 conf_data.set('__NEWLIB_PATCHLEVEL__', NEWLIB_PATCHLEVEL_VERSION, description: 'The newlib patch level.')
1585 inc_args += '-I' + meson.current_source_dir() / inc_dir
1588 # We don't need '-fdata-sections' currently as there aren't any
1590 # versions of gcc for RISC-V which have a bug that mis-names
1591 # initialized read-only data segments when -fdata-sections
1594 if cc.has_argument('-ffunction-sections')
1595 arguments += ['-ffunction-sections']
1599 tls_arg = '-ftls-model=' + get_option('tls-model')
1600 assert(cc.has_argument(tls_arg), 'Compiler does not support \'-ftls-model\'!')
1628 conf_data.set('_HAVE_SEMIHOST', has_semihost, description: 'Semihost APIs supported')
1632 # disable compiler built-ins so we don't use native equivalents
1635 if cc.has_argument('-fstack-protector-all') and cc.has_argument('-fstack-protector-strong')
1636 test_c_args += ['-fstack-protector-all', '-fstack-protector-strong', '-DTESTS_ENABLE_STACK_PROTECTOR']
1643 test_c_args += cc.get_supported_arguments(['-fno-stack-protector'])
1646 if have_long_double and get_option('test-long-double')
1647 test_c_args += ['-D_TEST_LONG_DOUBLE']
1648 native_c_args += ['-D_TEST_LONG_DOUBLE']
1666 foreach target : ['default-target'] + targets
1667 if target == 'default-target'
1686 ['-Wl,--gc-sections', '-nostdlib', '-T', picolibc_ld_string]
1692 # Make sure all of the tests get re-linked if the linker scripts change.
1696 test_link_args = ['-Wl,--gc-sections']
1703 picocrt_enable_mmu = get_option('picocrt-enable-mmu')
1704 conf_data.set('_PICOCRT_ENABLE_MMU', picocrt_enable_mmu,
1713 conf_data.set('_HAVE_IEEEFP_FUNCS', has_ieeefp_funcs, description: 'IEEE fp funcs available')