diff --git a/gcc/.footprint b/gcc/.footprint index f4e3bc32..062ab5a0 100644 --- a/gcc/.footprint +++ b/gcc/.footprint @@ -15,1369 +15,1408 @@ lrwxrwxrwx root/root usr/bin/cc -> gcc -rwxr-xr-x root/root usr/bin/gcov-tool drwxr-xr-x root/root usr/include/ drwxr-xr-x root/root usr/include/c++/ -drwxr-xr-x root/root usr/include/c++/6.4.0/ --rw-r--r-- root/root usr/include/c++/6.4.0/algorithm --rw-r--r-- root/root usr/include/c++/6.4.0/array --rw-r--r-- root/root usr/include/c++/6.4.0/atomic -drwxr-xr-x root/root usr/include/c++/6.4.0/backward/ --rw-r--r-- root/root usr/include/c++/6.4.0/backward/auto_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/backward/backward_warning.h --rw-r--r-- root/root usr/include/c++/6.4.0/backward/binders.h --rw-r--r-- root/root usr/include/c++/6.4.0/backward/hash_fun.h --rw-r--r-- root/root usr/include/c++/6.4.0/backward/hash_map --rw-r--r-- root/root usr/include/c++/6.4.0/backward/hash_set --rw-r--r-- root/root usr/include/c++/6.4.0/backward/hashtable.h --rw-r--r-- root/root usr/include/c++/6.4.0/backward/strstream -drwxr-xr-x root/root usr/include/c++/6.4.0/bits/ --rw-r--r-- root/root usr/include/c++/6.4.0/bits/algorithmfwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/alloc_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/allocated_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/atomic_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/atomic_futex.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/atomic_lockfree_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/basic_ios.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/basic_ios.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/basic_string.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/basic_string.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/boost_concept_check.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/c++0x_warning.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/c++14_warning.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/char_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/codecvt.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/concept_check.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/cpp_type_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/cxxabi_forced.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/deque.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/enable_special_members.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/exception_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/exception_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/forward_list.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/forward_list.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/fstream.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/functexcept.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/functional_hash.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/gslice.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/gslice_array.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/hash_bytes.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/hashtable.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/hashtable_policy.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/indirect_array.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/ios_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/istream.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/list.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_classes.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_classes.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_conv.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_facets.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_facets.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_facets_nonio.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/locale_facets_nonio.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/localefwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/mask_array.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/memoryfwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/move.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/nested_exception.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/ostream.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/ostream_insert.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/parse_numbers.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/postypes.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/predefined_ops.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/ptr_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/quoted_string.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/random.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/random.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/range_access.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_automaton.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_automaton.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_compiler.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_compiler.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_constants.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_error.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_executor.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_executor.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_scanner.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/regex_scanner.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/shared_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/shared_ptr_atomic.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/shared_ptr_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/slice_array.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/specfun.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/sstream.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/std_mutex.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_algo.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_algobase.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_bvector.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_construct.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_deque.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_function.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_heap.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_iterator_base_funcs.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_iterator_base_types.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_list.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_map.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_multimap.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_multiset.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_numeric.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_pair.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_queue.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_raw_storage_iter.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_relops.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_set.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_stack.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_tempbuf.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_tree.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_uninitialized.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stl_vector.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stream_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/streambuf.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/streambuf_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/stringfwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/uniform_int_dist.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/unique_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/unordered_map.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/unordered_set.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/uses_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/valarray_after.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/valarray_array.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/valarray_array.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bits/valarray_before.h --rw-r--r-- root/root usr/include/c++/6.4.0/bits/vector.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/bitset --rw-r--r-- root/root usr/include/c++/6.4.0/cassert --rw-r--r-- root/root usr/include/c++/6.4.0/ccomplex --rw-r--r-- root/root usr/include/c++/6.4.0/cctype --rw-r--r-- root/root usr/include/c++/6.4.0/cerrno --rw-r--r-- root/root usr/include/c++/6.4.0/cfenv --rw-r--r-- root/root usr/include/c++/6.4.0/cfloat --rw-r--r-- root/root usr/include/c++/6.4.0/chrono --rw-r--r-- root/root usr/include/c++/6.4.0/cinttypes --rw-r--r-- root/root usr/include/c++/6.4.0/ciso646 --rw-r--r-- root/root usr/include/c++/6.4.0/climits --rw-r--r-- root/root usr/include/c++/6.4.0/clocale --rw-r--r-- root/root usr/include/c++/6.4.0/cmath --rw-r--r-- root/root usr/include/c++/6.4.0/codecvt --rw-r--r-- root/root usr/include/c++/6.4.0/complex --rw-r--r-- root/root usr/include/c++/6.4.0/complex.h --rw-r--r-- root/root usr/include/c++/6.4.0/condition_variable --rw-r--r-- root/root usr/include/c++/6.4.0/csetjmp --rw-r--r-- root/root usr/include/c++/6.4.0/csignal --rw-r--r-- root/root usr/include/c++/6.4.0/cstdalign --rw-r--r-- root/root usr/include/c++/6.4.0/cstdarg --rw-r--r-- root/root usr/include/c++/6.4.0/cstdbool --rw-r--r-- root/root usr/include/c++/6.4.0/cstddef --rw-r--r-- root/root usr/include/c++/6.4.0/cstdint --rw-r--r-- root/root usr/include/c++/6.4.0/cstdio --rw-r--r-- root/root usr/include/c++/6.4.0/cstdlib --rw-r--r-- root/root usr/include/c++/6.4.0/cstring --rw-r--r-- root/root usr/include/c++/6.4.0/ctgmath --rw-r--r-- root/root usr/include/c++/6.4.0/ctime --rw-r--r-- root/root usr/include/c++/6.4.0/cuchar --rw-r--r-- root/root usr/include/c++/6.4.0/cwchar --rw-r--r-- root/root usr/include/c++/6.4.0/cwctype --rw-r--r-- root/root usr/include/c++/6.4.0/cxxabi.h -drwxr-xr-x root/root usr/include/c++/6.4.0/debug/ --rw-r--r-- root/root usr/include/c++/6.4.0/debug/array --rw-r--r-- root/root usr/include/c++/6.4.0/debug/assertions.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/bitset --rw-r--r-- root/root usr/include/c++/6.4.0/debug/debug.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/deque --rw-r--r-- root/root usr/include/c++/6.4.0/debug/formatter.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/forward_list --rw-r--r-- root/root usr/include/c++/6.4.0/debug/functions.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/helper_functions.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/list --rw-r--r-- root/root usr/include/c++/6.4.0/debug/macros.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/map --rw-r--r-- root/root usr/include/c++/6.4.0/debug/map.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/multimap.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/multiset.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_container.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_iterator.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_local_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_local_iterator.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_sequence.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_sequence.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_unordered_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_unordered_container.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/safe_unordered_container.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/debug/set --rw-r--r-- root/root usr/include/c++/6.4.0/debug/set.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/stl_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/debug/string --rw-r--r-- root/root usr/include/c++/6.4.0/debug/unordered_map --rw-r--r-- root/root usr/include/c++/6.4.0/debug/unordered_set --rw-r--r-- root/root usr/include/c++/6.4.0/debug/vector -drwxr-xr-x root/root usr/include/c++/6.4.0/decimal/ --rw-r--r-- root/root usr/include/c++/6.4.0/decimal/decimal --rw-r--r-- root/root usr/include/c++/6.4.0/decimal/decimal.h --rw-r--r-- root/root usr/include/c++/6.4.0/deque --rw-r--r-- root/root usr/include/c++/6.4.0/exception -drwxr-xr-x root/root usr/include/c++/6.4.0/experimental/ --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/algorithm --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/any --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/array -drwxr-xr-x root/root usr/include/c++/6.4.0/experimental/bits/ --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/erase_if.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/fs_dir.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/fs_fwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/fs_ops.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/fs_path.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/lfts_config.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/shared_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/bits/string_view.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/chrono --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/deque --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/filesystem --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/forward_list --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/functional --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/iterator --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/list --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/map --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/memory --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/memory_resource --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/numeric --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/optional --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/propagate_const --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/random --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/ratio --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/regex --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/set --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/string --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/string_view --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/system_error --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/tuple --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/type_traits --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/unordered_map --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/unordered_set --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/utility --rw-r--r-- root/root usr/include/c++/6.4.0/experimental/vector -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/algorithm --rw-r--r-- root/root usr/include/c++/6.4.0/ext/aligned_buffer.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/alloc_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/array_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/atomicity.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/bitmap_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/cast.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/cmath --rw-r--r-- root/root usr/include/c++/6.4.0/ext/codecvt_specializations.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/concurrence.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/debug_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/enc_filebuf.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/extptr_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/functional --rw-r--r-- root/root usr/include/c++/6.4.0/ext/hash_map --rw-r--r-- root/root usr/include/c++/6.4.0/ext/hash_set --rw-r--r-- root/root usr/include/c++/6.4.0/ext/iterator --rw-r--r-- root/root usr/include/c++/6.4.0/ext/malloc_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/memory --rw-r--r-- root/root usr/include/c++/6.4.0/ext/mt_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/new_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/numeric --rw-r--r-- root/root usr/include/c++/6.4.0/ext/numeric_traits.h -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/assoc_container.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/bin_search_tree_/traits.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/entry_pred.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/resize_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/branch_policy/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/branch_policy/branch_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/branch_policy/traits.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/cond_dealtor.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/container_base_dispatch.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/debug_map_base.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/eq_fn/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/eq_fn/eq_by_less.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/lu_map_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_policy/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/ov_tree_map_/traits.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/traits.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/priority_queue_base_dispatch.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/node.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rb_tree_map_/traits.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/node.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/splay_tree_/traits.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/standard_policies.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/tree_policy/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/tree_trace_base.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/type_utils.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/types_traits.hpp -drwxr-xr-x root/root usr/include/c++/6.4.0/ext/pb_ds/detail/unordered_iterator/ --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/unordered_iterator/iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/exception.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/hash_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/list_update_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/priority_queue.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/tag_and_trait.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/tree_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pb_ds/trie_policy.hpp --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pod_char_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pointer.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/pool_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/random --rw-r--r-- root/root usr/include/c++/6.4.0/ext/random.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/ext/rb_tree --rw-r--r-- root/root usr/include/c++/6.4.0/ext/rc_string_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/rope --rw-r--r-- root/root usr/include/c++/6.4.0/ext/ropeimpl.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/slist --rw-r--r-- root/root usr/include/c++/6.4.0/ext/sso_string_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/stdio_filebuf.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/stdio_sync_filebuf.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/string_conversions.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/throw_allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/type_traits.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/typelist.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/vstring.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/vstring.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/ext/vstring_fwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/ext/vstring_util.h --rw-r--r-- root/root usr/include/c++/6.4.0/fenv.h --rw-r--r-- root/root usr/include/c++/6.4.0/forward_list --rw-r--r-- root/root usr/include/c++/6.4.0/fstream --rw-r--r-- root/root usr/include/c++/6.4.0/functional --rw-r--r-- root/root usr/include/c++/6.4.0/future --rw-r--r-- root/root usr/include/c++/6.4.0/initializer_list --rw-r--r-- root/root usr/include/c++/6.4.0/iomanip --rw-r--r-- root/root usr/include/c++/6.4.0/ios --rw-r--r-- root/root usr/include/c++/6.4.0/iosfwd --rw-r--r-- root/root usr/include/c++/6.4.0/iostream --rw-r--r-- root/root usr/include/c++/6.4.0/istream --rw-r--r-- root/root usr/include/c++/6.4.0/iterator --rw-r--r-- root/root usr/include/c++/6.4.0/limits --rw-r--r-- root/root usr/include/c++/6.4.0/list --rw-r--r-- root/root usr/include/c++/6.4.0/locale --rw-r--r-- root/root usr/include/c++/6.4.0/map --rw-r--r-- root/root usr/include/c++/6.4.0/math.h --rw-r--r-- root/root usr/include/c++/6.4.0/memory --rw-r--r-- root/root usr/include/c++/6.4.0/mutex --rw-r--r-- root/root usr/include/c++/6.4.0/new --rw-r--r-- root/root usr/include/c++/6.4.0/numeric --rw-r--r-- root/root usr/include/c++/6.4.0/ostream -drwxr-xr-x root/root usr/include/c++/6.4.0/parallel/ --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/algo.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/algobase.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/algorithm --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/algorithmfwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/balanced_quicksort.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/base.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/basic_iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/checkers.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/compatibility.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/compiletime_settings.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/equally_split.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/features.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/find.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/find_selectors.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/for_each.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/for_each_selectors.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/iterator.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/list_partition.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/losertree.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/merge.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/multiseq_selection.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/multiway_merge.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/multiway_mergesort.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/numeric --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/numericfwd.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/omp_loop.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/omp_loop_static.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/par_loop.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/parallel.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/partial_sum.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/partition.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/queue.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/quicksort.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/random_number.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/random_shuffle.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/search.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/set_operations.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/settings.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/sort.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/tags.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/types.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/unique_copy.h --rw-r--r-- root/root usr/include/c++/6.4.0/parallel/workstealing.h -drwxr-xr-x root/root usr/include/c++/6.4.0/profile/ --rw-r--r-- root/root usr/include/c++/6.4.0/profile/array --rw-r--r-- root/root usr/include/c++/6.4.0/profile/base.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/bitset --rw-r--r-- root/root usr/include/c++/6.4.0/profile/deque --rw-r--r-- root/root usr/include/c++/6.4.0/profile/forward_list -drwxr-xr-x root/root usr/include/c++/6.4.0/profile/impl/ --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_algos.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_container_size.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_hash_func.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_hashtable_size.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_list_to_slist.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_list_to_vector.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_map_to_unordered_map.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_node.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_state.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_trace.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_vector_size.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/impl/profiler_vector_to_list.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/iterator_tracker.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/list --rw-r--r-- root/root usr/include/c++/6.4.0/profile/map --rw-r--r-- root/root usr/include/c++/6.4.0/profile/map.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/multimap.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/multiset.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/ordered_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/set --rw-r--r-- root/root usr/include/c++/6.4.0/profile/set.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/unordered_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/profile/unordered_map --rw-r--r-- root/root usr/include/c++/6.4.0/profile/unordered_set --rw-r--r-- root/root usr/include/c++/6.4.0/profile/vector --rw-r--r-- root/root usr/include/c++/6.4.0/queue --rw-r--r-- root/root usr/include/c++/6.4.0/random --rw-r--r-- root/root usr/include/c++/6.4.0/ratio --rw-r--r-- root/root usr/include/c++/6.4.0/regex --rw-r--r-- root/root usr/include/c++/6.4.0/scoped_allocator --rw-r--r-- root/root usr/include/c++/6.4.0/set --rw-r--r-- root/root usr/include/c++/6.4.0/shared_mutex --rw-r--r-- root/root usr/include/c++/6.4.0/sstream --rw-r--r-- root/root usr/include/c++/6.4.0/stack --rw-r--r-- root/root usr/include/c++/6.4.0/stdexcept --rw-r--r-- root/root usr/include/c++/6.4.0/stdlib.h --rw-r--r-- root/root usr/include/c++/6.4.0/streambuf --rw-r--r-- root/root usr/include/c++/6.4.0/string --rw-r--r-- root/root usr/include/c++/6.4.0/system_error --rw-r--r-- root/root usr/include/c++/6.4.0/tgmath.h --rw-r--r-- root/root usr/include/c++/6.4.0/thread -drwxr-xr-x root/root usr/include/c++/6.4.0/tr1/ --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/array --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/bessel_function.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/beta_function.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/ccomplex --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cctype --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cfenv --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cfloat --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cinttypes --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/climits --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cmath --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/complex --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/complex.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cstdarg --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cstdbool --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cstdint --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cstdio --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cstdlib --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/ctgmath --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/ctime --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/ctype.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cwchar --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/cwctype --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/ell_integral.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/exp_integral.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/fenv.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/float.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/functional --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/functional_hash.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/gamma.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/hashtable.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/hashtable_policy.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/hypergeometric.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/inttypes.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/legendre_function.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/limits.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/math.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/memory --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/modified_bessel_func.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/poly_hermite.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/poly_laguerre.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/random --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/random.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/random.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/regex --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/riemann_zeta.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/shared_ptr.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/special_function_util.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/stdarg.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/stdbool.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/stdint.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/stdio.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/stdlib.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/tgmath.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/tuple --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/type_traits --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/unordered_map --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/unordered_map.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/unordered_set --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/unordered_set.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/utility --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/wchar.h --rw-r--r-- root/root usr/include/c++/6.4.0/tr1/wctype.h -drwxr-xr-x root/root usr/include/c++/6.4.0/tr2/ --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/bool_set --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/bool_set.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/dynamic_bitset --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/dynamic_bitset.tcc --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/ratio --rw-r--r-- root/root usr/include/c++/6.4.0/tr2/type_traits --rw-r--r-- root/root usr/include/c++/6.4.0/tuple --rw-r--r-- root/root usr/include/c++/6.4.0/type_traits --rw-r--r-- root/root usr/include/c++/6.4.0/typeindex --rw-r--r-- root/root usr/include/c++/6.4.0/typeinfo --rw-r--r-- root/root usr/include/c++/6.4.0/unordered_map --rw-r--r-- root/root usr/include/c++/6.4.0/unordered_set --rw-r--r-- root/root usr/include/c++/6.4.0/utility --rw-r--r-- root/root usr/include/c++/6.4.0/valarray --rw-r--r-- root/root usr/include/c++/6.4.0/vector -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/ -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/ -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/ --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/atomic_word.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/basic_file.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/c++allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/c++config.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/c++io.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/c++locale.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/cpu_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/ctype_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/ctype_inline.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/cxxabi_tweaks.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/error_constants.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/extc++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/gthr-default.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/gthr-posix.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/gthr-single.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/gthr.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/messages_members.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/opt_random.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/os_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/stdc++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/stdtr1c++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/bits/time_members.h -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/ext/ --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/32/ext/opt_random.h -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/ --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/atomic_word.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/basic_file.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/c++allocator.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/c++config.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/c++io.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/c++locale.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/cpu_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/ctype_base.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/ctype_inline.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/cxxabi_tweaks.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/error_constants.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/extc++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/gthr-default.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/gthr-posix.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/gthr-single.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/gthr.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/messages_members.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/opt_random.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/os_defines.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/stdc++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/stdtr1c++.h --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/bits/time_members.h -drwxr-xr-x root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/ext/ --rw-r--r-- root/root usr/include/c++/6.4.0/x86_64-pc-linux-gnu/ext/opt_random.h +drwxr-xr-x root/root usr/include/c++/7.2.0/ +-rw-r--r-- root/root usr/include/c++/7.2.0/algorithm +-rw-r--r-- root/root usr/include/c++/7.2.0/any +-rw-r--r-- root/root usr/include/c++/7.2.0/array +-rw-r--r-- root/root usr/include/c++/7.2.0/atomic +drwxr-xr-x root/root usr/include/c++/7.2.0/backward/ +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/auto_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/backward_warning.h +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/binders.h +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/hash_fun.h +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/hash_map +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/hash_set +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/hashtable.h +-rw-r--r-- root/root usr/include/c++/7.2.0/backward/strstream +drwxr-xr-x root/root usr/include/c++/7.2.0/bits/ +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/algorithmfwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/alloc_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/allocated_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/atomic_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/atomic_futex.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/atomic_lockfree_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/basic_ios.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/basic_ios.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/basic_string.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/basic_string.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/boost_concept_check.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/c++0x_warning.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/c++14_warning.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/c++17_warning.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/char_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/codecvt.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/concept_check.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/cpp_type_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/cxxabi_forced.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/cxxabi_init_exception.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/deque.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/enable_special_members.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/exception.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/exception_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/exception_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/forward_list.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/forward_list.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/fstream.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/functexcept.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/functional_hash.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/gslice.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/gslice_array.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/hash_bytes.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/hashtable.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/hashtable_policy.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/indirect_array.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/invoke.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/ios_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/istream.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/list.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_classes.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_classes.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_conv.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_facets.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_facets.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_facets_nonio.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/locale_facets_nonio.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/localefwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/mask_array.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/memoryfwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/move.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/nested_exception.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/node_handle.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/ostream.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/ostream_insert.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/parse_numbers.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/postypes.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/predefined_ops.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/ptr_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/quoted_string.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/random.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/random.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/range_access.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/refwrap.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_automaton.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_automaton.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_compiler.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_compiler.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_constants.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_error.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_executor.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_executor.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_scanner.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/regex_scanner.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/shared_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/shared_ptr_atomic.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/shared_ptr_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/slice_array.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/specfun.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/sstream.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/std_abs.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/std_function.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/std_mutex.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_algo.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_algobase.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_bvector.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_construct.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_deque.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_function.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_heap.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_iterator_base_funcs.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_iterator_base_types.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_list.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_multimap.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_multiset.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_numeric.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_pair.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_queue.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_raw_storage_iter.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_relops.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_set.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_stack.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_tempbuf.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_tree.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_uninitialized.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stl_vector.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stream_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/streambuf.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/streambuf_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/string_view.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/stringfwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/uniform_int_dist.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/unique_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/unordered_map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/unordered_set.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/uses_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/valarray_after.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/valarray_array.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/valarray_array.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/valarray_before.h +-rw-r--r-- root/root usr/include/c++/7.2.0/bits/vector.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/bitset +-rw-r--r-- root/root usr/include/c++/7.2.0/cassert +-rw-r--r-- root/root usr/include/c++/7.2.0/ccomplex +-rw-r--r-- root/root usr/include/c++/7.2.0/cctype +-rw-r--r-- root/root usr/include/c++/7.2.0/cerrno +-rw-r--r-- root/root usr/include/c++/7.2.0/cfenv +-rw-r--r-- root/root usr/include/c++/7.2.0/cfloat +-rw-r--r-- root/root usr/include/c++/7.2.0/chrono +-rw-r--r-- root/root usr/include/c++/7.2.0/cinttypes +-rw-r--r-- root/root usr/include/c++/7.2.0/ciso646 +-rw-r--r-- root/root usr/include/c++/7.2.0/climits +-rw-r--r-- root/root usr/include/c++/7.2.0/clocale +-rw-r--r-- root/root usr/include/c++/7.2.0/cmath +-rw-r--r-- root/root usr/include/c++/7.2.0/codecvt +-rw-r--r-- root/root usr/include/c++/7.2.0/complex +-rw-r--r-- root/root usr/include/c++/7.2.0/complex.h +-rw-r--r-- root/root usr/include/c++/7.2.0/condition_variable +-rw-r--r-- root/root usr/include/c++/7.2.0/csetjmp +-rw-r--r-- root/root usr/include/c++/7.2.0/csignal +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdalign +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdarg +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdbool +-rw-r--r-- root/root usr/include/c++/7.2.0/cstddef +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdint +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdio +-rw-r--r-- root/root usr/include/c++/7.2.0/cstdlib +-rw-r--r-- root/root usr/include/c++/7.2.0/cstring +-rw-r--r-- root/root usr/include/c++/7.2.0/ctgmath +-rw-r--r-- root/root usr/include/c++/7.2.0/ctime +-rw-r--r-- root/root usr/include/c++/7.2.0/cuchar +-rw-r--r-- root/root usr/include/c++/7.2.0/cwchar +-rw-r--r-- root/root usr/include/c++/7.2.0/cwctype +-rw-r--r-- root/root usr/include/c++/7.2.0/cxxabi.h +drwxr-xr-x root/root usr/include/c++/7.2.0/debug/ +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/array +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/assertions.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/bitset +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/debug.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/deque +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/formatter.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/forward_list +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/functions.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/helper_functions.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/list +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/macros.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/map +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/multimap.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/multiset.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_container.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_iterator.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_local_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_local_iterator.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_sequence.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_sequence.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_unordered_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_unordered_container.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/safe_unordered_container.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/set +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/set.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/stl_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/string +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/unordered_map +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/unordered_set +-rw-r--r-- root/root usr/include/c++/7.2.0/debug/vector +drwxr-xr-x root/root usr/include/c++/7.2.0/decimal/ +-rw-r--r-- root/root usr/include/c++/7.2.0/decimal/decimal +-rw-r--r-- root/root usr/include/c++/7.2.0/decimal/decimal.h +-rw-r--r-- root/root usr/include/c++/7.2.0/deque +-rw-r--r-- root/root usr/include/c++/7.2.0/exception +drwxr-xr-x root/root usr/include/c++/7.2.0/experimental/ +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/algorithm +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/any +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/array +drwxr-xr-x root/root usr/include/c++/7.2.0/experimental/bits/ +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/erase_if.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/fs_dir.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/fs_fwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/fs_ops.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/fs_path.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/lfts_config.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/shared_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/bits/string_view.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/chrono +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/deque +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/filesystem +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/forward_list +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/functional +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/iterator +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/list +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/map +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/memory +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/memory_resource +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/numeric +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/optional +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/propagate_const +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/random +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/ratio +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/regex +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/set +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/source_location +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/string +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/string_view +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/system_error +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/tuple +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/type_traits +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/unordered_map +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/unordered_set +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/utility +-rw-r--r-- root/root usr/include/c++/7.2.0/experimental/vector +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/algorithm +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/aligned_buffer.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/alloc_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/array_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/atomicity.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/bitmap_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/cast.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/cmath +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/codecvt_specializations.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/concurrence.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/debug_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/enc_filebuf.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/extptr_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/functional +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/hash_map +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/hash_set +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/iterator +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/malloc_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/memory +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/mt_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/new_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/numeric +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/numeric_traits.h +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/assoc_container.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/bin_search_tree_/traits.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/entry_pred.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/point_const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/resize_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/branch_policy/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/branch_policy/branch_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/branch_policy/null_node_metadata.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/branch_policy/traits.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/cond_dealtor.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/container_base_dispatch.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/debug_map_base.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/eq_fn/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/eq_fn/eq_by_less.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/point_const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/lu_map_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_policy/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_policy/lu_counter_metadata.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/ov_tree_map_/traits.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/pat_trie_base.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/synth_access_traits.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/traits.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/priority_queue_base_dispatch.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/node.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rb_tree_map_/traits.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/node.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/splay_tree_/traits.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/standard_policies.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/tree_policy/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/tree_trace_base.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/sample_trie_access_traits.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/trie_policy/trie_string_access_traits_imp.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/type_utils.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/types_traits.hpp +drwxr-xr-x root/root usr/include/c++/7.2.0/ext/pb_ds/detail/unordered_iterator/ +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/unordered_iterator/iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/exception.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/hash_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/list_update_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/priority_queue.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/tag_and_trait.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/tree_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pb_ds/trie_policy.hpp +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pod_char_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pointer.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/pool_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/random +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/random.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/rb_tree +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/rc_string_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/rope +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/ropeimpl.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/slist +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/sso_string_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/stdio_filebuf.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/stdio_sync_filebuf.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/string_conversions.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/throw_allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/type_traits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/typelist.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/vstring.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/vstring.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/vstring_fwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/ext/vstring_util.h +-rw-r--r-- root/root usr/include/c++/7.2.0/fenv.h +-rw-r--r-- root/root usr/include/c++/7.2.0/forward_list +-rw-r--r-- root/root usr/include/c++/7.2.0/fstream +-rw-r--r-- root/root usr/include/c++/7.2.0/functional +-rw-r--r-- root/root usr/include/c++/7.2.0/future +-rw-r--r-- root/root usr/include/c++/7.2.0/initializer_list +-rw-r--r-- root/root usr/include/c++/7.2.0/iomanip +-rw-r--r-- root/root usr/include/c++/7.2.0/ios +-rw-r--r-- root/root usr/include/c++/7.2.0/iosfwd +-rw-r--r-- root/root usr/include/c++/7.2.0/iostream +-rw-r--r-- root/root usr/include/c++/7.2.0/istream +-rw-r--r-- root/root usr/include/c++/7.2.0/iterator +-rw-r--r-- root/root usr/include/c++/7.2.0/limits +-rw-r--r-- root/root usr/include/c++/7.2.0/list +-rw-r--r-- root/root usr/include/c++/7.2.0/locale +-rw-r--r-- root/root usr/include/c++/7.2.0/map +-rw-r--r-- root/root usr/include/c++/7.2.0/math.h +-rw-r--r-- root/root usr/include/c++/7.2.0/memory +-rw-r--r-- root/root usr/include/c++/7.2.0/mutex +-rw-r--r-- root/root usr/include/c++/7.2.0/new +-rw-r--r-- root/root usr/include/c++/7.2.0/numeric +-rw-r--r-- root/root usr/include/c++/7.2.0/optional +-rw-r--r-- root/root usr/include/c++/7.2.0/ostream +drwxr-xr-x root/root usr/include/c++/7.2.0/parallel/ +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/algo.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/algobase.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/algorithm +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/algorithmfwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/balanced_quicksort.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/basic_iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/checkers.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/compatibility.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/compiletime_settings.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/equally_split.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/features.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/find.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/find_selectors.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/for_each.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/for_each_selectors.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/iterator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/list_partition.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/losertree.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/merge.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/multiseq_selection.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/multiway_merge.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/multiway_mergesort.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/numeric +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/numericfwd.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/omp_loop.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/omp_loop_static.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/par_loop.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/parallel.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/partial_sum.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/partition.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/queue.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/quicksort.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/random_number.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/random_shuffle.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/search.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/set_operations.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/settings.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/sort.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/tags.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/types.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/unique_copy.h +-rw-r--r-- root/root usr/include/c++/7.2.0/parallel/workstealing.h +drwxr-xr-x root/root usr/include/c++/7.2.0/profile/ +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/array +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/bitset +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/deque +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/forward_list +drwxr-xr-x root/root usr/include/c++/7.2.0/profile/impl/ +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_algos.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_container_size.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_hash_func.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_hashtable_size.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_list_to_slist.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_list_to_vector.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_map_to_unordered_map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_node.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_state.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_trace.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_vector_size.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/impl/profiler_vector_to_list.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/iterator_tracker.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/list +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/map +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/multimap.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/multiset.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/ordered_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/set +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/set.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/unordered_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/unordered_map +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/unordered_set +-rw-r--r-- root/root usr/include/c++/7.2.0/profile/vector +-rw-r--r-- root/root usr/include/c++/7.2.0/queue +-rw-r--r-- root/root usr/include/c++/7.2.0/random +-rw-r--r-- root/root usr/include/c++/7.2.0/ratio +-rw-r--r-- root/root usr/include/c++/7.2.0/regex +-rw-r--r-- root/root usr/include/c++/7.2.0/scoped_allocator +-rw-r--r-- root/root usr/include/c++/7.2.0/set +-rw-r--r-- root/root usr/include/c++/7.2.0/shared_mutex +-rw-r--r-- root/root usr/include/c++/7.2.0/sstream +-rw-r--r-- root/root usr/include/c++/7.2.0/stack +-rw-r--r-- root/root usr/include/c++/7.2.0/stdexcept +-rw-r--r-- root/root usr/include/c++/7.2.0/stdlib.h +-rw-r--r-- root/root usr/include/c++/7.2.0/streambuf +-rw-r--r-- root/root usr/include/c++/7.2.0/string +-rw-r--r-- root/root usr/include/c++/7.2.0/string_view +-rw-r--r-- root/root usr/include/c++/7.2.0/system_error +-rw-r--r-- root/root usr/include/c++/7.2.0/tgmath.h +-rw-r--r-- root/root usr/include/c++/7.2.0/thread +drwxr-xr-x root/root usr/include/c++/7.2.0/tr1/ +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/array +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/bessel_function.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/beta_function.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/ccomplex +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cctype +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cfenv +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cfloat +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cinttypes +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/climits +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cmath +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/complex +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/complex.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cstdarg +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cstdbool +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cstdint +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cstdio +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cstdlib +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/ctgmath +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/ctime +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/ctype.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cwchar +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/cwctype +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/ell_integral.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/exp_integral.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/fenv.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/float.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/functional +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/functional_hash.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/gamma.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/hashtable.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/hashtable_policy.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/hypergeometric.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/inttypes.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/legendre_function.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/limits.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/math.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/memory +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/modified_bessel_func.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/poly_hermite.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/poly_laguerre.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/random +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/random.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/random.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/regex +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/riemann_zeta.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/shared_ptr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/special_function_util.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/stdarg.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/stdbool.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/stdint.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/stdio.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/stdlib.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/tgmath.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/tuple +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/type_traits +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/unordered_map +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/unordered_map.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/unordered_set +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/unordered_set.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/utility +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/wchar.h +-rw-r--r-- root/root usr/include/c++/7.2.0/tr1/wctype.h +drwxr-xr-x root/root usr/include/c++/7.2.0/tr2/ +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/bool_set +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/bool_set.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/dynamic_bitset +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/dynamic_bitset.tcc +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/ratio +-rw-r--r-- root/root usr/include/c++/7.2.0/tr2/type_traits +-rw-r--r-- root/root usr/include/c++/7.2.0/tuple +-rw-r--r-- root/root usr/include/c++/7.2.0/type_traits +-rw-r--r-- root/root usr/include/c++/7.2.0/typeindex +-rw-r--r-- root/root usr/include/c++/7.2.0/typeinfo +-rw-r--r-- root/root usr/include/c++/7.2.0/unordered_map +-rw-r--r-- root/root usr/include/c++/7.2.0/unordered_set +-rw-r--r-- root/root usr/include/c++/7.2.0/utility +-rw-r--r-- root/root usr/include/c++/7.2.0/valarray +-rw-r--r-- root/root usr/include/c++/7.2.0/variant +-rw-r--r-- root/root usr/include/c++/7.2.0/vector +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/ +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/ +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/ +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/atomic_word.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/basic_file.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/c++allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/c++config.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/c++io.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/c++locale.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/cpu_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/ctype_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/ctype_inline.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/cxxabi_tweaks.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/error_constants.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/extc++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/gthr-default.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/gthr-posix.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/gthr-single.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/gthr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/messages_members.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/opt_random.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/os_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/stdc++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/stdtr1c++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/bits/time_members.h +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/ext/ +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/32/ext/opt_random.h +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/ +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/atomic_word.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/basic_file.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++allocator.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++config.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++io.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++locale.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/cpu_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/ctype_base.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/ctype_inline.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/cxxabi_tweaks.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/error_constants.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/extc++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/gthr-default.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/gthr-posix.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/gthr-single.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/gthr.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/messages_members.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/opt_random.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/os_defines.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/stdc++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/stdtr1c++.h +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/time_members.h +drwxr-xr-x root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/ext/ +-rw-r--r-- root/root usr/include/c++/7.2.0/x86_64-pc-linux-gnu/ext/opt_random.h drwxr-xr-x root/root usr/lib/ drwxr-xr-x root/root usr/lib/gcc/ drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/ -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/ -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtbegin.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtbeginS.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtbeginT.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtend.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtendS.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtfastmath.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtprec32.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtprec64.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/crtprec80.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/libgcc.a --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/libgcc_eh.a --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/32/libgcov.a --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/cc1 --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/cc1obj --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/cc1plus --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/collect2 --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtbegin.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtbeginS.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtbeginT.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtend.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtendS.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtfastmath.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtprec32.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtprec64.o --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/crtprec80.o -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/adxintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ammintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx2intrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512bwintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512cdintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512dqintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512erintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512fintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512ifmaintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512ifmavlintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512pfintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512vbmiintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512vbmivlintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512vlbwintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512vldqintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avx512vlintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/avxintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/bmi2intrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/bmiintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/bmmintrin.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/cilk.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/cilk_api.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/cilk_api_linux.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/cilk_stub.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/cilk_undocumented.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/holder.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/hyperobject_base.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/metaprogramming.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_file.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_list.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_max.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_min.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_min_max.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_opadd.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_opand.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_opmul.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_opor.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_opxor.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_ostream.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cilk/reducer_string.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/clflushoptintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/clwbintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/clzerointrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cpuid.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/cross-stdarg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/emmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/f16cintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/float.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/fma4intrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/fmaintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/fxsrintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ia32intrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/immintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/iso646.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/limits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/lwpintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/lzcntintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/mm3dnow.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/mm_malloc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/mmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/mwaitxintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/nmmintrin.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/NXConstStr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/Object.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/Protocol.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/message.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/objc-decls.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/objc-exception.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/objc-sync.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/objc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/runtime.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/objc/thr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/omp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/openacc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/pkuintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/pmmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/popcntintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/prfchwintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/quadmath.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/quadmath_weak.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/rdseedintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/rtmintrin.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/sanitizer/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/sanitizer/asan_interface.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/sanitizer/common_interface_defs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/sanitizer/lsan_interface.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/shaintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/smmintrin.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ssp/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ssp/ssp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ssp/stdio.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ssp/string.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/ssp/unistd.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdalign.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdarg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdatomic.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdbool.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stddef.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdfix.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdint-gcc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdint.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/stdnoreturn.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/syslimits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/tbmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/tmmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/unwind.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/varargs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/wmmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/x86intrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xmmintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xopintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xsavecintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xsaveintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xsaveoptintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xsavesintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/xtestintrin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libgcc.a --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libgcc_eh.a --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libgcov.a --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/liblto_plugin.la -lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/liblto_plugin.so -> liblto_plugin.so.0.0.0 -lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/liblto_plugin.so.0.0.0 --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/lto-wrapper --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/lto1 -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/ --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/gengtype --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/gtype.state -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ada/ -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ada/gcc-interface/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ada/gcc-interface/ada-tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/addresses.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/alias.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/all-tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/alloc-pool.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ansidecl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/asan.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/attribs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/auto-host.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/auto-profile.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/b-header-vars --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/backend.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/basic-block.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/bb-reorder.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/bitmap.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/builtin-attrs.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/builtin-types.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/builtins.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/bversion.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/c-common.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/c-common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/c-objc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/c-pragma.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-family/c-pretty-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/c-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/calls.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ccmp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfg-flags.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfganal.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgbuild.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgcleanup.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgexpand.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfghooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgloop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgloopmanip.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cfgrtl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cgraph.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/chkp-builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cif-code.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cilk-builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cilk.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cilkplus.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/collect-utils.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/collect2-aix.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/collect2.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/conditions.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/dbxelf.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/elfos.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/glibc-stdint.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/gnu-user.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/att.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/biarch64.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/gnu-user-common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/gnu-user64.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/i386-opts.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/i386-protos.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/i386.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/linux-common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/linux64.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/stringop.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/unix.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/x86-64.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/i386/x86-tune.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/initfini-array.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/linux-android.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/linux-protos.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/linux.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/config/vxworks-dummy.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/configargs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/context.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/convert.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/coretypes.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/coverage.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/cp-tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/cp-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/cxx-pretty-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/name-lookup.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cp/type-utils.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cppbuiltin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cppdefault.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cpplib.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/cselib.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/data-streamer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dbgcnt.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dbgcnt.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dbxout.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dce.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ddg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/debug.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/defaults.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/df.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dfp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/diagnostic-color.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/diagnostic-core.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/diagnostic.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/diagnostic.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dojump.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dominance.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/domwalk.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/double-int.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dumpfile.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dwarf2asm.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/dwarf2out.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/emit-rtl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/errors.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/et-forest.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/except.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/explow.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/expmed.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/expr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/fibonacci_heap.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/file-find.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/filenames.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/fixed-value.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/flag-types.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/flags.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/fold-const-call.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/fold-const.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/function.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcc-plugin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcc-rich-location.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcc-symtab.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcov-counter.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcov-io.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcse-common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gcse.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/generic-match.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gengtype.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/genrtl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gensupport.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ggc-internal.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ggc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-builder.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-expr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-fold.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-iterator.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-low.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-match.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-predict.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-pretty-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-ssa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-streamer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple-walk.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimple.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimplify-me.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gimplify.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/glimits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/graph.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/graphds.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/graphite.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gsstruct.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gstab.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gsyms.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gsyslimits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gtm-builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/gtype-desc.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hard-reg-set.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hash-map-traits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hash-map.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hash-set.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hash-table.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hash-traits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hashtab.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/highlev-plugin-common.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hosthooks-def.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hosthooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hsa-brig-format.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hsa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hw-doloop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/hwint.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ifcvt.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/inchash.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/incpath.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/input.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-addr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-codes.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-constants.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-flags.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-modes.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/insn-notes.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/internal-fn.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/internal-fn.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/intl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-chkp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-icf-gimple.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-icf.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-inline.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-prop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-ref.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-reference.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ipa-utils.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ira-int.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ira.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/is-a.h -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/java/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/java/java-tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/langhooks-def.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/langhooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lcm.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/libfuncs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/libiberty.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/limitx.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/limity.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/line-map.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/loop-unroll.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lower-subreg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lra-int.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lra.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lto-compress.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lto-section-names.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/lto-streamer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/machmode.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/machmode.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/md5.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/mem-stats-traits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/mem-stats.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/memory-block.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/mode-classes.def -drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/objc/ --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/objc/objc-tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/obstack.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/omp-builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/omp-low.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/optabs-libfuncs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/optabs-query.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/optabs-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/optabs.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/optabs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/options.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/opts-diagnostic.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/opts.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/output.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/params-enum.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/params-list.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/params.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/params.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/params.list --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/pass-instances.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/pass_manager.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/passes.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/plugin-api.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/plugin-version.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/plugin.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/plugin.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/predict.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/predict.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/prefix.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/pretty-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/print-rtl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/print-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/profile.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/read-md.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/real.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/realmpfr.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/recog.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/reg-notes.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/regcprop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/regrename.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/regs.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/regset.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/reload.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/resource.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtl-chkp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtl-error.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtl-iter.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtl.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtl.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtlhash.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/rtlhooks-def.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/safe-ctype.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sanitizer.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sbitmap.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sched-int.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sdbout.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sel-sched-dump.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sel-sched-ir.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sel-sched.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sese.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/shrink-wrap.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/signop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sparseset.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/spellcheck.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/splay-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sreal.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ssa-iterators.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ssa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/stab.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/statistics.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/stmt.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/stor-layout.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/streamer-hooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/stringpool.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/symbol-summary.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/symtab.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/sync-builtins.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/system.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target-def.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target-globals.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target-hooks-macros.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target-insns.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/target.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/targhooks.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/timevar.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/timevar.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tm-preds.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tm.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tm_p.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/toplev.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tracer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/trans-mem.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-affine.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-cfg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-cfgcleanup.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-check.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-chkp.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-chrec.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-core.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-data-ref.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-dfa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-diagnostic.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-dump.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-eh.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-hash-traits.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-hasher.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-inline.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-into-ssa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-iterator.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-nested.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-object-size.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-outof-ssa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-parloops.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-pass.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-phinodes.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-pretty-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-scalar-evolution.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-address.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-alias.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-coalesce.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-dom.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-live.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-loop-ivopts.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-loop-manip.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-loop-niter.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-loop.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-operands.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-propagate.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-sccvn.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-scopedtables.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-ter.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-threadbackward.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-threadedge.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa-threadupdate.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssa.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-ssanames.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-stdarg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-streamer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree-vectorizer.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/treestruct.def --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tsan.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/tsystem.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/typeclass.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/typed-splay-tree.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/ubsan.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/valtrack.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/value-prof.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/varasm.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/vec.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/version.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/vmsdbg.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/vtable-verify.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/wide-int-print.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/wide-int.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/xcoff.h --rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/include/xcoffout.h --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/libcc1plugin.la -lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/libcc1plugin.so -> libcc1plugin.so.0.0.0 -lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/libcc1plugin.so.0 -> libcc1plugin.so.0.0.0 --rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/plugin/libcc1plugin.so.0.0.0 +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/ +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtbegin.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtbeginS.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtbeginT.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtend.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtendS.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtfastmath.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtprec32.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtprec64.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/crtprec80.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/libgcc.a +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/libgcc_eh.a +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/libgcov.a +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1obj +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/cc1plus +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/collect2 +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtbegin.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtbeginS.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtbeginT.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtend.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtendS.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtfastmath.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtprec32.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtprec64.o +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/crtprec80.o +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/adxintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ammintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx2intrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx5124fmapsintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx5124vnniwintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512bwintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512cdintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512dqintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512erintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512fintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512ifmaintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512ifmavlintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512pfintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vbmiintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vbmivlintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vlbwintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vldqintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vlintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avx512vpopcntdqintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/avxintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/bmi2intrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/bmiintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/bmmintrin.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/cilk.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/cilk_api.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/cilk_api_linux.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/cilk_stub.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/cilk_undocumented.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/holder.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/hyperobject_base.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/metaprogramming.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_file.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_list.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_max.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_min.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_min_max.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_opadd.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_opand.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_opmul.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_opor.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_opxor.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_ostream.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cilk/reducer_string.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/clflushoptintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/clwbintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/clzerointrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cpuid.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/cross-stdarg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/emmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/f16cintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/float.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/fma4intrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/fmaintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/fxsrintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/gcov.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ia32intrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/immintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/iso646.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/limits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/lwpintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/lzcntintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/mm3dnow.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/mm_malloc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/mmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/mwaitxintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/nmmintrin.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/NXConstStr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/Object.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/Protocol.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/message.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/objc-decls.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/objc-exception.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/objc-sync.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/objc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/runtime.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/objc/thr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/omp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/openacc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/pkuintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/pmmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/popcntintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/prfchwintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/quadmath.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/quadmath_weak.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/rdseedintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/rtmintrin.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/sanitizer/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/sanitizer/asan_interface.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/sanitizer/common_interface_defs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/sanitizer/lsan_interface.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/sgxintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/shaintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/smmintrin.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ssp/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ssp/ssp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ssp/stdio.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ssp/string.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ssp/unistd.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdalign.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdarg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdatomic.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdbool.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stddef.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdfix.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdint-gcc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdint.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stdnoreturn.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/syslimits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/tbmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/tmmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/unwind.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/varargs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/wmmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/x86intrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xmmintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xopintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xsavecintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xsaveintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xsaveoptintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xsavesintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/xtestintrin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/libgcc.a +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/libgcc_eh.a +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/libgcov.a +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/liblto_plugin.la +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/liblto_plugin.so -> liblto_plugin.so.0.0.0 +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/liblto_plugin.so.0 -> liblto_plugin.so.0.0.0 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/liblto_plugin.so.0.0.0 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/lto1 +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/ +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/gengtype +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/gtype.state +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ada/ +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ada/gcc-interface/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ada/gcc-interface/ada-tree.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/addresses.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/alias.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/all-tree.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/alloc-pool.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ansidecl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/asan.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/attribs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/auto-host.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/auto-profile.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/b-header-vars +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/backend.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/basic-block.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/bb-reorder.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/bitmap.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/brig-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/builtin-attrs.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/builtin-types.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/builtins.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/bversion.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/c-common.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/c-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/c-objc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/c-pragma.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-family/c-pretty-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/c-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/calls.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ccmp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfg-flags.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfganal.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgbuild.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgcleanup.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgexpand.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfghooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgloop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgloopmanip.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cfgrtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cgraph.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/chkp-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cif-code.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cilk-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cilk.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cilkplus.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/collect-utils.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/collect2-aix.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/collect2.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/conditions.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/dbxelf.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/elfos.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/glibc-stdint.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/gnu-user.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/att.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/biarch64.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/gnu-user-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/gnu-user64.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/i386-opts.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/i386-protos.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/i386.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/linux-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/linux64.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/stringop.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/unix.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/x86-64.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/i386/x86-tune.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/initfini-array.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/linux-android.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/linux-protos.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/linux.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/config/vxworks-dummy.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/configargs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/context.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/convert.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/coretypes.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/coverage.h +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/cp-tree.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/cp-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/cxx-pretty-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/name-lookup.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cp/type-utils.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cppbuiltin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cppdefault.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cpplib.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/cselib.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/data-streamer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dbgcnt.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dbgcnt.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dbxout.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dce.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ddg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/debug.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/defaults.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/df.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dfp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/diagnostic-color.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/diagnostic-core.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/diagnostic.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/diagnostic.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dojump.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dominance.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/domwalk.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/double-int.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dumpfile.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dwarf2asm.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/dwarf2out.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/edit-context.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/emit-rtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/errors.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/et-forest.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/except.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/explow.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/expmed.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/expr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/fibonacci_heap.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/file-find.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/filenames.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/fixed-value.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/flag-types.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/flags.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/fold-const-call.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/fold-const.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/function.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcc-plugin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcc-rich-location.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcc-symtab.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcov-counter.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcov-io.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcse-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gcse.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/generic-match.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gengtype.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/genrtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gensupport.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ggc-internal.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ggc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-builder.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-expr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-fold.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-iterator.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-low.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-match.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-predict.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-pretty-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-ssa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-streamer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple-walk.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimple.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimplify-me.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gimplify.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/glimits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/graph.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/graphds.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/graphite.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gsstruct.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gstab.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gsyms.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gsyslimits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gtm-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/gtype-desc.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hard-reg-set.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hash-map-traits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hash-map.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hash-set.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hash-table.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hash-traits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hashtab.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/highlev-plugin-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hosthooks-def.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hosthooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hsa-brig-format.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hsa-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hsa-common.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hw-doloop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/hwint.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ifcvt.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/inchash.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/incpath.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/input.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-addr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-codes.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-constants.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-flags.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-modes.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/insn-notes.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/internal-fn.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/internal-fn.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/intl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-chkp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-icf-gimple.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-icf.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-inline.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-prop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-ref.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-reference.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ipa-utils.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ira-int.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ira.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/is-a.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/langhooks-def.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/langhooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lcm.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/libfuncs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/libiberty.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/limitx.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/limity.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/line-map.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/loop-unroll.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lower-subreg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lra-int.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lra.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lto-compress.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lto-section-names.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/lto-streamer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/machmode.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/machmode.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/md5.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/mem-stats-traits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/mem-stats.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/memmodel.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/memory-block.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/mode-classes.def +drwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/objc/ +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/objc/objc-tree.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/obstack.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-expand.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-general.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-grid.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-low.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/omp-offload.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/optabs-libfuncs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/optabs-query.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/optabs-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/optabs.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/optabs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/options.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/opts-diagnostic.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/opts.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/output.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params-enum.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params-list.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params-options.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/params.list +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/pass-instances.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/pass_manager.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/passes.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/plugin-api.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/plugin-version.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/plugin.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/plugin.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/predict.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/predict.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/prefix.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/pretty-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/print-rtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/print-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/profile.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/read-md.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/read-rtl-function.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/real.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/realmpfr.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/recog.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/reg-notes.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/regcprop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/regrename.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/regs.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/regset.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/reload.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/resource.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtl-chkp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtl-error.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtl-iter.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtl.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtlhash.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/rtlhooks-def.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/run-rtl-passes.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/safe-ctype.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sanitizer.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sbitmap.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sched-int.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sdbout.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sel-sched-dump.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sel-sched-ir.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sel-sched.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/selftest-rtl.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/selftest.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sese.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/shrink-wrap.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/signop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sparseset.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/spellcheck-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/spellcheck.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/splay-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sreal.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ssa-iterators.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ssa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/stab.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/statistics.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/stmt.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/stor-layout.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/streamer-hooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/stringpool.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/substring-locations.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/symbol-summary.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/symtab.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/sync-builtins.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/system.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target-def.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target-globals.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target-hooks-macros.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target-insns.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/target.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/targhooks.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/timevar.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/timevar.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tm-preds.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tm.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tm_p.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/toplev.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tracer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/trans-mem.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-affine.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-cfg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-cfgcleanup.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-check.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-chkp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-chrec.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-core.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-data-ref.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-dfa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-diagnostic.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-dump.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-eh.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-hash-traits.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-hasher.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-if-conv.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-inline.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-into-ssa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-iterator.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-nested.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-object-size.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-outof-ssa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-parloops.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-pass.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-phinodes.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-pretty-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-scalar-evolution.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-address.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-alias.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-ccp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-coalesce.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-dom.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-live.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-loop-ivopts.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-loop-manip.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-loop-niter.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-loop.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-operands.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-propagate.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-sccvn.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-scopedtables.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-ter.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-threadbackward.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-threadedge.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa-threadupdate.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssa.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-ssanames.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-stdarg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-streamer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-vectorizer.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree-vrp.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/treestruct.def +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tsan.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/tsystem.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/typeclass.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/typed-splay-tree.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/ubsan.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/valtrack.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/value-prof.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/varasm.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/vec.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/version.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/vmsdbg.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/vtable-verify.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/wide-int-print.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/wide-int.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/xcoff.h +-rw-r--r-- root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/include/xcoffout.h +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcc1plugin.la +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcc1plugin.so -> libcc1plugin.so.0.0.0 +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcc1plugin.so.0 -> libcc1plugin.so.0.0.0 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcc1plugin.so.0.0.0 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcp1plugin.la +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcp1plugin.so -> libcp1plugin.so.0.0.0 +lrwxrwxrwx root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcp1plugin.so.0 -> libcp1plugin.so.0.0.0 +-rwxr-xr-x root/root usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/plugin/libcp1plugin.so.0.0.0 -rw-r--r-- root/root usr/lib/libasan.a -rwxr-xr-x root/root usr/lib/libasan.la -lrwxrwxrwx root/root usr/lib/libasan.so -> libasan.so.3.0.0 -lrwxrwxrwx root/root usr/lib/libasan.so.3 -> libasan.so.3.0.0 --rwxr-xr-x root/root usr/lib/libasan.so.3.0.0 +lrwxrwxrwx root/root usr/lib/libasan.so -> libasan.so.4.0.0 +lrwxrwxrwx root/root usr/lib/libasan.so.4 -> libasan.so.4.0.0 +-rwxr-xr-x root/root usr/lib/libasan.so.4.0.0 -rw-r--r-- root/root usr/lib/libasan_preinit.o -rw-r--r-- root/root usr/lib/libatomic.a -rwxr-xr-x root/root usr/lib/libatomic.la @@ -1415,15 +1454,15 @@ lrwxrwxrwx root/root usr/lib/liblsan.so.0 -> liblsan.so.0.0.0 -rwxr-xr-x root/root usr/lib/liblsan.so.0.0.0 -rw-r--r-- root/root usr/lib/libmpx.a -rwxr-xr-x root/root usr/lib/libmpx.la -lrwxrwxrwx root/root usr/lib/libmpx.so -> libmpx.so.2.0.0 -lrwxrwxrwx root/root usr/lib/libmpx.so.2 -> libmpx.so.2.0.0 --rwxr-xr-x root/root usr/lib/libmpx.so.2.0.0 +lrwxrwxrwx root/root usr/lib/libmpx.so -> libmpx.so.2.0.1 +lrwxrwxrwx root/root usr/lib/libmpx.so.2 -> libmpx.so.2.0.1 +-rwxr-xr-x root/root usr/lib/libmpx.so.2.0.1 -rw-r--r-- root/root usr/lib/libmpx.spec -rw-r--r-- root/root usr/lib/libmpxwrappers.a -rwxr-xr-x root/root usr/lib/libmpxwrappers.la -lrwxrwxrwx root/root usr/lib/libmpxwrappers.so -> libmpxwrappers.so.2.0.0 -lrwxrwxrwx root/root usr/lib/libmpxwrappers.so.2 -> libmpxwrappers.so.2.0.0 --rwxr-xr-x root/root usr/lib/libmpxwrappers.so.2.0.0 +lrwxrwxrwx root/root usr/lib/libmpxwrappers.so -> libmpxwrappers.so.2.0.1 +lrwxrwxrwx root/root usr/lib/libmpxwrappers.so.2 -> libmpxwrappers.so.2.0.1 +-rwxr-xr-x root/root usr/lib/libmpxwrappers.so.2.0.1 -rw-r--r-- root/root usr/lib/libobjc.a -rwxr-xr-x root/root usr/lib/libobjc.la lrwxrwxrwx root/root usr/lib/libobjc.so -> libobjc.so.4.0.0 @@ -1444,10 +1483,9 @@ lrwxrwxrwx root/root usr/lib/libssp.so.0 -> libssp.so.0.0.0 -rwxr-xr-x root/root usr/lib/libssp_nonshared.la -rw-r--r-- root/root usr/lib/libstdc++.a -rwxr-xr-x root/root usr/lib/libstdc++.la -lrwxrwxrwx root/root usr/lib/libstdc++.so -> libstdc++.so.6.0.22 -lrwxrwxrwx root/root usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.22 --rwxr-xr-x root/root usr/lib/libstdc++.so.6.0.22 --rw-r--r-- root/root usr/lib/libstdc++.so.6.0.22-gdb.py +lrwxrwxrwx root/root usr/lib/libstdc++.so -> libstdc++.so.6.0.24 +lrwxrwxrwx root/root usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.24 +-rwxr-xr-x root/root usr/lib/libstdc++.so.6.0.24 -rw-r--r-- root/root usr/lib/libstdc++fs.a -rwxr-xr-x root/root usr/lib/libstdc++fs.la -rw-r--r-- root/root usr/lib/libsupc++.a @@ -1457,6 +1495,7 @@ lrwxrwxrwx root/root usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.22 lrwxrwxrwx root/root usr/lib/libtsan.so -> libtsan.so.0.0.0 lrwxrwxrwx root/root usr/lib/libtsan.so.0 -> libtsan.so.0.0.0 -rwxr-xr-x root/root usr/lib/libtsan.so.0.0.0 +-rw-r--r-- root/root usr/lib/libtsan_preinit.o -rw-r--r-- root/root usr/lib/libubsan.a -rwxr-xr-x root/root usr/lib/libubsan.la lrwxrwxrwx root/root usr/lib/libubsan.so -> libubsan.so.0.0.0 @@ -1465,9 +1504,9 @@ lrwxrwxrwx root/root usr/lib/libubsan.so.0 -> libubsan.so.0.0.0 drwxr-xr-x root/root usr/lib32/ -rw-r--r-- root/root usr/lib32/libasan.a -rwxr-xr-x root/root usr/lib32/libasan.la -lrwxrwxrwx root/root usr/lib32/libasan.so -> libasan.so.3.0.0 -lrwxrwxrwx root/root usr/lib32/libasan.so.3 -> libasan.so.3.0.0 --rwxr-xr-x root/root usr/lib32/libasan.so.3.0.0 +lrwxrwxrwx root/root usr/lib32/libasan.so -> libasan.so.4.0.0 +lrwxrwxrwx root/root usr/lib32/libasan.so.4 -> libasan.so.4.0.0 +-rwxr-xr-x root/root usr/lib32/libasan.so.4.0.0 -rw-r--r-- root/root usr/lib32/libasan_preinit.o -rw-r--r-- root/root usr/lib32/libatomic.a -rwxr-xr-x root/root usr/lib32/libatomic.la @@ -1496,15 +1535,15 @@ lrwxrwxrwx root/root usr/lib32/libitm.so.1 -> libitm.so.1.0.0 -rw-r--r-- root/root usr/lib32/libitm.spec -rw-r--r-- root/root usr/lib32/libmpx.a -rwxr-xr-x root/root usr/lib32/libmpx.la -lrwxrwxrwx root/root usr/lib32/libmpx.so -> libmpx.so.2.0.0 -lrwxrwxrwx root/root usr/lib32/libmpx.so.2 -> libmpx.so.2.0.0 --rwxr-xr-x root/root usr/lib32/libmpx.so.2.0.0 +lrwxrwxrwx root/root usr/lib32/libmpx.so -> libmpx.so.2.0.1 +lrwxrwxrwx root/root usr/lib32/libmpx.so.2 -> libmpx.so.2.0.1 +-rwxr-xr-x root/root usr/lib32/libmpx.so.2.0.1 -rw-r--r-- root/root usr/lib32/libmpx.spec -rw-r--r-- root/root usr/lib32/libmpxwrappers.a -rwxr-xr-x root/root usr/lib32/libmpxwrappers.la -lrwxrwxrwx root/root usr/lib32/libmpxwrappers.so -> libmpxwrappers.so.2.0.0 -lrwxrwxrwx root/root usr/lib32/libmpxwrappers.so.2 -> libmpxwrappers.so.2.0.0 --rwxr-xr-x root/root usr/lib32/libmpxwrappers.so.2.0.0 +lrwxrwxrwx root/root usr/lib32/libmpxwrappers.so -> libmpxwrappers.so.2.0.1 +lrwxrwxrwx root/root usr/lib32/libmpxwrappers.so.2 -> libmpxwrappers.so.2.0.1 +-rwxr-xr-x root/root usr/lib32/libmpxwrappers.so.2.0.1 -rw-r--r-- root/root usr/lib32/libobjc.a -rwxr-xr-x root/root usr/lib32/libobjc.la lrwxrwxrwx root/root usr/lib32/libobjc.so -> libobjc.so.4.0.0 @@ -1525,10 +1564,9 @@ lrwxrwxrwx root/root usr/lib32/libssp.so.0 -> libssp.so.0.0.0 -rwxr-xr-x root/root usr/lib32/libssp_nonshared.la -rw-r--r-- root/root usr/lib32/libstdc++.a -rwxr-xr-x root/root usr/lib32/libstdc++.la -lrwxrwxrwx root/root usr/lib32/libstdc++.so -> libstdc++.so.6.0.22 -lrwxrwxrwx root/root usr/lib32/libstdc++.so.6 -> libstdc++.so.6.0.22 --rwxr-xr-x root/root usr/lib32/libstdc++.so.6.0.22 --rw-r--r-- root/root usr/lib32/libstdc++.so.6.0.22-gdb.py +lrwxrwxrwx root/root usr/lib32/libstdc++.so -> libstdc++.so.6.0.24 +lrwxrwxrwx root/root usr/lib32/libstdc++.so.6 -> libstdc++.so.6.0.24 +-rwxr-xr-x root/root usr/lib32/libstdc++.so.6.0.24 -rw-r--r-- root/root usr/lib32/libstdc++fs.a -rwxr-xr-x root/root usr/lib32/libstdc++fs.la -rw-r--r-- root/root usr/lib32/libsupc++.a @@ -1539,6 +1577,13 @@ lrwxrwxrwx root/root usr/lib32/libubsan.so -> libubsan.so.0.0.0 lrwxrwxrwx root/root usr/lib32/libubsan.so.0 -> libubsan.so.0.0.0 -rwxr-xr-x root/root usr/lib32/libubsan.so.0.0.0 drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/gdb/ +drwxr-xr-x root/root usr/share/gdb/auto-load/ +drwxr-xr-x root/root usr/share/gdb/auto-load/usr/ +drwxr-xr-x root/root usr/share/gdb/auto-load/usr/lib/ +-rw-r--r-- root/root usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.24-gdb.py +drwxr-xr-x root/root usr/share/gdb/auto-load/usr/lib32/ +-rw-r--r-- root/root usr/share/gdb/auto-load/usr/lib32/libstdc++.so.6.0.24-gdb.py drwxr-xr-x root/root usr/share/man/ drwxr-xr-x root/root usr/share/man/man1/ -rw-r--r-- root/root usr/share/man/man1/cpp.1.gz diff --git a/gcc/.md5sum b/gcc/.md5sum deleted file mode 100644 index ac495b4e..00000000 --- a/gcc/.md5sum +++ /dev/null @@ -1,3 +0,0 @@ -61a057afa31006764b957a483ba90b9d gcc-4.7.3-multilib-dirs.patch -11ba51a0cfb8471927f387c8895fe232 gcc-6.4.0.tar.xz -7c9128522053af79791bcfdd55834c2a gcc-nocheck-fixincludes.patch diff --git a/gcc/.signature b/gcc/.signature index 4e9afe70..2431d1da 100644 --- a/gcc/.signature +++ b/gcc/.signature @@ -1,7 +1,7 @@ untrusted comment: verify with /etc/ports/core.pub -RWRJc1FUaeVequMJ9BZrPWpkRhpoDNPE/AAPNco0XsuKOiJj4q0vByxFuCwlyUjvtVpdKm+y51Mi4vEWxaT9KMq+CNlcbgr1YA0= -SHA256 (Pkgfile) = 25e064430f66ca8e128827ccf0ef31ff56d024e52f25f328c00af89d4ad6a7a5 -SHA256 (.footprint) = d970350880e84ef7c09a9f59e14ccc44b23eefddcad18b8baa353c65ebf8f6b4 -SHA256 (gcc-6.4.0.tar.xz) = 850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4 +RWRJc1FUaeVeqtmVuLuQfex7fiHE7LtDqvp4ABi+UMBtICVQTsgWjKiAXPc6IQgJnFQnTVQh1CYurJkDy2FYo4QmXWyHyhwqjwg= +SHA256 (Pkgfile) = 78fecffb1adeca2a61efc2d325401054093a0e5252253b296645b979ec184ba9 +SHA256 (.footprint) = 6d91599bfd6d164611110cfd05d69db09a58b476e6415f0272cec2dfa4353159 +SHA256 (gcc-7.2.0.tar.xz) = 1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a SHA256 (gcc-nocheck-fixincludes.patch) = 850a71d2c64b9f2bec31821bd972bf89c2d57764faf64948100eaf474fd63bbb SHA256 (gcc-4.7.3-multilib-dirs.patch) = 149b151999d0afad909ca0d1eaf1f9a81c9cd6499e56989ec4fc574d108eeef6 diff --git a/gcc/07-10-gcc-sanitizer-Fix-build-with-glibc-2.26.patch b/gcc/07-10-gcc-sanitizer-Fix-build-with-glibc-2.26.patch new file mode 100644 index 00000000..fc41a4a5 --- /dev/null +++ b/gcc/07-10-gcc-sanitizer-Fix-build-with-glibc-2.26.patch @@ -0,0 +1,166 @@ +diff --git a/meta/recipes-devtools/gcc/gcc-7.1/0048-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch b/meta/recipes-devtools/gcc/gcc-7.1/0048-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch +new file mode 100644 +index 0000000000..ee15c6cac8 +--- /dev/null ++++ b/meta/recipes-devtools/gcc/gcc-7.1/0048-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch +@@ -0,0 +1,160 @@ ++From 4c07606bb77bbd30f02adb947d480516da3fa3f7 Mon Sep 17 00:00:00 2001 ++From: Khem Raj ++Date: Sun, 11 Jun 2017 10:09:13 -0700 ++Subject: [PATCH] libsanitizer: Use stack_t instead of struct sigaltstack ++ ++Upstream-Status: Submitted ++ ++Signed-off-by: Khem Raj ++--- ++ libsanitizer/sanitizer_common/sanitizer_linux.cc | 4 ++-- ++ libsanitizer/sanitizer_common/sanitizer_linux.h | 6 +++--- ++ .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 3 ++- ++ 3 files changed, 7 insertions(+), 6 deletions(-) ++ ++Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.cc +++++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc ++@@ -14,6 +14,10 @@ ++ ++ #if SANITIZER_FREEBSD || SANITIZER_LINUX ++ +++#if !SANITIZER_ANDROID +++#include +++#endif +++ ++ #include "sanitizer_common.h" ++ #include "sanitizer_flags.h" ++ #include "sanitizer_internal_defs.h" ++@@ -71,10 +75,6 @@ extern "C" { ++ extern char **environ; // provided by crt1 ++ #endif // SANITIZER_FREEBSD ++ ++-#if !SANITIZER_ANDROID ++-#include ++-#endif ++- ++ #if SANITIZER_LINUX ++ // ++ struct kernel_timeval { ++@@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg ++ } ++ #endif ++ ++-uptr internal_sigaltstack(const struct sigaltstack *ss, ++- struct sigaltstack *oss) { +++uptr internal_sigaltstack(const stack_t *ss, +++ stack_t *oss) { ++ return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); ++ } ++ ++Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.h +++++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h ++@@ -19,7 +19,10 @@ ++ #include "sanitizer_platform_limits_posix.h" ++ ++ struct link_map; // Opaque type returned by dlopen(). ++-struct sigaltstack; +++ +++#ifndef __stack_t_defined +++struct stack_t; +++#endif ++ ++ namespace __sanitizer { ++ // Dirent structure for getdents(). Note that this structure is different from ++@@ -28,8 +31,8 @@ struct linux_dirent; ++ ++ // Syscall wrappers. ++ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); ++-uptr internal_sigaltstack(const struct sigaltstack* ss, ++- struct sigaltstack* oss); +++uptr internal_sigaltstack(const stack_t* ss, +++ stack_t* oss); ++ uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, ++ __sanitizer_sigset_t *oldset); ++ ++Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +++++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++@@ -16,6 +16,7 @@ ++ defined(__aarch64__) || defined(__powerpc64__) || \ ++ defined(__s390__)) ++ +++#include ++ #include "sanitizer_stoptheworld.h" ++ ++ #include "sanitizer_platform_limits_posix.h" ++@@ -273,7 +274,7 @@ static int TracerThread(void* argument) ++ ++ // Alternate stack for signal handling. ++ InternalScopedBuffer handler_stack_memory(kHandlerStackSize); ++- struct sigaltstack handler_stack; +++ stack_t handler_stack; ++ internal_memset(&handler_stack, 0, sizeof(handler_stack)); ++ handler_stack.ss_sp = handler_stack_memory.data(); ++ handler_stack.ss_size = kHandlerStackSize; ++Index: gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/tsan/tsan_platform_linux.cc +++++ gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc ++@@ -14,6 +14,7 @@ ++ #include "sanitizer_common/sanitizer_platform.h" ++ #if SANITIZER_LINUX || SANITIZER_FREEBSD ++ +++#include ++ #include "sanitizer_common/sanitizer_common.h" ++ #include "sanitizer_common/sanitizer_libc.h" ++ #include "sanitizer_common/sanitizer_linux.h" ++@@ -28,7 +29,6 @@ ++ ++ #include ++ #include ++-#include ++ #include ++ #include ++ #include ++@@ -287,7 +287,7 @@ void InitializePlatform() { ++ int ExtractResolvFDs(void *state, int *fds, int nfd) { ++ #if SANITIZER_LINUX && !SANITIZER_ANDROID ++ int cnt = 0; ++- __res_state *statp = (__res_state*)state; +++ res_state statp = (res_state)state; ++ for (int i = 0; i < MAXNS && cnt < nfd; i++) { ++ if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) ++ fds[cnt++] = statp->_u._ext.nssocks[i]; ++Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc +++++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc ++@@ -14,6 +14,7 @@ ++ ++ #if SANITIZER_FREEBSD || SANITIZER_LINUX ++ +++#include ++ #include "sanitizer_allocator_internal.h" ++ #include "sanitizer_atomic.h" ++ #include "sanitizer_common.h" ++@@ -30,7 +31,6 @@ ++ ++ #include ++ #include ++-#include ++ #include ++ #include ++ ++Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc ++=================================================================== ++--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc +++++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc ++@@ -12,6 +12,7 @@ ++ ++ #include "sanitizer_platform.h" ++ #if SANITIZER_POSIX +++#include ++ #include "sanitizer_allocator_internal.h" ++ #include "sanitizer_common.h" ++ #include "sanitizer_flags.h" diff --git a/gcc/Pkgfile b/gcc/Pkgfile index 4f581b19..4ccc0530 100644 --- a/gcc/Pkgfile +++ b/gcc/Pkgfile @@ -4,8 +4,8 @@ # Depends on: zlib libmpc name=gcc -version=6.4.0 -release=1 +version=7.2.0 +release=2 source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-$version/$name-$version.tar.xz \ $name-nocheck-fixincludes.patch $name-4.7.3-multilib-dirs.patch) @@ -27,6 +27,8 @@ build() { --with-x=no \ --with-system-zlib \ --enable-multilib \ + --enable-default-pie \ + --enable-default-ssp \ --with-pkgversion="CRUX-x86_64-multilib" make bootstrap make -j1 DESTDIR=$PKG install @@ -37,10 +39,14 @@ build() { ln -sf g++ $PKG/usr/bin/c++ mv $PKG/usr/lib/gcc/*/$version/include-fixed/{limits.h,syslimits.h} $PKG/usr/lib/gcc/*/$version/include/ - rm -f $PKG/usr/lib{,32}/{libiberty.a,libstdc++.so.6.0.21-gdb.py} rm -r $PKG/usr/share/{info,$name-$version} rm -r $PKG/usr/bin/*-linux-gnu-* rm -r $PKG/usr/lib/gcc/*/$version/{install-tools,include-fixed} + for D in lib{,32}; do + install -d -m 0755 $PKG/usr/share/gdb/auto-load/usr/${D} + mv $PKG/usr/${D}/libstdc++.so.*-gdb.py $PKG/usr/share/gdb/auto-load/usr/${D} + done + sed -i "s|-L$SRC[^ ]* ||g" $PKG/usr/lib{,32}/{libstdc++.la,libsupc++.la} } diff --git a/gcc/gcc-7.1-ucontext_t.patch b/gcc/gcc-7.1-ucontext_t.patch new file mode 100644 index 00000000..4fb34aef --- /dev/null +++ b/gcc/gcc-7.1-ucontext_t.patch @@ -0,0 +1,94 @@ +diff -rupN gcc-7.1.0.orig/libgcc/config/aarch64/linux-unwind.h gcc-7.1.0/libgcc/config/aarch64/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/aarch64/linux-unwind.h 2017-08-03 17:57:35.224124437 +0200 ++++ gcc-7.1.0/libgcc/config/aarch64/linux-unwind.h 2017-08-03 17:58:50.244134563 +0200 +@@ -55,7 +55,7 @@ aarch64_fallback_frame_state (struct _Un + struct rt_sigframe + { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + }; + + struct rt_sigframe *rt_; +diff -rupN gcc-7.1.0.orig/libgcc/config/alpha/linux-unwind.h gcc-7.1.0/libgcc/config/alpha/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/alpha/linux-unwind.h 2017-08-03 17:57:35.221124496 +0200 ++++ gcc-7.1.0/libgcc/config/alpha/linux-unwind.h 2017-08-03 17:59:28.195143475 +0200 +@@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwi + { + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + sc = &rt_->uc.uc_mcontext; + } +diff -rupN gcc-7.1.0.orig/libgcc/config/bfin/linux-unwind.h gcc-7.1.0/libgcc/config/bfin/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/bfin/linux-unwind.h 2017-08-03 17:57:35.225124418 +0200 ++++ gcc-7.1.0/libgcc/config/bfin/linux-unwind.h 2017-08-03 17:59:51.829727193 +0200 +@@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwin + void *puc; + char retcode[8]; + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + + /* The void * cast is necessary to avoid an aliasing warning. +diff -rupN gcc-7.1.0.orig/libgcc/config/i386/linux-unwind.h gcc-7.1.0/libgcc/config/i386/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/i386/linux-unwind.h 2017-08-03 17:57:35.216124593 +0200 ++++ gcc-7.1.0/libgcc/config/i386/linux-unwind.h 2017-08-03 18:12:30.160537173 +0200 +@@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unw + if (*(unsigned char *)(pc+0) == 0x48 + && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) + { +- struct ucontext *uc_ = context->cfa; ++ ucontext_t *uc_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem + because it does not alias anything. */ +@@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind + siginfo_t *pinfo; + void *puc; + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem +Binary files gcc-7.1.0.orig/libgcc/config/i386/.linux-unwind.h.swp and gcc-7.1.0/libgcc/config/i386/.linux-unwind.h.swp differ +diff -rupN gcc-7.1.0.orig/libgcc/config/pa/linux-unwind.h gcc-7.1.0/libgcc/config/pa/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/pa/linux-unwind.h 2017-08-03 17:57:35.224124437 +0200 ++++ gcc-7.1.0/libgcc/config/pa/linux-unwind.h 2017-08-03 18:00:17.384441123 +0200 +@@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwin + struct sigcontext *sc; + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *frame; + + /* rt_sigreturn trampoline: +diff -rupN gcc-7.1.0.orig/libgcc/config/riscv/linux-unwind.h gcc-7.1.0/libgcc/config/riscv/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/riscv/linux-unwind.h 2017-08-03 17:57:35.216124593 +0200 ++++ gcc-7.1.0/libgcc/config/riscv/linux-unwind.h 2017-08-03 18:00:32.665270064 +0200 +@@ -42,7 +42,7 @@ riscv_fallback_frame_state (struct _Unwi + struct rt_sigframe + { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + }; + + struct rt_sigframe *rt_; +diff -rupN gcc-7.1.0.orig/libgcc/config/sh/linux-unwind.h gcc-7.1.0/libgcc/config/sh/linux-unwind.h +--- gcc-7.1.0.orig/libgcc/config/sh/linux-unwind.h 2017-08-03 17:57:35.216124593 +0200 ++++ gcc-7.1.0/libgcc/config/sh/linux-unwind.h 2017-08-03 18:00:50.448059284 +0200 +@@ -82,7 +82,7 @@ sh_fallback_frame_state (struct _Unwind_ + { + struct rt_sigframe { + siginfo_t info; +- struct ucontext uc; ++ ucontext_t uc; + } *rt_ = context->cfa; + /* The void * cast is necessary to avoid an aliasing warning. + The aliasing warning is correct, but should not be a problem diff --git a/glibc-32/.footprint b/glibc-32/.footprint index 9579d626..79b6dd71 100644 --- a/glibc-32/.footprint +++ b/glibc-32/.footprint @@ -4,51 +4,45 @@ drwxr-xr-x root/root etc/ld.so.conf.d/ drwxr-xr-x root/root lib/ lrwxrwxrwx root/root lib/ld-linux.so.2 -> /lib32/ld-linux.so.2 drwxr-xr-x root/root lib32/ --rwxr-xr-x root/root lib32/ld-2.24.so -lrwxrwxrwx root/root lib32/ld-linux.so.2 -> ld-2.24.so --rwxr-xr-x root/root lib32/libBrokenLocale-2.24.so -lrwxrwxrwx root/root lib32/libBrokenLocale.so.1 -> libBrokenLocale-2.24.so +-rwxr-xr-x root/root lib32/ld-2.26.so +lrwxrwxrwx root/root lib32/ld-linux.so.2 -> ld-2.26.so +-rwxr-xr-x root/root lib32/libBrokenLocale-2.26.so +lrwxrwxrwx root/root lib32/libBrokenLocale.so.1 -> libBrokenLocale-2.26.so -rwxr-xr-x root/root lib32/libSegFault.so --rwxr-xr-x root/root lib32/libanl-2.24.so -lrwxrwxrwx root/root lib32/libanl.so.1 -> libanl-2.24.so --rwxr-xr-x root/root lib32/libc-2.24.so -lrwxrwxrwx root/root lib32/libc.so.6 -> libc-2.24.so --rwxr-xr-x root/root lib32/libcidn-2.24.so -lrwxrwxrwx root/root lib32/libcidn.so.1 -> libcidn-2.24.so --rwxr-xr-x root/root lib32/libcrypt-2.24.so -lrwxrwxrwx root/root lib32/libcrypt.so.1 -> libcrypt-2.24.so --rwxr-xr-x root/root lib32/libdl-2.24.so -lrwxrwxrwx root/root lib32/libdl.so.2 -> libdl-2.24.so --rwxr-xr-x root/root lib32/libm-2.24.so -lrwxrwxrwx root/root lib32/libm.so.6 -> libm-2.24.so +-rwxr-xr-x root/root lib32/libanl-2.26.so +lrwxrwxrwx root/root lib32/libanl.so.1 -> libanl-2.26.so +-rwxr-xr-x root/root lib32/libc-2.26.so +lrwxrwxrwx root/root lib32/libc.so.6 -> libc-2.26.so +-rwxr-xr-x root/root lib32/libcidn-2.26.so +lrwxrwxrwx root/root lib32/libcidn.so.1 -> libcidn-2.26.so +-rwxr-xr-x root/root lib32/libcrypt-2.26.so +lrwxrwxrwx root/root lib32/libcrypt.so.1 -> libcrypt-2.26.so +-rwxr-xr-x root/root lib32/libdl-2.26.so +lrwxrwxrwx root/root lib32/libdl.so.2 -> libdl-2.26.so +-rwxr-xr-x root/root lib32/libm-2.26.so +lrwxrwxrwx root/root lib32/libm.so.6 -> libm-2.26.so -rwxr-xr-x root/root lib32/libmemusage.so --rwxr-xr-x root/root lib32/libnsl-2.24.so -lrwxrwxrwx root/root lib32/libnsl.so.1 -> libnsl-2.24.so --rwxr-xr-x root/root lib32/libnss_compat-2.24.so -lrwxrwxrwx root/root lib32/libnss_compat.so.2 -> libnss_compat-2.24.so --rwxr-xr-x root/root lib32/libnss_db-2.24.so -lrwxrwxrwx root/root lib32/libnss_db.so.2 -> libnss_db-2.24.so --rwxr-xr-x root/root lib32/libnss_dns-2.24.so -lrwxrwxrwx root/root lib32/libnss_dns.so.2 -> libnss_dns-2.24.so --rwxr-xr-x root/root lib32/libnss_files-2.24.so -lrwxrwxrwx root/root lib32/libnss_files.so.2 -> libnss_files-2.24.so --rwxr-xr-x root/root lib32/libnss_hesiod-2.24.so -lrwxrwxrwx root/root lib32/libnss_hesiod.so.2 -> libnss_hesiod-2.24.so --rwxr-xr-x root/root lib32/libnss_nis-2.24.so -lrwxrwxrwx root/root lib32/libnss_nis.so.2 -> libnss_nis-2.24.so --rwxr-xr-x root/root lib32/libnss_nisplus-2.24.so -lrwxrwxrwx root/root lib32/libnss_nisplus.so.2 -> libnss_nisplus-2.24.so +-rwxr-xr-x root/root lib32/libnsl-2.26.so +lrwxrwxrwx root/root lib32/libnsl.so.1 -> libnsl-2.26.so +-rwxr-xr-x root/root lib32/libnss_db-2.26.so +lrwxrwxrwx root/root lib32/libnss_db.so.2 -> libnss_db-2.26.so +-rwxr-xr-x root/root lib32/libnss_dns-2.26.so +lrwxrwxrwx root/root lib32/libnss_dns.so.2 -> libnss_dns-2.26.so +-rwxr-xr-x root/root lib32/libnss_files-2.26.so +lrwxrwxrwx root/root lib32/libnss_files.so.2 -> libnss_files-2.26.so +-rwxr-xr-x root/root lib32/libnss_hesiod-2.26.so +lrwxrwxrwx root/root lib32/libnss_hesiod.so.2 -> libnss_hesiod-2.26.so -rwxr-xr-x root/root lib32/libpcprofile.so --rwxr-xr-x root/root lib32/libpthread-2.24.so -lrwxrwxrwx root/root lib32/libpthread.so.0 -> libpthread-2.24.so --rwxr-xr-x root/root lib32/libresolv-2.24.so -lrwxrwxrwx root/root lib32/libresolv.so.2 -> libresolv-2.24.so --rwxr-xr-x root/root lib32/librt-2.24.so -lrwxrwxrwx root/root lib32/librt.so.1 -> librt-2.24.so +-rwxr-xr-x root/root lib32/libpthread-2.26.so +lrwxrwxrwx root/root lib32/libpthread.so.0 -> libpthread-2.26.so +-rwxr-xr-x root/root lib32/libresolv-2.26.so +lrwxrwxrwx root/root lib32/libresolv.so.2 -> libresolv-2.26.so +-rwxr-xr-x root/root lib32/librt-2.26.so +lrwxrwxrwx root/root lib32/librt.so.1 -> librt-2.26.so -rwxr-xr-x root/root lib32/libthread_db-1.0.so lrwxrwxrwx root/root lib32/libthread_db.so.1 -> libthread_db-1.0.so --rwxr-xr-x root/root lib32/libutil-2.24.so -lrwxrwxrwx root/root lib32/libutil.so.1 -> libutil-2.24.so +-rwxr-xr-x root/root lib32/libutil-2.26.so +lrwxrwxrwx root/root lib32/libutil.so.1 -> libutil-2.26.so drwxr-xr-x root/root usr/ drwxr-xr-x root/root usr/include/ drwxr-xr-x root/root usr/include/gnu/ @@ -342,13 +336,10 @@ lrwxrwxrwx root/root usr/lib32/libm.so -> ../../lib32/libm.so.6 -rw-r--r-- root/root usr/lib32/libmcheck.a -rw-r--r-- root/root usr/lib32/libnsl.a lrwxrwxrwx root/root usr/lib32/libnsl.so -> ../../lib32/libnsl.so.1 -lrwxrwxrwx root/root usr/lib32/libnss_compat.so -> ../../lib32/libnss_compat.so.2 lrwxrwxrwx root/root usr/lib32/libnss_db.so -> ../../lib32/libnss_db.so.2 lrwxrwxrwx root/root usr/lib32/libnss_dns.so -> ../../lib32/libnss_dns.so.2 lrwxrwxrwx root/root usr/lib32/libnss_files.so -> ../../lib32/libnss_files.so.2 lrwxrwxrwx root/root usr/lib32/libnss_hesiod.so -> ../../lib32/libnss_hesiod.so.2 -lrwxrwxrwx root/root usr/lib32/libnss_nis.so -> ../../lib32/libnss_nis.so.2 -lrwxrwxrwx root/root usr/lib32/libnss_nisplus.so -> ../../lib32/libnss_nisplus.so.2 -rw-r--r-- root/root usr/lib32/libpthread.a -rw-r--r-- root/root usr/lib32/libpthread.so -rw-r--r-- root/root usr/lib32/libpthread_nonshared.a diff --git a/glibc-32/.md5sum b/glibc-32/.md5sum deleted file mode 100644 index 8d31067f..00000000 --- a/glibc-32/.md5sum +++ /dev/null @@ -1,5 +0,0 @@ -bcfb2cb7f1cb0b4ecce27fcd5d5d2b21 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch -cb9c54c9d22b3ab597a69d05420b5e80 glibc-2.24.8.patch -97dc5517f92016f3d70d83e3162ad318 glibc-2.24.tar.xz -ac19b5dac0b160aa59a2e265998c3e91 kernel-headers-4.9.5.tar.xz -a8f4549c716cd37244fbf1ed059497f8 lib32.conf diff --git a/glibc-32/.signature b/glibc-32/.signature index 6b94ce07..86bf0c1c 100644 --- a/glibc-32/.signature +++ b/glibc-32/.signature @@ -1,9 +1,8 @@ untrusted comment: verify with /etc/ports/core.pub -RWRJc1FUaeVeqjeyptGRCBcjcyr/ot+fF8dm4Kc50exfkG6Dh1ByVtDUMJHkKHGfkRAeiq/6S6qY0oYbewnOS8I7fQ3Vjzj3xw0= -SHA256 (Pkgfile) = e3f3c583e8e6da48eb296cab0aee6bae04c9def714432f8b81fe749c1b08adec -SHA256 (.footprint) = 0af47db3e8a5ea832d1f971ca56f7718a59167c0214375307a508ff46b327119 -SHA256 (glibc-2.24.tar.xz) = 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 +RWRJc1FUaeVeqiWFUCcaruHDiLFe6M32aJKrJUyJvOBVpvy3J2s/HblLzl/Mk7pTUbTlIde3Pn+pk0ceB6AcfQu2kf7aLbkLLg8= +SHA256 (Pkgfile) = d1df5a0e1780ebbbca231291a411f14ed9f5536501e48aab72388e53f221c46a +SHA256 (.footprint) = d8373022b083aa83f74e13eab15f0b785d08adee0efe44dd762aef5ee286c258 +SHA256 (glibc-2.26.tar.xz) = e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA256 (kernel-headers-4.9.5.tar.xz) = 5783ad8f668ee71561fae370fbcdc477aaa6df249bd85635b87a8c204aeb4aa9 -SHA256 (glibc-2.24.8.patch) = 314fe8ec41042a85991e830a002abf2ff0b98dc4467afa238d8bb369d3be7cca -SHA256 (0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch) = 3f634bf301eb8bab57e5ea552de3f694fb063ab45af3cc91990e1bc24f280ddd +SHA256 (glibc-2.25-updates.patch) = 5fa8a520c4afdfb9aff8f75e9039800ef0fa713e6ec8e2a6c946c1528075150b SHA256 (lib32.conf) = 2f174d2bcefe1c29327690514f34d6970fffdd54398320ca23a11b5f1e3c9b2d diff --git a/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch b/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch deleted file mode 100644 index bc410b26..00000000 --- a/glibc-32/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch +++ /dev/null @@ -1,765 +0,0 @@ -From b9911eb529e51ebe7c5daa3b4f17e2caf7ddb9a4 Mon Sep 17 00:00:00 2001 -From: Fredrik Rinnestam -Date: Sun, 22 Oct 2017 16:18:40 +0200 -Subject: [PATCH] CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - ---- - ChangeLog | 10 + - NEWS | 701 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - posix/glob.c | 2 +- - 3 files changed, 712 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 84189ec762..1fb38cb7ee 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,4 @@ -+<<<<<<< HEAD - 2017-10-19 H.J. Lu - - * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and -@@ -20,6 +21,15 @@ - * sysdeps/x86_64/tst-avxmod.c: Likewise. - * sysdeps/x86_64/tst-sse.c: Likewise. - * sysdeps/x86_64/tst-ssemod.c: Likewise. -+======= -+2017-10-20 Paul Eggert -+ -+ [BZ #22320] -+ CVE-2017-15670 -+ * posix/glob.c (__glob): Fix one-byte overflow. -+ -+2017-10-20 Wilco Dijkstra -+>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - - 2017-10-19 H.J. Lu - -diff --git a/NEWS b/NEWS -index 4831542023..90cae42eee 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,7 +5,708 @@ See the end for copying conditions. - Please send GNU C library bug reports via - using `glibc' in the "product" field. - -+<<<<<<< HEAD - Version 2.24.1 -+======= -+Version 2.27 -+ -+Major new features: -+ -+* Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin and tan -+ with FMA, contributed by Arjan van de Ven and H.J. Lu from Intel. -+ -+* Optimized x86-64 trunc and truncf for processors with SSE4.1. -+ -+* Optimized generic expf, exp2f, logf, log2f and powf. -+ -+* In order to support faster and safer process termination the malloc API -+ family of functions will no longer print a failure address and stack -+ backtrace after detecting heap corruption. The goal is to minimize the -+ amount of work done after corruption is detected and to avoid potential -+ security issues in continued process execution. Reducing shutdown time -+ leads to lower overall process restart latency, so there is benefit both -+ from a security and performance perspective. -+ -+* The abort function terminates the process immediately, without flushing -+ stdio streams. Previous glibc versions used to flush streams, resulting -+ in deadlocks and further data corruption. This change also affects -+ process aborts as the result of assertion failures. -+ -+* On platforms where long double has the IEEE binary128 format (aarch64, -+ alpha, mips64, s390 and sparc), the math library now implements _Float128 -+ interfaces for that type, as defined by ISO/IEC TS 18661-3:2015. These -+ are the same interfaces added in version 2.26 for some platforms where -+ this format is supported but is not the format of long double. -+ -+Deprecated and removed features, and other changes affecting compatibility: -+ -+* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer -+ defined by . -+ -+* libm no longer supports SVID error handling (calling a user-provided -+ matherr function on error) or the _LIB_VERSION variable to control error -+ handling. (SVID error handling and the _LIB_VERSION variable still work -+ for binaries linked against older versions of the GNU C Library.) The -+ libieee.a library is no longer provided. math.h no longer defines struct -+ exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW, -+ TLOSS, PLOSS and HUGE. -+ -+* The libm functions pow10, pow10f and pow10l are no longer supported for -+ new programs. Programs should use the standard names exp10, exp10f and -+ exp10l for these functions instead. -+ -+* The mcontext_t type is no longer the same as struct sigcontext. On -+ platforms where it was previously the same, this changes the C++ name -+ mangling for interfaces involving this type. -+ -+* The add-ons mechanism for building additional packages at the same time as -+ glibc has been removed. The --enable-add-ons configure option is now -+ ignored. -+ -+Changes to build and runtime requirements: -+ -+ [Add changes to build and runtime requirements here] -+ -+Security related changes: -+ -+ CVE-2009-5064: The ldd script would sometimes run the program under -+ examination directly, without preventing code execution through the -+ dynamic linker. (The glibc project disputes that this is a security -+ vulnerability; only trusted binaries must be examined using the ldd -+ script.) -+ -+ CVE-2017-15670: The glob function, when invoked with GLOB_TILDE, suffered -+ from a one-byte overflow during ~ operator processing (either on the stack -+ or the heap, depending on the length of the user name). -+ -+The following bugs are resolved with this release: -+ -+ [The release manager will add the list generated by -+ scripts/list-fixed-bugs.py just before the release.] -+ -+ -+Version 2.26 -+ -+Major new features: -+ -+* A per-thread cache has been added to malloc. Access to the cache requires -+ no locks and therefore significantly accelerates the fast path to allocate -+ and free small amounts of memory. Refilling an empty cache requires locking -+ the underlying arena. Performance measurements show significant gains in a -+ wide variety of user workloads. Workloads were captured using a special -+ instrumented malloc and analyzed with a malloc simulator. Contributed by -+ DJ Delorie with the help of Florian Weimer, and Carlos O'Donell. -+ -+* Unicode 10.0.0 Support: Character encoding, character type info, and -+ transliteration tables are all updated to Unicode 10.0.0, using -+ generator scripts contributed by Mike FABIAN (Red Hat). -+ These updates cause user visible changes, especially the changes in -+ wcwidth for many emoji characters cause problems when emoji sequences -+ are rendered with pango, see for example: -+ https://bugzilla.gnome.org/show_bug.cgi?id=780669#c5 -+ -+* Collation of Hungarian has been overhauled and is now consistent with "The -+ Rules of Hungarian Orthography, 12th edition" (Bug 18934). Contributed by -+ Egmont Koblinger. -+ -+* Improvements to the DNS stub resolver, contributed by Florian Weimer: -+ -+ - The GNU C Library will now detect when /etc/resolv.conf has been -+ modified and reload the changed configuration. The new resolver option -+ “no-reload” (RES_NORELOAD) disables this behavior. -+ -+ - The GNU C Library now supports an arbitrary number of search domains -+ (configured using the “search” directive in /etc/resolv.conf); -+ previously, there was a hard limit of six domains. For backward -+ compatibility, applications that directly modify the ‘_res’ global -+ object are still limited to six search domains. -+ -+ - When the “rotate” (RES_ROTATE) resolver option is active, the GNU C -+ Library will now randomly pick a name server from the configuration as a -+ starting point. (Previously, the second name server was always used.) -+ -+* The tunables feature is now enabled by default. This allows users to tweak -+ behavior of the GNU C Library using the GLIBC_TUNABLES environment variable. -+ -+* New function reallocarray, which resizes an allocated block (like realloc) -+ to the product of two sizes, with a guaranteed clean failure upon integer -+ overflow in the multiplication. Originally from OpenBSD, contributed by -+ Dennis Wölfing and Rüdiger Sonderfeld. -+ -+* New wrappers for the Linux-specific system calls preadv2 and pwritev2. -+ These are extended versions of preadv and pwritev, respectively, taking an -+ additional flags argument. The set of supported flags depends on the -+ running kernel; full support currently requires kernel 4.7 or later. -+ -+* posix_spawnattr_setflags now supports the flag POSIX_SPAWN_SETSID, to -+ create a new session ID for the spawned process. This feature is -+ scheduled to be added to the next major revision of POSIX; for the time -+ being, it is available under _GNU_SOURCE. -+ -+* errno.h is now safe to use from C-preprocessed assembly language on all -+ supported operating systems. In this context, it will only define the -+ Exxxx constants, as preprocessor macros expanding to integer literals. -+ -+* On ia64, powerpc64le, x86-32, and x86-64, the math library now implements -+ 128-bit floating point as defined by ISO/IEC/IEEE 60559:2011 (IEEE -+ 754-2008) and ISO/IEC TS 18661-3:2015. Contributed by Paul E. Murphy, -+ Gabriel F. T. Gomes, Tulio Magno Quites Machado Filho, and Joseph Myers. -+ -+ To compile programs that use this feature, the compiler must support -+ 128-bit floating point with the type name _Float128 (as defined by TS -+ 18661-3) or __float128 (the nonstandard name used by GCC for C++, and for -+ C prior to version 7). _GNU_SOURCE or __STDC_WANT_IEC_60559_TYPES_EXT__ -+ must be defined to make the new interfaces visible. -+ -+ The new functions and macros correspond to those present for other -+ floating-point types (except for a few obsolescent interfaces not -+ supported for the new type), with F128 or f128 suffixes; for example, -+ strtof128, HUGE_VAL_F128 and cosf128. Following TS 18661-3, there are no -+ printf or scanf formats for the new type; the strfromf128 and strtof128 -+ interfaces should be used instead. -+ -+Deprecated and removed features, and other changes affecting compatibility: -+ -+* The synchronization that pthread_spin_unlock performs has been changed to -+ now be equivalent to a C11 atomic store with release memory order to the -+ spin lock's memory location. Previously, several (but not all) -+ architectures used stronger synchronization (e.g., containing what is -+ often called a full barrier). This change can improve performance, but -+ may affect odd fringe uses of spin locks that depend on the previous -+ behavior (e.g., using spin locks as atomic variables to try to implement -+ Dekker's mutual exclusion algorithm). -+ -+* The port to Native Client running on ARMv7-A (--host=arm-nacl) has been -+ removed. -+ -+* Sun RPC is deprecated. The rpcgen program, librpcsvc, and Sun RPC headers -+ will only be built and installed when the GNU C Library is configured with -+ --enable-obsolete-rpc. This allows alternative RPC implementations, such -+ as TIRPC or rpcsvc-proto, to be used. -+ -+* The NIS(+) name service modules, libnss_nis, libnss_nisplus, and -+ libnss_compat, are deprecated, and will not be built or installed by -+ default. -+ -+ The NIS(+) support library, libnsl, is also deprecated. By default, a -+ compatibility shared library will be built and installed, but not headers -+ or development libraries. Only a few NIS-related programs require this -+ library. (In particular, the GNU C Library has never required programs -+ that use 'gethostbyname' to be linked with libnsl.) -+ -+ Replacement implementations based on TIRPC, which additionally support -+ IPv6, are available from . The configure -+ option --enable-obsolete-nsl will cause libnsl's headers, and the NIS(+) -+ name service modules, to be built and installed. -+ -+* The DNS stub resolver no longer performs EDNS fallback. If EDNS or DNSSEC -+ support is enabled, the configured recursive resolver must support EDNS. -+ (Responding to EDNS-enabled queries with responses which are not -+ EDNS-enabled is fine, but FORMERR responses are not.) -+ -+* res_mkquery and res_nmkquery no longer support the IQUERY opcode. DNS -+ servers have not supported this opcode for a long time. -+ -+* The _res_opcodes variable has been removed from libresolv. It had been -+ exported by accident. -+ -+* no longer includes inline versions of any string functions, -+ as this kind of optimization is better done by the compiler. The macros -+ __USE_STRING_INLINES and __NO_STRING_INLINES no longer have any effect. -+ -+* The nonstandard header has been removed. Most programs should -+ use instead. If you have a specific need for the definition of -+ locale_t with no other declarations, please contact -+ libc-alpha@sourceware.org and explain. -+ -+* The obsolete header has been removed. -+ -+* The obsolete signal constant SIGUNUSED is no longer defined by . -+ -+* The obsolete function cfree has been removed. Applications should use -+ free instead. -+ -+* The stack_t type no longer has the name struct sigaltstack. This changes -+ the C++ name mangling for interfaces involving this type. -+ -+* The ucontext_t type no longer has the name struct ucontext. This changes -+ the C++ name mangling for interfaces involving this type. -+ -+* On M68k GNU/Linux and MIPS GNU/Linux, the fpregset_t type no longer has -+ the name struct fpregset. On Nios II GNU/Linux, the mcontext_t type no -+ longer has the name struct mcontext. On SPARC GNU/Linux, the struct -+ mc_fq, struct rwindow, struct fpq and struct fq types are no longer -+ defined in sys/ucontext.h, the mc_fpu_t type no longer has the name struct -+ mc_fpu, the gwindows_t type no longer has the name struct gwindows and the -+ fpregset_t type no longer has the name struct fpu. This changes the C++ -+ name mangling for interfaces involving those types. -+ -+* On S/390 GNU/Linux, the constants defined by have been -+ synced with the kernel: -+ -+ - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS -+ are not supported on this architecture and have been removed. -+ -+ - PTRACE_SINGLEBLOCK, PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, -+ PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, -+ PTRACE_DISABLE_TE and PTRACE_TE_ABORT_RAND have been added. -+ -+ Programs that assume the GET/SETREGS ptrace requests are universally -+ available will now fail to build, instead of malfunctioning at runtime. -+ -+Changes to build and runtime requirements: -+ -+* Linux kernel 3.2 or later is required at runtime, on all architectures -+ supported by that kernel. (This is a change from version 2.25 only for -+ x86-32 and x86-64.) -+ -+* GNU Binutils 2.25 or later is now required to build the GNU C Library. -+ -+* On most architectures, GCC 4.9 or later is required to build the GNU C -+ Library. On powerpc64le, GCC 6.2 or later is required. -+ -+ Older GCC versions and non-GNU compilers are still supported when -+ compiling programs that use the GNU C Library. (We do not know exactly -+ how old, and some GNU extensions to C may be _de facto_ required. If you -+ are interested in helping us make this statement less vague, please -+ contact libc-alpha@sourceware.org.) -+ -+Security related changes: -+ -+* The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes, -+ to avoid fragmentation-based spoofing attacks (CVE-2017-12132). -+ -+* LD_LIBRARY_PATH is now ignored in binaries running in privileged AT_SECURE -+ mode to guard against local privilege escalation attacks (CVE-2017-1000366). -+ -+* Avoid printing a backtrace from the __stack_chk_fail function since it is -+ called on a corrupt stack and a backtrace is unreliable on a corrupt stack -+ (CVE-2010-3192). -+ -+* A use-after-free vulnerability in clntudp_call in the Sun RPC system has been -+ fixed (CVE-2017-12133). -+ -+The following bugs are resolved with this release: -+ -+ [984] network: Respond to changed resolv.conf in gethostbyname -+ [5010] network: sunrpc service cleanup causes unwanted port mapper traffic -+ [12068] localedata: sc_IT: misspelled yesexpr/day/abday/mon/abmon/date_fmt -+ fields -+ [12189] libc: __stack_chk_fail should not attempt a backtrace -+ (CVE-2010-3192) -+ [14096] time: Race condition on timezone/tst-timezone.out -+ [14172] localedata: az_IR: new locale -+ [14995] build: glibc fails to build if gold is the default linker, even if -+ ld.bfd is available -+ [15998] build: [powerpc] Set arch_minimum_kernel for powerpc LE -+ [16637] network: inet_pton function is accepting IPv6 with bad format -+ [16640] string: string/strtok.c: undefined behaviour inconsistent between -+ x86 and other generic code -+ [16875] localedata: ko_KR: fix lang_name -+ [17225] localedata: ar_SY: localized month names for May and June are -+ incorrect -+ [17297] localedata: da_DK: wrong date_fmt string -+ [18907] stdio: Incorrect order of __wur __THROW in -+ [18934] localedata: hu_HU: collate: fix multiple bugs and add tests -+ [18988] nptl: pthread wastes memory with mlockall(MCL_FUTURE) -+ [19066] localedata: ar_SA abbreviated day and month names are in English -+ [19569] network: resolv: Support an arbitrary number of search domains -+ [19570] network: Implement random DNS server selection in the stub -+ resolver -+ [19838] locale: localedef fails on PA-RISC -+ [19919] localedata: iso14651_t1_common: Correct the Malayalam sorting -+ order of 0D36 and 0D37 -+ [19922] localedata: iso14651_t1_common: Define collation for Malayalam -+ chillu characters -+ [20098] libc: FAIL: debug/backtrace-tst on hppa -+ [20257] network: sunrpc: clntudp_call does not enforce timeout when -+ receiving data -+ [20275] localedata: locale day/abday/mon/abmon should not have trailing -+ whitespace -+ [20313] localedata: Update locale data to Unicode 9.0 -+ [20424] manual: Document how to provide a malloc replacement -+ [20496] localedata: agr_PE: new language locale Awajún / Aguaruna (agr) -+ for Peru -+ [20686] locale: Add el_GR@euro to SUPPORTED. -+ [20831] dynamic-link: _dl_map_segments does not test for __mprotect -+ failures consistently -+ [21015] dynamic-link: Document and fix --enable-bind-now -+ [21016] nptl: pthread_cond support is broken on hppa -+ [21029] libc: glibc-2.23 (and later) fails to compile with -fno-omit- -+ frame-pointer on i386 -+ [21049] libc: segfault in longjmp_chk() due to clobbered processor -+ register -+ [21075] libc: unused assigment to %g4 in sparc/sparc{64,32}/clone.S -+ [21088] libc: Build fails with --enable-static-nss -+ [21094] math: cosf(1.57079697) has 3 ulp error on targets where the -+ generic c code is used -+ [21109] libc: Tunables broken on big-endian -+ [21112] math: powf has large ulp errors with base close to 1 and exponent -+ around 4000 -+ [21115] network: sunrpc: Use-after-free in error path in clntudp_call -+ (CVE-2017-12133) -+ [21120] malloc: glibc malloc is incompatible with GCC 7 -+ [21130] math: Incorrect return from y0l (-inf) and y1l (-inf) when linking -+ with -lieee -+ [21134] math: Exception (divide by zero) not set for y0/y1 (0.0) and y0/y1 -+ (-0.0) when linking with -lieee -+ [21171] math: log10, log2 and lgamma return incorrect results -+ [21179] libc: handle R_SPARC_DISP64 and R_SPARC_REGISTER relocs -+ [21182] libc: __memchr_sse2: regression in glibc-2.25 on i686 -+ [21207] localedata: ce_RU: update weekdays from CLDR -+ [21209] dynamic-link: LD_HWCAP_MASK read in setuid binaries -+ [21217] localedata: Update months from CLDR-31 -+ [21232] libc: miss posix_fadvise64 on MIPS64 when static linking -+ [21243] libc: support_delete_temp_file should issue warning for failed -+ remove() -+ [21244] libc: support resolv_test_start() socket fd close should be -+ checked for errors. -+ [21253] libc: localedef randomly segfaults when using -fstack-check due to -+ new posix_spawn implementation -+ [21258] dynamic-link: Branch predication in _dl_runtime_resolve_avx512_opt -+ leads to lower CPU frequency -+ [21259] libc: [alpha] termios.h missing IXANY for POSIX -+ [21261] libc: [sparc64] bits/setjmp.h namespace -+ [21267] network: [mips] bits/socket.h IOC* namespace -+ [21268] libc: [alpha] termios.h NL2, NL3 namespace -+ [21270] libc: mmap64 silently truncates large offset values -+ [21275] libc: posix_spawn always crashes on ia64 now -+ [21277] libc: [alpha] termios.h missing IUCLC for UNIX98 and older -+ [21280] math: [powerpc] logbl for POWER7 return incorrect results -+ [21289] libc: Incorrect declaration for 32-bit platforms with -+ _FILE_OFFSET_BITS=64 causes build error -+ [21295] network: GETAI(AF_UNSPEC) drops IPv6 addresses if nss module does -+ not support gethostbyname4_r -+ [21298] nptl: rwlock can deadlock on frequent reader/writer phase -+ switching -+ [21338] malloc: mallopt M_ARENA_MAX doesn't set the maximum number of -+ arenas -+ [21340] libc: Support POSIX_SPAWN_SETSID -+ [21357] libc: unwind-dw2-fde deadlock when using AddressSanitizer -+ [21359] network: ns_name_pack needs additional byte in destination buffer -+ [21361] network: resolv: Reduce advertised EDNS0 buffer size to guard -+ against fragmentation attacks (CVE-2017-12132) -+ [21369] network: resolv: Remove EDNS fallback -+ [21371] libc: Missing timespec definition when compiled with _XOPEN_SOURCE -+ and _POSIX_C_SOURCE -+ [21386] nptl: Assertion in fork for distinct parent PID is incorrect -+ [21391] dynamic-link: x86: Set dl_platform and dl_hwcap from CPU features -+ [21393] stdio: Missing dup3 error check in freopen, freopen64 -+ [21396] libc: Use AVX2 memcpy/memset on Skylake server -+ [21399] localedata: Bad description for U00EC in -+ localedata/charmaps/CP1254 -+ [21411] malloc: realloc documentation error -+ [21426] network: sys/socket.h uio.h namespace -+ [21428] libc: [aarch64] tst-backtrace5 testsuite failure -+ [21445] libc: signal.h bsd_signal namespace -+ [21455] network: Network headers stdint.h namespace -+ [21474] network: resolv: res_init does not use RES_DFLRETRY (2) but 4 for -+ retry value -+ [21475] network: resolv: Overlong search path is truncated mid-label -+ [21511] libc: sigstack namespace -+ [21512] libc: clone() ends up calling exit_group() through _exit() wrapper -+ [21514] libc: sysdeps/unix/sysv/linux/sys/syscall.h:31:27: fatal error: -+ bits/syscall.h: No such file or directory -+ [21517] libc: struct sigaltstack namespace -+ [21528] dynamic-link: Duplicated minimal strtoul implementations in ld.so -+ [21533] localedata: Update locale data to Unicode 10.0 -+ [21537] libc: -+ ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error: -+ junk at end of line, first unrecognized character is `@' -+ [21538] libc: SIG_HOLD missing for XPG4 -+ [21539] libc: S390: Mismatch between kernel and glibc ptrace.h with -+ request 12: PTRACE_SINGLEBLOCK vs PTRACE_GETREGS. -+ [21542] libc: Use conservative default for sysconf (_SC_NPROCESSORS_ONLN) -+ [21543] libc: sigevent namespace -+ [21548] libc: [mips] get/set/make/swap context for MIPS O32 assume wrong -+ size for general purpose registers in mcontext_t structure -+ [21550] libc: sigwait namespace -+ [21552] libc: XPG4 bsd_signal namespace -+ [21554] libc: sigpause namespace -+ [21560] libc: sys/wait.h signal.h namespace -+ [21561] libc: waitid namespace -+ [21573] nptl: GCC 7: /usr/bin/install: cannot remove -+ '/usr/include/stdlib.h': Permission denied -+ [21575] libc: sys/wait.h missing struct rusage definition -+ [21584] libc: sigaltstack etc namespace -+ [21597] libc: siginterrupt namespace -+ [21607] math: hppa: FAIL: math/test-tgmath -+ [21609] dynamic-link: Incomplete workaround for GCC __tls_get_addr ABI -+ issue on x86-64 -+ [21622] libc: [tile] missing SA_* for POSIX.1:2008 -+ [21624] dynamic-link: ld.so: Unsafe alloca allows local attackers to alias -+ stack and heap (CVE-2017-1000366) -+ [21625] libc: wait3 namespace -+ [21654] nss: Incorrect pointer alignment in NSS group merge result -+ construction -+ [21657] network: Parse interface zone id for node-local multicast -+ [21662] string: memcmp-avx2-movbe.S lacks saturating subtraction for -+ between_2_3 -+ [21666] libc: .symver is used on common symbol -+ [21668] network: resolv: res_init cross-thread broadcast introduces race -+ conditions -+ [21687] math: tgmath.h totalorder, totalordermag return type -+ [21694] locale: Current Glibc Locale Does Not Support Tok-Pisin and Fiji -+ Hindi Locale -+ [21696] libc: Incorrect assumption of of __cpu_mask in -+ posix/sched_cpucount.c -+ [21697] libc: sysdeps/posix/spawni.c: 2 * suspicious condition ? -+ [21706] localedata: yesstr and nostr are missing for Breton [LC_MESSAGES] -+ locale -+ [21707] math: ppc64le: Invalid IFUNC resolver from libgcc calls getauxval, -+ leading to relocation crash -+ [21709] libc: resolv_conf.c:552: update_from_conf: Assertion -+ `resolv_conf_matches (resp, conf)' failed. -+ [21710] localedata: Added Samoan language locale for Samoa -+ [21711] localedata: Pashto yesstr/nostr locale are missing -+ [21715] nptl: sysdeps/nptl/bits/pthreadtypes.h: typedef guard -+ __have_pthread_attr_t can cause redefinition of typedef ‘pthread_attr_t’ -+ [21721] localedata: Incorrect Full Weekday names for ks_IN@devanagari -+ [21723] localedata: yesstr/nostr missing for Chinese language locale -+ [21724] localedata: yesstr and nostr are missing for Xhosa [LC_MESSAGES] -+ locale -+ [21727] localedata: yesstr and nostr are missing for Tsonga [LC_MESSAGES] -+ locale -+ [21728] localedata: New Locale for Tongan language -+ [21729] localedata: incorrect LC_NAME fields for hi_IN -+ [21733] localedata: yesstr and nostr are missing for zh_HK -+ [21734] localedata: Missing yesstr and nostr are for kw_GB -+ [21738] libc: misc/tst-preadvwritev2 and misc/tst-preadvwritev64v2 fail -+ [21741] libc: Undefined __memmove_chk_XXX and __memset_chk_XXX in libc.a -+ [21742] libc: _dl_num_cache_relocations is undefined in libc.a -+ [21743] localedata: ks_IN@devanagari: abday strings mismatch the day -+ strings -+ [21744] libc: Tests failing on --enable-tunables --enable-stack- -+ protector=all -+ [21749] localedata: Wrong abbreviated day name (“abday”) for -+ ar_JO/ar_LB/ar_SY -+ [21756] localedata: missing yesstr, nostr for nds_DE and nds_NL -+ [21757] localedata: missing yesstr, nostr for pap_AW and pap_CW -+ [21759] localedata: missing yesstr and nostr for Tigrinya -+ [21760] localedata: Fix LC_MESSAGES and LC_ADDRESS for anp_IN -+ [21766] localedata: Wrong LC_MESSAGES for om_ET Locale -+ [21767] localedata: Missing Bislama locales -+ [21768] localedata: Missing yesstr and nostr for aa_ET -+ [21770] localedata: Missing Field in li_NL -+ [21778] nptl: Robust mutex may deadlock -+ [21779] libc: MicroBlaze segfaults when loading libpthread -+ [21783] localedata: Fix int_select international_call_prefixes -+ [21784] localedata: Inconsistency in country_isbn -+ [21788] localedata: Missing Country Postal Abbreviations -+ [21794] localedata: Added-country_isbn-for-Italy -+ [21795] localedata: Add/Fix country_isbn for France -+ [21796] localedata: Added country_isbn for Republic of Korea -+ [21797] localedata: Fix inconsistency in country_isbn and missing prefixes -+ [21799] localedata: Added int_select international_call_prefixes -+ [21801] localedata: Added int_select international_call_prefixes -+ [21804] nptl: Double semicolon in thread-shared-types.h -+ [21807] localedata: LC_ADDRESS fix for pap_CW -+ [21808] localedata: Fix LC_ADDRESS for pap_AW -+ [21821] localedata: Added country_name in mai_IN -+ [21822] localedata: Fix LC_TIME for mai_IN -+ [21823] localedata: missing yesstr, nostr for sa_IN -+ [21825] localedata: Fix name_mrs for mag_IN -+ [21828] localedata: 2.26 changelog should mention user visible changes -+ with unicode 9.0 -+ [21835] localedata: Added Maithili language locale for Nepal -+ [21838] localedata: Removed redundant data for the_NP -+ [21839] localedata: Fix LC_MONETARY for ta_LK -+ [21844] localedata: Fix Latin characters and Months Sequence. -+ [21848] localedata: Fix mai_NP Title Name -+ -+ -+Version 2.25 -+ -+* The feature test macro __STDC_WANT_LIB_EXT2__, from ISO/IEC TR -+ 24731-2:2010, is supported to enable declarations of functions from that -+ TR. Note that not all functions from that TR are supported by the GNU C -+ Library. -+ -+* The feature test macro __STDC_WANT_IEC_60559_BFP_EXT__, from ISO/IEC TS -+ 18661-1:2014, is supported to enable declarations of functions and macros -+ from that TS. Note that not all features from that TS are supported by -+ the GNU C Library. -+ -+* The feature test macro __STDC_WANT_IEC_60559_FUNCS_EXT__, from ISO/IEC TS -+ 18661-4:2015, is supported to enable declarations of functions and macros -+ from that TS. Note that most features from that TS are not supported by -+ the GNU C Library. -+ -+* The nonstandard feature selection macros _REENTRANT and _THREAD_SAFE are -+ now treated as compatibility synonyms for _POSIX_C_SOURCE=199506L. -+ Since the GNU C Library defaults to a much newer revision of POSIX, this -+ will only affect programs that specifically request an old conformance -+ mode. For instance, a program compiled with -std=c89 -D_REENTRANT will -+ see a change in the visible declarations, but a program compiled with -+ just -D_REENTRANT, or -std=c99 -D_POSIX_C_SOURCE=200809L -D_REENTRANT, -+ will not. -+ -+ Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be -+ defined by all multithreaded code, but glibc has not required this for -+ many years. -+ -+* The inclusion of by is deprecated. This -+ means that in a future release, the macros “major”, “minor”, and “makedev” -+ will only be available from . -+ -+ These macros are not part of POSIX nor XSI, and their names frequently -+ collide with user code; see for instance glibc bug 19239 and Red Hat bug -+ 130601. includes under _GNU_SOURCE, and C++ code -+ presently cannot avoid being compiled under _GNU_SOURCE, exacerbating the -+ problem. -+ -+* New features from TS 18661-1:2014 are added to libm: the -+ fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the -+ femode_t type and the FE_DFL_MODE and FE_SNANS_ALWAYS_SIGNAL macros. -+ -+* Integer width macros from TS 18661-1:2014 are added to : -+ CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH, -+ UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH; and to -+ : INT8_WIDTH, UINT8_WIDTH, INT16_WIDTH, UINT16_WIDTH, -+ INT32_WIDTH, UINT32_WIDTH, INT64_WIDTH, UINT64_WIDTH, INT_LEAST8_WIDTH, -+ UINT_LEAST8_WIDTH, INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH, -+ INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH, INT_LEAST64_WIDTH, -+ UINT_LEAST64_WIDTH, INT_FAST8_WIDTH, UINT_FAST8_WIDTH, INT_FAST16_WIDTH, -+ UINT_FAST16_WIDTH, INT_FAST32_WIDTH, UINT_FAST32_WIDTH, INT_FAST64_WIDTH, -+ UINT_FAST64_WIDTH, INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH, -+ UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH, -+ WINT_WIDTH. -+ -+* New features are added from TS 18661-1:2014: -+ -+ - Signaling NaN macros: SNANF, SNAN, SNANL. -+ -+ - Nearest integer functions: roundeven, roundevenf, roundevenl, fromfp, -+ fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, -+ fromfpxl, ufromfpx, ufromfpxf, ufromfpxl. -+ -+ - llogb functions: the llogb, llogbf and llogbl functions, and the -+ FP_LLOGB0 and FP_LLOGBNAN macros. -+ -+ - Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag, -+ fminmagf, fminmagl. -+ -+ - Comparison macros: iseqsig. -+ -+ - Classification macros: iscanonical, issubnormal, iszero. -+ -+ - Total order functions: totalorder, totalorderf, totalorderl, -+ totalordermag, totalordermagf, totalordermagl. -+ -+ - Canonicalize functions: canonicalize, canonicalizef, canonicalizel. -+ -+ - NaN functions: getpayload, getpayloadf, getpayloadl, setpayload, -+ setpayloadf, setpayloadl, setpayloadsig, setpayloadsigf, setpayloadsigl. -+ -+* The functions strfromd, strfromf, and strfroml, from ISO/IEC TS 18661-1:2014, -+ are added to libc. They convert a floating-point number into string. -+ -+* Most of glibc can now be built with the stack smashing protector enabled. -+ It is recommended to build glibc with --enable-stack-protector=strong. -+ Implemented by Nick Alcock (Oracle). -+ -+* The function explicit_bzero, from OpenBSD, has been added to libc. It is -+ intended to be used instead of memset() to erase sensitive data after use; -+ the compiler will not optimize out calls to explicit_bzero even if they -+ are "unnecessary" (in the sense that no _correct_ program can observe the -+ effects of the memory clear). -+ -+* On ColdFire, MicroBlaze, Nios II and SH3, the float_t type is now defined -+ to float instead of double. This does not affect the ABI of any libraries -+ that are part of the GNU C Library, but may affect the ABI of other -+ libraries that use this type in their interfaces. -+ -+* On x86_64, when compiling with -mfpmath=387 or -mfpmath=sse+387, the -+ float_t and double_t types are now defined to long double instead of float -+ and double. These options are not the default, and this does not affect -+ the ABI of any libraries that are part of the GNU C Library, but it may -+ affect the ABI of other libraries that use this type in their interfaces, -+ if they are compiled or used with those options. -+ -+* The getentropy and getrandom functions, and the header file -+ have been added. -+ -+* The buffer size for byte-oriented stdio streams is now limited to 8192 -+ bytes by default. Previously, on Linux, the default buffer size on most -+ file systems was 4096 bytes (and thus remains unchanged), except on -+ network file systems, where the buffer size was unpredictable and could be -+ as large as several megabytes. -+ -+* The header now includes the header. Support -+ for the Linux quota interface which predates kernel version 2.4.22 has -+ been removed. -+ -+* The malloc_get_state and malloc_set_state functions have been removed. -+ Already-existing binaries that dynamically link to these functions will -+ get a hidden implementation in which malloc_get_state is a stub. As far -+ as we know, these functions are used only by GNU Emacs and this change -+ will not adversely affect already-built Emacs executables. Any undumped -+ Emacs executables, which normally exist only during an Emacs build, should -+ be rebuilt by re-running “./configure; make” in the Emacs build tree. -+ -+* The “ip6-dotint” and “no-ip6-dotint” resolver options, and the -+ corresponding RES_NOIP6DOTINT flag from have been removed. -+ “no-ip6-dotint” had already been the default, and support for the -+ “ip6-dotint” option was removed from the Internet in 2006. -+ -+* The "ip6-bytestring" resolver option and the corresponding RES_USEBSTRING -+ flag from have been removed. The option relied on a -+ backwards-incompatible DNS extension which was never deployed on the -+ Internet. -+ -+* The flags RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG, -+ RES_BLAST defined in the header file have been deprecated. -+ They were already unimplemented. -+ -+* The "inet6" option in /etc/resolv.conf and the RES_USE_INET6 flag for -+ _res.flags are deprecated. The flag was standardized in RFC 2133, but -+ removed again from the IETF name lookup interface specification in RFC -+ 2553. Applications should use getaddrinfo instead. -+ -+* DNSSEC-related declarations and definitions have been removed from the -+ header file, and libresolv will no longer attempt to -+ decode the data part of DNSSEC record types. Previous versions of glibc -+ only implemented minimal support for the previous version of DNSSEC, which -+ is incompatible with the currently deployed version. -+ -+* The resource record type classification macros ns_t_qt_p, ns_t_mrr_p, -+ ns_t_rr_p, ns_t_udp_p, ns_t_xfr_p have been removed from the -+ header file because the distinction between RR types and -+ meta-RR types is not officially standardized, subject to revision, and -+ thus not suitable for encoding in a macro. -+ -+* The types res_sendhookact, res_send_qhook, re_send_rhook, and the qhook -+ and rhook members of the res_state type in have been removed. -+ The glibc stub resolver did not support these hooks, but the header file -+ did not reflect that. -+ -+* For multi-arch support it is recommended to use a GCC which has -+ been built with support for GNU indirect functions. This ensures -+ that correct debugging information is generated for functions -+ selected by IFUNC resolvers. This support can either be enabled by -+ configuring GCC with '--enable-gnu-indirect-function', or by -+ enabling it by default by setting 'default_gnu_indirect_function' -+ variable for a particular architecture in the GCC source file -+ 'gcc/config.gcc'. -+ -+* GDB pretty printers have been added for mutex and condition variable -+ structures in POSIX Threads. When installed and loaded in gdb these pretty -+ printers show various pthread variables in human-readable form when read -+ using the 'print' or 'display' commands in gdb. -+ -+* Tunables feature added to allow tweaking of the runtime for an application -+ program. This feature can be enabled with the '--enable-tunables' configure -+ flag. The GNU C Library manual has details on usage and README.tunables has -+ instructions on adding new tunables to the library. -+ -+* A new version of condition variables functions have been implemented in -+ the NPTL implementation of POSIX Threads to provide stronger ordering -+ guarantees. -+ -+* A new version of pthread_rwlock functions have been implemented to use a more -+ scalable algorithm primarily through not using a critical section anymore to -+ make state changes. -+>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - - Security related changes: - -diff --git a/posix/glob.c b/posix/glob.c -index ea4b0b61eb..08f240a1ff 100644 ---- a/posix/glob.c -+++ b/posix/glob.c -@@ -856,7 +856,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - *p = '\0'; - } - else -- *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) -+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) - = '\0'; - user_name = newp; - } --- -2.14.2 - diff --git a/glibc-32/Pkgfile b/glibc-32/Pkgfile index f9948ec4..d82bbf2d 100644 --- a/glibc-32/Pkgfile +++ b/glibc-32/Pkgfile @@ -3,12 +3,11 @@ # Maintainer: CRUX System Team, core-ports at crux dot nu name=glibc-32 -version=2.24 -release=8 -source=(http://ftpmirror.gnu.org/gnu/glibc/glibc-2.24.tar.xz \ +version=2.26 +release=1 +source=(http://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ http://crux.nu/files/distfiles/kernel-headers-4.9.5.tar.xz \ - glibc-2.24.8.patch 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch \ - lib32.conf) + glibc-2.25-updates.patch lib32.conf) build() { mkdir build @@ -18,9 +17,8 @@ build() { export CC="${CC:-gcc} -m32" export CFLAGS="$CFLAGS -Wno-error=parentheses" - patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-2.24.8.patch - patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch - + #patch -p1 -d $SRC/glibc-${version:0:4} -i $SRC/glibc-2.25-updates.patch + ../glibc-${version:0:4}/configure --prefix=/usr \ --libdir=/usr/lib32 \ --libexecdir=/usr/lib32 \ @@ -28,6 +26,7 @@ build() { --enable-kernel=3.12 \ --enable-add-ons \ --disable-profile \ + --disable-werror \ --without-gd \ --enable-obsolete-rpc \ --enable-multi-arch \ diff --git a/glibc-32/glibc-2.24.8.patch b/glibc-32/glibc-2.24.8.patch deleted file mode 100644 index 4f1db10c..00000000 --- a/glibc-32/glibc-2.24.8.patch +++ /dev/null @@ -1,16286 +0,0 @@ -diff --git a/ChangeLog b/ChangeLog -index c44c926094..84189ec762 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,685 @@ -+2017-10-19 H.J. Lu -+ -+ * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and -+ tst-avx512. -+ (test-extras): Add tst-avx-aux and tst-avx512-aux. -+ (extra-test-objs): Add tst-avx-aux.o and tst-avx512-aux.o. -+ (modules-names): Add tst-ssemod, tst-avxmod and tst-avx512mod. -+ ($(objpfx)tst-sse): New rule. -+ ($(objpfx)tst-avx): Likewise. -+ ($(objpfx)tst-avx512): Likewise. -+ (CFLAGS-tst-avx-aux.c): New. -+ (CFLAGS-tst-avxmod.c): Likewise. -+ (CFLAGS-tst-avx512-aux.c): Likewise. -+ (CFLAGS-tst-avx512mod.c): Likewise. -+ * sysdeps/x86_64/tst-avx-aux.c: New file. -+ * sysdeps/x86_64/tst-avx.c: Likewise. -+ * sysdeps/x86_64/tst-avx512-aux.c: Likewise. -+ * sysdeps/x86_64/tst-avx512.c: Likewise. -+ * sysdeps/x86_64/tst-avx512mod.c: Likewise. -+ * sysdeps/x86_64/tst-avxmod.c: Likewise. -+ * sysdeps/x86_64/tst-sse.c: Likewise. -+ * sysdeps/x86_64/tst-ssemod.c: Likewise. -+ -+2017-10-19 H.J. Lu -+ -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't -+ adjust CFA when allocating register save area on re-aligned -+ stack. -+ -+2016-12-21 Joseph Myers -+ -+ [BZ #20978] -+ * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): -+ Compare name == NULL, not name != NULL. -+ -+2016-11-08 Joseph Myers -+ -+ [BZ #20790] -+ * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size -+ to MAXLINESIZE. -+ * sunrpc/bug20790.x: New file. -+ * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New -+ variable. -+ [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). -+ [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule. -+ -+2016-10-14 Steve Ellcey -+ -+ * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly -+ boolean. -+ -+2017-07-19 DJ Delorie -+ -+ [BZ #21654] -+ * grp/grp-merge.c (libc_hidden_def): Fix cast-after-dereference. -+ -+2017-07-14 DJ Delorie -+ -+ [BZ #21654] -+ * grp/grp_merge.c (__copy_grp): Align char** to minimum pointer -+ alignment not char alignment. -+ (__merge_grp): Likewise. -+ -+2017-08-06 H.J. Lu -+ -+ [BZ #21871] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F. -+ -+2017-02-27 Florian Weimer -+ -+ [BZ #21115] -+ * sunrpc/clnt_udp.c (clntudp_call): Free ancillary data later. -+ * sunrpc/Makefile (tests): Add tst-udp-error. -+ (tst-udp-error): Link against libc.so explicitly. -+ * sunrpc/tst-udp-error: New file. -+ -+2017-01-24 James Clarke -+ -+ * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: Use new REG_R* -+ constants instead of the old R* ones. -+ * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: Likewise. -+ * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGPREG): Rename... -+ (NGREG): ... to this, to fit in with other architectures. -+ (gpregset_t): Use new NGREG macro. -+ [__USE_GNU]: Remove condition; all architectures other than tile -+ are unconditional. -+ (R*): Rename to REG_R*. -+ -+2017-07-26 H.J. Lu -+ -+ [BZ #21666] -+ * misc/regexp.c (loc1): Add __attribute__ ((nocommon)); -+ (loc2): Likewise. -+ (locs): Likewise. -+ -+2017-07-12 Szabolcs Nagy -+ -+ * sysdeps/aarch64/dl-machine.h (RTLD_START_1): Change _dl_argv to the -+ hidden __GI__dl_argv symbol. -+ -+2016-09-05 Aurelien Jarno -+ -+ * conform/Makefile (conformtest-header-tests): Pass -I. to $(PERL). -+ (linknamespace-symlists-tests): Likewise. -+ (linknamespace-header-tests): Likewise. -+ -+2017-07-06 Florian Weimer -+ H.J. Lu -+ -+ [BZ #21609] -+ * sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr. -+ (gen-as-const-headers): Add rtld-offsets.sym. -+ * sysdeps/x86_64/dl-tls.c: New file. -+ * sysdeps/x86_64/rtld-offsets.sym: Likwise. -+ * sysdeps/x86_64/tls_get_addr.S: Likewise. -+ * sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards. -+ * sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New. -+ (TI_OFFSET_OFFSET): Likwise. -+ -+2017-06-14 Florian Weimer -+ -+ * sysdeps/i386/i686/multiarch/strcspn-c.c: Add IS_IN (libc) guard. -+ * sysdeps/i386/i686/multiarch/varshift.c: Likewise. -+ -+2017-03-07 Siddhesh Poyarekar -+ -+ [BZ #21209] -+ * elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for -+ AT_SECURE processes. -+ * sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK. -+ -+2017-06-19 Florian Weimer -+ -+ * elf/rtld.c (audit_list_string): New variable. -+ (audit_list): Update comment. -+ (struct audit_list_iter): Define. -+ (audit_list_iter_init, audit_list_iter_next): New function. -+ (dl_main): Use struct audit_list_iter to process audit modules. -+ (process_dl_audit): Call dso_name_valid_for_suid. -+ (process_envvars): Set audit_list_string instead of calling -+ process_dl_audit. -+ -+2017-06-19 Florian Weimer -+ -+ * elf/rtld.c (SECURE_NAME_LIMIT, SECURE_PATH_LIMIT): Define. -+ (dso_name_valid_for_suid): New function. -+ (handle_ld_preload): Likewise. -+ (dl_main): Call it. Remove alloca. -+ -+2017-06-19 Florian Weimer -+ -+ [BZ #21624] -+ CVE-2017-1000366 -+ * elf/rtld.c (process_envvars): Ignore LD_LIBRARY_PATH for -+ __libc_enable_secure. -+ -+2017-02-01 Andreas Schwab -+ -+ * sysdeps/m68k/m680x0/m68020/atomic-machine.h -+ (__arch_compare_and_exchange_val_64_acq, atomic_exchange_acq) -+ (atomic_exchange_and_add, atomic_add): Add casts to 64 bit asm -+ operands. -+ -+2017-05-12 Florian Weimer -+ -+ [BZ #21386] -+ * sysdeps/nptl/fork.c (__libc_fork): Remove assertions on the -+ parent PID. The assertion in the child is incorrect with PID -+ namespaces. -+ -+2017-06-07 Arjun Shankar -+ -+ * sysdeps/unix/sysv/linux/tst-clone2.c: Do not -+ include test-skeleton.c. -+ Include support/check.h and support/test-driver.c. -+ -+2016-11-24 Adhemerval Zanella -+ -+ * sysdeps/nptl/fork.c (__libc_fork): Remove pid cache setting. -+ * nptl/allocatestack.c (allocate_stack): Likewise. -+ (__reclaim_stacks): Likewise. -+ (setxid_signal_thread): Obtain pid through syscall. -+ * nptl/nptl-init.c (sigcancel_handler): Likewise. -+ (sighandle_setxid): Likewise. -+ * nptl/pthread_cancel.c (pthread_cancel): Likewise. -+ * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise. -+ * sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue): -+ Likewise. -+ * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise. -+ * sysdeps/unix/sysv/linux/raise.c (raise): Remove old behaviour -+ comment. -+ * sysdeps/unix/sysv/linux/getpid.c: Remove file. -+ * nptl/descr.h (struct pthread): Change comment about pid value. -+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Remove thread -+ pid assert. -+ * sysdeps/unix/sysv/linux/pthread-pids.h (__pthread_initialize_pids): -+ Do not set pid value. -+ * nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove thread -+ pid cache check. -+ * nptl_db/td_thr_validate.c (td_thr_validate): Likewise. -+ * sysdeps/aarch64/nptl/tcb-offsets.sym: Remove pid offset. -+ * sysdeps/alpha/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/arm/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/hppa/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/i386/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/ia64/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/m68k/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/microblaze/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/mips/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/nios2/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/s390/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/sh/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/sparc/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/tile/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/unix/sysv/linux/aarch64/clone.S: Remove pid and tid caching. -+ * sysdeps/unix/sysv/linux/alpha/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/arm/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/hppa/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/i386/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise. -+ * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/nios2/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sh/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/tile/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/aarch64/vfork.S: Remove pid set and reset. -+ * sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/arm/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/i386/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/m68k/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/m68k/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/mips/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/nios2/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sh/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/tile/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/hppa/pt-vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/tst-clone2.c (f): Remove direct pthread -+ struct access. -+ (clone_test): Remove function. -+ (do_test): Rewrite to take in consideration pid is not cached anymore. -+ -+2016-09-26 Adhemerval Zanella -+ -+ * sysdeps/unix/sysdep.h (__INTERNAL_SYSCALL0): New macro. -+ (__INTERNAL_SYSCALL1): Likewise. -+ (__INTERNAL_SYSCALL2): Likewise. -+ (__INTERNAL_SYSCALL3): Likewise. -+ (__INTERNAL_SYSCALL4): Likewise. -+ (__INTERNAL_SYSCALL5): Likewise. -+ (__INTERNAL_SYSCALL6): Likewise. -+ (__INTERNAL_SYSCALL7): Likewise. -+ (__INTERNAL_SYSCALL_NARGS_X): Likewise. -+ (__INTERNAL_SYSCALL_NARGS): Likewise. -+ (__INTERNAL_SYSCALL_DISP): Likewise. -+ (INTERNAL_SYSCALL_CALL): Likewise. -+ (__SYSCALL0): Rename to __INLINE_SYSCALL0. -+ (__SYSCALL1): Rename to __INLINE_SYSCALL1. -+ (__SYSCALL2): Rename to __INLINE_SYSCALL2. -+ (__SYSCALL3): Rename to __INLINE_SYSCALL3. -+ (__SYSCALL4): Rename to __INLINE_SYSCALL4. -+ (__SYSCALL5): Rename to __INLINE_SYSCALL5. -+ (__SYSCALL6): Rename to __INLINE_SYSCALL6. -+ (__SYSCALL7): Rename to __INLINE_SYSCALL7. -+ (__SYSCALL_NARGS_X): Rename to __INLINE_SYSCALL_NARGS_X. -+ (__SYSCALL_NARGS): Rename to __INLINE_SYSCALL_NARGS. -+ (__SYSCALL_DISP): Rename to __INLINE_SYSCALL_DISP. -+ (__SYSCALL_CALL): Rename to INLINE_SYSCALL_CALL. -+ (SYSCALL_CANCEL): Replace __SYSCALL_CALL with INLINE_SYSCALL_CALL. -+ -+2017-04-28 H.J. Lu -+ -+ [BZ #21396] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ Prefer_No_AVX512 if AVX512ER isn't available. -+ * sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New. -+ (index_arch_Prefer_No_AVX512): Likewise. -+ * sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use -+ AVX512 version if Prefer_No_AVX512 is set. -+ * sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise. -+ * sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise. -+ * sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/memset.S (memset): Likewise. -+ * sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk): -+ Likewise. -+ -+2017-04-28 H.J. Lu -+ -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ Prefer_No_VZEROUPPER if AVX512ER is available. -+ * sysdeps/x86/cpu-features.h -+ (bit_cpu_AVX512PF): New. -+ (bit_cpu_AVX512ER): Likewise. -+ (bit_cpu_AVX512CD): Likewise. -+ (bit_cpu_AVX512BW): Likewise. -+ (bit_cpu_AVX512VL): Likewise. -+ (index_cpu_AVX512PF): Likewise. -+ (index_cpu_AVX512ER): Likewise. -+ (index_cpu_AVX512CD): Likewise. -+ (index_cpu_AVX512BW): Likewise. -+ (index_cpu_AVX512VL): Likewise. -+ (reg_AVX512PF): Likewise. -+ (reg_AVX512ER): Likewise. -+ (reg_AVX512CD): Likewise. -+ (reg_AVX512BW): Likewise. -+ (reg_AVX512VL): Likewise. -+ -+2017-01-05 Joseph Myers -+ -+ [BZ #21026] -+ * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -+ (readahead): New syscall entry. -+ -+2017-04-07 H.J. Lu -+ -+ [BZ #21258] -+ * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt): -+ Define only if _dl_runtime_resolve is defined to -+ _dl_runtime_resolve_sse_vex. -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt): -+ Fallthrough to _dl_runtime_resolve_sse_vex. -+ -+2017-04-03 Mike Frysinger -+ -+ [BZ #21253] -+ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Increase argv_size -+ slack space by 32KiB. -+ -+2017-03-31 Slava Barinov -+ -+ [BZ #21289] -+ * io/fts.h (fts_set): Replace __REDIRECT with __REDIRECT_NTH. -+ -+2017-03-20 Mike Frysinger -+ -+ [BZ #21275] -+ * sysdeps/unix/sysv/linux/spawni.c [__ia64__] (CLONE): Rename -+ __stack to __stackbase. -+ (STACK): Invert _STACK_GROWS_DOWN and _STACK_GROWS_UP order of -+ checks so we can include defined(__ia64__) first. -+ -+2017-03-15 John David Anglin -+ -+ * sysdeps/hppa/dl-machine.h (DL_STACK_END): Define. -+ (RTLD_START): Don't record stack end address in _dl_start_user. -+ -+2017-01-30 H.J. Lu -+ -+ [BZ #21081] -+ * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -+ (L(stosb)): Add VZEROUPPER before ret. -+ -+2016-11-28 H.J. Lu -+ -+ [BZ #20750] -+ * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead -+ of PIC. -+ -+2016-12-31 Florian Weimer -+ -+ [BZ #18784] -+ CVE-2015-5180 -+ * include/arpa/nameser_compat.h (T_QUERY_A_AND_AAAA): Rename from -+ T_UNSPEC. Adjust value. -+ * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname4_r): Use it. -+ * resolv/res_query.c (__libc_res_nquery): Likewise. -+ * resolv/res_mkquery.c (res_nmkquery): Check for out-of-range -+ QTYPEs. -+ * resolv/tst-resolv-qtypes.c: New file. -+ * resolv/Makefile (xtests): Add tst-resolv-qtypes. -+ (tst-resolv-qtypes): Link against libresolv and libpthread. -+ -+2017-02-02 Siddhesh Poyarekar -+ -+ * sysdeps/generic/unsecvars.h: Add GLIBC_TUNABLES. -+ -+2017-01-23 Rajalakshmi Srinivasaraghavan -+ Steven Munroe -+ Tulio Magno Quites Machado Filho -+ -+ [BZ #20822] -+ * sysdeps/unix/sysv/linux/powerpc/elision-lock.c -+ (__lll_lock_elision): Access adapt_count via C11 atomics. -+ * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -+ (__lll_trylock_elision): Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -+ (__lll_unlock_elision): Update adapt_count variable inside the -+ critical section using C11 atomics. -+ -+2016-12-24 Carlos O'Donell -+ -+ [BZ #11941] -+ * elf/dl-close.c (_dl_close): Take dl_load_lock to examine map. -+ Remove assert (map->l_init_called); if DF_1_NODELETE is set. -+ * elf/Makefile [ifeq (yes,$(build-shared))] (tests): Add -+ tst-nodelete-dlclose. -+ (modules-names): Add tst-nodelete-dlclose-dso and -+ tst-nodelete-dlclose-plugin. -+ ($(objpfx)tst-nodelete-dlclose-dso.so): Define. -+ ($(objpfx)tst-nodelete-dlclose-plugin.so): Define. -+ ($(objpfx)tst-nodelete-dlclose): Define. -+ ($(objpfx)tst-nodelete-dlclose.out): Define. -+ -+2016-08-02 Aurelien Jarno -+ -+2016-08-02 Aurelien Jarno -+ -+ * sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself -+ when it is a NaN. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise. -+ * sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself -+ when it is a NaN. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise. -+ * sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself -+ when it is a NaN. -+ * sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise. -+ * sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value -+ when its absolute value is greater than 0x1.0p52. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value -+ when its absolute value is greater than 0x1.0p23. -+ [_IEEE_FP_INEXACT] Remove. -+ -+2016-11-30 H.J. Lu -+ -+ [BZ #20495] -+ [BZ #20508] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): For Intel -+ processors, set Use_dl_runtime_resolve_slow and set -+ Use_dl_runtime_resolve_opt if XGETBV suports ECX == 1. -+ * sysdeps/x86/cpu-features.h (bit_arch_Use_dl_runtime_resolve_opt): -+ New. -+ (bit_arch_Use_dl_runtime_resolve_slow): Likewise. -+ (index_arch_Use_dl_runtime_resolve_opt): Likewise. -+ (index_arch_Use_dl_runtime_resolve_slow): Likewise. -+ * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup): Use -+ _dl_runtime_resolve_avx512_opt and _dl_runtime_resolve_avx_opt -+ if Use_dl_runtime_resolve_opt is set. Use -+ _dl_runtime_resolve_slow if Use_dl_runtime_resolve_slow is set. -+ * sysdeps/x86_64/dl-trampoline.S: Include . -+ (_dl_runtime_resolve_opt): New. Defined for AVX and AVX512. -+ (_dl_runtime_resolve): Add one for _dl_runtime_resolve_sse_vex. -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_avx_slow): -+ New. -+ (_dl_runtime_resolve_opt): Likewise. -+ (_dl_runtime_profile): Define only if _dl_runtime_profile is -+ defined. -+ -+2016-11-24 Aurelien Jarno -+ -+ * sysdeps/x86_64/memcpy_chk.S (__memcpy_chk): Check for SHARED -+ instead of PIC. -+ -+2016-11-23 Matthew Fortune -+ Maciej W. Rozycki -+ -+ * sysdeps/mips/mips32/crti.S (_init): Add `.insn' pseudo-op at -+ `.Lno_weak_fn' label. -+ * sysdeps/mips/mips64/n32/crti.S (_init): Likewise. -+ * sysdeps/mips/mips64/n64/crti.S (_init): Likewise. -+ -+2016-11-22 Adhemerval Zanella -+ -+ [BZ #20847] -+ * posix/execvpe.c (maybe_script_execute): Remove write past allocated -+ array bounds. -+ (__execvpe): Likewise. -+ -+2016-11-15 Denis Kaganovich -+ Magnus Granberg -+ Mike Frysinger -+ -+ [BZ #20662] -+ * configure.ac (libc_cv_predef_stack_protector): Also check for -+ __stack_chk_fail_local symbols. -+ * configure: Regenerated. -+ -+2016-11-03 Joseph Myers -+ -+ * conform/Makefile ($(linknamespace-header-tests)): Also depend on -+ $(linknamespace-symlists-tests). -+ -+2016-11-06 Aurelien Jarno -+ -+ * iconv/gconv.h (__gconv_info): Define __data element using a -+ zero-length array. -+ -+2016-10-25 Joseph Myers -+ -+ * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi -+ instead of cmpli. -+ * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi -+ instead of cmpli. -+ -+2016-10-24 Adhemerval Zanella -+ -+ * sysdeps/unix/sysv/linux/pread.c (__libc_pread): Use SYSCALL_LL_PRW. -+ * sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise. -+ * sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Use -+ SYSCALL_LL64_PRW. -+ * sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise. -+ * sysdeps/unix/sysv/linux/sh/kernel-features.h: Define -+ __ASSUME_PRW_DUMMY_ARG. -+ * sysdeps/unix/sysv/linux/sh/pread.c: Remove file. -+ * sysdeps/unix/sysv/linux/sh/pread64.c: Likewise. -+ * sysdeps/unix/sysv/linux/sh/pwrite.c: Likewise. -+ * sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise. -+ * sysdeps/unix/sysv/linux/sysdep.h: Define SYSCALL_LL_PRW and -+ SYSCALL_LL_PRW64 based on __ASSUME_PRW_DUMMY_ARG. -+ -+2016-10-05 Tulio Magno Quites Machado Filho -+ -+ * sysdeps/powerpc/fpu/libm-test-ulps: Regenerated. -+ -+2016-09-20 Adhemerval Zanella -+ -+ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock -+ all signals when executing the clone vfork child. -+ (SIGALL_SET): Remove macro. -+ -+ * nptl/Makefile (tests): Add tst-exec5. -+ * nptl/tst-exec5.c: New file. -+ * sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable -+ asynchronous cancellation. -+ -+2016-09-19 Tulio Magno Quites Machado Filho -+ -+ [BZ #20615] -+ * sysdeps/powerpc/powerpc32/power9/multiarch/Implies: Replace -+ fpu directory by non-fpu. -+ * sysdeps/powerpc/powerpc64/power9/fpu/Implies: Remove dependency -+ on non-fpu directory from a fpu directory. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.24 A. -+ -+ * sysdeps/nacl/dup.c: Add libc_hidden_def. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/posix/wait3.c: Don't treat STAT_LOC as a union, since it's -+ not any more. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/nacl/clock.c (clock): nacl_abi_clock_t -> nacl_irt_clock_t -+ -+2016-08-17 Florian Weimer -+ -+ Reduce time to expected nptl/tst-once5 failure. -+ * nptl/tst-once5.cc (TIMEOUT): Define. -+ -+2016-08-18 Florian Weimer -+ -+ [BZ #16907] -+ * argp/argp.h: Switch to __BEGIN_DECLS and __END_DECLS. -+ (__THROW, __NTH, __attribute__, __restrict): Remove definitions. -+ * argp/argp-fmtstream.h: Add __BEGIN_DECLS and __END_DECLS. -+ (__attribute__): Remove definition. -+ -+2016-08-15 Andreas Schwab -+ -+ [BZ #20435] -+ * sysdeps/unix/sysv/linux/arm/setcontext.S (__startcontext): Mark -+ as .cantunwind. -+ -+2016-08-17 Florian Weimer -+ -+ [BZ #20452] -+ Avoid additional copies of objects in libc.a in static libraries. -+ * sysdeps/ia64/nptl/Makefile (libpthread-shared-only-routines): -+ Add ptw-sysdep, ptw-sigblock, ptw-sigprocmask. -+ * sysdeps/mips/Makefile (librt-shared-only-routines): Add -+ rt-sysdep. -+ * sysdeps/mips/nptl/Makefile (libpthread-shared-only-routines): -+ Add nptl-sysdep. -+ * sysdeps/s390/nptl/Makefile (libpthread-shared-only-routines): -+ Add ptw-sysdep. -+ * sysdeps/unix/alpha/Makefile (librt-shared-only-routines): Add -+ rt-sysdep. -+ * sysdeps/unix/sysv/linux/alpha/Makefile -+ (libpthread-shared-only-routines): Add ptw-sysdep, -+ ptw-sigprocmask, ptw-rt_sigaction. -+ * sysdeps/unix/sysv/linux/ia64/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ * sysdeps/unix/sysv/linux/i386/Makefile -+ (libpthread-shared-only-routines): Add libc-do-syscall. -+ * sysdeps/unix/sysv/linux/microblaze/Makefile -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/powerpc/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/s390/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ * sysdeps/unix/sysv/linux/sparc/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/tile/Makefile -+ (libpthread-shared-only-routines): Likewise. -+ -+2016-08-05 Aurelien Jarno -+ -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -+ [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): -+ Remove s_fdimf-vis3, s_fdim-vis3. -+ * sysdeps/sparc/sparc32/fpu/s_fdim.S: Delete file. -+ * sysdeps/sparc/sparc32/fpu/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc64/fpu/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc64/fpu/s_fdimf.S: Likewise. -+ -+2016-08-02 David S. Miller -+ -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -+ (__nearbyint_vis3): Don't check for sNaN before float register is -+ loaded with the incoming argument. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -+ (__nearbyintf_vis3): Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint): -+ Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf): -+ Likewise. -+ -+2016-08-03 Aurelien Jarno -+ -+ * sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Replace beqlr instructions -+ by beq instructions jumping to the end of the function. -+ * sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the -+ clobber list. Use "i" constraint instead of "X". -+ (ifunc_one): Add "12" to the clobber list. Use "i" constraint instead -+ of "X". -+ -+2016-08-04 Carlos O'Donell -+ -+ * po/de.po: Update from Translation Project. -+ * po/fi.po: Likewise. -+ * po/sv.po: Likewise. -+ -+2016-08-02 Florian Weimer -+ -+ [BZ #20370] -+ * malloc/arena.c (get_free_list): Update comment. Assert that -+ arenas on the free list have no attached threads. -+ (remove_from_free_list): New function. -+ (reused_arena): Call it. -+ -+2016-08-04 Florian Weimer -+ -+ Use sysdep.o from libc.a in static libraries. -+ * sysdeps/unix/sysv/linux/i386/Makefile -+ (libpthread-shared-only-routines): Add sysdep. -+ (librt-shared-only-routines): Likewise. -+ - 2016-08-01 Carlos O'Donell - - * version.h (RELEASE): Set to "stable" -diff --git a/Makeconfig b/Makeconfig -index 03fd89c13e..ee379f5852 100644 ---- a/Makeconfig -+++ b/Makeconfig -@@ -394,6 +394,9 @@ ifndef after-link - after-link = - endif - -+# Additional libraries to link into every test. -+link-extra-libs-tests = $(libsupport) -+ - # Command for linking PIE programs with the C library. - ifndef +link-pie - +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ -@@ -503,7 +506,7 @@ link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib) - link-libc-tests = $(link-libc-tests-rpath-link) \ - $(link-libc-before-gnulib) $(gnulib-tests) - # This is how to find at build-time things that will be installed there. --rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec -+rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support - rpath-link = \ - $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) - else -@@ -850,7 +853,7 @@ libio-include = -I$(..)libio - # List of non-library modules that we build. - built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ - libSegFault libpcprofile librpcsvc locale-programs \ -- memusagestat nonlib nscd extramodules libnldbl -+ memusagestat nonlib nscd extramodules libnldbl libsupport - - in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ - $(libof-$( - using `glibc' in the "product" field. - -+Version 2.24.1 -+ -+Security related changes: -+ -+* On ARM EABI (32-bit), generating a backtrace for execution contexts which -+ have been created with makecontext could fail to terminate due to a -+ missing .cantunwind annotation. This has been observed to lead to a hang -+ (denial of service) in some Go applications compiled with gccgo. Reported -+ by Andreas Schwab. (CVE-2016-6323) -+ -+* The DNS stub resolver functions would crash due to a NULL pointer -+ dereference when processing a query with a valid DNS question type which -+ was used internally in the implementation. The stub resolver now uses a -+ question type which is outside the range of valid question type values. -+ (CVE-2015-5180) -+ -+The following bugs are resolved with this release: -+ -+ [20790] Fix rpcgen buffer overrun -+ [20978] Fix strlen on null pointer in nss_nisplus -+ [21209] Ignore and remove LD_HWCAP_MASK for AT_SECURE programs -+ [21289] Fix symbol redirect for fts_set -+ [21386] Assertion in fork for distinct parent PID is incorrect -+ [21609] x86-64: Align the stack in __tls_get_addr -+ [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366) -+ [21654] nss: Fix invalid cast in group merging -+ - Version 2.24 - - * The minimum Linux kernel version that this version of the GNU C Library -diff --git a/Rules b/Rules -index 8306d36a07..a981965d2b 100644 ---- a/Rules -+++ b/Rules -@@ -149,6 +149,7 @@ endif - - ifneq "$(strip $(binaries-shared-tests))" "" - $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-tests) -@@ -156,6 +157,7 @@ endif - - ifneq "$(strip $(binaries-pie-tests))" "" - $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-pie-tests) -@@ -177,6 +179,7 @@ endif - - ifneq "$(strip $(binaries-static-tests))" "" - $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-static-tests) -diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h -index bdeaa54dc2..e8c5797f38 100644 ---- a/argp/argp-fmtstream.h -+++ b/argp/argp-fmtstream.h -@@ -29,21 +29,6 @@ - #include - #include - --#ifndef __attribute__ --/* This feature is available in gcc versions 2.5 and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \ -- defined __STRICT_ANSI__ --# define __attribute__(Spec) /* empty */ --# endif --/* The __-protected variants of `format' and `printf' attributes -- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \ -- defined __STRICT_ANSI__ --# define __format__ format --# define __printf__ printf --# endif --#endif -- - #if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H) - /* line_wrap_stream is available, so use that. */ - #define ARGP_FMTSTREAM_USE_LINEWRAP -@@ -111,6 +96,8 @@ struct argp_fmtstream - - typedef struct argp_fmtstream *argp_fmtstream_t; - -+__BEGIN_DECLS -+ - /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines - written on it with LMARGIN spaces and limits them to RMARGIN columns - total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by -@@ -297,6 +284,8 @@ __argp_fmtstream_point (argp_fmtstream_t __fs) - - #endif /* __OPTIMIZE__ */ - -+__END_DECLS -+ - #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ - - #endif /* argp-fmtstream.h */ -diff --git a/argp/argp.h b/argp/argp.h -index e67bbef739..7cb5a69f08 100644 ---- a/argp/argp.h -+++ b/argp/argp.h -@@ -28,48 +28,12 @@ - #define __need_error_t - #include - --#ifndef __THROW --# define __THROW --#endif --#ifndef __NTH --# define __NTH(fct) fct __THROW --#endif -- --#ifndef __attribute__ --/* This feature is available in gcc versions 2.5 and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \ -- defined __STRICT_ANSI__ --# define __attribute__(Spec) /* empty */ --# endif --/* The __-protected variants of `format' and `printf' attributes -- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \ -- defined __STRICT_ANSI__ --# define __format__ format --# define __printf__ printf --# endif --#endif -- --/* GCC 2.95 and later have "__restrict"; C99 compilers have -- "restrict", and "configure" may have defined "restrict". */ --#ifndef __restrict --# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) --# if defined restrict || 199901L <= __STDC_VERSION__ --# define __restrict restrict --# else --# define __restrict --# endif --# endif --#endif -- - #ifndef __error_t_defined - typedef int error_t; - # define __error_t_defined - #endif - --#ifdef __cplusplus --extern "C" { --#endif -+__BEGIN_DECLS - - /* A description of a particular option. A pointer to an array of - these is passed in the OPTIONS field of an argp structure. Each option -@@ -590,8 +554,6 @@ __NTH (__option_is_end (const struct argp_option *__opt)) - # endif - #endif /* Use extern inlines. */ - --#ifdef __cplusplus --} --#endif -+__END_DECLS - - #endif /* argp.h */ -diff --git a/configure b/configure -index 17625e1041..9b5a486048 100755 ---- a/configure -+++ b/configure -@@ -6289,12 +6289,14 @@ echo >&5 "libc_undefs='$libc_undefs'" - # symbols (resolved by the linker), so filter out unknown symbols. - # This will fail to produce the correct result if the compiler - # defaults to -fstack-protector but this produces an undefined symbol --# other than __stack_chk_fail. However, compilers like that have not --# been encountered in practice. --libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'` -+# other than __stack_chk_fail or __stack_chk_fail_local. However, -+# compilers like that have not been encountered in practice. -+libc_undefs=`echo "$libc_undefs" | \ -+ egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'` - case "$libc_undefs" in - foobar) libc_cv_predef_stack_protector=no ;; - '__stack_chk_fail -+foobar'|'__stack_chk_fail_local - foobar') libc_cv_predef_stack_protector=yes ;; - *) as_fn_error $? "unexpected symbols in test: $libc_undefs" "$LINENO" 5 ;; - esac -diff --git a/configure.ac b/configure.ac -index 33bcd62180..8277d9f727 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1626,12 +1626,14 @@ echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'" - # symbols (resolved by the linker), so filter out unknown symbols. - # This will fail to produce the correct result if the compiler - # defaults to -fstack-protector but this produces an undefined symbol --# other than __stack_chk_fail. However, compilers like that have not --# been encountered in practice. --libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'` -+# other than __stack_chk_fail or __stack_chk_fail_local. However, -+# compilers like that have not been encountered in practice. -+libc_undefs=`echo "$libc_undefs" | \ -+ egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'` - case "$libc_undefs" in - foobar) libc_cv_predef_stack_protector=no ;; - '__stack_chk_fail -+foobar'|'__stack_chk_fail_local - foobar') libc_cv_predef_stack_protector=yes ;; - *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;; - esac], -diff --git a/conform/Makefile b/conform/Makefile -index 32a0937b06..7883624c81 100644 ---- a/conform/Makefile -+++ b/conform/Makefile -@@ -196,13 +196,13 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \ - conformtest.pl $(conformtest-headers-data) - (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ - mkdir -p $(@D)/scratch; \ -- $(PERL) conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ -+ $(PERL) -I. conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --headers=$$hdr > $@); \ - $(evaluate-test) - - $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl -- $(PERL) -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ -+ $(PERL) -I. -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$* \ - --headers="$(strip $(conformtest-headers-$*))" \ - > $@ 2> $@.err; \ -@@ -229,10 +229,11 @@ $(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ - - $(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \ - linknamespace.pl \ -+ $(linknamespace-symlists-tests) \ - $(linknamespace-symlist-stdlibs-tests) - (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ - mkdir -p $(@D)/scratch; \ -- $(PERL) -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ -+ $(PERL) -I. -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \ - --libsyms=$(objpfx)symlist-stdlibs-$$std \ -diff --git a/elf/Makefile b/elf/Makefile -index 593403c640..847a012f84 100644 ---- a/elf/Makefile -+++ b/elf/Makefile -@@ -149,7 +149,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ - tst-nodelete) \ - tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ -- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error -+ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error \ -+ tst-nodelete-dlclose - # reldep9 - ifeq ($(build-hardcoded-path-in-tests),yes) - tests += tst-dlopen-aout -@@ -223,7 +224,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ - tst-array5dep tst-null-argv-lib \ - tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \ - tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \ -- tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 -+ tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \ -+ tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin - ifeq (yes,$(have-mtls-dialect-gnu2)) - tests += tst-gnu2-tls1 - modules-names += tst-gnu2-tls1mod -@@ -1267,3 +1269,12 @@ $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig - $(evaluate-test) - - $(objpfx)tst-dlsym-error: $(libdl) -+ -+# The application depends on the DSO, and the DSO loads the plugin. -+# The plugin also depends on the DSO. This creates the circular -+# dependency via dlopen that we're testing to make sure works. -+$(objpfx)tst-nodelete-dlclose-dso.so: $(libdl) -+$(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so -+$(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so -+$(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \ -+ $(objpfx)tst-nodelete-dlclose-plugin.so -diff --git a/elf/dl-close.c b/elf/dl-close.c -index 687d7de874..9f93ab7628 100644 ---- a/elf/dl-close.c -+++ b/elf/dl-close.c -@@ -805,19 +805,37 @@ _dl_close (void *_map) - { - struct link_map *map = _map; - -- /* First see whether we can remove the object at all. */ -+ /* We must take the lock to examine the contents of map and avoid -+ concurrent dlopens. */ -+ __rtld_lock_lock_recursive (GL(dl_load_lock)); -+ -+ /* At this point we are guaranteed nobody else is touching the list of -+ loaded maps, but a concurrent dlclose might have freed our map -+ before we took the lock. There is no way to detect this (see below) -+ so we proceed assuming this isn't the case. First see whether we -+ can remove the object at all. */ - if (__glibc_unlikely (map->l_flags_1 & DF_1_NODELETE)) - { -- assert (map->l_init_called); - /* Nope. Do nothing. */ -+ __rtld_lock_unlock_recursive (GL(dl_load_lock)); - return; - } - -+ /* At present this is an unreliable check except in the case where the -+ caller has recursively called dlclose and we are sure the link map -+ has not been freed. In a non-recursive dlclose the map itself -+ might have been freed and this access is potentially a data race -+ with whatever other use this memory might have now, or worse we -+ might silently corrupt memory if it looks enough like a link map. -+ POSIX has language in dlclose that appears to guarantee that this -+ should be a detectable case and given that dlclose should be threadsafe -+ we need this to be a reliable detection. -+ This is bug 20990. */ - if (__builtin_expect (map->l_direct_opencount, 1) == 0) -- GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open")); -- -- /* Acquire the lock. */ -- __rtld_lock_lock_recursive (GL(dl_load_lock)); -+ { -+ __rtld_lock_unlock_recursive (GL(dl_load_lock)); -+ _dl_signal_error (0, map->l_name, NULL, N_("shared object not open")); -+ } - - _dl_close_worker (map, false); - -diff --git a/elf/rtld.c b/elf/rtld.c -index 647661ca45..8f56d6edd3 100644 ---- a/elf/rtld.c -+++ b/elf/rtld.c -@@ -99,14 +99,121 @@ uintptr_t __pointer_chk_guard_local - strong_alias (__pointer_chk_guard_local, __pointer_chk_guard) - #endif - -+/* Length limits for names and paths, to protect the dynamic linker, -+ particularly when __libc_enable_secure is active. */ -+#ifdef NAME_MAX -+# define SECURE_NAME_LIMIT NAME_MAX -+#else -+# define SECURE_NAME_LIMIT 255 -+#endif -+#ifdef PATH_MAX -+# define SECURE_PATH_LIMIT PATH_MAX -+#else -+# define SECURE_PATH_LIMIT 1024 -+#endif -+ -+/* Check that AT_SECURE=0, or that the passed name does not contain -+ directories and is not overly long. Reject empty names -+ unconditionally. */ -+static bool -+dso_name_valid_for_suid (const char *p) -+{ -+ if (__glibc_unlikely (__libc_enable_secure)) -+ { -+ /* Ignore pathnames with directories for AT_SECURE=1 -+ programs, and also skip overlong names. */ -+ size_t len = strlen (p); -+ if (len >= SECURE_NAME_LIMIT || memchr (p, '/', len) != NULL) -+ return false; -+ } -+ return *p != '\0'; -+} - --/* List of auditing DSOs. */ -+/* LD_AUDIT variable contents. Must be processed before the -+ audit_list below. */ -+const char *audit_list_string; -+ -+/* Cyclic list of auditing DSOs. audit_list->next is the first -+ element. */ - static struct audit_list - { - const char *name; - struct audit_list *next; - } *audit_list; - -+/* Iterator for audit_list_string followed by audit_list. */ -+struct audit_list_iter -+{ -+ /* Tail of audit_list_string still needing processing, or NULL. */ -+ const char *audit_list_tail; -+ -+ /* The list element returned in the previous iteration. NULL before -+ the first element. */ -+ struct audit_list *previous; -+ -+ /* Scratch buffer for returning a name which is part of -+ audit_list_string. */ -+ char fname[SECURE_NAME_LIMIT]; -+}; -+ -+/* Initialize an audit list iterator. */ -+static void -+audit_list_iter_init (struct audit_list_iter *iter) -+{ -+ iter->audit_list_tail = audit_list_string; -+ iter->previous = NULL; -+} -+ -+/* Iterate through both audit_list_string and audit_list. */ -+static const char * -+audit_list_iter_next (struct audit_list_iter *iter) -+{ -+ if (iter->audit_list_tail != NULL) -+ { -+ /* First iterate over audit_list_string. */ -+ while (*iter->audit_list_tail != '\0') -+ { -+ /* Split audit list at colon. */ -+ size_t len = strcspn (iter->audit_list_tail, ":"); -+ if (len > 0 && len < sizeof (iter->fname)) -+ { -+ memcpy (iter->fname, iter->audit_list_tail, len); -+ iter->fname[len] = '\0'; -+ } -+ else -+ /* Do not return this name to the caller. */ -+ iter->fname[0] = '\0'; -+ -+ /* Skip over the substring and the following delimiter. */ -+ iter->audit_list_tail += len; -+ if (*iter->audit_list_tail == ':') -+ ++iter->audit_list_tail; -+ -+ /* If the name is valid, return it. */ -+ if (dso_name_valid_for_suid (iter->fname)) -+ return iter->fname; -+ /* Otherwise, wrap around and try the next name. */ -+ } -+ /* Fall through to the procesing of audit_list. */ -+ } -+ -+ if (iter->previous == NULL) -+ { -+ if (audit_list == NULL) -+ /* No pre-parsed audit list. */ -+ return NULL; -+ /* Start of audit list. The first list element is at -+ audit_list->next (cyclic list). */ -+ iter->previous = audit_list->next; -+ return iter->previous->name; -+ } -+ if (iter->previous == audit_list) -+ /* Cyclic list wrap-around. */ -+ return NULL; -+ iter->previous = iter->previous->next; -+ return iter->previous->name; -+} -+ - #ifndef HAVE_INLINED_SYSCALLS - /* Set nonzero during loading and initialization of executable and - libraries, cleared before the executable's entry point runs. This -@@ -730,6 +837,42 @@ static const char *preloadlist attribute_relro; - /* Nonzero if information about versions has to be printed. */ - static int version_info attribute_relro; - -+/* The LD_PRELOAD environment variable gives list of libraries -+ separated by white space or colons that are loaded before the -+ executable's dependencies and prepended to the global scope list. -+ (If the binary is running setuid all elements containing a '/' are -+ ignored since it is insecure.) Return the number of preloads -+ performed. */ -+unsigned int -+handle_ld_preload (const char *preloadlist, struct link_map *main_map) -+{ -+ unsigned int npreloads = 0; -+ const char *p = preloadlist; -+ char fname[SECURE_PATH_LIMIT]; -+ -+ while (*p != '\0') -+ { -+ /* Split preload list at space/colon. */ -+ size_t len = strcspn (p, " :"); -+ if (len > 0 && len < sizeof (fname)) -+ { -+ memcpy (fname, p, len); -+ fname[len] = '\0'; -+ } -+ else -+ fname[0] = '\0'; -+ -+ /* Skip over the substring and the following delimiter. */ -+ p += len; -+ if (*p != '\0') -+ ++p; -+ -+ if (dso_name_valid_for_suid (fname)) -+ npreloads += do_preload (fname, main_map, "LD_PRELOAD"); -+ } -+ return npreloads; -+} -+ - static void - dl_main (const ElfW(Phdr) *phdr, - ElfW(Word) phnum, -@@ -1257,11 +1400,13 @@ of this helper program; chances are you did not intend to run this program.\n\ - GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid (); - - /* If we have auditing DSOs to load, do it now. */ -- if (__glibc_unlikely (audit_list != NULL)) -+ bool need_security_init = true; -+ if (__glibc_unlikely (audit_list != NULL) -+ || __glibc_unlikely (audit_list_string != NULL)) - { -- /* Iterate over all entries in the list. The order is important. */ - struct audit_ifaces *last_audit = NULL; -- struct audit_list *al = audit_list->next; -+ struct audit_list_iter al_iter; -+ audit_list_iter_init (&al_iter); - - /* Since we start using the auditing DSOs right away we need to - initialize the data structures now. */ -@@ -1272,9 +1417,14 @@ of this helper program; chances are you did not intend to run this program.\n\ - use different values (especially the pointer guard) and will - fail later on. */ - security_init (); -+ need_security_init = false; - -- do -+ while (true) - { -+ const char *name = audit_list_iter_next (&al_iter); -+ if (name == NULL) -+ break; -+ - int tls_idx = GL(dl_tls_max_dtv_idx); - - /* Now it is time to determine the layout of the static TLS -@@ -1283,7 +1433,7 @@ of this helper program; chances are you did not intend to run this program.\n\ - no DF_STATIC_TLS bit is set. The reason is that we know - glibc will use the static model. */ - struct dlmopen_args dlmargs; -- dlmargs.fname = al->name; -+ dlmargs.fname = name; - dlmargs.map = NULL; - - const char *objname; -@@ -1296,7 +1446,7 @@ of this helper program; chances are you did not intend to run this program.\n\ - not_loaded: - _dl_error_printf ("\ - ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", -- al->name, err_str); -+ name, err_str); - if (malloced) - free ((char *) err_str); - } -@@ -1400,10 +1550,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - goto not_loaded; - } - } -- -- al = al->next; - } -- while (al != audit_list->next); - - /* If we have any auditing modules, announce that we already - have two objects loaded. */ -@@ -1481,23 +1628,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - - if (__glibc_unlikely (preloadlist != NULL)) - { -- /* The LD_PRELOAD environment variable gives list of libraries -- separated by white space or colons that are loaded before the -- executable's dependencies and prepended to the global scope -- list. If the binary is running setuid all elements -- containing a '/' are ignored since it is insecure. */ -- char *list = strdupa (preloadlist); -- char *p; -- - HP_TIMING_NOW (start); -- -- /* Prevent optimizing strsep. Speed is not important here. */ -- while ((p = (strsep) (&list, " :")) != NULL) -- if (p[0] != '\0' -- && (__builtin_expect (! __libc_enable_secure, 1) -- || strchr (p, '/') == NULL)) -- npreloads += do_preload (p, main_map, "LD_PRELOAD"); -- -+ npreloads += handle_ld_preload (preloadlist, main_map); - HP_TIMING_NOW (stop); - HP_TIMING_DIFF (diff, start, stop); - HP_TIMING_ACCUM_NT (load_time, diff); -@@ -1682,7 +1814,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - if (tcbp == NULL) - tcbp = init_tls (); - -- if (__glibc_likely (audit_list == NULL)) -+ if (__glibc_likely (need_security_init)) - /* Initialize security features. But only if we have not done it - earlier. */ - security_init (); -@@ -2313,9 +2445,7 @@ process_dl_audit (char *str) - char *p; - - while ((p = (strsep) (&str, ":")) != NULL) -- if (p[0] != '\0' -- && (__builtin_expect (! __libc_enable_secure, 1) -- || strchr (p, '/') == NULL)) -+ if (dso_name_valid_for_suid (p)) - { - /* This is using the local malloc, not the system malloc. The - memory can never be freed. */ -@@ -2379,7 +2509,7 @@ process_envvars (enum mode *modep) - break; - } - if (memcmp (envline, "AUDIT", 5) == 0) -- process_dl_audit (&envline[6]); -+ audit_list_string = &envline[6]; - break; - - case 7: -@@ -2423,7 +2553,8 @@ process_envvars (enum mode *modep) - - case 10: - /* Mask for the important hardware capabilities. */ -- if (memcmp (envline, "HWCAP_MASK", 10) == 0) -+ if (!__libc_enable_secure -+ && memcmp (envline, "HWCAP_MASK", 10) == 0) - GLRO(dl_hwcap_mask) = __strtoul_internal (&envline[11], NULL, - 0, 0); - break; -@@ -2437,7 +2568,8 @@ process_envvars (enum mode *modep) - - case 12: - /* The library search path. */ -- if (memcmp (envline, "LIBRARY_PATH", 12) == 0) -+ if (!__libc_enable_secure -+ && memcmp (envline, "LIBRARY_PATH", 12) == 0) - { - library_path = &envline[13]; - break; -diff --git a/elf/tst-nodelete-dlclose-dso.c b/elf/tst-nodelete-dlclose-dso.c -new file mode 100644 -index 0000000000..dd930f99cc ---- /dev/null -+++ b/elf/tst-nodelete-dlclose-dso.c -@@ -0,0 +1,90 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This is the primary DSO that is loaded by the appliation. This DSO -+ then loads a plugin with RTLD_NODELETE. This plugin depends on this -+ DSO. This dependency chain means that at application shutdown the -+ plugin will be destructed first. Thus by the time this DSO is -+ destructed we will be calling dlclose on an object that has already -+ been destructed. It is allowed to call dlclose in this way and -+ should not assert. */ -+#include -+#include -+#include -+ -+/* Plugin to load. */ -+static void *plugin_lib = NULL; -+/* Plugin function. */ -+static void (*plugin_func) (void); -+#define LIB_PLUGIN "tst-nodelete-dlclose-plugin.so" -+ -+/* This function is never called but the plugin references it. -+ We do this to avoid any future --as-needed from removing the -+ plugin's DT_NEEDED on this DSO (required for the test). */ -+void -+primary_reference (void) -+{ -+ printf ("INFO: Called primary_reference function.\n"); -+} -+ -+void -+primary (void) -+{ -+ char *error; -+ -+ plugin_lib = dlopen (LIB_PLUGIN, RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE); -+ if (plugin_lib == NULL) -+ { -+ printf ("ERROR: Unable to load plugin library.\n"); -+ exit (EXIT_FAILURE); -+ } -+ dlerror (); -+ -+ plugin_func = (void (*) (void)) dlsym (plugin_lib, "plugin_func"); -+ error = dlerror (); -+ if (error != NULL) -+ { -+ printf ("ERROR: Unable to find symbol with error \"%s\".", -+ error); -+ exit (EXIT_FAILURE); -+ } -+ -+ return; -+} -+ -+__attribute__ ((destructor)) -+static void -+primary_dtor (void) -+{ -+ int ret; -+ -+ printf ("INFO: Calling primary destructor.\n"); -+ -+ /* The destructor runs in the test driver also, which -+ hasn't called primary, in that case do nothing. */ -+ if (plugin_lib == NULL) -+ return; -+ -+ ret = dlclose (plugin_lib); -+ if (ret != 0) -+ { -+ printf ("ERROR: Calling dlclose failed with \"%s\"\n", -+ dlerror ()); -+ exit (EXIT_FAILURE); -+ } -+} -diff --git a/elf/tst-nodelete-dlclose-plugin.c b/elf/tst-nodelete-dlclose-plugin.c -new file mode 100644 -index 0000000000..8b295c1718 ---- /dev/null -+++ b/elf/tst-nodelete-dlclose-plugin.c -@@ -0,0 +1,40 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This DSO simulates a plugin with a dependency on the -+ primary DSO loaded by the appliation. */ -+#include -+ -+extern void primary_reference (void); -+ -+void -+plugin_func (void) -+{ -+ printf ("INFO: Calling plugin function.\n"); -+ /* Need a reference to the DSO to ensure that a potential --as-needed -+ doesn't remove the DT_NEEDED entry which we rely upon to ensure -+ destruction ordering. */ -+ primary_reference (); -+} -+ -+__attribute__ ((destructor)) -+static void -+plugin_dtor (void) -+{ -+ printf ("INFO: Calling plugin destructor.\n"); -+} -diff --git a/elf/tst-nodelete-dlclose.c b/elf/tst-nodelete-dlclose.c -new file mode 100644 -index 0000000000..b3d07e1849 ---- /dev/null -+++ b/elf/tst-nodelete-dlclose.c -@@ -0,0 +1,36 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This simulates an application using the primary DSO which loads the -+ plugin DSO. */ -+#include -+#include -+ -+extern void primary (void); -+ -+static int -+do_test (void) -+{ -+ printf ("INFO: Starting application.\n"); -+ primary (); -+ printf ("INFO: Exiting application.\n"); -+ return 0; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/extra-lib.mk b/extra-lib.mk -index b10748d185..2552049135 100644 ---- a/extra-lib.mk -+++ b/extra-lib.mk -@@ -5,6 +5,9 @@ - # The variable $($(lib)-routines) defines the list of modules - # to be included in that library. A sysdep Makefile can add to - # $(lib)-sysdep_routines to include additional modules. -+# -+# Libraries listed in $(extra-libs-noinstall) are built, but not -+# installed. - - lib := $(firstword $(extra-libs-left)) - extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) -@@ -28,7 +31,9 @@ extra-objs := $(extra-objs) - all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) - - # Add each flavor of library to the lists of things to build and install. -+ifeq (,$(filter $(lib), $(extra-libs-noinstall))) - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) -+endif - extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ -diff --git a/grp/grp-merge.c b/grp/grp-merge.c -index 0a1eb38d2c..5f79755798 100644 ---- a/grp/grp-merge.c -+++ b/grp/grp-merge.c -@@ -85,6 +85,14 @@ __copy_grp (const struct group srcgrp, const size_t buflen, - } - members[i] = NULL; - -+ /* Align for pointers. We can't simply align C because we need to -+ align destbuf[c]. */ -+ if ((((uintptr_t)destbuf + c) & (__alignof__(char **) - 1)) != 0) -+ { -+ uintptr_t mis_align = ((uintptr_t)destbuf + c) & (__alignof__(char **) - 1); -+ c += __alignof__(char **) - mis_align; -+ } -+ - /* Copy the pointers from the members array into the buffer and assign them - to the gr_mem member of destgrp. */ - destgrp->gr_mem = (char **) &destbuf[c]; -@@ -129,7 +137,7 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, - - /* Get the count of group members from the last sizeof (size_t) bytes in the - mergegrp buffer. */ -- savedmemcount = (size_t) *(savedend - sizeof (size_t)); -+ savedmemcount = *(size_t *) (savedend - sizeof (size_t)); - - /* Get the count of new members to add. */ - for (memcount = 0; mergegrp->gr_mem[memcount]; memcount++) -@@ -168,6 +176,14 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, - /* Add the NULL-terminator. */ - members[savedmemcount + memcount] = NULL; - -+ /* Align for pointers. We can't simply align C because we need to -+ align savedbuf[c]. */ -+ if ((((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1)) != 0) -+ { -+ uintptr_t mis_align = ((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1); -+ c += __alignof__(char **) - mis_align; -+ } -+ - /* Copy the member array back into the buffer after the member list and free - the member array. */ - savedgrp->gr_mem = (char **) &savedbuf[c]; -diff --git a/iconv/gconv.h b/iconv/gconv.h -index 8d8ce5813b..a87028047b 100644 ---- a/iconv/gconv.h -+++ b/iconv/gconv.h -@@ -139,7 +139,7 @@ typedef struct __gconv_info - { - size_t __nsteps; - struct __gconv_step *__steps; -- __extension__ struct __gconv_step_data __data __flexarr; -+ __extension__ struct __gconv_step_data __data[0]; - } *__gconv_t; - - /* Transliteration using the locale's data. */ -diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h -index 2e735ede4c..7c0deed9ae 100644 ---- a/include/arpa/nameser_compat.h -+++ b/include/arpa/nameser_compat.h -@@ -1,8 +1,8 @@ - #ifndef _ARPA_NAMESER_COMPAT_ - #include - --/* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e., -- T_A and T_AAAA). */ --#define T_UNSPEC 62321 -+/* The number is outside the 16-bit RR type range and is used -+ internally by the implementation. */ -+#define T_QUERY_A_AND_AAAA 439963904 - - #endif -diff --git a/io/fts.h b/io/fts.h -index 127a0d2721..b6b45206c8 100644 ---- a/io/fts.h -+++ b/io/fts.h -@@ -193,7 +193,7 @@ FTS *__REDIRECT (fts_open, (char * const *, int, - int (*)(const FTSENT **, const FTSENT **)), - fts64_open); - FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); --int __REDIRECT (fts_set, (FTS *, FTSENT *, int), fts64_set) __THROW; -+int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set); - # else - # define fts_children fts64_children - # define fts_close fts64_close -diff --git a/localedata/ChangeLog b/localedata/ChangeLog -index 4be8afc110..a7688e3df6 100644 ---- a/localedata/ChangeLog -+++ b/localedata/ChangeLog -@@ -1,3 +1,17 @@ -+2017-06-11 Santhosh Thottingal -+ -+ [BZ #19922] -+ * locales/iso14651_t1_common: Add collation rules for U+07DA to U+07DF. -+ -+ [BZ #19919] -+ * locales/iso14651_t1_common: Correct collation of U+0D36 and U+0D37. -+ -+2016-12-30 Mike Frysinger -+ -+ [BZ #20974] -+ * localedata/bs_BA (LC_MESSAGES): Delete "*." from the end of -+ yesexpr and noexpr. -+ - 2016-07-07 Aurelien Jarno - - * locales/de_LI (postal_fmt): Fix indentation. -diff --git a/localedata/locales/bs_BA b/localedata/locales/bs_BA -index a47f87eb37..68c2f9471a 100644 ---- a/localedata/locales/bs_BA -+++ b/localedata/locales/bs_BA -@@ -148,8 +148,8 @@ copy "en_DK" - END LC_CTYPE - - LC_MESSAGES --yesexpr "" --noexpr "" -+yesexpr "" -+noexpr "" - yesstr "" - nostr "" - END LC_MESSAGES -diff --git a/localedata/locales/iso14651_t1_common b/localedata/locales/iso14651_t1_common -index eef75ba65e..0e64f26a12 100644 ---- a/localedata/locales/iso14651_t1_common -+++ b/localedata/locales/iso14651_t1_common -@@ -1042,9 +1042,9 @@ collating-element from "" - collating-element from "" - collating-element from "" - collating-element from "" --collating-element from "" - collating-element from "" - collating-element from "" -+collating-element from "" - collating-element from "" - collating-element from "" - collating-element from "" -@@ -1103,8 +1103,8 @@ collating-symbol - collating-symbol - collating-symbol - collating-symbol --collating-symbol - collating-symbol -+collating-symbol - collating-symbol - collating-symbol - collating-symbol -@@ -1126,6 +1126,12 @@ collating-symbol - collating-symbol - collating-symbol - collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol - # - # - # -@@ -4552,6 +4558,12 @@ collating-symbol - - - -+ -+ -+ -+ -+ -+ - # - # - # -@@ -7252,6 +7264,7 @@ order_start ;forward;forward;forward;forward,position - ;;;IGNORE - ;;;IGNORE - "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE -@@ -7280,6 +7293,7 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ണ്‍ = ണ + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ണ = ണ + ് + അ - "";;;IGNORE - "";;;IGNORE -@@ -7290,6 +7304,7 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ന്‍= ന + ് + zwj -+ "";;;IGNORE - "";;;IGNORE #ന = ന + ് + അ - "";;;IGNORE - "";;;IGNORE -@@ -7305,20 +7320,23 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ര = ര + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ര = ര + ് + അ - ;;;IGNORE # ല്‍ = ല + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ല = ല + ് + അ - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE -- "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE -- "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ള്‍ = ള + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ള = ള + ് + അ - "";;;IGNORE - "";;;IGNORE -diff --git a/malloc/arena.c b/malloc/arena.c -index 229783f3b7..4e16593d8b 100644 ---- a/malloc/arena.c -+++ b/malloc/arena.c -@@ -702,8 +702,7 @@ _int_new_arena (size_t size) - } - - --/* Remove an arena from free_list. The arena may be in use because it -- was attached concurrently to a thread by reused_arena below. */ -+/* Remove an arena from free_list. */ - static mstate - get_free_list (void) - { -@@ -718,7 +717,8 @@ get_free_list (void) - free_list = result->next_free; - - /* The arena will be attached to this thread. */ -- ++result->attached_threads; -+ assert (result->attached_threads == 0); -+ result->attached_threads = 1; - - detach_arena (replaced_arena); - } -@@ -735,6 +735,26 @@ get_free_list (void) - return result; - } - -+/* Remove the arena from the free list (if it is present). -+ free_list_lock must have been acquired by the caller. */ -+static void -+remove_from_free_list (mstate arena) -+{ -+ mstate *previous = &free_list; -+ for (mstate p = free_list; p != NULL; p = p->next_free) -+ { -+ assert (p->attached_threads == 0); -+ if (p == arena) -+ { -+ /* Remove the requested arena from the list. */ -+ *previous = p->next_free; -+ break; -+ } -+ else -+ previous = &p->next_free; -+ } -+} -+ - /* Lock and return an arena that can be reused for memory allocation. - Avoid AVOID_ARENA as we have already failed to allocate memory in - it and it is currently locked. */ -@@ -782,14 +802,25 @@ reused_arena (mstate avoid_arena) - (void) mutex_lock (&result->mutex); - - out: -- /* Attach the arena to the current thread. Note that we may have -- selected an arena which was on free_list. */ -+ /* Attach the arena to the current thread. */ - { - /* Update the arena thread attachment counters. */ - mstate replaced_arena = thread_arena; - (void) mutex_lock (&free_list_lock); - detach_arena (replaced_arena); -+ -+ /* We may have picked up an arena on the free list. We need to -+ preserve the invariant that no arena on the free list has a -+ positive attached_threads counter (otherwise, -+ arena_thread_freeres cannot use the counter to determine if the -+ arena needs to be put on the free list). We unconditionally -+ remove the selected arena from the free list. The caller of -+ reused_arena checked the free list and observed it to be empty, -+ so the list is very short. */ -+ remove_from_free_list (result); -+ - ++result->attached_threads; -+ - (void) mutex_unlock (&free_list_lock); - } - -diff --git a/misc/regexp.c b/misc/regexp.c -index 3b3668272f..b2a2c6e636 100644 ---- a/misc/regexp.c -+++ b/misc/regexp.c -@@ -29,14 +29,15 @@ - - #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) - --/* Define the variables used for the interface. */ --char *loc1; --char *loc2; -+/* Define the variables used for the interface. Avoid .symver on common -+ symbol, which just creates a new common symbol, not an alias. */ -+char *loc1 __attribute__ ((nocommon)); -+char *loc2 __attribute__ ((nocommon)); - compat_symbol (libc, loc1, loc1, GLIBC_2_0); - compat_symbol (libc, loc2, loc2, GLIBC_2_0); - - /* Although we do not support the use we define this variable as well. */ --char *locs; -+char *locs __attribute__ ((nocommon)); - compat_symbol (libc, locs, locs, GLIBC_2_0); - - -diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c -index 7f698b4e6d..cb5acce01d 100644 ---- a/nis/nss_nisplus/nisplus-alias.c -+++ b/nis/nss_nisplus/nisplus-alias.c -@@ -291,7 +291,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, - return status; - } - -- if (name != NULL) -+ if (name == NULL) - { - *errnop = EINVAL; - return NSS_STATUS_UNAVAIL; -diff --git a/nptl/Makefile b/nptl/Makefile -index 0d8aadebed..fa925819ca 100644 ---- a/nptl/Makefile -+++ b/nptl/Makefile -@@ -268,7 +268,7 @@ tests = tst-typesizes \ - tst-flock1 tst-flock2 \ - tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \ - tst-signal6 tst-signal7 \ -- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \ -+ tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \ - tst-exit1 tst-exit2 tst-exit3 \ - tst-stdio1 tst-stdio2 \ - tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \ -diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c -index 6b42b11d5a..7365ca606b 100644 ---- a/nptl/allocatestack.c -+++ b/nptl/allocatestack.c -@@ -440,9 +440,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, - SETUP_THREAD_SYSINFO (pd); - #endif - -- /* The process ID is also the same as that of the caller. */ -- pd->pid = THREAD_GETMEM (THREAD_SELF, pid); -- - /* Don't allow setxid until cloned. */ - pd->setxid_futex = -1; - -@@ -579,9 +576,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, - /* Don't allow setxid until cloned. */ - pd->setxid_futex = -1; - -- /* The process ID is also the same as that of the caller. */ -- pd->pid = THREAD_GETMEM (THREAD_SELF, pid); -- - /* Allocate the DTV for this thread. */ - if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL) - { -@@ -875,9 +869,6 @@ __reclaim_stacks (void) - /* This marks the stack as free. */ - curp->tid = 0; - -- /* The PID field must be initialized for the new process. */ -- curp->pid = self->pid; -- - /* Account for the size of the stack. */ - stack_cache_actsize += curp->stackblock_size; - -@@ -903,13 +894,6 @@ __reclaim_stacks (void) - } - } - -- /* Reset the PIDs in any cached stacks. */ -- list_for_each (runp, &stack_cache) -- { -- struct pthread *curp = list_entry (runp, struct pthread, list); -- curp->pid = self->pid; -- } -- - /* Add the stack of all running threads to the cache. */ - list_splice (&stack_used, &stack_cache); - -@@ -1054,9 +1038,9 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t) - return 0; - - int val; -+ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err); -- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid), -- t->tid, SIGSETXID); -+ val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, t->tid, SIGSETXID); - - /* If this failed, it must have had not started yet or else exited. */ - if (!INTERNAL_SYSCALL_ERROR_P (val, err)) -diff --git a/nptl/descr.h b/nptl/descr.h -index 8e4938deb5..bc92abf010 100644 ---- a/nptl/descr.h -+++ b/nptl/descr.h -@@ -167,8 +167,8 @@ struct pthread - therefore stack) used' flag. */ - pid_t tid; - -- /* Process ID - thread group ID in kernel speak. */ -- pid_t pid; -+ /* Ununsed. */ -+ pid_t pid_ununsed; - - /* List of robust mutexes the thread is holding. */ - #ifdef __PTHREAD_MUTEX_HAVE_PREV -diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c -index bdbdfedcef..48fab50c4e 100644 ---- a/nptl/nptl-init.c -+++ b/nptl/nptl-init.c -@@ -184,18 +184,12 @@ __nptl_set_robust (struct pthread *self) - static void - sigcancel_handler (int sig, siginfo_t *si, void *ctx) - { -- /* Determine the process ID. It might be negative if the thread is -- in the middle of a fork() call. */ -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); -- if (__glibc_unlikely (pid < 0)) -- pid = -pid; -- - /* Safety check. It would be possible to call this function for - other signals and send a signal from another process. This is not - correct and might even be a security problem. Try to catch as - many incorrect invocations as possible. */ - if (sig != SIGCANCEL -- || si->si_pid != pid -+ || si->si_pid != __getpid() - || si->si_code != SI_TKILL) - return; - -@@ -243,19 +237,14 @@ struct xid_command *__xidcmd attribute_hidden; - static void - sighandler_setxid (int sig, siginfo_t *si, void *ctx) - { -- /* Determine the process ID. It might be negative if the thread is -- in the middle of a fork() call. */ -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); - int result; -- if (__glibc_unlikely (pid < 0)) -- pid = -pid; - - /* Safety check. It would be possible to call this function for - other signals and send a signal from another process. This is not - correct and might even be a security problem. Try to catch as - many incorrect invocations as possible. */ - if (sig != SIGSETXID -- || si->si_pid != pid -+ || si->si_pid != __getpid () - || si->si_code != SI_TKILL) - return; - -diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c -index 1419baf988..89d02e1741 100644 ---- a/nptl/pthread_cancel.c -+++ b/nptl/pthread_cancel.c -@@ -22,7 +22,7 @@ - #include "pthreadP.h" - #include - #include -- -+#include - - int - pthread_cancel (pthread_t th) -@@ -66,19 +66,11 @@ pthread_cancel (pthread_t th) - #ifdef SIGCANCEL - /* The cancellation handler will take care of marking the - thread as canceled. */ -- INTERNAL_SYSCALL_DECL (err); -- -- /* One comment: The PID field in the TCB can temporarily be -- changed (in fork). But this must not affect this code -- here. Since this function would have to be called while -- the thread is executing fork, it would have to happen in -- a signal handler. But this is no allowed, pthread_cancel -- is not guaranteed to be async-safe. */ -- int val; -- val = INTERNAL_SYSCALL (tgkill, err, 3, -- THREAD_GETMEM (THREAD_SELF, pid), pd->tid, -- SIGCANCEL); -+ pid_t pid = getpid (); - -+ INTERNAL_SYSCALL_DECL (err); -+ int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, pd->tid, -+ SIGCANCEL); - if (INTERNAL_SYSCALL_ERROR_P (val, err)) - result = INTERNAL_SYSCALL_ERRNO (val, err); - #else -diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c -index fb906f0484..32d7484bf8 100644 ---- a/nptl/pthread_getattr_np.c -+++ b/nptl/pthread_getattr_np.c -@@ -68,7 +68,6 @@ pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr) - { - /* No stack information available. This must be for the initial - thread. Get the info in some magical way. */ -- assert (abs (thread->pid) == thread->tid); - - /* Stack size limit. */ - struct rlimit rl; -diff --git a/nptl/tst-exec5.c b/nptl/tst-exec5.c -new file mode 100644 -index 0000000000..4327d8d41c ---- /dev/null -+++ b/nptl/tst-exec5.c -@@ -0,0 +1,196 @@ -+/* Check if posix_spawn does not act as a cancellation entrypoint. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int do_test (void); -+#define TEST_FUNCTION do_test () -+#include -+ -+static pthread_barrier_t b; -+ -+static pid_t pid; -+static int pipefd[2]; -+ -+static void * -+tf (void *arg) -+{ -+ int r = pthread_barrier_wait (&b); -+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) -+ { -+ puts ("error: pthread_barrier_wait failed"); -+ exit (1); -+ } -+ -+ posix_spawn_file_actions_t a; -+ if (posix_spawn_file_actions_init (&a) != 0) -+ { -+ puts ("error: spawn_file_actions_init failed"); -+ exit (1); -+ } -+ -+ if (posix_spawn_file_actions_adddup2 (&a, pipefd[1], STDOUT_FILENO) != 0) -+ { -+ puts ("error: spawn_file_actions_adddup2 failed"); -+ exit (1); -+ } -+ -+ if (posix_spawn_file_actions_addclose (&a, pipefd[0]) != 0) -+ { -+ puts ("error: spawn_file_actions_addclose"); -+ exit (1); -+ } -+ -+ char *argv[] = { (char *) _PATH_BSHELL, (char *) "-c", (char *) "echo $$", -+ NULL }; -+ if (posix_spawn (&pid, _PATH_BSHELL, &a, NULL, argv, NULL) != 0) -+ { -+ puts ("error: spawn failed"); -+ exit (1); -+ } -+ -+ return NULL; -+} -+ -+ -+static int -+do_test (void) -+{ -+ /* The test basically pipe a 'echo $$' created by a thread with a -+ cancellation pending. It then checks if the thread is not cancelled, -+ the process is created and if the output is the expected one. */ -+ -+ if (pipe (pipefd) != 0) -+ { -+ puts ("error: pipe failed"); -+ exit (1); -+ } -+ -+ /* Not interested in knowing when the pipe is closed. */ -+ if (sigignore (SIGPIPE) != 0) -+ { -+ puts ("error: sigignore failed"); -+ exit (1); -+ } -+ -+ /* To synchronize with the thread. */ -+ if (pthread_barrier_init (&b, NULL, 2) != 0) -+ { -+ puts ("error: pthread_barrier_init failed"); -+ exit (1); -+ } -+ -+ pthread_t th; -+ if (pthread_create (&th, NULL, &tf, NULL) != 0) -+ { -+ puts ("error: pthread_create failed"); -+ exit (1); -+ } -+ -+ if (pthread_cancel (th) != 0) -+ { -+ puts ("error: pthread_cancel failed"); -+ exit (1); -+ } -+ -+ int r = pthread_barrier_wait (&b); -+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) -+ { -+ puts ("error: pthread_barrier_wait"); -+ exit (1); -+ } -+ -+ void *retval; -+ if (pthread_join (th, &retval) != 0) -+ { -+ puts ("error: pthread_join failed\n"); -+ } -+ if (retval == PTHREAD_CANCELED) -+ { -+ puts ("error: thread cancelled"); -+ exit (1); -+ } -+ -+ close (pipefd[1]); -+ -+ /* The global 'pid' should be set by thread posix_spawn calling. Check -+ below if it was executed correctly and with expected output. */ -+ -+ char buf[64]; -+ ssize_t n; -+ bool seen_pid = false; -+ while (TEMP_FAILURE_RETRY ((n = read (pipefd[0], buf, sizeof (buf)))) > 0) -+ { -+ /* We only expect to read the PID. */ -+ char *endp; -+ long int rpid = strtol (buf, &endp, 10); -+ -+ if (*endp != '\n') -+ { -+ printf ("error: didn't parse whole line: \"%s\"\n", buf); -+ exit (1); -+ } -+ if (endp == buf) -+ { -+ puts ("error: read empty line"); -+ exit (1); -+ } -+ -+ if (rpid != pid) -+ { -+ printf ("error: found \"%s\", expected PID %ld\n", buf, -+ (long int) pid); -+ exit (1); -+ } -+ -+ if (seen_pid) -+ { -+ puts ("error: found more than one PID line"); -+ exit (1); -+ } -+ -+ seen_pid = true; -+ } -+ -+ close (pipefd[0]); -+ -+ int status; -+ int err = waitpid (pid, &status, 0); -+ if (err != pid) -+ { -+ puts ("errnor: waitpid failed"); -+ exit (1); -+ } -+ -+ if (!seen_pid) -+ { -+ puts ("error: didn't get PID"); -+ exit (1); -+ } -+ -+ return 0; -+} -diff --git a/nptl/tst-once5.cc b/nptl/tst-once5.cc -index 978d8271bd..513ac53f6f 100644 ---- a/nptl/tst-once5.cc -+++ b/nptl/tst-once5.cc -@@ -75,5 +75,7 @@ do_test (void) - return result; - } - -+// The test currently hangs and is XFAILed. Reduce the timeout. -+#define TIMEOUT 1 - #define TEST_FUNCTION do_test () - #include "../test-skeleton.c" -diff --git a/nptl_db/structs.def b/nptl_db/structs.def -index a9b621b126..1cb6a46391 100644 ---- a/nptl_db/structs.def -+++ b/nptl_db/structs.def -@@ -48,7 +48,6 @@ DB_STRUCT (pthread) - DB_STRUCT_FIELD (pthread, list) - DB_STRUCT_FIELD (pthread, report_events) - DB_STRUCT_FIELD (pthread, tid) --DB_STRUCT_FIELD (pthread, pid) - DB_STRUCT_FIELD (pthread, start_routine) - DB_STRUCT_FIELD (pthread, cancelhandling) - DB_STRUCT_FIELD (pthread, schedpolicy) -diff --git a/nptl_db/td_ta_thr_iter.c b/nptl_db/td_ta_thr_iter.c -index a990fed150..9e5059956b 100644 ---- a/nptl_db/td_ta_thr_iter.c -+++ b/nptl_db/td_ta_thr_iter.c -@@ -76,48 +76,28 @@ iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback, - if (ps_pdread (ta->ph, addr, copy, ta->ta_sizeof_pthread) != PS_OK) - return TD_ERR; - -- /* Verify that this thread's pid field matches the child PID. -- If its pid field is negative, it's about to do a fork or it -- is the sole thread in a fork child. */ -- psaddr_t pid; -- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, pid, 0); -- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0) -- { -- if (-(pid_t) (uintptr_t) pid == match_pid) -- /* It is about to do a fork, but is really still the parent PID. */ -- pid = (psaddr_t) (uintptr_t) match_pid; -- else -- /* It must be a fork child, whose new PID is in the tid field. */ -- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, tid, 0); -- } -+ err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread, -+ schedpolicy, 0); - if (err != TD_OK) - break; -+ err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread, -+ schedparam_sched_priority, 0); -+ if (err != TD_OK) -+ break; -+ -+ /* Now test whether this thread matches the specified conditions. */ - -- if ((pid_t) (uintptr_t) pid == match_pid) -+ /* Only if the priority level is as high or higher. */ -+ int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER -+ ? 0 : (uintptr_t) schedprio); -+ if (descr_pri >= ti_pri) - { -- err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread, -- schedpolicy, 0); -- if (err != TD_OK) -- break; -- err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread, -- schedparam_sched_priority, 0); -- if (err != TD_OK) -- break; -- -- /* Now test whether this thread matches the specified conditions. */ -- -- /* Only if the priority level is as high or higher. */ -- int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER -- ? 0 : (uintptr_t) schedprio); -- if (descr_pri >= ti_pri) -- { -- /* Yep, it matches. Call the callback function. */ -- td_thrhandle_t th; -- th.th_ta_p = (td_thragent_t *) ta; -- th.th_unique = addr; -- if (callback (&th, cbdata_p) != 0) -- return TD_DBERR; -- } -+ /* Yep, it matches. Call the callback function. */ -+ td_thrhandle_t th; -+ th.th_ta_p = (td_thragent_t *) ta; -+ th.th_unique = addr; -+ if (callback (&th, cbdata_p) != 0) -+ return TD_DBERR; - } - - /* Get the pointer to the next element. */ -diff --git a/nptl_db/td_thr_validate.c b/nptl_db/td_thr_validate.c -index f3c8a7bed6..9b89fecad2 100644 ---- a/nptl_db/td_thr_validate.c -+++ b/nptl_db/td_thr_validate.c -@@ -80,28 +80,5 @@ td_thr_validate (const td_thrhandle_t *th) - err = TD_OK; - } - -- if (err == TD_OK) -- { -- /* Verify that this is not a stale element in a fork child. */ -- pid_t match_pid = ps_getpid (th->th_ta_p->ph); -- psaddr_t pid; -- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, pthread, pid, 0); -- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0) -- { -- /* This was a thread that was about to fork, or it is the new sole -- thread in a fork child. In the latter case, its tid was stored -- via CLONE_CHILD_SETTID and so is already the proper child PID. */ -- if (-(pid_t) (uintptr_t) pid == match_pid) -- /* It is about to do a fork, but is really still the parent PID. */ -- pid = (psaddr_t) (uintptr_t) match_pid; -- else -- /* It must be a fork child, whose new PID is in the tid field. */ -- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, -- pthread, tid, 0); -- } -- if (err == TD_OK && (pid_t) (uintptr_t) pid != match_pid) -- err = TD_NOTHR; -- } -- - return err; - } -diff --git a/po/de.po b/po/de.po -index 1383e8c4a9..ca14c7e386 100644 ---- a/po/de.po -+++ b/po/de.po -@@ -8,7 +8,7 @@ msgid "" - msgstr "" - "Project-Id-Version: GNU libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-08-31 18:30+0200\n" -+"PO-Revision-Date: 2016-04-22 18:44+0200\n" - "Last-Translator: Jochen Hein \n" - "Language-Team: German \n" - "Language: de\n" -@@ -4479,13 +4479,13 @@ msgstr "" - "%15s Cache ist dauerhaft\n" - "%15s Cache wird gemeinsam verwendet\n" - "%15Zu vorgeschlagene Größe\n" --"%15Zu Gesamtröße des Data-Pools\n" -+"%15Zu Gesamtgröße des Data-Pools\n" - "%15Zu Benutzter Speicher im Data-Pool\n" - "%15lu Time to Live für positive Einträge in Sekunden\n" - "%15lu Time to Live für negative Einträge in Sekunden\n" - "%15 Cache-Hits bei positiven Einträgen\n" - "%15 Cache-Hits bei positiven Einträgen\n" --"%15 Cache-Misses bei positiven Einträgen\n" -+"%15 Cache-Misses bei positiven Einträgen\n" - "%15 Cache-Misses bei negativen Einträgen\n" - "%15lu%% Cache-Hit Verhältnis\n" - "%15zu aktuelle Anzahl der Werte im Cache\n" -diff --git a/po/fi.po b/po/fi.po -index 17cb3e3e1d..8a2ab8358c 100644 ---- a/po/fi.po -+++ b/po/fi.po -@@ -24,16 +24,16 @@ - # - msgid "" - msgstr "" --"Project-Id-Version: libc 2.21-pre1\n" -+"Project-Id-Version: libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-07-28 20:29+0300\n" -+"PO-Revision-Date: 2016-05-26 21:14+0300\n" - "Last-Translator: Lauri Nurmi \n" - "Language-Team: Finnish \n" - "Language: fi\n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" --"X-Generator: Poedit 1.8.3\n" -+"X-Generator: Poedit 1.8.7\n" - "Plural-Forms: nplurals=2; plural=(n != 1);\n" - - #: argp/argp-help.c:227 -@@ -126,7 +126,7 @@ msgid "%s%s%s:%u: %s%sUnexpected error: %s.\n" - msgstr "%s%s%s:%u: %s%sOdottamaton virhe: %s.\n" - - #: assert/assert.c:101 --#, fuzzy, c-format -+#, c-format - msgid "" - "%s%s%s:%u: %s%sAssertion `%s' failed.\n" - "%n" -@@ -169,12 +169,12 @@ msgstr "" - #: malloc/memusagestat.c:563 nss/getent.c:973 nss/makedb.c:369 - #: posix/getconf.c:486 sunrpc/rpcinfo.c:691 - #: sysdeps/unix/sysv/linux/lddlibc4.c:61 --#, fuzzy, c-format -+#, c-format - msgid "" - "For bug reporting instructions, please see:\n" - "%s.\n" - msgstr "" --"Ohjeet ohjelmistovioista ilmoittamiseen ovat osoitteessa\n" -+"Katso ohjeet vikailmoitusten tekemiseen osoitteesta:\n" - "%s.\n" - - #: catgets/gencat.c:245 debug/pcprofiledump.c:225 debug/xtrace.sh:64 -@@ -321,9 +321,8 @@ msgstr "Käyttö: xtrace [VALITSIN]... OHJELMA [OHJELMANVALITSIN]...\\n" - - #: debug/xtrace.sh:32 elf/sotruss.sh:56 elf/sotruss.sh:67 elf/sotruss.sh:135 - #: malloc/memusage.sh:26 --#, fuzzy - msgid "Try \\`%s --help' or \\`%s --usage' for more information.\\n" --msgstr "Kokeile ”%s --help” tai ”%s --usage” saadaksesi lisää tietoa.\n" -+msgstr "Kokeile ”%s --help” tai ”%s --usage” saadaksesi lisää tietoa.\\n" - - #: debug/xtrace.sh:38 - #, fuzzy -@@ -594,9 +593,8 @@ msgid "cannot enable executable stack as shared object requires" - msgstr "jaettua objektikahvaa ei voi luoda" - - #: elf/dl-load.c:1339 --#, fuzzy - msgid "cannot close file descriptor" --msgstr "tiedostoa %s ei voi sulkea" -+msgstr "tiedostokahvaa ei voi sulkea" - - #: elf/dl-load.c:1568 - msgid "file too short" -@@ -796,9 +794,8 @@ msgid "Format to use: new, old or compat (default)" - msgstr "Käytettävä muoto: ”new”, ”old” tai ”compat” (oletus)" - - #: elf/ldconfig.c:151 --#, fuzzy - msgid "Ignore auxiliary cache file" --msgstr "Käytä CACHEa välimuistitiedostona" -+msgstr "Jätä huomiotta apuvälimuistitiedosto" - - #: elf/ldconfig.c:159 - msgid "Configure Dynamic Linker Run Time Bindings." -@@ -1087,9 +1084,9 @@ msgid "invalid process ID '%s'" - msgstr "virheellinen prosessi-ID ”%s”" - - #: elf/pldd.c:120 --#, fuzzy, c-format -+#, c-format - msgid "cannot open %s" --msgstr "laitetta %s ei voi avata" -+msgstr "tiedostoa %s ei voi avata" - - #: elf/pldd.c:152 - #, fuzzy, c-format -@@ -1102,24 +1099,24 @@ msgid "cannot prepare reading %s/task" - msgstr "ei voi avata laitetta %s lukutilaan" - - #: elf/pldd.c:168 --#, fuzzy, c-format -+#, c-format - msgid "invalid thread ID '%s'" --msgstr "virheellinen prosessi-ID ”%s”" -+msgstr "virheellinen säie-ID ”%s”" - - #: elf/pldd.c:179 --#, fuzzy, c-format -+#, c-format - msgid "cannot attach to process %lu" --msgstr "tiedostoa ”%s” ei voi avata" -+msgstr "ei voida kiinnittyä prosessiin %lu" - - #: elf/pldd.c:294 - #, c-format - msgid "cannot get information about process %lu" --msgstr "" -+msgstr "tietojen saaminen prosessista %lu ei onnistu" - - #: elf/pldd.c:307 --#, fuzzy, c-format -+#, c-format - msgid "process %lu is no ELF program" --msgstr "ohjelma %lu ei ole käytettävissä\n" -+msgstr "prosessi %lu ei ole ELF-ohjelma" - - #: elf/readelflib.c:34 - #, c-format -@@ -1203,7 +1200,7 @@ msgstr "%s kohde ei saa olla hakemisto\n" - #: elf/sln.c:184 - #, c-format - msgid "%s: failed to remove the old destination\n" --msgstr "" -+msgstr "%s: vanhan kohteen poistaminen epäonnistui\n" - - #: elf/sln.c:192 - #, c-format -@@ -1237,9 +1234,8 @@ msgid "Mandatory arguments to long options are also mandatory for any correspond - msgstr "Pakolliset argumentit pitkille valitsimille ovat pakollisia kaikille vastaaville lyhyille valitsimille.\\n" - - #: elf/sotruss.sh:55 --#, fuzzy - msgid "%s: option requires an argument -- '%s'\\n" --msgstr "%s: valitsin ”%s” vaatii argumentin\n" -+msgstr "%s: valitsin vaatii argumentin -- ”%c”\\n" - - #: elf/sotruss.sh:61 - msgid "%s: option is ambiguous; possibilities:" -@@ -1507,7 +1503,6 @@ msgid "unknown iconv() error %d" - msgstr "tuntematon iconv()-virhe %d" - - #: iconv/iconv_prog.c:791 --#, fuzzy - msgid "" - "The following list contains all the coded character sets known. This does\n" - "not necessarily mean that all combinations of these names can be used for\n" -@@ -1516,9 +1511,9 @@ msgid "" - "\n" - " " - msgstr "" --"Seuraavassa listassa ovat kaikki tunnetut koodatut merkistöt. Se ei\n" -+"Seuraavassa listassa ovat kaikki tunnetut koodatut merkistöt. Tämä ei\n" - "kuitenkaan välttämättä tarkoita sitä, että kaikkia näiden nimien\n" --"yhdistelmiä voidaan käyttää FROM- ja TO-komentoriviparametreina. Yksi\n" -+"yhdistelmiä voisi käyttää FROM- ja TO-komentoriviparametreina. Yksi\n" - "koodattu merkistö voi olla listalla useilla eri nimillä (aliaksilla).\n" - "\n" - " " -@@ -2733,14 +2728,12 @@ msgid "locale.alias file to consult when making archive" - msgstr "Arkistoa luotaessa käytettävä locale.alias-tiedosto" - - #: locale/programs/localedef.c:150 --#, fuzzy - msgid "Generate little-endian output" --msgstr "Tuota little-endian-koodia" -+msgstr "Tuota little-endian-muotoa" - - #: locale/programs/localedef.c:152 --#, fuzzy - msgid "Generate big-endian output" --msgstr "Tuota big-endian-koodia" -+msgstr "Tuota big-endian-muotoa" - - #: locale/programs/localedef.c:157 - msgid "Compile locale specification" -@@ -4275,10 +4268,9 @@ msgid "" - msgstr "" - - #: nscd/nscd.c:635 --#, fuzzy, c-format --#| msgid "lstat failed" -+#, c-format - msgid "'wait' failed\n" --msgstr "tiedoston tilan luku epäonnistui" -+msgstr "”wait” epäonnistui\n" - - #: nscd/nscd.c:642 - #, c-format -@@ -4670,9 +4662,9 @@ msgid "cannot create temporary file" - msgstr "tilapäistä tiedostoa ei voi luoda" - - #: nss/makedb.c:304 --#, fuzzy, c-format -+#, c-format - msgid "cannot stat newly created file" --msgstr "tiedoston ”%s” tilaa ei voi lukea: %s" -+msgstr "juuri luodun tiedoston tilaa ei voi lukea" - - #: nss/makedb.c:315 - #, c-format -@@ -4680,9 +4672,9 @@ msgid "cannot rename temporary file" - msgstr "tilapäistä tiedostoa ei voi nimetä uudelleen" - - #: nss/makedb.c:531 nss/makedb.c:554 --#, fuzzy, c-format -+#, c-format - msgid "cannot create search tree" --msgstr "hakupolulle ei voi luoda välimuistia" -+msgstr "hakupuuta ei voi luoda" - - #: nss/makedb.c:560 - msgid "duplicate key" -@@ -4699,9 +4691,9 @@ msgid "failed to write new database file" - msgstr "uuden tietokantatiedoston kirjoittaminen epäonnistui" - - #: nss/makedb.c:812 --#, fuzzy, c-format -+#, c-format - msgid "cannot stat database file" --msgstr "tiedoston ”%s” tilaa ei voi lukea: %s" -+msgstr "tietokantatiedoston tilaa ei voi lukea" - - #: nss/makedb.c:817 - #, fuzzy, c-format -@@ -4709,9 +4701,9 @@ msgid "cannot map database file" - msgstr "Karttatietokannassa ei ole enempää tietueita" - - #: nss/makedb.c:820 --#, fuzzy, c-format -+#, c-format - msgid "file not a database file" --msgstr "luettaessa profilointidatatiedoston tilaa" -+msgstr "tiedosto ei ole tietokantatiedosto" - - #: nss/makedb.c:871 - #, fuzzy, c-format -@@ -4726,7 +4718,7 @@ msgstr "Käyttö: %s [-v määrittely] muuttujanimi [polku]\n" - #: posix/getconf.c:403 - #, c-format - msgid " %s -a [pathname]\n" --msgstr "" -+msgstr " %s -a [polku]\n" - - #: posix/getconf.c:479 - #, c-format -@@ -5094,11 +5086,11 @@ msgstr "Laitetta irrotettu" - - #: stdio-common/psiginfo.c:139 - msgid "Signal sent by kill()" --msgstr "" -+msgstr "Signaalin lähetti kill()" - - #: stdio-common/psiginfo.c:142 - msgid "Signal sent by sigqueue()" --msgstr "" -+msgstr "Signaalin lähetti sigqueue()" - - #: stdio-common/psiginfo.c:145 - msgid "Signal generated by the expiration of a timer" -@@ -5114,7 +5106,7 @@ msgstr "" - - #: stdio-common/psiginfo.c:157 - msgid "Signal sent by tkill()" --msgstr "" -+msgstr "Signaalin lähetti tkill()" - - #: stdio-common/psiginfo.c:162 - msgid "Signal generated by the completion of an asynchronous name lookup request" -@@ -5296,9 +5288,8 @@ msgid "Failed (unspecified error)" - msgstr "Epäonnistui (määrittelemätön virhe)" - - #: sunrpc/clnt_raw.c:115 --#, fuzzy - msgid "clnt_raw.c: fatal header serialization error" --msgstr "clnt_raw.c: vakava otsikon serialisointivirhe" -+msgstr "clnt_raw.c: vakava otsikon sarjallistamisvirhe" - - #: sunrpc/pm_getmaps.c:77 - msgid "pmap_getmaps.c: rpc problem" -@@ -6825,9 +6816,8 @@ msgid "Interrupted by a signal" - msgstr "Signaalin keskeyttämä" - - #: sysdeps/posix/gai_strerror-strs.h:17 --#, fuzzy - msgid "Parameter string not correctly encoded" --msgstr "Parametrimerkkijono on väärin koodattu" -+msgstr "Parametrimerkkijono ei ole koodattu oikein" - - #: sysdeps/unix/sysv/linux/i386/readelflib.c:65 - #, c-format -diff --git a/po/sv.po b/po/sv.po -index 49d1f23904..e046577b08 100644 ---- a/po/sv.po -+++ b/po/sv.po -@@ -1,13 +1,17 @@ - # GNU libc message catalog for Swedish --# Copyright © 1996, 1998, 2001, 2002, 2003, 2006, 2008, 2009, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. -+# Copyright © 1996, 1998, 2001, 2002, 2003, 2006, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc. - # This file is distributed under the same license as the glibc package. --# Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015 -+# -+# Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015. -+# Göran Uddeborg , 2016. -+# -+# $Revision: 1.3 $ - msgid "" - msgstr "" --"Project-Id-Version: libc 2.21-pre1\n" -+"Project-Id-Version: libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-01-24 10:35+0100\n" --"Last-Translator: Jan Djärv \n" -+"PO-Revision-Date: 2016-08-02 17:17+0200\n" -+"Last-Translator: Göran Uddeborg \n" - "Language-Team: Swedish \n" - "Language: sv\n" - "MIME-Version: 1.0\n" -@@ -48,7 +52,7 @@ msgstr " [FLAGGA...]" - #: argp/argp-help.c:1643 - #, c-format - msgid "Try `%s --help' or `%s --usage' for more information.\n" --msgstr "Försök med \"%s --help\" eller \"%s --usage\" för mer information\n" -+msgstr "Försök med ”%s --help” eller ”%s --usage” för mer information.\n" - - #: argp/argp-help.c:1671 - #, c-format -@@ -304,11 +308,11 @@ msgstr "Användning: xtrace [FLAGGA]... PROGRAM [PROGRAMFLAGGA}...\\n" - #: debug/xtrace.sh:32 elf/sotruss.sh:56 elf/sotruss.sh:67 elf/sotruss.sh:135 - #: malloc/memusage.sh:26 - msgid "Try \\`%s --help' or \\`%s --usage' for more information.\\n" --msgstr "Försök med \\\"%s --help\\\" eller \\\"%s --usage\\\" för mer information\\n" -+msgstr "Försök med ”%s --help” eller ”%s --usage” för mer information\\n" - - #: debug/xtrace.sh:38 - msgid "%s: option '%s' requires an argument.\\n" --msgstr "%s: flaggan \\\"%s\\\" kräver ett argument\\n" -+msgstr "%s: flaggan ”%s” kräver ett argument.\\n" - - #: debug/xtrace.sh:45 - msgid "" -@@ -332,19 +336,17 @@ msgstr "" - " --usage Visa en kort hjälptext\n" - " -V,--version Visa versionsinformation och avsluta\n" - "\n" --"Obligatoriska argument för långa flaggor är obligatoriska även för\n" -+"Obligatoriska argument för långa flaggor är obligatoriska även för\n" - "motsvarande korta.\n" - - #: debug/xtrace.sh:57 elf/ldd.bash.in:55 elf/sotruss.sh:49 - #: malloc/memusage.sh:64 - msgid "For bug reporting instructions, please see:\\\\n%s.\\\\n" --msgstr "" --"För felrapporteringsinstruktioner, se:\\\\n%s.\\\\n\n" --"Rapportera fel eller synpunkter på översättningen till .\\\\n" -+msgstr "För felrapporteringsinstruktioner, se:\\\\n%s.\\\\nRapportera fel eller synpunkter på översättningen till:\\\\n.\\\\n" - - #: debug/xtrace.sh:125 - msgid "xtrace: unrecognized option \\`$1'\\n" --msgstr "xtrace: okänd flagga \"$1\"\\n" -+msgstr "xtrace: okänd flagga ”$1”\\n" - - #: debug/xtrace.sh:138 - msgid "No program name given\\n" -@@ -353,12 +355,12 @@ msgstr "Inget programnamn givet\\n" - #: debug/xtrace.sh:146 - #, sh-format - msgid "executable \\`$program' not found\\n" --msgstr "program \"$program\" hittades inte\\n" -+msgstr "program ”$program” hittades inte\\n" - - #: debug/xtrace.sh:150 - #, sh-format - msgid "\\`$program' is no executable\\n" --msgstr "\"$program\" är inte en körbar binär\\n" -+msgstr "”$program” är inte en körbar binär\\n" - - #: dlfcn/dlinfo.c:63 - msgid "RTLD_SELF used in code not dynamically loaded" -@@ -396,7 +398,7 @@ msgstr ", OS ABI: %s %d.%d.%d" - #: elf/cache.c:157 elf/ldconfig.c:1340 - #, c-format - msgid "Can't open cache file %s\n" --msgstr "Kan inte öppna cache-fil \"%s\"\n" -+msgstr "Kan inte öppna cache-filen %s\n" - - #: elf/cache.c:171 - #, c-format -@@ -416,7 +418,7 @@ msgstr "%d bibliotek hittades i cache \"%s\"\n" - #: elf/cache.c:426 - #, c-format - msgid "Can't create temporary cache file %s" --msgstr "Kan inte skapa temporär cache-fil \"%s\"" -+msgstr "Kan inte skapa en temporär cache-fil %s" - - #: elf/cache.c:434 elf/cache.c:444 elf/cache.c:448 elf/cache.c:453 - #, c-format -@@ -829,7 +831,7 @@ msgstr "Kan inte ta status (lstat) på %s" - #: elf/ldconfig.c:609 - #, c-format - msgid "Ignored file %s since it is not a regular file." --msgstr "Ignorerar fil %s eftersom den inte är en vanlig fil" -+msgstr "Ignorerar fil %s eftersom den inte är en vanlig fil." - - #: elf/ldconfig.c:618 - #, c-format -@@ -951,7 +953,7 @@ msgstr "" - - #: elf/ldd.bash.in:80 - msgid "ldd: option \\`$1' is ambiguous" --msgstr "ldd: flaggan \"$1\" är tvetydig" -+msgstr "ldd: flaggan ”$1” är tvetydig" - - #: elf/ldd.bash.in:87 - msgid "unrecognized option" -@@ -959,7 +961,7 @@ msgstr "okänd flagga" - - #: elf/ldd.bash.in:88 elf/ldd.bash.in:125 - msgid "Try \\`ldd --help' for more information." --msgstr "Försök med \"ldd --help\" för mer information" -+msgstr "Försök med \"ldd --help\" för mer information." - - #: elf/ldd.bash.in:124 - msgid "missing file arguments" -@@ -1028,10 +1030,9 @@ msgid "cannot read object name" - msgstr "kan inte läsa objektnamn" - - #: elf/pldd-xx.c:219 --#, fuzzy, c-format --#| msgid "cannot allocate memory for program header" -+#, c-format - msgid "cannot allocate buffer for object name" --msgstr "kan inte allokera minne för programhuvud" -+msgstr "kan inte allokera en buffert för objektnamn" - - #: elf/pldd.c:64 - msgid "List dynamic shared objects loaded into process." -@@ -1212,11 +1213,11 @@ msgstr "" - - #: elf/sotruss.sh:46 - msgid "Mandatory arguments to long options are also mandatory for any corresponding\\nshort options.\\n" --msgstr "Obligatoriska respektive valfria argument för långa flaggor är obligatoriska respektive\\nvalfria även för korta.\\n" -+msgstr "Obligatoriska respektive valfria argument för långa flaggor är obligatoriska\\nrespektive valfria även för korta.\\n" - - #: elf/sotruss.sh:55 - msgid "%s: option requires an argument -- '%s'\\n" --msgstr "%s: flaggan kräver ett argument -- \\\"%s\\\"\\n" -+msgstr "%s: flaggan kräver ett argument — ”%s”\\n" - - #: elf/sotruss.sh:61 - msgid "%s: option is ambiguous; possibilities:" -@@ -1240,7 +1241,7 @@ msgstr "" - - #: elf/sotruss.sh:134 - msgid "%s: unrecognized option '%c%s'\\n" --msgstr "%s: okänd flagga \\\"%c%s\\\"\\n" -+msgstr "%s: okänd flagga ”%c%s”\\n" - - #: elf/sprof.c:77 - msgid "Output selection:" -@@ -1260,7 +1261,7 @@ msgstr "generera anropsgraf" - - #: elf/sprof.c:89 - msgid "Read and display shared object profiling data." --msgstr "Läs och visa profildata för delat objekt" -+msgstr "Läs och visa profildata för delat objekt." - - #: elf/sprof.c:94 - msgid "SHOBJ [PROFDATA]" -@@ -1622,7 +1623,7 @@ msgstr "Fel: .netrc kan läsas av andra." - - #: inet/ruserpass.c:185 - msgid "Remove password or make file unreadable by others." --msgstr "Ta bort lösenord eller gör filen oläsbar för andra" -+msgstr "Ta bort lösenord eller gör filen oläsbar för andra." - - #: inet/ruserpass.c:277 - #, c-format -@@ -2182,12 +2183,12 @@ msgstr "Inget namn definierat i teckenuppsättning" - #: locale/programs/ld-ctype.c:479 - #, c-format - msgid "character L'\\u%0*x' in class `%s' must be in class `%s'" --msgstr "tecken L\"\\u%0*x\" i klass \"%s\" måste vara i klass \"%s\"" -+msgstr "tecken L'\\u%0*x' i klassen ”%s” måste vara i klassen ”%s”" - - #: locale/programs/ld-ctype.c:494 - #, c-format - msgid "character L'\\u%0*x' in class `%s' must not be in class `%s'" --msgstr "tecken L\"\\u%0*x\" i klass \"%s\" får inte vara i klass \"%s\"" -+msgstr "tecken L'\\u%0*x' i klassen ”%s” får inte vara i klassen ”%s”" - - #: locale/programs/ld-ctype.c:508 locale/programs/ld-ctype.c:566 - #, c-format -@@ -2611,7 +2612,7 @@ msgstr "Skriv mer information" - - #: locale/programs/locale.c:85 - msgid "Get locale-specific information." --msgstr "Hämta lokalspecifik information" -+msgstr "Hämta lokalspecifik information." - - #: locale/programs/locale.c:88 - msgid "" -@@ -3022,7 +3023,7 @@ msgstr "felaktig mcheck_status, biblioteket är felaktigt\n" - - #: malloc/memusage.sh:32 - msgid "%s: option '%s' requires an argument\\n" --msgstr "%s: flaggan \\\"%s\\\" kräver ett argument\\n" -+msgstr "%s: flaggan ”%s” kräver ett argument\\n" - - #: malloc/memusage.sh:38 - msgid "" -@@ -3091,11 +3092,11 @@ msgstr "" - - #: malloc/memusage.sh:191 - msgid "memusage: option \\`${1##*=}' is ambiguous" --msgstr "memusage: flaggan \"${1##*=}\" är tvetydig" -+msgstr "memusage: flaggan ”${1##*=}” är tvetydig" - - #: malloc/memusage.sh:200 - msgid "memusage: unrecognized option \\`$1'" --msgstr "memusage: okänd flagga \"$1\"" -+msgstr "memusage: okänd flagga ”$1”" - - #: malloc/memusage.sh:213 - msgid "No program name given" -@@ -3341,7 +3342,7 @@ msgstr "Kan inte skapa process hos server" - - #: nis/nis_error.h:48 - msgid "Master server busy, full dump rescheduled." --msgstr "Huvudserver är upptagen, full dump åter schemalagd" -+msgstr "Huvudserver är upptagen, full dump åter schemalagd." - - #: nis/nis_local_names.c:121 - #, c-format -@@ -3511,7 +3512,7 @@ msgstr "\t\tRättigheter : " - - #: nis/nis_print.c:290 - msgid "Linked Object Type : " --msgstr "Länkad objekttyp: " -+msgstr "Länkad objekttyp : " - - #: nis/nis_print.c:292 - #, c-format -@@ -3802,15 +3803,14 @@ msgid " (first)" - msgstr " (första)" - - #: nscd/cache.c:288 --#, fuzzy, c-format --#| msgid "cannot stat() file `%s': %s" -+#, c-format - msgid "checking for monitored file `%s': %s" --msgstr "kan inte ta status på fil \"%s\": %s" -+msgstr "kontrollerar den övervakade filen ”%s”: %s" - - #: nscd/cache.c:298 - #, c-format - msgid "monitored file `%s` changed (mtime)" --msgstr "" -+msgstr "den övervakade filen ”%s” ändrades (mtime)" - - #: nscd/cache.c:341 - #, c-format -@@ -3906,34 +3906,32 @@ msgstr "kan inte få uttag (socket) att acceptera förbindelser: %s" - #: nscd/connections.c:973 - #, c-format - msgid "disabled inotify-based monitoring for file `%s': %s" --msgstr "" -+msgstr "avaktiverade inotify-baserad övervakning för filen ”%s”: %s" - - #: nscd/connections.c:977 - #, c-format - msgid "monitoring file `%s` (%d)" --msgstr "" -+msgstr "övervakar filen ”%s” (%d)" - - #: nscd/connections.c:990 - #, c-format - msgid "disabled inotify-based monitoring for directory `%s': %s" --msgstr "" -+msgstr "avaktiverade inotify-baserad övervakning av katalogen ”%s”: %s" - - #: nscd/connections.c:994 --#, fuzzy, c-format --#| msgid "Can't open directory %s" -+#, c-format - msgid "monitoring directory `%s` (%d)" --msgstr "Kan inte öppna katalog %s" -+msgstr "övervakar katalogen ”%s” (%d)" - - #: nscd/connections.c:1022 --#, fuzzy, c-format --#| msgid "register trace file %s for database %s" -+#, c-format - msgid "monitoring file %s for database %s" --msgstr "registrera spårningsfil %s för databas %s" -+msgstr "övervakar filen %s för databas %s" - - #: nscd/connections.c:1032 - #, c-format - msgid "stat failed for file `%s'; will try again later: %s" --msgstr "" -+msgstr "stat misslyckades för filen ”%s”; kommer försöka igen senare: %s" - - #: nscd/connections.c:1151 - #, c-format -@@ -4032,44 +4030,42 @@ msgstr "handle_request: begäran mottagen (Version = %d)" - #: nscd/connections.c:1963 - #, c-format - msgid "ignored inotify event for `%s` (file exists)" --msgstr "" -+msgstr "ignorerade inotify-händelse för ”%s” (filen finns)" - - #: nscd/connections.c:1968 - #, c-format - msgid "monitored file `%s` was %s, removing watch" --msgstr "" -+msgstr "den övervakade filen ”%s” var %s, tar bort vakten" - - #: nscd/connections.c:1976 nscd/connections.c:2018 - #, c-format - msgid "failed to remove file watch `%s`: %s" --msgstr "" -+msgstr "misslyckades att ta bort filvakt ”%s”: %s" - - #: nscd/connections.c:1991 - #, c-format - msgid "monitored file `%s` was written to" --msgstr "" -+msgstr "den övervakade filen ”%s” skrevs till" - - #: nscd/connections.c:2015 - #, c-format - msgid "monitored parent directory `%s` was %s, removing watch on `%s`" --msgstr "" -+msgstr "den övervakade föräldrakatalogen ”%s” var %s, tar bort vakten av ”%s”" - - #: nscd/connections.c:2041 - #, c-format - msgid "monitored file `%s` was %s, adding watch" --msgstr "" -+msgstr "den övervakade filen ”%s” var %s, lägger till vakt" - - #: nscd/connections.c:2053 --#, fuzzy, c-format --#| msgid "failed to load shared object `%s'" -+#, c-format - msgid "failed to add file watch `%s`: %s" --msgstr "misslyckades med att ladda delat objekt \"%s\"" -+msgstr "misslyckades med att lägga till filvakt ”%s”: %s" - - #: nscd/connections.c:2247 nscd/connections.c:2428 --#, fuzzy, c-format --#| msgid "disabled inotify after read error %d" -+#, c-format - msgid "disabled inotify-based monitoring after read error %d" --msgstr "inaktiverade inotify efter läsfel %d" -+msgstr "avaktiverade inotify-baserad övervakning efter läsfel %d" - - #: nscd/connections.c:2543 - msgid "could not initialize conditional variable" -@@ -4199,7 +4195,7 @@ msgstr "Använd separat cache för varje användare" - - #: nscd/nscd.c:122 - msgid "Name Service Cache Daemon." --msgstr "Namntjänst cache-demon" -+msgstr "Cache-demon för namntjänsten." - - #: nscd/nscd.c:155 nss/getent.c:1007 nss/makedb.c:206 - #, c-format -@@ -4531,11 +4527,11 @@ msgstr "Access Vector Cache (AVC) startad" - - #: nscd/selinux.c:368 - msgid "Error querying policy for undefined object classes or permissions." --msgstr "Fel när policy för odefinierade objektklasser eller rättigheter hämtades" -+msgstr "Fel när policy för odefinierade objektklasser eller rättigheter hämtades." - - #: nscd/selinux.c:375 - msgid "Error getting security class for nscd." --msgstr "Fel när säkerhetsklass för nscd hämtades" -+msgstr "Fel när säkerhetsklass för nscd hämtades." - - #: nscd/selinux.c:380 - #, c-format -@@ -4609,7 +4605,7 @@ msgstr "inaktivera DIN-kodning" - - #: nss/getent.c:64 - msgid "Get entries from administrative database." --msgstr "Hämta poster från den administrativa databasen" -+msgstr "Hämta poster från den administrativa databasen." - - #: nss/getent.c:148 nss/getent.c:477 nss/getent.c:522 - #, c-format -@@ -4652,7 +4648,7 @@ msgstr "Genererad rad som inte ingår i iterationen" - - #: nss/makedb.c:131 - msgid "Create simple database from textual input." --msgstr "Skapa en enkel databas från textuell indata" -+msgstr "Skapa en enkel databas från textuell indata." - - #: nss/makedb.c:134 - msgid "" -@@ -5412,7 +5408,7 @@ msgstr "Kan inte ange netid-flaggan utan TIRPC!\n" - #: sunrpc/rpc_main.c:1374 - #, c-format - msgid "Cannot use table flags with newstyle!\n" --msgstr "Kan inte ange tabellflaggor med ny stil\n" -+msgstr "Kan inte ange tabellflaggor med ny stil!\n" - - #: sunrpc/rpc_main.c:1393 - #, c-format -@@ -7270,18 +7266,9 @@ msgstr "tidszonsförkortning skiljer sig från POSIX-standarden" - - #: timezone/zic.c:2789 - msgid "too many, or too long, time zone abbreviations" --msgstr "för många eller för långa tidszonförkortningar" -+msgstr "för många eller för långa tidszonsförkortningar" - - #: timezone/zic.c:2829 - #, c-format - msgid "%s: Can't create directory %s: %s\n" - msgstr "%s: Kan inte skapa katalog %s: %s\n" -- --#~ msgid "cannot load any more object with static TLS" --#~ msgstr "kan inte ladda fler objekt med statiskt TLS" -- --#~ msgid "%s: no PLTREL found in object %s\n" --#~ msgstr "%s: hittade inga PLTREL i objekt %s\n" -- --#~ msgid "cannot create internal descriptors" --#~ msgstr "kan inte skapa interna deskriptorer" -diff --git a/posix/execvpe.c b/posix/execvpe.c -index d933f9c92a..7cdb06a611 100644 ---- a/posix/execvpe.c -+++ b/posix/execvpe.c -@@ -48,12 +48,13 @@ maybe_script_execute (const char *file, char *const argv[], char *const envp[]) - } - } - -- /* Construct an argument list for the shell. */ -+ /* Construct an argument list for the shell. It will contain at minimum 3 -+ arguments (current shell, script, and an ending NULL. */ - char *new_argv[argc + 1]; - new_argv[0] = (char *) _PATH_BSHELL; - new_argv[1] = (char *) file; - if (argc > 1) -- memcpy (new_argv + 2, argv + 1, argc * sizeof(char *)); -+ memcpy (new_argv + 2, argv + 1, (argc - 1) * sizeof(char *)); - else - new_argv[2] = NULL; - -@@ -91,10 +92,11 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - /* Although GLIBC does not enforce NAME_MAX, we set it as the maximum - size to avoid unbounded stack allocation. Same applies for - PATH_MAX. */ -- size_t file_len = __strnlen (file, NAME_MAX + 1); -+ size_t file_len = __strnlen (file, NAME_MAX) + 1; - size_t path_len = __strnlen (path, PATH_MAX - 1) + 1; - -- if ((file_len > NAME_MAX) -+ /* NAME_MAX does not include the terminating null character. */ -+ if (((file_len-1) > NAME_MAX) - || !__libc_alloca_cutoff (path_len + file_len + 1)) - { - errno = ENAMETOOLONG; -@@ -103,6 +105,9 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - - const char *subp; - bool got_eacces = false; -+ /* The resulting string maximum size would be potentially a entry -+ in PATH plus '/' (path_len + 1) and then the the resulting file name -+ plus '\0' (file_len since it already accounts for the '\0'). */ - char buffer[path_len + file_len + 1]; - for (const char *p = path; ; p = subp) - { -@@ -123,7 +128,7 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - execute. */ - char *pend = mempcpy (buffer, p, subp - p); - *pend = '/'; -- memcpy (pend + (p < subp), file, file_len + 1); -+ memcpy (pend + (p < subp), file, file_len); - - __execve (buffer, argv, envp); - -diff --git a/resolv/Makefile b/resolv/Makefile -index 8be41d3ae1..a4c86b9762 100644 ---- a/resolv/Makefile -+++ b/resolv/Makefile -@@ -40,6 +40,9 @@ ifeq ($(have-thread-library),yes) - extra-libs += libanl - routines += gai_sigqueue - tests += tst-res_hconf_reorder -+ -+# This test sends millions of packets and is rather slow. -+xtests += tst-resolv-qtypes - endif - extra-libs-others = $(extra-libs) - libresolv-routines := gethnamaddr res_comp res_debug \ -@@ -117,3 +120,5 @@ tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace - $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out - $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@; \ - $(evaluate-test) -+ -+$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library) -diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c -index 5f9e35701b..d16fa4b8ed 100644 ---- a/resolv/nss_dns/dns-host.c -+++ b/resolv/nss_dns/dns-host.c -@@ -323,7 +323,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, - - int olderr = errno; - enum nss_status status; -- int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC, -+ int n = __libc_res_nsearch (&_res, name, C_IN, T_QUERY_A_AND_AAAA, - host_buffer.buf->buf, 2048, &host_buffer.ptr, - &ans2p, &nans2p, &resplen2, &ans2p_malloced); - if (n >= 0) -diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c -index 12f9730199..d80b5318e5 100644 ---- a/resolv/res_mkquery.c -+++ b/resolv/res_mkquery.c -@@ -103,6 +103,10 @@ res_nmkquery(res_state statp, - int n; - u_char *dnptrs[20], **dpp, **lastdnptr; - -+ if (class < 0 || class > 65535 -+ || type < 0 || type > 65535) -+ return -1; -+ - #ifdef DEBUG - if (statp->options & RES_DEBUG) - printf(";; res_nmkquery(%s, %s, %s, %s)\n", -diff --git a/resolv/res_query.c b/resolv/res_query.c -index 944d1a90f5..07dc6f6583 100644 ---- a/resolv/res_query.c -+++ b/resolv/res_query.c -@@ -122,7 +122,7 @@ __libc_res_nquery(res_state statp, - int n, use_malloc = 0; - u_int oflags = statp->_flags; - -- size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE; -+ size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE; - u_char *buf = alloca (bufsize); - u_char *query1 = buf; - int nquery1 = -1; -@@ -137,7 +137,7 @@ __libc_res_nquery(res_state statp, - printf(";; res_query(%s, %d, %d)\n", name, class, type); - #endif - -- if (type == T_UNSPEC) -+ if (type == T_QUERY_A_AND_AAAA) - { - n = res_nmkquery(statp, QUERY, name, class, T_A, NULL, 0, NULL, - query1, bufsize); -@@ -190,7 +190,7 @@ __libc_res_nquery(res_state statp, - if (__builtin_expect (n <= 0, 0) && !use_malloc) { - /* Retry just in case res_nmkquery failed because of too - short buffer. Shouldn't happen. */ -- bufsize = (type == T_UNSPEC ? 2 : 1) * MAXPACKET; -+ bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * MAXPACKET; - buf = malloc (bufsize); - if (buf != NULL) { - query1 = buf; -diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c -new file mode 100644 -index 0000000000..b3e60c693b ---- /dev/null -+++ b/resolv/tst-resolv-qtypes.c -@@ -0,0 +1,185 @@ -+/* Exercise low-level query functions with different QTYPEs. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* If ture, the response function will send the actual response packet -+ over TCP instead of UDP. */ -+static volatile bool force_tcp; -+ -+/* Send back a fake resource record matching the QTYPE. */ -+static void -+response (const struct resolv_response_context *ctx, -+ struct resolv_response_builder *b, -+ const char *qname, uint16_t qclass, uint16_t qtype) -+{ -+ if (force_tcp && ctx->tcp) -+ { -+ resolv_response_init (b, (struct resolv_response_flags) { .tc = 1 }); -+ resolv_response_add_question (b, qname, qclass, qtype); -+ return; -+ } -+ -+ resolv_response_init (b, (struct resolv_response_flags) { }); -+ resolv_response_add_question (b, qname, qclass, qtype); -+ resolv_response_section (b, ns_s_an); -+ resolv_response_open_record (b, qname, qclass, qtype, 0); -+ resolv_response_add_data (b, &qtype, sizeof (qtype)); -+ resolv_response_close_record (b); -+} -+ -+static const const char *domain = "www.example.com"; -+ -+static int -+wrap_res_query (int type, unsigned char *answer, int answer_length) -+{ -+ return res_query (domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_search (int type, unsigned char *answer, int answer_length) -+{ -+ return res_query (domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_querydomain (int type, unsigned char *answer, int answer_length) -+{ -+ return res_querydomain ("www", "example.com", C_IN, type, -+ answer, answer_length); -+} -+ -+static int -+wrap_res_send (int type, unsigned char *answer, int answer_length) -+{ -+ unsigned char buf[512]; -+ int ret = res_mkquery (QUERY, domain, C_IN, type, -+ (const unsigned char *) "", 0, NULL, -+ buf, sizeof (buf)); -+ if (type < 0 || type >= 65536) -+ { -+ /* res_mkquery fails for out-of-range record types. */ -+ TEST_VERIFY_EXIT (ret == -1); -+ return -1; -+ } -+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ -+ return res_send (buf, ret, answer, answer_length); -+} -+ -+static int -+wrap_res_nquery (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_nsearch (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_nquerydomain (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquerydomain (&_res, "www", "example.com", C_IN, type, -+ answer, answer_length); -+} -+ -+static int -+wrap_res_nsend (int type, unsigned char *answer, int answer_length) -+{ -+ unsigned char buf[512]; -+ int ret = res_nmkquery (&_res, QUERY, domain, C_IN, type, -+ (const unsigned char *) "", 0, NULL, -+ buf, sizeof (buf)); -+ if (type < 0 || type >= 65536) -+ { -+ /* res_mkquery fails for out-of-range record types. */ -+ TEST_VERIFY_EXIT (ret == -1); -+ return -1; -+ } -+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ -+ return res_nsend (&_res, buf, ret, answer, answer_length); -+} -+ -+static void -+test_function (const char *fname, -+ int (*func) (int type, -+ unsigned char *answer, int answer_length)) -+{ -+ unsigned char buf[512]; -+ for (int tcp = 0; tcp < 2; ++tcp) -+ { -+ force_tcp = tcp; -+ for (unsigned int type = 1; type <= 65535; ++type) -+ { -+ if (test_verbose) -+ printf ("info: sending QTYPE %d with %s (tcp=%d)\n", -+ type, fname, tcp); -+ int ret = func (type, buf, sizeof (buf)); -+ if (ret != 47) -+ FAIL_EXIT1 ("%s tcp=%d qtype=%d return value %d", -+ fname,tcp, type, ret); -+ /* One question, one answer record. */ -+ TEST_VERIFY (memcmp (buf + 4, "\0\1\0\1\0\0\0\0", 8) == 0); -+ /* Question section. */ -+ static const char qname[] = "\3www\7example\3com"; -+ size_t qname_length = sizeof (qname); -+ TEST_VERIFY (memcmp (buf + 12, qname, qname_length) == 0); -+ /* RDATA part of answer. */ -+ uint16_t type16 = type; -+ TEST_VERIFY (memcmp (buf + ret - 2, &type16, sizeof (type16)) == 0); -+ } -+ } -+ -+ TEST_VERIFY (func (-1, buf, sizeof (buf) == -1)); -+ TEST_VERIFY (func (65536, buf, sizeof (buf) == -1)); -+} -+ -+static int -+do_test (void) -+{ -+ struct resolv_redirect_config config = -+ { -+ .response_callback = response, -+ }; -+ struct resolv_test *obj = resolv_test_start (config); -+ -+ test_function ("res_query", &wrap_res_query); -+ test_function ("res_search", &wrap_res_search); -+ test_function ("res_querydomain", &wrap_res_querydomain); -+ test_function ("res_send", &wrap_res_send); -+ -+ test_function ("res_nquery", &wrap_res_nquery); -+ test_function ("res_nsearch", &wrap_res_nsearch); -+ test_function ("res_nquerydomain", &wrap_res_nquerydomain); -+ test_function ("res_nsend", &wrap_res_nsend); -+ -+ resolv_test_end (obj); -+ return 0; -+} -+ -+#define TIMEOUT 300 -+#include -diff --git a/scripts/backport-support.sh b/scripts/backport-support.sh -new file mode 100644 -index 0000000000..2ece7ce575 ---- /dev/null -+++ b/scripts/backport-support.sh -@@ -0,0 +1,110 @@ -+#!/bin/bash -+# Create a patch which backports the support/ subdirectory. -+# Copyright (C) 2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+ -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+ -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . -+ -+# This script does not backport the Makefile tweaks outside the -+# support/ directory (which need to be backported separately), or the -+# changes to test-skeleton.c (which should not be backported). -+ -+set -e -+ -+export LC_ALL=C -+export GIT_CONFIG=/dev/null -+export GTT_CONFIG_NOSYSTEM=0 -+export GIT_PAGER= -+ -+usage () { -+ cat >&2 <&2 -+ echo "# rm -rf $patch_targets" >&2 -+} -+ -+command_commit () { -+ git status --porcelain | while read line ; do -+ echo "error: working copy is not clean, cannot commit" >&2 -+ exit 1 -+ done -+ for path in $patch_targets; do -+ echo "# Processing $path" >&2 -+ case "$path" in -+ [a-zA-Z0-9]*/) -+ # Directory. -+ git rm --cached --ignore-unmatch -r "$path" -+ rm -rf "$path" -+ git read-tree --prefix="$path" "$latest_commit":"$path" -+ git checkout "$path" -+ ;; -+ *) -+ # File. -+ git show "$latest_commit":"$path" > "$path" -+ git add "$path" -+ esac -+ done -+ git commit -m "Synchronize support/ infrastructure with $branch_name -+ -+This commit updates the support/ subdirectory to -+commit $latest_commit -+on the $branch_name branch. -+" -+} -+ -+command_$command -diff --git a/sunrpc/Makefile b/sunrpc/Makefile -index 789ef423e5..1e91905011 100644 ---- a/sunrpc/Makefile -+++ b/sunrpc/Makefile -@@ -96,13 +96,18 @@ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ - extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs)) - others += rpcgen - --tests = tst-xdrmem tst-xdrmem2 test-rpcent -+tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error - xtests := tst-getmyaddr - - ifeq ($(have-thread-library),yes) - xtests += thrsvc - endif - -+ifeq ($(run-built-tests),yes) -+rpcgen-tests := $(objpfx)bug20790.out -+tests-special += $(rpcgen-tests) -+endif -+ - headers += $(rpcsvc:%.x=rpcsvc/%.h) - extra-libs := librpcsvc - extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. -@@ -153,6 +158,7 @@ BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS) - $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so - $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so - $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so -+$(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so - - $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) - -@@ -225,3 +231,9 @@ endif - endif - - $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library) -+ -+ifeq ($(run-built-tests),yes) -+$(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen -+ $(built-program-cmd) -c $< -o $@; \ -+ $(evaluate-test) -+endif -diff --git a/sunrpc/bug20790.x b/sunrpc/bug20790.x -new file mode 100644 -index 0000000000..a00c9b3830 ---- /dev/null -+++ b/sunrpc/bug20790.x -@@ -0,0 +1 @@ -+program TPROG { version TVERS { int FUNC(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) = 1; } = 1; } = 1; -diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c -index 4d9acb1e6a..1de25cb771 100644 ---- a/sunrpc/clnt_udp.c -+++ b/sunrpc/clnt_udp.c -@@ -421,9 +421,9 @@ send_again: - cmsg = CMSG_NXTHDR (&msg, cmsg)) - if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) - { -- free (cbuf); - e = (struct sock_extended_err *) CMSG_DATA(cmsg); - cu->cu_error.re_errno = e->ee_errno; -+ free (cbuf); - return (cu->cu_error.re_status = RPC_CANTRECV); - } - free (cbuf); -diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c -index 1a1df6d8c2..505a6554cf 100644 ---- a/sunrpc/rpc_parse.c -+++ b/sunrpc/rpc_parse.c -@@ -521,7 +521,7 @@ static void - get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ ) - { - token tok; -- char name[10]; /* argument name */ -+ char name[MAXLINESIZE]; /* argument name */ - - if (dkind == DEF_PROGRAM) - { -diff --git a/sunrpc/tst-udp-error.c b/sunrpc/tst-udp-error.c -new file mode 100644 -index 0000000000..1efc02f5c6 ---- /dev/null -+++ b/sunrpc/tst-udp-error.c -@@ -0,0 +1,62 @@ -+/* Check for use-after-free in clntudp_call (bug 21115). -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ support_become_root (); -+ support_enter_network_namespace (); -+ -+ /* Obtain a likely-unused port number. */ -+ struct sockaddr_in sin = -+ { -+ .sin_family = AF_INET, -+ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), -+ }; -+ { -+ int fd = xsocket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); -+ xbind (fd, (struct sockaddr *) &sin, sizeof (sin)); -+ socklen_t sinlen = sizeof (sin); -+ xgetsockname (fd, (struct sockaddr *) &sin, &sinlen); -+ /* Close the socket, so that we will receive an error below. */ -+ close (fd); -+ } -+ -+ int sock = RPC_ANYSOCK; -+ CLIENT *clnt = clntudp_create -+ (&sin, 1, 2, (struct timeval) { 1, 0 }, &sock); -+ TEST_VERIFY_EXIT (clnt != NULL); -+ TEST_VERIFY (clnt_call (clnt, 3, -+ (xdrproc_t) xdr_void, NULL, -+ (xdrproc_t) xdr_void, NULL, -+ ((struct timeval) { 3, 0 })) -+ == RPC_CANTRECV); -+ clnt_destroy (clnt); -+ -+ return 0; -+} -+ -+#include -diff --git a/support/Makefile b/support/Makefile -new file mode 100644 -index 0000000000..20b0343ade ---- /dev/null -+++ b/support/Makefile -@@ -0,0 +1,146 @@ -+# Makefile for support library, used only at build and test time -+# Copyright (C) 2016-2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+ -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+ -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . -+ -+subdir := support -+ -+include ../Makeconfig -+ -+extra-libs := libsupport -+extra-libs-others = $(extra-libs) -+extra-libs-noinstall := $(extra-libs) -+ -+libsupport-routines = \ -+ check \ -+ check_addrinfo \ -+ check_dns_packet \ -+ check_hostent \ -+ check_netent \ -+ delayed_exit \ -+ ignore_stderr \ -+ oom_error \ -+ resolv_test \ -+ set_fortify_handler \ -+ support-xstat \ -+ support_become_root \ -+ support_can_chroot \ -+ support_capture_subprocess \ -+ support_capture_subprocess_check \ -+ support_enter_network_namespace \ -+ support_format_address_family \ -+ support_format_addrinfo \ -+ support_format_dns_packet \ -+ support_format_herrno \ -+ support_format_hostent \ -+ support_format_netent \ -+ support_isolate_in_subprocess \ -+ support_record_failure \ -+ support_run_diff \ -+ support_shared_allocate \ -+ support_write_file_string \ -+ support_test_main \ -+ support_test_verify_impl \ -+ temp_file \ -+ write_message \ -+ xaccept \ -+ xaccept4 \ -+ xasprintf \ -+ xbind \ -+ xcalloc \ -+ xchroot \ -+ xclose \ -+ xconnect \ -+ xdup2 \ -+ xfclose \ -+ xfopen \ -+ xfork \ -+ xgetsockname \ -+ xlisten \ -+ xmalloc \ -+ xmemstream \ -+ xmkdir \ -+ xmmap \ -+ xmunmap \ -+ xopen \ -+ xpipe \ -+ xpoll \ -+ xpthread_attr_destroy \ -+ xpthread_attr_init \ -+ xpthread_attr_setdetachstate \ -+ xpthread_attr_setstacksize \ -+ xpthread_barrier_destroy \ -+ xpthread_barrier_init \ -+ xpthread_barrier_wait \ -+ xpthread_cancel \ -+ xpthread_check_return \ -+ xpthread_cond_wait \ -+ xpthread_create \ -+ xpthread_detach \ -+ xpthread_join \ -+ xpthread_mutex_consistent \ -+ xpthread_mutex_destroy \ -+ xpthread_mutex_init \ -+ xpthread_mutex_lock \ -+ xpthread_mutex_unlock \ -+ xpthread_mutexattr_destroy \ -+ xpthread_mutexattr_init \ -+ xpthread_mutexattr_setprotocol \ -+ xpthread_mutexattr_setpshared \ -+ xpthread_mutexattr_setrobust \ -+ xpthread_mutexattr_settype \ -+ xpthread_once \ -+ xpthread_sigmask \ -+ xpthread_spin_lock \ -+ xpthread_spin_unlock \ -+ xrealloc \ -+ xrecvfrom \ -+ xsendto \ -+ xsetsockopt \ -+ xsocket \ -+ xstrdup \ -+ xwaitpid \ -+ xwrite \ -+ -+libsupport-static-only-routines := $(libsupport-routines) -+# Only build one variant of the library. -+libsupport-inhibit-o := .os -+ifeq ($(build-shared),yes) -+libsupport-inhibit-o += .o -+endif -+ -+tests = \ -+ README-testing \ -+ tst-support-namespace \ -+ tst-support_capture_subprocess \ -+ tst-support_format_dns_packet \ -+ tst-support_record_failure \ -+ -+ifeq ($(run-built-tests),yes) -+tests-special = \ -+ $(objpfx)tst-support_record_failure-2.out -+ -+$(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ -+ $(objpfx)tst-support_record_failure -+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ -+ '$(run-program-env)' '$(test-program-prefix-after-env)' \ -+ > $@; \ -+ $(evaluate-test) -+endif -+ -+$(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so -+ -+include ../Rules -diff --git a/support/README b/support/README -new file mode 100644 -index 0000000000..476cfcda59 ---- /dev/null -+++ b/support/README -@@ -0,0 +1,29 @@ -+This subdirectory contains infrastructure which is not put into -+installed libraries, but may be linked into programs (installed or -+not) and tests. -+ -+# Error-checking wrappers -+ -+These wrappers test for error return codes an terminate the process on -+error. They are declared in these header files: -+ -+* support.h -+* xsignal.h -+* xthread.h -+ -+In general, new wrappers should be added to support.h if possible. -+However, support.h must remain fully compatible with C90 and therefore -+cannot include headers which use identifers not reserved in C90. If -+the wrappers need additional types, additional headers such as -+signal.h need to be introduced. -+ -+# Test framework -+ -+The test framework provides a main program for tests, including a -+timeout for hanging tests. See README-testing.c for a minimal -+example, and test-driver.c for details how to use it. The following -+header files provide related declarations: -+ -+* check.h -+* temp_file.h -+* test-driver.h -diff --git a/support/README-testing.c b/support/README-testing.c -new file mode 100644 -index 0000000000..9d289c3020 ---- /dev/null -+++ b/support/README-testing.c -@@ -0,0 +1,19 @@ -+/* This file contains an example test case which shows minimal use of -+ the test framework. Additional testing hooks are described in -+ . */ -+ -+/* This function will be called from the test driver. */ -+static int -+do_test (void) -+{ -+ if (3 == 5) -+ /* Indicate failure. */ -+ return 1; -+ else -+ /* Indicate success. */ -+ return 0; -+} -+ -+/* This file references do_test above and contains the definition of -+ the main function. */ -+#include -diff --git a/support/capture_subprocess.h b/support/capture_subprocess.h -new file mode 100644 -index 0000000000..43caf9bce4 ---- /dev/null -+++ b/support/capture_subprocess.h -@@ -0,0 +1,61 @@ -+/* Capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CAPTURE_SUBPROCESS_H -+#define SUPPORT_CAPTURE_SUBPROCESS_H -+ -+#include -+ -+struct support_capture_subprocess -+{ -+ struct xmemstream out; -+ struct xmemstream err; -+ int status; -+}; -+ -+/* Invoke CALLBACK (CLOSURE) in a subprocess and capture standard -+ output, standard error, and the exit status. The out.buffer and -+ err.buffer members in the result are null-terminated strings which -+ can be examined by the caller (out.out and err.out are NULL). */ -+struct support_capture_subprocess support_capture_subprocess -+ (void (*callback) (void *), void *closure); -+ -+/* Deallocate the subprocess data captured by -+ support_capture_subprocess. */ -+void support_capture_subprocess_free (struct support_capture_subprocess *); -+ -+enum support_capture_allow -+{ -+ /* No output is allowed. */ -+ sc_allow_none = 0x01, -+ /* Output to stdout is permitted. */ -+ sc_allow_stdout = 0x02, -+ /* Output to standard error is permitted. */ -+ sc_allow_stderr = 0x04, -+}; -+ -+/* Check that the subprocess exited with STATUS and that only the -+ allowed outputs happened. ALLOWED is a combination of -+ support_capture_allow flags. Report errors under the CONTEXT -+ message. */ -+void support_capture_subprocess_check (struct support_capture_subprocess *, -+ const char *context, int status, -+ int allowed) -+ __attribute__ ((nonnull (1, 2))); -+ -+#endif /* SUPPORT_CAPTURE_SUBPROCESS_H */ -diff --git a/support/check.c b/support/check.c -new file mode 100644 -index 0000000000..592f2bc856 ---- /dev/null -+++ b/support/check.c -@@ -0,0 +1,57 @@ -+/* Support code for reporting test results. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+static void -+print_failure (const char *file, int line, const char *format, va_list ap) -+{ -+ printf ("error: %s:%d: ", file, line); -+ vprintf (format, ap); -+ puts (""); -+} -+ -+int -+support_print_failure_impl (const char *file, int line, -+ const char *format, ...) -+{ -+ support_record_failure (); -+ va_list ap; -+ va_start (ap, format); -+ print_failure (file, line, format, ap); -+ va_end (ap); -+ return 1; -+} -+ -+void -+support_exit_failure_impl (int status, const char *file, int line, -+ const char *format, ...) -+{ -+ if (status != EXIT_SUCCESS && status != EXIT_UNSUPPORTED) -+ support_record_failure (); -+ va_list ap; -+ va_start (ap, format); -+ print_failure (file, line, format, ap); -+ va_end (ap); -+ exit (status); -+} -diff --git a/support/check.h b/support/check.h -new file mode 100644 -index 0000000000..1d244a3557 ---- /dev/null -+++ b/support/check.h -@@ -0,0 +1,94 @@ -+/* Functionality for reporting test results. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CHECK_H -+#define SUPPORT_CHECK_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+/* Record a test failure, print the failure message to standard output -+ and return 1. */ -+#define FAIL_RET(...) \ -+ return support_print_failure_impl (__FILE__, __LINE__, __VA_ARGS__) -+ -+/* Print the failure message and terminate the process with STATUS. -+ Record a the process as failed if STATUS is neither EXIT_SUCCESS -+ nor EXIT_UNSUPPORTED. */ -+#define FAIL_EXIT(status, ...) \ -+ support_exit_failure_impl (status, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Record a test failure, print the failure message and terminate with -+ exit status 1. */ -+#define FAIL_EXIT1(...) \ -+ support_exit_failure_impl (1, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Print failure message and terminate with as unsupported test (exit -+ status of 77). */ -+#define FAIL_UNSUPPORTED(...) \ -+ support_exit_failure_impl (77, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Record a test failure (but continue executing) if EXPR evaluates to -+ false. */ -+#define TEST_VERIFY(expr) \ -+ ({ \ -+ if (expr) \ -+ ; \ -+ else \ -+ support_test_verify_impl (-1, __FILE__, __LINE__, #expr); \ -+ }) -+ -+/* Record a test failure and exit if EXPR evaluates to false. */ -+#define TEST_VERIFY_EXIT(expr) \ -+ ({ \ -+ if (expr) \ -+ ; \ -+ else \ -+ support_test_verify_impl (1, __FILE__, __LINE__, #expr); \ -+ }) -+ -+int support_print_failure_impl (const char *file, int line, -+ const char *format, ...) -+ __attribute__ ((nonnull (1), format (printf, 3, 4))); -+void support_exit_failure_impl (int exit_status, -+ const char *file, int line, -+ const char *format, ...) -+ __attribute__ ((noreturn, nonnull (2), format (printf, 4, 5))); -+void support_test_verify_impl (int status, const char *file, int line, -+ const char *expr); -+ -+/* Record a test failure. This function returns and does not -+ terminate the process. The failure counter is stored in a shared -+ memory mapping, so that failures reported in child processes are -+ visible to the parent process and test driver. This function -+ depends on initialization by an ELF constructor, so it can only be -+ invoked after the test driver has run. Note that this function -+ does not support reporting failures from a DSO. */ -+void support_record_failure (void); -+ -+/* Internal function called by the test driver. */ -+int support_report_failure (int status) -+ __attribute__ ((weak, warn_unused_result)); -+ -+/* Internal function used to test the failure recording framework. */ -+void support_record_failure_reset (void); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_CHECK_H */ -diff --git a/support/check_addrinfo.c b/support/check_addrinfo.c -new file mode 100644 -index 0000000000..55895ace3c ---- /dev/null -+++ b/support/check_addrinfo.c -@@ -0,0 +1,42 @@ -+/* Compare struct addrinfo values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_addrinfo (const char *query_description, struct addrinfo *ai, int ret, -+ const char *expected) -+{ -+ char *formatted = support_format_addrinfo (ai, ret); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: addrinfo comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_dns_packet.c b/support/check_dns_packet.c -new file mode 100644 -index 0000000000..d2a31bed7b ---- /dev/null -+++ b/support/check_dns_packet.c -@@ -0,0 +1,42 @@ -+/* Check that a DNS packet buffer has the expected contents. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_dns_packet (const char *query_description, -+ const unsigned char *buffer, size_t length, -+ const char *expected) -+{ -+ char *formatted = support_format_dns_packet (buffer, length); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: packet comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_hostent.c b/support/check_hostent.c -new file mode 100644 -index 0000000000..890d672d50 ---- /dev/null -+++ b/support/check_hostent.c -@@ -0,0 +1,42 @@ -+/* Compare struct hostent values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_hostent (const char *query_description, struct hostent *h, -+ const char *expected) -+{ -+ char *formatted = support_format_hostent (h); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: hostent comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_netent.c b/support/check_netent.c -new file mode 100644 -index 0000000000..daa3083fd1 ---- /dev/null -+++ b/support/check_netent.c -@@ -0,0 +1,42 @@ -+/* Compare struct netent values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_netent (const char *query_description, struct netent *e, -+ const char *expected) -+{ -+ char *formatted = support_format_netent (e); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: netent comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_nss.h b/support/check_nss.h -new file mode 100644 -index 0000000000..2893f2c295 ---- /dev/null -+++ b/support/check_nss.h -@@ -0,0 +1,42 @@ -+/* Test verification functions for NSS- and DNS-related data. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CHECK_NSS_H -+#define SUPPORT_CHECK_NSS_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Compare the data structures against the expected values (which have -+ to be formatted according to the support_format_* functions in -+ ). If there is a difference, a delayed test -+ failure is recorded, and a diff is written to standard output. */ -+void check_addrinfo (const char *query_description, -+ struct addrinfo *, int ret, const char *expected); -+void check_dns_packet (const char *query_description, -+ const unsigned char *, size_t, const char *expected); -+void check_hostent (const char *query_description, -+ struct hostent *, const char *expected); -+void check_netent (const char *query_description, -+ struct netent *, const char *expected); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_CHECK_NSS_H */ -diff --git a/support/delayed_exit.c b/support/delayed_exit.c -new file mode 100644 -index 0000000000..67442f95df ---- /dev/null -+++ b/support/delayed_exit.c -@@ -0,0 +1,55 @@ -+/* Time-triggered process termination. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static void * -+delayed_exit_thread (void *seconds_as_ptr) -+{ -+ int seconds = (uintptr_t) seconds_as_ptr; -+ struct timespec delay = { seconds, 0 }; -+ struct timespec remaining = { 0 }; -+ if (nanosleep (&delay, &remaining) != 0) -+ FAIL_EXIT1 ("nanosleep: %m"); -+ /* Exit the process sucessfully. */ -+ exit (0); -+ return NULL; -+} -+ -+void -+delayed_exit (int seconds) -+{ -+ /* Create the new thread with all signals blocked. */ -+ sigset_t all_blocked; -+ sigfillset (&all_blocked); -+ sigset_t old_set; -+ xpthread_sigmask (SIG_SETMASK, &all_blocked, &old_set); -+ /* Create a detached thread. */ -+ pthread_t thr = xpthread_create -+ (NULL, delayed_exit_thread, (void *) (uintptr_t) seconds); -+ xpthread_detach (thr); -+ /* Restore the original signal mask. */ -+ xpthread_sigmask (SIG_SETMASK, &old_set, NULL); -+} -diff --git a/support/format_nss.h b/support/format_nss.h -new file mode 100644 -index 0000000000..fb4597c238 ---- /dev/null -+++ b/support/format_nss.h -@@ -0,0 +1,41 @@ -+/* String formatting functions for NSS- and DNS-related data. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_FORMAT_NSS_H -+#define SUPPORT_FORMAT_NSS_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* The following functions format their arguments as human-readable -+ strings (which can span multiple lines). The caller must free the -+ returned buffer. For NULL pointers or failure status arguments, -+ error variables such as h_errno and errno are included in the -+ result. */ -+char *support_format_address_family (int); -+char *support_format_addrinfo (struct addrinfo *, int ret); -+char *support_format_dns_packet (const unsigned char *buffer, size_t length); -+char *support_format_herrno (int); -+char *support_format_hostent (struct hostent *); -+char *support_format_netent (struct netent *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_FORMAT_NSS_H */ -diff --git a/support/ignore_stderr.c b/support/ignore_stderr.c -new file mode 100644 -index 0000000000..7b77a2cd56 ---- /dev/null -+++ b/support/ignore_stderr.c -@@ -0,0 +1,38 @@ -+/* Avoid all the buffer overflow messages on stderr. -+ Copyright (C) 2015-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void -+ignore_stderr (void) -+{ -+ int fd = open (_PATH_DEVNULL, O_WRONLY); -+ if (fd == -1) -+ close (STDERR_FILENO); -+ else -+ { -+ dup2 (fd, STDERR_FILENO); -+ close (fd); -+ } -+ setenv ("LIBC_FATAL_STDERR_", "1", 1); -+} -diff --git a/support/namespace.h b/support/namespace.h -new file mode 100644 -index 0000000000..e1ccaa1ef0 ---- /dev/null -+++ b/support/namespace.h -@@ -0,0 +1,65 @@ -+/* Entering namespaces for test case isolation. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_NAMESPACE_H -+#define SUPPORT_NAMESPACE_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Attempts to become root (or acquire root-like privileges), possibly -+ with the help of user namespaces. Return true if (restricted) root -+ privileges could be attained in some way. Print diagnostics to -+ standard output. -+ -+ Note that this function generally has to be called before a process -+ becomes multi-threaded, otherwise it may fail with insufficient -+ privileges on systems which would support this operation for -+ single-threaded processes. */ -+bool support_become_root (void); -+ -+/* Return true if this process can perform a chroot operation. In -+ general, this is only possible if support_become_root has been -+ called. Note that the actual test is performed in a subprocess, -+ after fork, so that the file system root of the original process is -+ not changed. */ -+bool support_can_chroot (void); -+ -+/* Enter a network namespace (and a UTS namespace if possible) and -+ configure the loopback interface. Return true if a network -+ namespace could be created. Print diagnostics to standard output. -+ If a network namespace could be created, but networking in it could -+ not be configured, terminate the process. It is recommended to -+ call support_become_root before this function so that the process -+ has sufficient privileges. */ -+bool support_enter_network_namespace (void); -+ -+/* Return true if support_enter_network_namespace managed to enter a -+ UTS namespace. */ -+bool support_in_uts_namespace (void); -+ -+/* Invoke CALLBACK (CLOSURE) in a subprocess created using fork. -+ Terminate the calling process if the subprocess exits with a -+ non-zero exit status. */ -+void support_isolate_in_subprocess (void (*callback) (void *), void *closure); -+ -+__END_DECLS -+ -+#endif -diff --git a/sysdeps/sparc/sparc64/fpu/s_fdimf.S b/support/oom_error.c -similarity index 69% -rename from sysdeps/sparc/sparc64/fpu/s_fdimf.S -rename to support/oom_error.c -index 356c23c4e3..7816978273 100644 ---- a/sysdeps/sparc/sparc64/fpu/s_fdimf.S -+++ b/support/oom_error.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 64-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Reporting out-of-memory errors. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,15 +16,14 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- fcmps %f1, %f3 -- fbug 1f -- nop -- fzeros %f1 -- fnegs %f1, %f3 --1: retl -- fsubs %f1, %f3, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+#include -+ -+void -+oom_error (const char *function, size_t size) -+{ -+ printf ("%s: unable to allocate %zu bytes: %m\n", function, size); -+ exit (1); -+} -diff --git a/support/resolv_test.c b/support/resolv_test.c -new file mode 100644 -index 0000000000..050cd7154b ---- /dev/null -+++ b/support/resolv_test.c -@@ -0,0 +1,1202 @@ -+/* DNS test framework and libresolv redirection. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Response builder. */ -+ -+enum -+ { -+ max_response_length = 65536 -+ }; -+ -+/* List of pointers to be freed. The hash table implementation -+ (struct hsearch_data) does not provide a way to deallocate all -+ objects, so this approach is used to avoid memory leaks. */ -+struct to_be_freed -+{ -+ struct to_be_freed *next; -+ void *ptr; -+}; -+ -+struct resolv_response_builder -+{ -+ const unsigned char *query_buffer; -+ size_t query_length; -+ -+ size_t offset; /* Bytes written so far in buffer. */ -+ ns_sect section; /* Current section in the DNS packet. */ -+ unsigned int truncate_bytes; /* Bytes to remove at end of response. */ -+ bool drop; /* Discard generated response. */ -+ bool close; /* Close TCP client connection. */ -+ -+ /* Offset of the two-byte RDATA length field in the currently -+ written RDATA sub-structure. 0 if no RDATA is being written. */ -+ size_t current_rdata_offset; -+ -+ /* Hash table for locating targets for label compression. */ -+ struct hsearch_data compression_offsets; -+ /* List of pointers which need to be freed. Used for domain names -+ involved in label compression. */ -+ struct to_be_freed *to_be_freed; -+ -+ /* Must be last. Not zeroed for performance reasons. */ -+ unsigned char buffer[max_response_length]; -+}; -+ -+/* Response builder. */ -+ -+/* Add a pointer to the list of pointers to be freed when B is -+ deallocated. */ -+static void -+response_push_pointer_to_free (struct resolv_response_builder *b, void *ptr) -+{ -+ if (ptr == NULL) -+ return; -+ struct to_be_freed *e = xmalloc (sizeof (*e)); -+ *e = (struct to_be_freed) {b->to_be_freed, ptr}; -+ b->to_be_freed = e; -+} -+ -+void -+resolv_response_init (struct resolv_response_builder *b, -+ struct resolv_response_flags flags) -+{ -+ if (b->offset > 0) -+ FAIL_EXIT1 ("response_init: called at offset %zu", b->offset); -+ if (b->query_length < 12) -+ FAIL_EXIT1 ("response_init called for a query of size %zu", -+ b->query_length); -+ if (flags.rcode > 15) -+ FAIL_EXIT1 ("response_init: invalid RCODE %u", flags.rcode); -+ -+ /* Copy the transaction ID. */ -+ b->buffer[0] = b->query_buffer[0]; -+ b->buffer[1] = b->query_buffer[1]; -+ -+ /* Initialize the flags. */ -+ b->buffer[2] = 0x80; /* Mark as response. */ -+ b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */ -+ if (flags.tc) -+ b->buffer[2] |= 0x02; -+ b->buffer[3] = 0x80 | flags.rcode; /* Always set RA. */ -+ -+ /* Fill in the initial section count values. */ -+ b->buffer[4] = flags.qdcount >> 8; -+ b->buffer[5] = flags.qdcount; -+ b->buffer[6] = flags.ancount >> 8; -+ b->buffer[7] = flags.ancount; -+ b->buffer[8] = flags.nscount >> 8; -+ b->buffer[9] = flags.nscount; -+ b->buffer[10] = flags.adcount >> 8; -+ b->buffer[11] = flags.adcount; -+ -+ b->offset = 12; -+} -+ -+void -+resolv_response_section (struct resolv_response_builder *b, ns_sect section) -+{ -+ if (b->offset == 0) -+ FAIL_EXIT1 ("resolv_response_section: response_init not called before"); -+ if (section < b->section) -+ FAIL_EXIT1 ("resolv_response_section: cannot go back to previous section"); -+ b->section = section; -+} -+ -+/* Add a single byte to B. */ -+static inline void -+response_add_byte (struct resolv_response_builder *b, unsigned char ch) -+{ -+ if (b->offset == max_response_length) -+ FAIL_EXIT1 ("DNS response exceeds 64 KiB limit"); -+ b->buffer[b->offset] = ch; -+ ++b->offset; -+} -+ -+/* Add a 16-bit word VAL to B, in big-endian format. */ -+static void -+response_add_16 (struct resolv_response_builder *b, uint16_t val) -+{ -+ response_add_byte (b, val >> 8); -+ response_add_byte (b, val); -+} -+ -+/* Increment the pers-section record counter in the packet header. */ -+static void -+response_count_increment (struct resolv_response_builder *b) -+{ -+ unsigned int offset = b->section; -+ offset = 4 + 2 * offset; -+ ++b->buffer[offset + 1]; -+ if (b->buffer[offset + 1] == 0) -+ { -+ /* Carry. */ -+ ++b->buffer[offset]; -+ if (b->buffer[offset] == 0) -+ /* Overflow. */ -+ FAIL_EXIT1 ("too many records in section"); -+ } -+} -+ -+void -+resolv_response_add_question (struct resolv_response_builder *b, -+ const char *name, uint16_t class, uint16_t type) -+{ -+ if (b->offset == 0) -+ FAIL_EXIT1 ("resolv_response_add_question: " -+ "resolv_response_init not called"); -+ if (b->section != ns_s_qd) -+ FAIL_EXIT1 ("resolv_response_add_question: " -+ "must be called in the question section"); -+ -+ resolv_response_add_name (b, name); -+ response_add_16 (b, type); -+ response_add_16 (b, class); -+ -+ response_count_increment (b); -+} -+ -+void -+resolv_response_add_name (struct resolv_response_builder *b, -+ const char *const origname) -+{ -+ /* Normalized name. */ -+ char *name; -+ /* Normalized name with case preserved. */ -+ char *name_case; -+ { -+ size_t namelen = strlen (origname); -+ /* Remove trailing dots. FIXME: Handle trailing quoted dots. */ -+ while (namelen > 0 && origname[namelen - 1] == '.') -+ --namelen; -+ name = xmalloc (namelen + 1); -+ name_case = xmalloc (namelen + 1); -+ /* Copy and convert to lowercase. FIXME: This needs to normalize -+ escaping as well. */ -+ for (size_t i = 0; i < namelen; ++i) -+ { -+ char ch = origname[i]; -+ name_case[i] = ch; -+ if ('A' <= ch && ch <= 'Z') -+ ch = ch - 'A' + 'a'; -+ name[i] = ch; -+ } -+ name[namelen] = 0; -+ name_case[namelen] = 0; -+ } -+ char *name_start = name; -+ char *name_case_start = name_case; -+ -+ bool compression = false; -+ while (*name) -+ { -+ /* Search for a previous name we can reference. */ -+ ENTRY new_entry = -+ { -+ .key = name, -+ .data = (void *) (uintptr_t) b->offset, -+ }; -+ -+ /* If the label can be a compression target because it is at a -+ reachable offset, add it to the hash table. */ -+ ACTION action; -+ if (b->offset < (1 << 12)) -+ action = ENTER; -+ else -+ action = FIND; -+ -+ /* Search for known compression offsets in the hash table. */ -+ ENTRY *e; -+ if (hsearch_r (new_entry, action, &e, &b->compression_offsets) == 0) -+ { -+ if (action == FIND && errno == ESRCH) -+ /* Fall through. */ -+ e = NULL; -+ else -+ FAIL_EXIT1 ("hsearch_r failure in name compression: %m"); -+ } -+ -+ /* The name is known. Reference the previous location. */ -+ if (e != NULL && e->data != new_entry.data) -+ { -+ size_t old_offset = (uintptr_t) e->data; -+ response_add_byte (b, 0xC0 | (old_offset >> 8)); -+ response_add_byte (b, old_offset); -+ compression = true; -+ break; -+ } -+ -+ /* The name does not exist yet. Write one label. First, add -+ room for the label length. */ -+ size_t buffer_label_offset = b->offset; -+ response_add_byte (b, 0); -+ -+ /* Copy the label. */ -+ while (true) -+ { -+ char ch = *name_case; -+ if (ch == '\0') -+ break; -+ ++name; -+ ++name_case; -+ if (ch == '.') -+ break; -+ /* FIXME: Handle escaping. */ -+ response_add_byte (b, ch); -+ } -+ -+ /* Patch in the label length. */ -+ size_t label_length = b->offset - buffer_label_offset - 1; -+ if (label_length == 0) -+ FAIL_EXIT1 ("empty label in name compression: %s", origname); -+ if (label_length > 63) -+ FAIL_EXIT1 ("label too long in name compression: %s", origname); -+ b->buffer[buffer_label_offset] = label_length; -+ -+ /* Continue with the tail of the name and the next label. */ -+ } -+ -+ if (compression) -+ { -+ /* If we found an immediate match for the name, we have not put -+ it into the hash table, and can free it immediately. */ -+ if (name == name_start) -+ free (name_start); -+ else -+ response_push_pointer_to_free (b, name_start); -+ } -+ else -+ { -+ /* Terminate the sequence of labels. With compression, this is -+ implicit in the compression reference. */ -+ response_add_byte (b, 0); -+ response_push_pointer_to_free (b, name_start); -+ } -+ -+ free (name_case_start); -+} -+ -+void -+resolv_response_open_record (struct resolv_response_builder *b, -+ const char *name, -+ uint16_t class, uint16_t type, uint32_t ttl) -+{ -+ if (b->section == ns_s_qd) -+ FAIL_EXIT1 ("resolv_response_open_record called in question section"); -+ if (b->current_rdata_offset != 0) -+ FAIL_EXIT1 ("resolv_response_open_record called with open record"); -+ -+ resolv_response_add_name (b, name); -+ response_add_16 (b, type); -+ response_add_16 (b, class); -+ response_add_16 (b, ttl >> 16); -+ response_add_16 (b, ttl); -+ -+ b->current_rdata_offset = b->offset; -+ /* Add room for the RDATA length. */ -+ response_add_16 (b, 0); -+} -+ -+ -+void -+resolv_response_close_record (struct resolv_response_builder *b) -+{ -+ size_t rdata_offset = b->current_rdata_offset; -+ if (rdata_offset == 0) -+ FAIL_EXIT1 ("response_close_record called without open record"); -+ size_t rdata_length = b->offset - rdata_offset - 2; -+ if (rdata_length > 65535) -+ FAIL_EXIT1 ("RDATA length %zu exceeds limit", rdata_length); -+ b->buffer[rdata_offset] = rdata_length >> 8; -+ b->buffer[rdata_offset + 1] = rdata_length; -+ response_count_increment (b); -+ b->current_rdata_offset = 0; -+} -+ -+void -+resolv_response_add_data (struct resolv_response_builder *b, -+ const void *data, size_t length) -+{ -+ size_t remaining = max_response_length - b->offset; -+ if (remaining < length) -+ FAIL_EXIT1 ("resolv_response_add_data: not enough room for %zu bytes", -+ length); -+ memcpy (b->buffer + b->offset, data, length); -+ b->offset += length; -+} -+ -+void -+resolv_response_drop (struct resolv_response_builder *b) -+{ -+ b->drop = true; -+} -+ -+void -+resolv_response_close (struct resolv_response_builder *b) -+{ -+ b->close = true; -+} -+ -+void -+resolv_response_truncate_data (struct resolv_response_builder *b, size_t count) -+{ -+ if (count > 65535) -+ FAIL_EXIT1 ("resolv_response_truncate_data: argument too large: %zu", -+ count); -+ b->truncate_bytes = count; -+} -+ -+ -+size_t -+resolv_response_length (const struct resolv_response_builder *b) -+{ -+ return b->offset; -+} -+ -+unsigned char * -+resolv_response_buffer (const struct resolv_response_builder *b) -+{ -+ unsigned char *result = xmalloc (b->offset); -+ memcpy (result, b->buffer, b->offset); -+ return result; -+} -+ -+static struct resolv_response_builder * -+response_builder_allocate -+ (const unsigned char *query_buffer, size_t query_length) -+{ -+ struct resolv_response_builder *b = xmalloc (sizeof (*b)); -+ memset (b, 0, offsetof (struct resolv_response_builder, buffer)); -+ b->query_buffer = query_buffer; -+ b->query_length = query_length; -+ TEST_VERIFY_EXIT (hcreate_r (10000, &b->compression_offsets) != 0); -+ return b; -+} -+ -+static void -+response_builder_free (struct resolv_response_builder *b) -+{ -+ struct to_be_freed *current = b->to_be_freed; -+ while (current != NULL) -+ { -+ struct to_be_freed *next = current->next; -+ free (current->ptr); -+ free (current); -+ current = next; -+ } -+ hdestroy_r (&b->compression_offsets); -+ free (b); -+} -+ -+/* DNS query processing. */ -+ -+/* Data extracted from the question section of a DNS packet. */ -+struct query_info -+{ -+ char qname[MAXDNAME]; -+ uint16_t qclass; -+ uint16_t qtype; -+ struct resolv_edns_info edns; -+}; -+ -+/* Update *INFO from the specified DNS packet. */ -+static void -+parse_query (struct query_info *info, -+ const unsigned char *buffer, size_t length) -+{ -+ HEADER hd; -+ _Static_assert (sizeof (hd) == 12, "DNS header size"); -+ if (length < sizeof (hd)) -+ FAIL_EXIT1 ("malformed DNS query: too short: %zu bytes", length); -+ memcpy (&hd, buffer, sizeof (hd)); -+ -+ if (ntohs (hd.qdcount) != 1) -+ FAIL_EXIT1 ("malformed DNS query: wrong question count: %d", -+ (int) ntohs (hd.qdcount)); -+ if (ntohs (hd.ancount) != 0) -+ FAIL_EXIT1 ("malformed DNS query: wrong answer count: %d", -+ (int) ntohs (hd.ancount)); -+ if (ntohs (hd.nscount) != 0) -+ FAIL_EXIT1 ("malformed DNS query: wrong authority count: %d", -+ (int) ntohs (hd.nscount)); -+ if (ntohs (hd.arcount) > 1) -+ FAIL_EXIT1 ("malformed DNS query: wrong additional count: %d", -+ (int) ntohs (hd.arcount)); -+ -+ int ret = dn_expand (buffer, buffer + length, buffer + sizeof (hd), -+ info->qname, sizeof (info->qname)); -+ if (ret < 0) -+ FAIL_EXIT1 ("malformed DNS query: cannot uncompress QNAME"); -+ -+ /* Obtain QTYPE and QCLASS. */ -+ size_t remaining = length - (12 + ret); -+ struct -+ { -+ uint16_t qtype; -+ uint16_t qclass; -+ } qtype_qclass; -+ if (remaining < sizeof (qtype_qclass)) -+ FAIL_EXIT1 ("malformed DNS query: " -+ "query lacks QCLASS/QTYPE, QNAME: %s", info->qname); -+ memcpy (&qtype_qclass, buffer + 12 + ret, sizeof (qtype_qclass)); -+ info->qclass = ntohs (qtype_qclass.qclass); -+ info->qtype = ntohs (qtype_qclass.qtype); -+ -+ memset (&info->edns, 0, sizeof (info->edns)); -+ if (ntohs (hd.arcount) > 0) -+ { -+ /* Parse EDNS record. */ -+ struct __attribute__ ((packed, aligned (1))) -+ { -+ uint8_t root; -+ uint16_t rtype; -+ uint16_t payload; -+ uint8_t edns_extended_rcode; -+ uint8_t edns_version; -+ uint16_t flags; -+ uint16_t rdatalen; -+ } rr; -+ _Static_assert (sizeof (rr) == 11, "EDNS record size"); -+ -+ if (remaining < 4 + sizeof (rr)) -+ FAIL_EXIT1 ("mailformed DNS query: no room for EDNS record"); -+ memcpy (&rr, buffer + 12 + ret + 4, sizeof (rr)); -+ if (rr.root != 0) -+ FAIL_EXIT1 ("malformed DNS query: invalid OPT RNAME: %d\n", rr.root); -+ if (rr.rtype != htons (41)) -+ FAIL_EXIT1 ("malformed DNS query: invalid OPT type: %d\n", -+ ntohs (rr.rtype)); -+ info->edns.active = true; -+ info->edns.extended_rcode = rr.edns_extended_rcode; -+ info->edns.version = rr.edns_version; -+ info->edns.flags = ntohs (rr.flags); -+ info->edns.payload_size = ntohs (rr.payload); -+ } -+} -+ -+ -+/* Main testing framework. */ -+ -+/* Per-server information. One struct is allocated for each test -+ server. */ -+struct resolv_test_server -+{ -+ /* Local address of the server. UDP and TCP use the same port. */ -+ struct sockaddr_in address; -+ -+ /* File descriptor of the UDP server, or -1 if this server is -+ disabled. */ -+ int socket_udp; -+ -+ /* File descriptor of the TCP server, or -1 if this server is -+ disabled. */ -+ int socket_tcp; -+ -+ /* Counter of the number of responses processed so far. */ -+ size_t response_number; -+ -+ /* Thread handles for the server threads (if not disabled in the -+ configuration). */ -+ pthread_t thread_udp; -+ pthread_t thread_tcp; -+}; -+ -+/* Main struct for keeping track of libresolv redirection and -+ testing. */ -+struct resolv_test -+{ -+ /* After initialization, any access to the struct must be performed -+ while this lock is acquired. */ -+ pthread_mutex_t lock; -+ -+ /* Data for each test server. */ -+ struct resolv_test_server servers[resolv_max_test_servers]; -+ -+ /* Used if config.single_thread_udp is true. */ -+ pthread_t thread_udp_single; -+ -+ struct resolv_redirect_config config; -+ bool termination_requested; -+}; -+ -+/* Function implementing a server thread. */ -+typedef void (*thread_callback) (struct resolv_test *, int server_index); -+ -+/* Storage for thread-specific data, for passing to the -+ thread_callback function. */ -+struct thread_closure -+{ -+ struct resolv_test *obj; /* Current test object. */ -+ thread_callback callback; /* Function to call. */ -+ int server_index; /* Index of the implemented server. */ -+}; -+ -+/* Wrap response_callback as a function which can be passed to -+ pthread_create. */ -+static void * -+thread_callback_wrapper (void *arg) -+{ -+ struct thread_closure *closure = arg; -+ closure->callback (closure->obj, closure->server_index); -+ free (closure); -+ return NULL; -+} -+ -+/* Start a server thread for the specified SERVER_INDEX, implemented -+ by CALLBACK. */ -+static pthread_t -+start_server_thread (struct resolv_test *obj, int server_index, -+ thread_callback callback) -+{ -+ struct thread_closure *closure = xmalloc (sizeof (*closure)); -+ *closure = (struct thread_closure) -+ { -+ .obj = obj, -+ .callback = callback, -+ .server_index = server_index, -+ }; -+ return xpthread_create (NULL, thread_callback_wrapper, closure); -+} -+ -+/* Process one UDP query. Return false if a termination requested has -+ been detected. */ -+static bool -+server_thread_udp_process_one (struct resolv_test *obj, int server_index) -+{ -+ unsigned char query[512]; -+ struct sockaddr_storage peer; -+ socklen_t peerlen = sizeof (peer); -+ size_t length = xrecvfrom (obj->servers[server_index].socket_udp, -+ query, sizeof (query), 0, -+ (struct sockaddr *) &peer, &peerlen); -+ /* Check for termination. */ -+ { -+ bool termination_requested; -+ xpthread_mutex_lock (&obj->lock); -+ termination_requested = obj->termination_requested; -+ xpthread_mutex_unlock (&obj->lock); -+ if (termination_requested) -+ return false; -+ } -+ -+ -+ struct query_info qinfo; -+ parse_query (&qinfo, query, length); -+ if (test_verbose > 0) -+ { -+ if (test_verbose > 1) -+ printf ("info: UDP server %d: incoming query:" -+ " %zd bytes, %s/%u/%u, tnxid=0x%02x%02x\n", -+ server_index, length, qinfo.qname, qinfo.qclass, qinfo.qtype, -+ query[0], query[1]); -+ else -+ printf ("info: UDP server %d: incoming query:" -+ " %zd bytes, %s/%u/%u\n", -+ server_index, length, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ -+ struct resolv_response_context ctx = -+ { -+ .query_buffer = query, -+ .query_length = length, -+ .server_index = server_index, -+ .tcp = false, -+ .edns = qinfo.edns, -+ }; -+ struct resolv_response_builder *b = response_builder_allocate (query, length); -+ obj->config.response_callback -+ (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ -+ if (b->drop) -+ { -+ if (test_verbose) -+ printf ("info: UDP server %d: dropping response to %s/%u/%u\n", -+ server_index, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ else -+ { -+ if (test_verbose) -+ { -+ if (b->offset >= 12) -+ printf ("info: UDP server %d: sending response:" -+ " %zu bytes, RCODE %d (for %s/%u/%u)\n", -+ server_index, b->offset, b->buffer[3] & 0x0f, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ else -+ printf ("info: UDP server %d: sending response: %zu bytes" -+ " (for %s/%u/%u)\n", -+ server_index, b->offset, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ if (b->truncate_bytes > 0) -+ printf ("info: truncated by %u bytes\n", b->truncate_bytes); -+ } -+ size_t to_send = b->offset; -+ if (to_send < b->truncate_bytes) -+ to_send = 0; -+ else -+ to_send -= b->truncate_bytes; -+ -+ /* Ignore most errors here because the other end may have closed -+ the socket. */ -+ if (sendto (obj->servers[server_index].socket_udp, -+ b->buffer, to_send, 0, -+ (struct sockaddr *) &peer, peerlen) < 0) -+ TEST_VERIFY_EXIT (errno != EBADF); -+ } -+ response_builder_free (b); -+ return true; -+} -+ -+/* UDP thread_callback function. Variant for one thread per -+ server. */ -+static void -+server_thread_udp (struct resolv_test *obj, int server_index) -+{ -+ while (server_thread_udp_process_one (obj, server_index)) -+ ; -+} -+ -+/* Single-threaded UDP processing function, for the single_thread_udp -+ case. */ -+static void * -+server_thread_udp_single (void *closure) -+{ -+ struct resolv_test *obj = closure; -+ -+ struct pollfd fds[resolv_max_test_servers]; -+ for (int server_index = 0; server_index < resolv_max_test_servers; -+ ++server_index) -+ if (obj->config.servers[server_index].disable_udp) -+ fds[server_index] = (struct pollfd) {.fd = -1}; -+ else -+ { -+ fds[server_index] = (struct pollfd) -+ { -+ .fd = obj->servers[server_index].socket_udp, -+ .events = POLLIN -+ }; -+ -+ /* Make the socket non-blocking. */ -+ int flags = fcntl (obj->servers[server_index].socket_udp, F_GETFL, 0); -+ if (flags < 0) -+ FAIL_EXIT1 ("fcntl (F_GETFL): %m"); -+ flags |= O_NONBLOCK; -+ if (fcntl (obj->servers[server_index].socket_udp, F_SETFL, flags) < 0) -+ FAIL_EXIT1 ("fcntl (F_SETFL): %m"); -+ } -+ -+ while (true) -+ { -+ xpoll (fds, resolv_max_test_servers, -1); -+ for (int server_index = 0; server_index < resolv_max_test_servers; -+ ++server_index) -+ if (fds[server_index].revents != 0) -+ { -+ if (!server_thread_udp_process_one (obj, server_index)) -+ goto out; -+ fds[server_index].revents = 0; -+ } -+ } -+ -+ out: -+ return NULL; -+} -+ -+/* Start the single UDP handler thread (for the single_thread_udp -+ case). */ -+static void -+start_server_thread_udp_single (struct resolv_test *obj) -+{ -+ obj->thread_udp_single -+ = xpthread_create (NULL, server_thread_udp_single, obj); -+} -+ -+/* Data describing a TCP client connect. */ -+struct tcp_thread_closure -+{ -+ struct resolv_test *obj; -+ int server_index; -+ int client_socket; -+}; -+ -+/* Read a complete DNS query packet. If EOF_OK, an immediate -+ end-of-file condition is acceptable. */ -+static bool -+read_fully (int fd, void *buf, size_t len, bool eof_ok) -+{ -+ const void *const end = buf + len; -+ while (buf < end) -+ { -+ ssize_t ret = read (fd, buf, end - buf); -+ if (ret == 0) -+ { -+ if (!eof_ok) -+ { -+ support_record_failure (); -+ printf ("error: unexpected EOF on TCP connection\n"); -+ } -+ return false; -+ } -+ else if (ret < 0) -+ { -+ if (!eof_ok || errno != ECONNRESET) -+ { -+ support_record_failure (); -+ printf ("error: TCP read: %m\n"); -+ } -+ return false; -+ } -+ buf += ret; -+ eof_ok = false; -+ } -+ return true; -+} -+ -+/* Write an array of iovecs. Terminate the process on failure. */ -+static void -+writev_fully (int fd, struct iovec *buffers, size_t count) -+{ -+ while (count > 0) -+ { -+ /* Skip zero-length write requests. */ -+ if (buffers->iov_len == 0) -+ { -+ ++buffers; -+ --count; -+ continue; -+ } -+ /* Try to rewrite the remaing buffers. */ -+ ssize_t ret = writev (fd, buffers, count); -+ if (ret < 0) -+ FAIL_EXIT1 ("writev: %m"); -+ if (ret == 0) -+ FAIL_EXIT1 ("writev: invalid return value zero"); -+ /* Find the buffers that were successfully written. */ -+ while (ret > 0) -+ { -+ if (count == 0) -+ FAIL_EXIT1 ("internal writev consistency failure"); -+ /* Current buffer was partially written. */ -+ if (buffers->iov_len > (size_t) ret) -+ { -+ buffers->iov_base += ret; -+ buffers->iov_len -= ret; -+ ret = 0; -+ } -+ else -+ { -+ ret -= buffers->iov_len; -+ buffers->iov_len = 0; -+ ++buffers; -+ --count; -+ } -+ } -+ } -+} -+ -+/* Thread callback for handling a single established TCP connection to -+ a client. */ -+static void * -+server_thread_tcp_client (void *arg) -+{ -+ struct tcp_thread_closure *closure = arg; -+ -+ while (true) -+ { -+ /* Read packet length. */ -+ uint16_t query_length; -+ if (!read_fully (closure->client_socket, -+ &query_length, sizeof (query_length), true)) -+ break; -+ query_length = ntohs (query_length); -+ -+ /* Read the packet. */ -+ unsigned char *query_buffer = xmalloc (query_length); -+ read_fully (closure->client_socket, query_buffer, query_length, false); -+ -+ struct query_info qinfo; -+ parse_query (&qinfo, query_buffer, query_length); -+ if (test_verbose > 0) -+ { -+ if (test_verbose > 1) -+ printf ("info: UDP server %d: incoming query:" -+ " %d bytes, %s/%u/%u, tnxid=0x%02x%02x\n", -+ closure->server_index, query_length, -+ qinfo.qname, qinfo.qclass, qinfo.qtype, -+ query_buffer[0], query_buffer[1]); -+ else -+ printf ("info: TCP server %d: incoming query:" -+ " %u bytes, %s/%u/%u\n", -+ closure->server_index, query_length, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ -+ struct resolv_response_context ctx = -+ { -+ .query_buffer = query_buffer, -+ .query_length = query_length, -+ .server_index = closure->server_index, -+ .tcp = true, -+ .edns = qinfo.edns, -+ }; -+ struct resolv_response_builder *b = response_builder_allocate -+ (query_buffer, query_length); -+ closure->obj->config.response_callback -+ (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ -+ if (b->drop) -+ { -+ if (test_verbose) -+ printf ("info: TCP server %d: dropping response to %s/%u/%u\n", -+ closure->server_index, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ else -+ { -+ if (test_verbose) -+ printf ("info: TCP server %d: sending response: %zu bytes" -+ " (for %s/%u/%u)\n", -+ closure->server_index, b->offset, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ uint16_t length = htons (b->offset); -+ size_t to_send = b->offset; -+ if (to_send < b->truncate_bytes) -+ to_send = 0; -+ else -+ to_send -= b->truncate_bytes; -+ struct iovec buffers[2] = -+ { -+ {&length, sizeof (length)}, -+ {b->buffer, to_send} -+ }; -+ writev_fully (closure->client_socket, buffers, 2); -+ } -+ bool close_flag = b->close; -+ response_builder_free (b); -+ free (query_buffer); -+ if (close_flag) -+ break; -+ } -+ -+ xclose (closure->client_socket); -+ free (closure); -+ return NULL; -+} -+ -+/* thread_callback for the TCP case. Accept connections and create a -+ new thread for each client. */ -+static void -+server_thread_tcp (struct resolv_test *obj, int server_index) -+{ -+ while (true) -+ { -+ /* Get the client conenction. */ -+ int client_socket = xaccept -+ (obj->servers[server_index].socket_tcp, NULL, NULL); -+ -+ /* Check for termination. */ -+ xpthread_mutex_lock (&obj->lock); -+ if (obj->termination_requested) -+ { -+ xpthread_mutex_unlock (&obj->lock); -+ xclose (client_socket); -+ break; -+ } -+ xpthread_mutex_unlock (&obj->lock); -+ -+ /* Spawn a new thread for handling this connection. */ -+ struct tcp_thread_closure *closure = xmalloc (sizeof (*closure)); -+ *closure = (struct tcp_thread_closure) -+ { -+ .obj = obj, -+ .server_index = server_index, -+ .client_socket = client_socket, -+ }; -+ -+ pthread_t thr -+ = xpthread_create (NULL, server_thread_tcp_client, closure); -+ /* TODO: We should keep track of this thread so that we can -+ block in resolv_test_end until it has exited. */ -+ xpthread_detach (thr); -+ } -+} -+ -+/* Create UDP and TCP server sockets. */ -+static void -+make_server_sockets (struct resolv_test_server *server) -+{ -+ while (true) -+ { -+ server->socket_udp = xsocket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); -+ server->socket_tcp = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ -+ /* Pick the address for the UDP socket. */ -+ server->address = (struct sockaddr_in) -+ { -+ .sin_family = AF_INET, -+ .sin_addr = {.s_addr = htonl (INADDR_LOOPBACK)} -+ }; -+ xbind (server->socket_udp, -+ (struct sockaddr *)&server->address, sizeof (server->address)); -+ -+ /* Retrieve the address. */ -+ socklen_t addrlen = sizeof (server->address); -+ xgetsockname (server->socket_udp, -+ (struct sockaddr *)&server->address, &addrlen); -+ -+ /* Bind the TCP socket to the same address. */ -+ { -+ int on = 1; -+ xsetsockopt (server->socket_tcp, SOL_SOCKET, SO_REUSEADDR, -+ &on, sizeof (on)); -+ } -+ if (bind (server->socket_tcp, -+ (struct sockaddr *)&server->address, -+ sizeof (server->address)) != 0) -+ { -+ /* Port collision. The UDP bind succeeded, but the TCP BIND -+ failed. We assume here that the kernel will pick the -+ next local UDP address randomly. */ -+ if (errno == EADDRINUSE) -+ { -+ xclose (server->socket_udp); -+ xclose (server->socket_tcp); -+ continue; -+ } -+ FAIL_EXIT1 ("TCP bind: %m"); -+ } -+ xlisten (server->socket_tcp, 5); -+ break; -+ } -+} -+ -+/* One-time initialization of NSS. */ -+static void -+resolv_redirect_once (void) -+{ -+ /* Only use nss_dns. */ -+ __nss_configure_lookup ("hosts", "dns"); -+ __nss_configure_lookup ("networks", "dns"); -+ /* Enter a network namespace for isolation and firewall state -+ cleanup. The tests will still work if these steps fail, but they -+ may be less reliable. */ -+ support_become_root (); -+ support_enter_network_namespace (); -+} -+pthread_once_t resolv_redirect_once_var = PTHREAD_ONCE_INIT; -+ -+void -+resolv_test_init (void) -+{ -+ /* Perform one-time initialization of NSS. */ -+ xpthread_once (&resolv_redirect_once_var, resolv_redirect_once); -+} -+ -+/* Copy the search path from CONFIG.search to the _res object. */ -+static void -+set_search_path (struct resolv_redirect_config config) -+{ -+ memset (_res.defdname, 0, sizeof (_res.defdname)); -+ memset (_res.dnsrch, 0, sizeof (_res.dnsrch)); -+ -+ char *current = _res.defdname; -+ char *end = current + sizeof (_res.defdname); -+ -+ for (unsigned int i = 0; -+ i < sizeof (config.search) / sizeof (config.search[0]); ++i) -+ { -+ if (config.search[i] == NULL) -+ continue; -+ -+ size_t length = strlen (config.search[i]) + 1; -+ size_t remaining = end - current; -+ TEST_VERIFY_EXIT (length <= remaining); -+ memcpy (current, config.search[i], length); -+ _res.dnsrch[i] = current; -+ current += length; -+ } -+} -+ -+struct resolv_test * -+resolv_test_start (struct resolv_redirect_config config) -+{ -+ /* Apply configuration defaults. */ -+ if (config.nscount == 0) -+ config.nscount = resolv_max_test_servers; -+ -+ struct resolv_test *obj = xmalloc (sizeof (*obj)); -+ *obj = (struct resolv_test) { -+ .config = config, -+ .lock = PTHREAD_MUTEX_INITIALIZER, -+ }; -+ -+ resolv_test_init (); -+ -+ /* Create all the servers, to reserve the necessary ports. */ -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ make_server_sockets (obj->servers + server_index); -+ -+ /* Start server threads. Disable the server ports, as -+ requested. */ -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ { -+ struct resolv_test_server *server = obj->servers + server_index; -+ if (config.servers[server_index].disable_udp) -+ { -+ xclose (server->socket_udp); -+ server->socket_udp = -1; -+ } -+ else if (!config.single_thread_udp) -+ server->thread_udp = start_server_thread (obj, server_index, -+ server_thread_udp); -+ if (config.servers[server_index].disable_tcp) -+ { -+ xclose (server->socket_tcp); -+ server->socket_tcp = -1; -+ } -+ else -+ server->thread_tcp = start_server_thread (obj, server_index, -+ server_thread_tcp); -+ } -+ if (config.single_thread_udp) -+ start_server_thread_udp_single (obj); -+ -+ int timeout = 1; -+ -+ /* Initialize libresolv. */ -+ TEST_VERIFY_EXIT (res_init () == 0); -+ -+ /* Disable IPv6 name server addresses. The code below only -+ overrides the IPv4 addresses. */ -+ __res_iclose (&_res, true); -+ _res._u._ext.nscount = 0; -+ -+ /* Redirect queries to the server socket. */ -+ if (test_verbose) -+ { -+ printf ("info: old timeout value: %d\n", _res.retrans); -+ printf ("info: old retry attempt value: %d\n", _res.retry); -+ printf ("info: old _res.options: 0x%lx\n", _res.options); -+ printf ("info: old _res.nscount value: %d\n", _res.nscount); -+ printf ("info: old _res.ndots value: %d\n", _res.ndots); -+ } -+ _res.retrans = timeout; -+ _res.retry = 4; -+ _res.nscount = config.nscount; -+ _res.options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH; -+ _res.ndots = 1; -+ if (test_verbose) -+ { -+ printf ("info: new timeout value: %d\n", _res.retrans); -+ printf ("info: new retry attempt value: %d\n", _res.retry); -+ printf ("info: new _res.options: 0x%lx\n", _res.options); -+ printf ("info: new _res.nscount value: %d\n", _res.nscount); -+ printf ("info: new _res.ndots value: %d\n", _res.ndots); -+ } -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ { -+ _res.nsaddr_list[server_index] = obj->servers[server_index].address; -+ if (test_verbose) -+ { -+ char buf[256]; -+ TEST_VERIFY_EXIT -+ (inet_ntop (AF_INET, &obj->servers[server_index].address.sin_addr, -+ buf, sizeof (buf)) != NULL); -+ printf ("info: server %d: %s/%u\n", -+ server_index, buf, -+ htons (obj->servers[server_index].address.sin_port)); -+ } -+ } -+ -+ set_search_path (config); -+ -+ return obj; -+} -+ -+void -+resolv_test_end (struct resolv_test *obj) -+{ -+ res_close (); -+ -+ xpthread_mutex_lock (&obj->lock); -+ obj->termination_requested = true; -+ xpthread_mutex_unlock (&obj->lock); -+ -+ /* Send trigger packets to unblock the server threads. */ -+ for (int server_index = 0; server_index < obj->config.nscount; -+ ++server_index) -+ { -+ if (!obj->config.servers[server_index].disable_udp) -+ { -+ int sock = xsocket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); -+ xsendto (sock, "", 1, 0, -+ (struct sockaddr *) &obj->servers[server_index].address, -+ sizeof (obj->servers[server_index].address)); -+ xclose (sock); -+ } -+ if (!obj->config.servers[server_index].disable_tcp) -+ { -+ int sock = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ xconnect (sock, -+ (struct sockaddr *) &obj->servers[server_index].address, -+ sizeof (obj->servers[server_index].address)); -+ xclose (sock); -+ } -+ } -+ -+ if (obj->config.single_thread_udp) -+ xpthread_join (obj->thread_udp_single); -+ -+ /* Wait for the server threads to terminate. */ -+ for (int server_index = 0; server_index < obj->config.nscount; -+ ++server_index) -+ { -+ if (!obj->config.servers[server_index].disable_udp) -+ { -+ if (!obj->config.single_thread_udp) -+ xpthread_join (obj->servers[server_index].thread_udp); -+ xclose (obj->servers[server_index].socket_udp); -+ } -+ if (!obj->config.servers[server_index].disable_tcp) -+ { -+ xpthread_join (obj->servers[server_index].thread_tcp); -+ xclose (obj->servers[server_index].socket_tcp); -+ } -+ } -+ -+ free (obj); -+} -diff --git a/support/resolv_test.h b/support/resolv_test.h -new file mode 100644 -index 0000000000..6498751569 ---- /dev/null -+++ b/support/resolv_test.h -@@ -0,0 +1,180 @@ -+/* DNS test framework and libresolv redirection. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_RESOLV_TEST_H -+#define SUPPORT_RESOLV_TEST_H -+ -+#include -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Information about EDNS properties of a DNS query. */ -+struct resolv_edns_info -+{ -+ bool active; -+ uint8_t extended_rcode; -+ uint8_t version; -+ uint16_t flags; -+ uint16_t payload_size; -+}; -+ -+/* This struct provides context information when the response callback -+ specified in struct resolv_redirect_config is invoked. */ -+struct resolv_response_context -+{ -+ const unsigned char *query_buffer; -+ size_t query_length; -+ int server_index; -+ bool tcp; -+ struct resolv_edns_info edns; -+}; -+ -+/* This opaque struct is used to construct responses from within the -+ response callback function. */ -+struct resolv_response_builder; -+ -+/* This opaque struct collects information about the resolver testing -+ currently in progress. */ -+struct resolv_test; -+ -+enum -+ { -+ /* Maximum number of test servers supported by the framework. */ -+ resolv_max_test_servers = 3, -+ }; -+ -+/* Configuration settings specific to individual test servers. */ -+struct resolv_redirect_server_config -+{ -+ bool disable_tcp; /* If true, no TCP server is listening. */ -+ bool disable_udp; /* If true, no UDP server is listening. */ -+}; -+ -+/* Instructions for setting up the libresolv redirection. */ -+struct resolv_redirect_config -+{ -+ /* The response_callback function is called for every incoming DNS -+ packet, over UDP or TCP. It must be specified, the other -+ configuration settings are optional. */ -+ void (*response_callback) (const struct resolv_response_context *, -+ struct resolv_response_builder *, -+ const char *qname, -+ uint16_t qclass, uint16_t qtype); -+ -+ /* Per-server configuration. */ -+ struct resolv_redirect_server_config servers[resolv_max_test_servers]; -+ -+ /* Search path entries. The first entry serves as the default -+ domain name as well. */ -+ const char *search[7]; -+ -+ /* Number of servers to activate in resolv. 0 means the default, -+ resolv_max_test_servers. */ -+ int nscount; -+ -+ /* If true, use a single thread to process all UDP queries. This -+ may results in more predictable ordering of queries and -+ responses. */ -+ bool single_thread_udp; -+}; -+ -+/* Configure NSS to use, nss_dns only for aplicable databases, and try -+ to put the process into a network namespace for better isolation. -+ This may have to be called before resolv_test_start, before the -+ process creates any threads. Otherwise, initialization is -+ performed by resolv_test_start implicitly. */ -+void resolv_test_init (void); -+ -+/* Initiate resolver testing. This updates the _res variable as -+ needed. As a side effect, NSS is reconfigured to use nss_dns only -+ for aplicable databases, and the process may enter a network -+ namespace for better isolation. */ -+struct resolv_test *resolv_test_start (struct resolv_redirect_config); -+ -+/* Call this function at the end of resolver testing, to free -+ resources and report pending errors (if any). */ -+void resolv_test_end (struct resolv_test *); -+ -+/* The remaining facilities in this file are used for constructing -+ response packets from the response_callback function. */ -+ -+/* Special settings for constructing responses from the callback. */ -+struct resolv_response_flags -+{ -+ /* 4-bit response code to incorporate into the response. */ -+ unsigned char rcode; -+ -+ /* If true, the TC (truncation) flag will be set. */ -+ bool tc; -+ -+ /* Initial section count values. Can be used to artificially -+ increase the counts, for malformed packet testing.*/ -+ unsigned short qdcount; -+ unsigned short ancount; -+ unsigned short nscount; -+ unsigned short adcount; -+}; -+ -+/* Begin a new response with the requested flags. Must be called -+ first. */ -+void resolv_response_init (struct resolv_response_builder *, -+ struct resolv_response_flags); -+ -+/* Switches to the section in the response packet. Only forward -+ movement is supported. */ -+void resolv_response_section (struct resolv_response_builder *, ns_sect); -+ -+/* Add a question record to the question section. */ -+void resolv_response_add_question (struct resolv_response_builder *, -+ const char *name, uint16_t class, -+ uint16_t type); -+/* Starts a new resource record with the specified owner name, class, -+ type, and TTL. Data is supplied with resolv_response_add_data or -+ resolv_response_add_name. */ -+void resolv_response_open_record (struct resolv_response_builder *, -+ const char *name, uint16_t class, -+ uint16_t type, uint32_t ttl); -+ -+/* Add unstructed bytes to the RDATA part of a resource record. */ -+void resolv_response_add_data (struct resolv_response_builder *, -+ const void *, size_t); -+ -+/* Add a compressed domain name to the RDATA part of a resource -+ record. */ -+void resolv_response_add_name (struct resolv_response_builder *, -+ const char *name); -+ -+/* Mark the end of the constructed record. Must be called last. */ -+void resolv_response_close_record (struct resolv_response_builder *); -+ -+/* Drop this query packet (that is, do not send a response, not even -+ an empty packet). */ -+void resolv_response_drop (struct resolv_response_builder *); -+ -+/* In TCP mode, close the connection after this packet (if a response -+ is sent). */ -+void resolv_response_close (struct resolv_response_builder *); -+ -+/* The size of the response packet built so far. */ -+size_t resolv_response_length (const struct resolv_response_builder *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_RESOLV_TEST_H */ -diff --git a/support/run_diff.h b/support/run_diff.h -new file mode 100644 -index 0000000000..f65b5dd22c ---- /dev/null -+++ b/support/run_diff.h -@@ -0,0 +1,31 @@ -+/* Invoke the system diff tool to compare two strings. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_RUN_DIFF_H -+#define SUPPORT_RUN_DIFF_H -+ -+/* Compare the two NUL-terminated strings LEFT and RIGHT using the -+ diff tool. Label the sides of the diff with LEFT_LABEL and -+ RIGHT_LABEL, respectively. -+ -+ This function assumes that LEFT and RIGHT are different -+ strings. */ -+void support_run_diff (const char *left_label, const char *left, -+ const char *right_label, const char *right); -+ -+#endif /* SUPPORT_RUN_DIFF_H */ -diff --git a/support/set_fortify_handler.c b/support/set_fortify_handler.c -new file mode 100644 -index 0000000000..f434a8082a ---- /dev/null -+++ b/support/set_fortify_handler.c -@@ -0,0 +1,34 @@ -+/* Set signal handler for use in fortify tests. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+set_fortify_handler (void (*handler) (int sig)) -+{ -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = 0; -+ sigemptyset (&sa.sa_mask); -+ -+ sigaction (SIGABRT, &sa, NULL); -+ ignore_stderr (); -+} -diff --git a/support/support-xstat.c b/support/support-xstat.c -new file mode 100644 -index 0000000000..86a81ec601 ---- /dev/null -+++ b/support/support-xstat.c -@@ -0,0 +1,30 @@ -+/* stat64 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* NB: Non-standard file name to avoid sysdeps override for xstat. */ -+ -+#include -+#include -+#include -+ -+void -+xstat (const char *path, struct stat64 *result) -+{ -+ if (stat64 (path, result) != 0) -+ FAIL_EXIT1 ("stat64 (\"%s\"): %m", path); -+} -diff --git a/support/support.h b/support/support.h -new file mode 100644 -index 0000000000..4b5f04c2cc ---- /dev/null -+++ b/support/support.h -@@ -0,0 +1,74 @@ -+/* Common extra functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This header file should only contain definitions compatible with -+ C90. (Using __attribute__ is fine because provides a -+ fallback.) */ -+ -+#ifndef SUPPORT_H -+#define SUPPORT_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Write a message to standard output. Can be used in signal -+ handlers. */ -+void write_message (const char *message) __attribute__ ((nonnull (1))); -+ -+/* Avoid all the buffer overflow messages on stderr. */ -+void ignore_stderr (void); -+ -+/* Set fortification error handler. Used when tests want to verify that bad -+ code is caught by the library. */ -+void set_fortify_handler (void (*handler) (int sig)); -+ -+/* Report an out-of-memory error for the allocation of SIZE bytes in -+ FUNCTION, terminating the process. */ -+void oom_error (const char *function, size_t size) -+ __attribute__ ((nonnull (1))); -+ -+/* Return a pointer to a memory region of SIZE bytes. The memory is -+ initialized to zero and will be shared with subprocesses (across -+ fork). The returned pointer must be freed using -+ support_shared_free; it is not compatible with the malloc -+ functions. */ -+void *support_shared_allocate (size_t size); -+ -+/* Deallocate a pointer returned by support_shared_allocate. */ -+void support_shared_free (void *); -+ -+/* Write CONTENTS to the file PATH. Create or truncate the file as -+ needed. The file mode is 0666 masked by the umask. Terminate the -+ process on error. */ -+void support_write_file_string (const char *path, const char *contents); -+ -+/* Error-checking wrapper functions which terminate the process on -+ error. */ -+ -+void *xmalloc (size_t) __attribute__ ((malloc)); -+void *xcalloc (size_t n, size_t s) __attribute__ ((malloc)); -+void *xrealloc (void *p, size_t n); -+char *xasprintf (const char *format, ...) -+ __attribute__ ((format (printf, 1, 2), malloc)); -+char *xstrdup (const char *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_H */ -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S b/support/support_become_root.c -similarity index 57% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S -rename to support/support_become_root.c -index 37f7f44dfa..3fa0bd4ac0 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S -+++ b/support/support_become_root.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Acquire root privileges. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,24 +16,25 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- std %o0, [%sp + 72] -- std %o2, [%sp + 80] -- ldd [%sp + 72], %f0 -- ldd [%sp + 80], %f2 -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+#include -+#include -+#include - --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); -+bool -+support_become_root (void) -+{ -+#ifdef CLONE_NEWUSER -+ if (unshare (CLONE_NEWUSER | CLONE_NEWNS) == 0) -+ /* Even if we do not have UID zero, we have extended privileges at -+ this point. */ -+ return true; - #endif -+ if (setuid (0) != 0) -+ { -+ printf ("warning: could not become root outside namespace (%m)\n"); -+ return false; -+ } -+ return true; -+} -diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c -new file mode 100644 -index 0000000000..0dfd2deb54 ---- /dev/null -+++ b/support/support_can_chroot.c -@@ -0,0 +1,65 @@ -+/* Return true if the process can perform a chroot operation. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static void -+callback (void *closure) -+{ -+ int *result = closure; -+ struct stat64 before; -+ xstat ("/dev", &before); -+ if (chroot ("/dev") != 0) -+ { -+ *result = errno; -+ return; -+ } -+ struct stat64 after; -+ xstat ("/", &after); -+ TEST_VERIFY (before.st_dev == after.st_dev); -+ TEST_VERIFY (before.st_ino == after.st_ino); -+ *result = 0; -+} -+ -+bool -+support_can_chroot (void) -+{ -+ int *result = support_shared_allocate (sizeof (*result)); -+ *result = 0; -+ support_isolate_in_subprocess (callback, result); -+ bool ok = *result == 0; -+ if (!ok) -+ { -+ static bool already_warned; -+ if (!already_warned) -+ { -+ already_warned = true; -+ errno = *result; -+ printf ("warning: this process does not support chroot: %m\n"); -+ } -+ } -+ support_shared_free (result); -+ return ok; -+} -diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c -new file mode 100644 -index 0000000000..030f124252 ---- /dev/null -+++ b/support/support_capture_subprocess.c -@@ -0,0 +1,108 @@ -+/* Capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static void -+transfer (const char *what, struct pollfd *pfd, struct xmemstream *stream) -+{ -+ if (pfd->revents != 0) -+ { -+ char buf[1024]; -+ ssize_t ret = TEMP_FAILURE_RETRY (read (pfd->fd, buf, sizeof (buf))); -+ if (ret < 0) -+ { -+ support_record_failure (); -+ printf ("error: reading from subprocess %s: %m", what); -+ pfd->events = 0; -+ pfd->revents = 0; -+ } -+ else if (ret == 0) -+ { -+ /* EOF reached. Stop listening. */ -+ pfd->events = 0; -+ pfd->revents = 0; -+ } -+ else -+ /* Store the data just read. */ -+ TEST_VERIFY (fwrite (buf, ret, 1, stream->out) == 1); -+ } -+} -+ -+struct support_capture_subprocess -+support_capture_subprocess (void (*callback) (void *), void *closure) -+{ -+ struct support_capture_subprocess result; -+ xopen_memstream (&result.out); -+ xopen_memstream (&result.err); -+ -+ int stdout_pipe[2]; -+ xpipe (stdout_pipe); -+ int stderr_pipe[2]; -+ xpipe (stderr_pipe); -+ -+ TEST_VERIFY (fflush (stdout) == 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ xclose (stdout_pipe[0]); -+ xclose (stderr_pipe[0]); -+ xdup2 (stdout_pipe[1], STDOUT_FILENO); -+ xdup2 (stderr_pipe[1], STDERR_FILENO); -+ callback (closure); -+ _exit (0); -+ } -+ xclose (stdout_pipe[1]); -+ xclose (stderr_pipe[1]); -+ -+ struct pollfd fds[2] = -+ { -+ { .fd = stdout_pipe[0], .events = POLLIN }, -+ { .fd = stderr_pipe[0], .events = POLLIN }, -+ }; -+ -+ do -+ { -+ xpoll (fds, 2, -1); -+ transfer ("stdout", &fds[0], &result.out); -+ transfer ("stderr", &fds[1], &result.err); -+ } -+ while (fds[0].events != 0 || fds[1].events != 0); -+ xclose (stdout_pipe[0]); -+ xclose (stderr_pipe[0]); -+ -+ xfclose_memstream (&result.out); -+ xfclose_memstream (&result.err); -+ xwaitpid (pid, &result.status, 0); -+ return result; -+} -+ -+void -+support_capture_subprocess_free (struct support_capture_subprocess *p) -+{ -+ free (p->out.buffer); -+ free (p->err.buffer); -+} -diff --git a/support/support_capture_subprocess_check.c b/support/support_capture_subprocess_check.c -new file mode 100644 -index 0000000000..708c89f331 ---- /dev/null -+++ b/support/support_capture_subprocess_check.c -@@ -0,0 +1,67 @@ -+/* Verify capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+static void -+print_context (const char *context, bool *failed) -+{ -+ if (*failed) -+ /* Do not duplicate message. */ -+ return; -+ support_record_failure (); -+ printf ("error: subprocess failed: %s\n", context); -+} -+ -+void -+support_capture_subprocess_check (struct support_capture_subprocess *proc, -+ const char *context, int status, -+ int allowed) -+{ -+ TEST_VERIFY ((allowed & sc_allow_none) -+ || (allowed & sc_allow_stdout) -+ || (allowed & sc_allow_stderr)); -+ TEST_VERIFY (!((allowed & sc_allow_none) -+ && ((allowed & sc_allow_stdout) -+ || (allowed & sc_allow_stderr)))); -+ -+ bool failed = false; -+ if (proc->status != status) -+ { -+ print_context (context, &failed); -+ printf ("error: expected exit status: %d\n", status); -+ printf ("error: actual exit status: %d\n", status); -+ } -+ if (!(allowed & sc_allow_stdout) && proc->out.length != 0) -+ { -+ print_context (context, &failed); -+ printf ("error: unexpected output from subprocess\n"); -+ fwrite (proc->out.buffer, proc->out.length, 1, stdout); -+ puts ("\n"); -+ } -+ if (!(allowed & sc_allow_stderr) && proc->err.length != 0) -+ { -+ print_context (context, &failed); -+ printf ("error: unexpected error output from subprocess\n"); -+ fwrite (proc->err.buffer, proc->err.length, 1, stdout); -+ puts ("\n"); -+ } -+} -diff --git a/support/support_enter_network_namespace.c b/support/support_enter_network_namespace.c -new file mode 100644 -index 0000000000..28b0ee29cf ---- /dev/null -+++ b/support/support_enter_network_namespace.c -@@ -0,0 +1,75 @@ -+/* Enter a network namespace. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static bool in_uts_namespace; -+ -+bool -+support_enter_network_namespace (void) -+{ -+#ifdef CLONE_NEWUTS -+ if (unshare (CLONE_NEWUTS) == 0) -+ in_uts_namespace = true; -+ else -+ printf ("warning: unshare (CLONE_NEWUTS) failed: %m\n"); -+#endif -+ -+#ifdef CLONE_NEWNET -+ if (unshare (CLONE_NEWNET) == 0) -+ { -+ /* Bring up the loopback interface. */ -+ int fd = xsocket (AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); -+ struct ifreq req; -+ strcpy (req.ifr_name, "lo"); -+ TEST_VERIFY_EXIT (ioctl (fd, SIOCGIFFLAGS, &req) == 0); -+ bool already_up = req.ifr_flags & IFF_UP; -+ if (already_up) -+ /* This means that we likely have not achieved isolation from -+ the parent namespace. */ -+ printf ("warning: loopback interface already exists" -+ " in new network namespace\n"); -+ else -+ { -+ req.ifr_flags |= IFF_UP | IFF_RUNNING; -+ TEST_VERIFY_EXIT (ioctl (fd, SIOCSIFFLAGS, &req) == 0); -+ } -+ xclose (fd); -+ -+ return !already_up; -+ } -+#endif -+ printf ("warning: could not enter network namespace\n"); -+ return false; -+} -+ -+bool -+support_in_uts_namespace (void) -+{ -+ return in_uts_namespace; -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S b/support/support_format_address_family.c -similarity index 63% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S -rename to support/support_format_address_family.c -index 9e0e3f21be..5d42c42a45 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S -+++ b/support/support_format_address_family.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Convert an address family to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,19 +16,20 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- st %o0, [%sp + 72] -- st %o1, [%sp + 76] -- ld [%sp + 72], %f0 -- ld [%sp + 76], %f1 -- fcmps %f0, %f1 -- fbug 1f -- nop -- fzeros %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+ -+char * -+support_format_address_family (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return xstrdup ("INET"); -+ case AF_INET6: -+ return xstrdup ("INET6"); -+ default: -+ return xasprintf ("", family); -+ } -+} -diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c -new file mode 100644 -index 0000000000..eedb030591 ---- /dev/null -+++ b/support/support_format_addrinfo.c -@@ -0,0 +1,239 @@ -+/* Convert struct addrinfo values to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static size_t -+socket_address_length (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return sizeof (struct sockaddr_in); -+ case AF_INET6: -+ return sizeof (struct sockaddr_in6); -+ default: -+ return -1; -+ } -+} -+ -+static void -+format_ai_flags_1 (FILE *out, struct addrinfo *ai, int flag, const char *name, -+ int * flags_printed) -+{ -+ if ((ai->ai_flags & flag) != 0) -+ fprintf (out, " %s", name); -+ *flags_printed |= flag; -+} -+ -+static void -+format_ai_flags (FILE *out, struct addrinfo *ai) -+{ -+ if (ai == NULL) -+ return; -+ -+ if (ai->ai_flags != 0) -+ { -+ fprintf (out, "flags:"); -+ int flags_printed = 0; -+#define FLAG(flag) format_ai_flags_1 (out, ai, flag, #flag, &flags_printed) -+ FLAG (AI_PASSIVE); -+ FLAG (AI_CANONNAME); -+ FLAG (AI_NUMERICHOST); -+ FLAG (AI_V4MAPPED); -+ FLAG (AI_ALL); -+ FLAG (AI_ADDRCONFIG); -+ FLAG (AI_IDN); -+ FLAG (AI_CANONIDN); -+ FLAG (AI_IDN_ALLOW_UNASSIGNED); -+ FLAG (AI_IDN_USE_STD3_ASCII_RULES); -+ FLAG (AI_NUMERICSERV); -+#undef FLAG -+ int remaining = ai->ai_flags & ~flags_printed; -+ if (remaining != 0) -+ fprintf (out, " %08x", remaining); -+ fprintf (out, "\n"); -+ } -+ -+ /* Report flag mismatches within the list. */ -+ int flags = ai->ai_flags; -+ int index = 1; -+ ai = ai->ai_next; -+ while (ai != NULL) -+ { -+ if (ai->ai_flags != flags) -+ fprintf (out, "error: flags at %d: 0x%x expected, 0x%x actual\n", -+ index, flags, ai->ai_flags); -+ ai = ai->ai_next; -+ ++index; -+ } -+} -+ -+static void -+format_ai_canonname (FILE *out, struct addrinfo *ai) -+{ -+ if (ai == NULL) -+ return; -+ if (ai->ai_canonname != NULL) -+ fprintf (out, "canonname: %s\n", ai->ai_canonname); -+ -+ /* Report incorrectly set ai_canonname fields on subsequent list -+ entries. */ -+ int index = 1; -+ ai = ai->ai_next; -+ while (ai != NULL) -+ { -+ if (ai->ai_canonname != NULL) -+ fprintf (out, "error: canonname set at %d: %s\n", -+ index, ai->ai_canonname); -+ ai = ai->ai_next; -+ ++index; -+ } -+} -+ -+static void -+format_ai_one (FILE *out, struct addrinfo *ai) -+{ -+ { -+ char type_buf[32]; -+ const char *type_str; -+ char proto_buf[32]; -+ const char *proto_str; -+ -+ /* ai_socktype */ -+ switch (ai->ai_socktype) -+ { -+ case SOCK_RAW: -+ type_str = "RAW"; -+ break; -+ case SOCK_DGRAM: -+ type_str = "DGRAM"; -+ break; -+ case SOCK_STREAM: -+ type_str = "STREAM"; -+ break; -+ default: -+ snprintf (type_buf, sizeof (type_buf), "%d", ai->ai_socktype); -+ type_str = type_buf; -+ } -+ -+ /* ai_protocol */ -+ switch (ai->ai_protocol) -+ { -+ case IPPROTO_IP: -+ proto_str = "IP"; -+ break; -+ case IPPROTO_UDP: -+ proto_str = "UDP"; -+ break; -+ case IPPROTO_TCP: -+ proto_str = "TCP"; -+ break; -+ default: -+ snprintf (proto_buf, sizeof (proto_buf), "%d", ai->ai_protocol); -+ proto_str = proto_buf; -+ } -+ fprintf (out, "address: %s/%s", type_str, proto_str); -+ } -+ -+ /* ai_addrlen */ -+ if (ai->ai_addrlen != socket_address_length (ai->ai_family)) -+ { -+ char *family = support_format_address_family (ai->ai_family); -+ fprintf (out, "error: invalid address length %d for %s\n", -+ ai->ai_addrlen, family); -+ free (family); -+ } -+ -+ /* ai_addr */ -+ { -+ char buf[128]; -+ uint16_t port; -+ const char *ret; -+ switch (ai->ai_family) -+ { -+ case AF_INET: -+ { -+ struct sockaddr_in *sin = (struct sockaddr_in *) ai->ai_addr; -+ ret = inet_ntop (AF_INET, &sin->sin_addr, buf, sizeof (buf)); -+ port = sin->sin_port; -+ } -+ break; -+ case AF_INET6: -+ { -+ struct sockaddr_in6 *sin = (struct sockaddr_in6 *) ai->ai_addr; -+ ret = inet_ntop (AF_INET6, &sin->sin6_addr, buf, sizeof (buf)); -+ port = sin->sin6_port; -+ } -+ break; -+ default: -+ errno = EAFNOSUPPORT; -+ ret = NULL; -+ } -+ if (ret == NULL) -+ fprintf (out, "error: inet_top failed: %m\n"); -+ else -+ fprintf (out, " %s %u\n", buf, ntohs (port)); -+ } -+} -+ -+/* Format all the addresses in one address family. */ -+static void -+format_ai_family (FILE *out, struct addrinfo *ai, int family) -+{ -+ while (ai) -+ { -+ if (ai->ai_family == family) -+ format_ai_one (out, ai); -+ ai = ai->ai_next; -+ } -+} -+ -+char * -+support_format_addrinfo (struct addrinfo *ai, int ret) -+{ -+ int errno_copy = errno; -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ if (ret != 0) -+ { -+ fprintf (mem.out, "error: %s\n", gai_strerror (ret)); -+ if (ret == EAI_SYSTEM) -+ { -+ errno = errno_copy; -+ fprintf (mem.out, "error: %m\n"); -+ } -+ } -+ else -+ { -+ format_ai_flags (mem.out, ai); -+ format_ai_canonname (mem.out, ai); -+ format_ai_family (mem.out, ai, AF_INET); -+ format_ai_family (mem.out, ai, AF_INET6); -+ } -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_dns_packet.c b/support/support_format_dns_packet.c -new file mode 100644 -index 0000000000..2992c57971 ---- /dev/null -+++ b/support/support_format_dns_packet.c -@@ -0,0 +1,222 @@ -+/* Convert a DNS packet to a human-readable representation. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+struct in_buffer -+{ -+ const unsigned char *data; -+ size_t size; -+}; -+ -+static inline bool -+extract_8 (struct in_buffer *in, unsigned char *value) -+{ -+ if (in->size == 0) -+ return false; -+ *value = in->data[0]; -+ ++in->data; -+ --in->size; -+ return true; -+} -+ -+static inline bool -+extract_16 (struct in_buffer *in, unsigned short *value) -+{ -+ if (in->size < 2) -+ return false; -+ *value = (in->data[0] << 8) | in->data[1]; -+ in->data += 2; -+ in->size -= 2; -+ return true; -+} -+ -+static inline bool -+extract_32 (struct in_buffer *in, unsigned *value) -+{ -+ if (in->size < 4) -+ return false; -+ unsigned a = in->data[0]; -+ unsigned b = in->data[1]; -+ unsigned c = in->data[2]; -+ unsigned d = in->data[3]; -+ *value = (a << 24) | (b << 16) | (c << 8) | d; -+ in->data += 4; -+ in->size -= 4; -+ return true; -+} -+ -+static inline bool -+extract_bytes (struct in_buffer *in, size_t length, struct in_buffer *value) -+{ -+ if (in->size < length) -+ return false; -+ *value = (struct in_buffer) {in->data, length}; -+ in->data += length; -+ in->size -= length; -+ return true; -+} -+ -+struct dname -+{ -+ char name[MAXDNAME + 1]; -+}; -+ -+static bool -+extract_name (struct in_buffer full, struct in_buffer *in, struct dname *value) -+{ -+ const unsigned char *full_end = full.data + full.size; -+ /* Sanity checks; these indicate buffer misuse. */ -+ TEST_VERIFY_EXIT -+ (!(in->data < full.data || in->data > full_end -+ || in->size > (size_t) (full_end - in->data))); -+ int ret = dn_expand (full.data, full_end, in->data, -+ value->name, sizeof (value->name)); -+ if (ret < 0) -+ return false; -+ in->data += ret; -+ in->size -= ret; -+ return true; -+} -+ -+char * -+support_format_dns_packet (const unsigned char *buffer, size_t length) -+{ -+ struct in_buffer full = { buffer, length }; -+ struct in_buffer in = full; -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ unsigned short txnid; -+ unsigned short flags; -+ unsigned short qdcount; -+ unsigned short ancount; -+ unsigned short nscount; -+ unsigned short adcount; -+ if (!(extract_16 (&in, &txnid) -+ && extract_16 (&in, &flags) -+ && extract_16 (&in, &qdcount) -+ && extract_16 (&in, &ancount) -+ && extract_16 (&in, &nscount) -+ && extract_16 (&in, &adcount))) -+ { -+ fprintf (mem.out, "error: could not parse DNS header\n"); -+ goto out; -+ } -+ if (qdcount != 1) -+ { -+ fprintf (mem.out, "error: question count is %d, not 1\n", qdcount); -+ goto out; -+ } -+ struct dname qname; -+ if (!extract_name (full, &in, &qname)) -+ { -+ fprintf (mem.out, "error: malformed QNAME\n"); -+ goto out; -+ } -+ unsigned short qtype; -+ unsigned short qclass; -+ if (!(extract_16 (&in, &qtype) -+ && extract_16 (&in, &qclass))) -+ { -+ fprintf (mem.out, "error: malformed question\n"); -+ goto out; -+ } -+ if (qtype != T_A && qtype != T_AAAA && qtype != T_PTR) -+ { -+ fprintf (mem.out, "error: unsupported QTYPE %d\n", qtype); -+ goto out; -+ } -+ -+ fprintf (mem.out, "name: %s\n", qname.name); -+ -+ for (int i = 0; i < ancount; ++i) -+ { -+ struct dname rname; -+ if (!extract_name (full, &in, &rname)) -+ { -+ fprintf (mem.out, "error: malformed record name\n"); -+ goto out; -+ } -+ unsigned short rtype; -+ unsigned short rclass; -+ unsigned ttl; -+ unsigned short rdlen; -+ struct in_buffer rdata; -+ if (!(extract_16 (&in, &rtype) -+ && extract_16 (&in, &rclass) -+ && extract_32 (&in, &ttl) -+ && extract_16 (&in, &rdlen) -+ && extract_bytes (&in, rdlen, &rdata))) -+ { -+ fprintf (mem.out, "error: malformed record header\n"); -+ goto out; -+ } -+ /* Skip non-matching record types. */ -+ if ((rtype != qtype && rtype != T_CNAME) || rclass != qclass) -+ continue; -+ switch (rtype) -+ { -+ case T_A: -+ if (rdlen == 4) -+ fprintf (mem.out, "address: %d.%d.%d.%d\n", -+ rdata.data[0], -+ rdata.data[1], -+ rdata.data[2], -+ rdata.data[3]); -+ else -+ fprintf (mem.out, "error: A record of size %d: %s\n", -+ rdlen, rname.name); -+ break; -+ case T_AAAA: -+ { -+ if (rdlen == 16) -+ { -+ char buf[100]; -+ if (inet_ntop (AF_INET6, rdata.data, buf, sizeof (buf)) == NULL) -+ fprintf (mem.out, "error: AAAA record decoding failed: %m\n"); -+ else -+ fprintf (mem.out, "address: %s\n", buf); -+ } -+ else -+ fprintf (mem.out, "error: AAAA record of size %d: %s\n", -+ rdlen, rname.name); -+ } -+ break; -+ case T_CNAME: -+ case T_PTR: -+ { -+ struct dname name; -+ if (extract_name (full, &rdata, &name)) -+ fprintf (mem.out, "name: %s\n", name.name); -+ else -+ fprintf (mem.out, "error: malformed CNAME/PTR record\n"); -+ } -+ } -+ } -+ -+ out: -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_herrno.c b/support/support_format_herrno.c -new file mode 100644 -index 0000000000..493d6ae962 ---- /dev/null -+++ b/support/support_format_herrno.c -@@ -0,0 +1,45 @@ -+/* Convert a h_errno error code to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+char * -+support_format_herrno (int code) -+{ -+ const char *errstr; -+ switch (code) -+ { -+ case HOST_NOT_FOUND: -+ errstr = "HOST_NOT_FOUND"; -+ break; -+ case NO_ADDRESS: -+ errstr = "NO_ADDRESS"; -+ break; -+ case NO_RECOVERY: -+ errstr = "NO_RECOVERY"; -+ break; -+ case TRY_AGAIN: -+ errstr = "TRY_AGAIN"; -+ break; -+ default: -+ return xasprintf ("\n", code); -+ } -+ return xstrdup (errstr); -+} -diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c -new file mode 100644 -index 0000000000..5b5f26082e ---- /dev/null -+++ b/support/support_format_hostent.c -@@ -0,0 +1,75 @@ -+/* Convert a struct hostent object to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+static int -+address_length (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return 4; -+ case AF_INET6: -+ return 16; -+ } -+ return -1; -+} -+ -+char * -+support_format_hostent (struct hostent *h) -+{ -+ if (h == NULL) -+ { -+ char *value = support_format_herrno (h_errno); -+ char *result = xasprintf ("error: %s\n", value); -+ free (value); -+ return result; -+ } -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ fprintf (mem.out, "name: %s\n", h->h_name); -+ for (char **alias = h->h_aliases; *alias != NULL; ++alias) -+ fprintf (mem.out, "alias: %s\n", *alias); -+ for (unsigned i = 0; h->h_addr_list[i] != NULL; ++i) -+ { -+ char buf[128]; -+ if (inet_ntop (h->h_addrtype, h->h_addr_list[i], -+ buf, sizeof (buf)) == NULL) -+ fprintf (mem.out, "error: inet_ntop failed: %m\n"); -+ else -+ fprintf (mem.out, "address: %s\n", buf); -+ } -+ if (h->h_length != address_length (h->h_addrtype)) -+ { -+ char *family = support_format_address_family (h->h_addrtype); -+ fprintf (mem.out, "error: invalid address length %d for %s\n", -+ h->h_length, family); -+ free (family); -+ } -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_netent.c b/support/support_format_netent.c -new file mode 100644 -index 0000000000..020f5720d9 ---- /dev/null -+++ b/support/support_format_netent.c -@@ -0,0 +1,52 @@ -+/* Convert a struct netent object to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+char * -+support_format_netent (struct netent *e) -+{ -+ if (e == NULL) -+ { -+ char *value = support_format_herrno (h_errno); -+ char *result = xasprintf ("error: %s\n", value); -+ free (value); -+ return result; -+ } -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ if (e->n_name != NULL) -+ fprintf (mem.out, "name: %s\n", e->n_name); -+ for (char **ap = e->n_aliases; *ap != NULL; ++ap) -+ fprintf (mem.out, "alias: %s\n", *ap); -+ if (e->n_addrtype != AF_INET) -+ fprintf (mem.out, "addrtype: %d\n", e->n_addrtype); -+ /* On alpha, e->n_net is an unsigned long. */ -+ unsigned int n_net = e->n_net; -+ fprintf (mem.out, "net: 0x%08x\n", n_net); -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_isolate_in_subprocess.c b/support/support_isolate_in_subprocess.c -new file mode 100644 -index 0000000000..cf48614383 ---- /dev/null -+++ b/support/support_isolate_in_subprocess.c -@@ -0,0 +1,38 @@ -+/* Run a function in a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+void -+support_isolate_in_subprocess (void (*callback) (void *), void *closure) -+{ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ /* Child process. */ -+ callback (closure); -+ _exit (0); -+ } -+ -+ /* Parent process. */ -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (status != 0) -+ FAIL_EXIT1 ("child process exited with status %d", status); -+} -diff --git a/support/support_record_failure.c b/support/support_record_failure.c -new file mode 100644 -index 0000000000..684055c746 ---- /dev/null -+++ b/support/support_record_failure.c -@@ -0,0 +1,106 @@ -+/* Global test failure counter. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* This structure keeps track of test failures. The counter is -+ incremented on each failure. The failed member is set to true if a -+ failure is detected, so that even if the counter wraps around to -+ zero, the failure of a test can be detected. -+ -+ The init constructor function below puts *state on a shared -+ annonymous mapping, so that failure reports from subprocesses -+ propagate to the parent process. */ -+struct test_failures -+{ -+ unsigned int counter; -+ unsigned int failed; -+}; -+static struct test_failures *state; -+ -+static __attribute__ ((constructor)) void -+init (void) -+{ -+ void *ptr = mmap (NULL, sizeof (*state), PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_SHARED, -1, 0); -+ if (ptr == MAP_FAILED) -+ { -+ printf ("error: could not map %zu bytes: %m\n", sizeof (*state)); -+ exit (1); -+ } -+ /* Zero-initialization of the struct is sufficient. */ -+ state = ptr; -+} -+ -+void -+support_record_failure (void) -+{ -+ if (state == NULL) -+ { -+ write_message -+ ("error: support_record_failure called without initialization\n"); -+ _exit (1); -+ } -+ /* Relaxed MO is sufficient because we are only interested in the -+ values themselves, in isolation. */ -+ __atomic_store_n (&state->failed, 1, __ATOMIC_RELEASE); -+ __atomic_add_fetch (&state->counter, 1, __ATOMIC_RELEASE); -+} -+ -+int -+support_report_failure (int status) -+{ -+ if (state == NULL) -+ { -+ write_message -+ ("error: support_report_failure called without initialization\n"); -+ return 1; -+ } -+ -+ /* Relaxed MO is sufficient because acquire test result reporting -+ assumes that exiting from the main thread happens before the -+ error reporting via support_record_failure, which requires some -+ form of external synchronization. */ -+ bool failed = __atomic_load_n (&state->failed, __ATOMIC_RELAXED); -+ if (failed) -+ printf ("error: %u test failures\n", -+ __atomic_load_n (&state->counter, __ATOMIC_RELAXED)); -+ -+ if ((status == 0 || status == EXIT_UNSUPPORTED) && failed) -+ /* If we have a recorded failure, it overrides a non-failure -+ report from the test function. */ -+ status = 1; -+ return status; -+} -+ -+void -+support_record_failure_reset (void) -+{ -+ /* Only used for testing the test framework, with external -+ synchronization, but use release MO for consistency. */ -+ __atomic_store_n (&state->failed, 0, __ATOMIC_RELAXED); -+ __atomic_add_fetch (&state->counter, 0, __ATOMIC_RELAXED); -+} -diff --git a/support/support_run_diff.c b/support/support_run_diff.c -new file mode 100644 -index 0000000000..f5155de727 ---- /dev/null -+++ b/support/support_run_diff.c -@@ -0,0 +1,76 @@ -+/* Invoke the system diff tool to compare two strings. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static char * -+write_to_temp_file (const char *prefix, const char *str) -+{ -+ char *template = xasprintf ("run_diff-%s", prefix); -+ char *name = NULL; -+ int fd = create_temp_file (template, &name); -+ TEST_VERIFY_EXIT (fd >= 0); -+ free (template); -+ xwrite (fd, str, strlen (str)); -+ xclose (fd); -+ return name; -+} -+ -+void -+support_run_diff (const char *left_label, const char *left, -+ const char *right_label, const char *right) -+{ -+ /* Ensure that the diff command output is ordered properly with -+ standard output. */ -+ TEST_VERIFY_EXIT (fflush (stdout) == 0); -+ -+ char *left_path = write_to_temp_file ("left-diff", left); -+ char *right_path = write_to_temp_file ("right-diff", right); -+ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ execlp ("diff", "diff", "-u", -+ "--label", left_label, "--label", right_label, -+ "--", left_path, right_path, -+ NULL); -+ _exit (17); -+ } -+ else -+ { -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (!WIFEXITED (status) || WEXITSTATUS (status) != 1) -+ printf ("warning: could not run diff, exit status: %d\n" -+ "*** %s ***\n%s\n" -+ "*** %s ***\n%s\n", -+ status, left_label, left, right_label, right); -+ } -+ -+ free (right_path); -+ free (left_path); -+} -diff --git a/support/support_shared_allocate.c b/support/support_shared_allocate.c -new file mode 100644 -index 0000000000..61d088e8cf ---- /dev/null -+++ b/support/support_shared_allocate.c -@@ -0,0 +1,57 @@ -+/* Allocate a memory region shared across processes. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* Header for the allocation. It contains the size of the allocation -+ for subsequent unmapping. */ -+struct header -+{ -+ size_t total_size; -+ char data[] __attribute__ ((aligned (__alignof__ (max_align_t)))); -+}; -+ -+void * -+support_shared_allocate (size_t size) -+{ -+ size_t total_size = size + offsetof (struct header, data); -+ if (total_size < size) -+ { -+ errno = ENOMEM; -+ oom_error (__func__, size); -+ return NULL; -+ } -+ else -+ { -+ struct header *result = xmmap (NULL, total_size, PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_SHARED, -1); -+ result->total_size = total_size; -+ return &result->data; -+ } -+} -+ -+void -+support_shared_free (void *data) -+{ -+ struct header *header = data - offsetof (struct header, data); -+ xmunmap (header, header->total_size); -+} -diff --git a/support/support_test_main.c b/support/support_test_main.c -new file mode 100644 -index 0000000000..914d64f603 ---- /dev/null -+++ b/support/support_test_main.c -@@ -0,0 +1,423 @@ -+/* Main worker function for the test driver. -+ Copyright (C) 1998-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const struct option default_options[] = -+{ -+ TEST_DEFAULT_OPTIONS -+ { NULL, 0, NULL, 0 } -+}; -+ -+/* Show people how to run the program. */ -+static void -+usage (const struct option *options) -+{ -+ size_t i; -+ -+ printf ("Usage: %s [options]\n" -+ "\n" -+ "Environment Variables:\n" -+ " TIMEOUTFACTOR An integer used to scale the timeout\n" -+ " TMPDIR Where to place temporary files\n" -+ " TEST_COREDUMPS Do not disable coredumps if set\n" -+ "\n", -+ program_invocation_short_name); -+ printf ("Options:\n"); -+ for (i = 0; options[i].name; ++i) -+ { -+ int indent; -+ -+ indent = printf (" --%s", options[i].name); -+ if (options[i].has_arg == required_argument) -+ indent += printf (" "); -+ printf ("%*s", 25 - indent, ""); -+ switch (options[i].val) -+ { -+ case 'v': -+ printf ("Increase the output verbosity"); -+ break; -+ case OPT_DIRECT: -+ printf ("Run the test directly (instead of forking & monitoring)"); -+ break; -+ case OPT_TESTDIR: -+ printf ("Override the TMPDIR env var"); -+ break; -+ } -+ printf ("\n"); -+ } -+} -+ -+/* The PID of the test process. */ -+static pid_t test_pid; -+ -+/* The cleanup handler passed to test_main. */ -+static void (*cleanup_function) (void); -+ -+/* Timeout handler. We kill the child and exit with an error. */ -+static void -+__attribute__ ((noreturn)) -+signal_handler (int sig) -+{ -+ int killed; -+ int status; -+ -+ assert (test_pid > 1); -+ /* Kill the whole process group. */ -+ kill (-test_pid, SIGKILL); -+ /* In case setpgid failed in the child, kill it individually too. */ -+ kill (test_pid, SIGKILL); -+ -+ /* Wait for it to terminate. */ -+ int i; -+ for (i = 0; i < 5; ++i) -+ { -+ killed = waitpid (test_pid, &status, WNOHANG|WUNTRACED); -+ if (killed != 0) -+ break; -+ -+ /* Delay, give the system time to process the kill. If the -+ nanosleep() call return prematurely, all the better. We -+ won't restart it since this probably means the child process -+ finally died. */ -+ struct timespec ts; -+ ts.tv_sec = 0; -+ ts.tv_nsec = 100000000; -+ nanosleep (&ts, NULL); -+ } -+ if (killed != 0 && killed != test_pid) -+ { -+ printf ("Failed to kill test process: %m\n"); -+ exit (1); -+ } -+ -+ if (cleanup_function != NULL) -+ cleanup_function (); -+ -+ if (sig == SIGINT) -+ { -+ signal (sig, SIG_DFL); -+ raise (sig); -+ } -+ -+ if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)) -+ puts ("Timed out: killed the child process"); -+ else if (WIFSTOPPED (status)) -+ printf ("Timed out: the child process was %s\n", -+ strsignal (WSTOPSIG (status))); -+ else if (WIFSIGNALED (status)) -+ printf ("Timed out: the child process got signal %s\n", -+ strsignal (WTERMSIG (status))); -+ else -+ printf ("Timed out: killed the child process but it exited %d\n", -+ WEXITSTATUS (status)); -+ -+ /* Exit with an error. */ -+ exit (1); -+} -+ -+/* Run test_function or test_function_argv. */ -+static int -+run_test_function (int argc, char **argv, const struct test_config *config) -+{ -+ if (config->test_function != NULL) -+ return config->test_function (); -+ else if (config->test_function_argv != NULL) -+ return config->test_function_argv (argc, argv); -+ else -+ { -+ printf ("error: no test function defined\n"); -+ exit (1); -+ } -+} -+ -+static bool test_main_called; -+ -+const char *test_dir = NULL; -+unsigned int test_verbose = 0; -+ -+/* If test failure reporting has been linked in, it may contribute -+ additional test failures. */ -+static int -+adjust_exit_status (int status) -+{ -+ if (support_report_failure != NULL) -+ return support_report_failure (status); -+ return status; -+} -+ -+int -+support_test_main (int argc, char **argv, const struct test_config *config) -+{ -+ if (test_main_called) -+ { -+ printf ("error: test_main called for a second time\n"); -+ exit (1); -+ } -+ test_main_called = true; -+ const struct option *options; -+ if (config->options != NULL) -+ options = config->options; -+ else -+ options = default_options; -+ -+ cleanup_function = config->cleanup_function; -+ -+ int direct = 0; /* Directly call the test function? */ -+ int status; -+ int opt; -+ unsigned int timeoutfactor = 1; -+ pid_t termpid; -+ -+ if (!config->no_mallopt) -+ { -+ /* Make uses of freed and uninitialized memory known. Do not -+ pull in a definition for mallopt if it has not been defined -+ already. */ -+ extern __typeof__ (mallopt) mallopt __attribute__ ((weak)); -+ if (mallopt != NULL) -+ mallopt (M_PERTURB, 42); -+ } -+ -+ while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1) -+ switch (opt) -+ { -+ case '?': -+ usage (options); -+ exit (1); -+ case 'v': -+ ++test_verbose; -+ break; -+ case OPT_DIRECT: -+ direct = 1; -+ break; -+ case OPT_TESTDIR: -+ test_dir = optarg; -+ break; -+ default: -+ if (config->cmdline_function != NULL) -+ config->cmdline_function (opt); -+ } -+ -+ /* If set, read the test TIMEOUTFACTOR value from the environment. -+ This value is used to scale the default test timeout values. */ -+ char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR"); -+ if (envstr_timeoutfactor != NULL) -+ { -+ char *envstr_conv = envstr_timeoutfactor; -+ unsigned long int env_fact; -+ -+ env_fact = strtoul (envstr_timeoutfactor, &envstr_conv, 0); -+ if (*envstr_conv == '\0' && envstr_conv != envstr_timeoutfactor) -+ timeoutfactor = MAX (env_fact, 1); -+ } -+ -+ /* Set TMPDIR to specified test directory. */ -+ if (test_dir != NULL) -+ { -+ setenv ("TMPDIR", test_dir, 1); -+ -+ if (chdir (test_dir) < 0) -+ { -+ printf ("chdir: %m\n"); -+ exit (1); -+ } -+ } -+ else -+ { -+ test_dir = getenv ("TMPDIR"); -+ if (test_dir == NULL || test_dir[0] == '\0') -+ test_dir = "/tmp"; -+ } -+ if (support_set_test_dir != NULL) -+ support_set_test_dir (test_dir); -+ -+ int timeout = config->timeout; -+ if (timeout == 0) -+ timeout = DEFAULT_TIMEOUT; -+ -+ /* Make sure we see all message, even those on stdout. */ -+ setvbuf (stdout, NULL, _IONBF, 0); -+ -+ /* Make sure temporary files are deleted. */ -+ if (support_delete_temp_files != NULL) -+ atexit (support_delete_temp_files); -+ -+ /* Correct for the possible parameters. */ -+ argv[optind - 1] = argv[0]; -+ argv += optind - 1; -+ argc -= optind - 1; -+ -+ /* Call the initializing function, if one is available. */ -+ if (config->prepare_function != NULL) -+ config->prepare_function (argc, argv); -+ -+ const char *envstr_direct = getenv ("TEST_DIRECT"); -+ if (envstr_direct != NULL) -+ { -+ FILE *f = fopen (envstr_direct, "w"); -+ if (f == NULL) -+ { -+ printf ("cannot open TEST_DIRECT output file '%s': %m\n", -+ envstr_direct); -+ exit (1); -+ } -+ -+ fprintf (f, "timeout=%u\ntimeoutfactor=%u\n", -+ config->timeout, timeoutfactor); -+ if (config->expected_status != 0) -+ fprintf (f, "exit=%u\n", config->expected_status); -+ if (config->expected_signal != 0) -+ fprintf (f, "signal=%s\n", strsignal (config->expected_signal)); -+ -+ if (support_print_temp_files != NULL) -+ support_print_temp_files (f); -+ -+ fclose (f); -+ direct = 1; -+ } -+ -+ bool disable_coredumps; -+ { -+ const char *coredumps = getenv ("TEST_COREDUMPS"); -+ disable_coredumps = coredumps == NULL || coredumps[0] == '\0'; -+ } -+ -+ /* If we are not expected to fork run the function immediately. */ -+ if (direct) -+ return adjust_exit_status (run_test_function (argc, argv, config)); -+ -+ /* Set up the test environment: -+ - prevent core dumps -+ - set up the timer -+ - fork and execute the function. */ -+ -+ test_pid = fork (); -+ if (test_pid == 0) -+ { -+ /* This is the child. */ -+ if (disable_coredumps) -+ { -+ /* Try to avoid dumping core. This is necessary because we -+ run the test from the source tree, and the coredumps -+ would end up there (and not in the build tree). */ -+ struct rlimit core_limit; -+ core_limit.rlim_cur = 0; -+ core_limit.rlim_max = 0; -+ setrlimit (RLIMIT_CORE, &core_limit); -+ } -+ -+ /* We put the test process in its own pgrp so that if it bogusly -+ generates any job control signals, they won't hit the whole build. */ -+ if (setpgid (0, 0) != 0) -+ printf ("Failed to set the process group ID: %m\n"); -+ -+ /* Execute the test function and exit with the return value. */ -+ exit (run_test_function (argc, argv, config)); -+ } -+ else if (test_pid < 0) -+ { -+ printf ("Cannot fork test program: %m\n"); -+ exit (1); -+ } -+ -+ /* Set timeout. */ -+ signal (SIGALRM, signal_handler); -+ alarm (timeout * timeoutfactor); -+ -+ /* Make sure we clean up if the wrapper gets interrupted. */ -+ signal (SIGINT, signal_handler); -+ -+ /* Wait for the regular termination. */ -+ termpid = TEMP_FAILURE_RETRY (waitpid (test_pid, &status, 0)); -+ if (termpid == -1) -+ { -+ printf ("Waiting for test program failed: %m\n"); -+ exit (1); -+ } -+ if (termpid != test_pid) -+ { -+ printf ("Oops, wrong test program terminated: expected %ld, got %ld\n", -+ (long int) test_pid, (long int) termpid); -+ exit (1); -+ } -+ -+ /* Process terminated normaly without timeout etc. */ -+ if (WIFEXITED (status)) -+ { -+ if (config->expected_status == 0) -+ { -+ if (config->expected_signal == 0) -+ /* Exit with the return value of the test. */ -+ return adjust_exit_status (WEXITSTATUS (status)); -+ else -+ { -+ printf ("Expected signal '%s' from child, got none\n", -+ strsignal (config->expected_signal)); -+ exit (1); -+ } -+ } -+ else -+ { -+ /* Non-zero exit status is expected */ -+ if (WEXITSTATUS (status) != config->expected_status) -+ { -+ printf ("Expected status %d, got %d\n", -+ config->expected_status, WEXITSTATUS (status)); -+ exit (1); -+ } -+ } -+ return adjust_exit_status (0); -+ } -+ /* Process was killed by timer or other signal. */ -+ else -+ { -+ if (config->expected_signal == 0) -+ { -+ printf ("Didn't expect signal from child: got `%s'\n", -+ strsignal (WTERMSIG (status))); -+ exit (1); -+ } -+ else if (WTERMSIG (status) != config->expected_signal) -+ { -+ printf ("Incorrect signal from child: got `%s', need `%s'\n", -+ strsignal (WTERMSIG (status)), -+ strsignal (config->expected_signal)); -+ exit (1); -+ } -+ -+ return adjust_exit_status (0); -+ } -+} -diff --git a/support/support_test_verify_impl.c b/support/support_test_verify_impl.c -new file mode 100644 -index 0000000000..5bae38f8b1 ---- /dev/null -+++ b/support/support_test_verify_impl.c -@@ -0,0 +1,33 @@ -+/* Implementation of the TEST_VERIFY and TEST_VERIFY_EXIT macros. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+ -+void -+support_test_verify_impl (int status, const char *file, int line, -+ const char *expr) -+{ -+ support_record_failure (); -+ printf ("error: %s:%d: not true: %s\n", file, line, expr); -+ if (status >= 0) -+ exit (status); -+ -+} -diff --git a/support/support_write_file_string.c b/support/support_write_file_string.c -new file mode 100644 -index 0000000000..48e89597f3 ---- /dev/null -+++ b/support/support_write_file_string.c -@@ -0,0 +1,39 @@ -+/* Write a string to a file. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+void -+support_write_file_string (const char *path, const char *contents) -+{ -+ int fd = xopen (path, O_CREAT | O_TRUNC | O_WRONLY, 0666); -+ const char *end = contents + strlen (contents); -+ for (const char *p = contents; p < end; ) -+ { -+ ssize_t ret = write (fd, p, end - p); -+ if (ret < 0) -+ FAIL_EXIT1 ("cannot write to \"%s\": %m", path); -+ if (ret == 0) -+ FAIL_EXIT1 ("zero-length write to \"%s\"", path); -+ p += ret; -+ } -+ xclose (fd); -+} -diff --git a/support/temp_file-internal.h b/support/temp_file-internal.h -new file mode 100644 -index 0000000000..fb6cceb065 ---- /dev/null -+++ b/support/temp_file-internal.h -@@ -0,0 +1,31 @@ -+/* Internal weak declarations for temporary file handling. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEMP_FILE_INTERNAL_H -+#define SUPPORT_TEMP_FILE_INTERNAL_H -+ -+/* These functions are called by the test driver if they are -+ defined. Tests should not call them directly. */ -+ -+#include -+ -+void support_set_test_dir (const char *name) __attribute__ ((weak)); -+void support_delete_temp_files (void) __attribute__ ((weak)); -+void support_print_temp_files (FILE *) __attribute__ ((weak)); -+ -+#endif /* SUPPORT_TEMP_FILE_INTERNAL_H */ -diff --git a/support/temp_file.c b/support/temp_file.c -new file mode 100644 -index 0000000000..fdb2477ab9 ---- /dev/null -+++ b/support/temp_file.c -@@ -0,0 +1,132 @@ -+/* Temporary file handling for tests. -+ Copyright (C) 1998-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This is required to get an mkstemp which can create large files on -+ some 32-bit platforms. */ -+#define _FILE_OFFSET_BITS 64 -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* List of temporary files. */ -+static struct temp_name_list -+{ -+ struct temp_name_list *next; -+ char *name; -+ pid_t owner; -+} *temp_name_list; -+ -+/* Location of the temporary files. Set by the test skeleton via -+ support_set_test_dir. The string is not be freed. */ -+static const char *test_dir = _PATH_TMP; -+ -+void -+add_temp_file (const char *name) -+{ -+ struct temp_name_list *newp -+ = (struct temp_name_list *) xcalloc (sizeof (*newp), 1); -+ char *newname = strdup (name); -+ if (newname != NULL) -+ { -+ newp->name = newname; -+ newp->next = temp_name_list; -+ newp->owner = getpid (); -+ temp_name_list = newp; -+ } -+ else -+ free (newp); -+} -+ -+int -+create_temp_file (const char *base, char **filename) -+{ -+ char *fname; -+ int fd; -+ -+ fname = (char *) xmalloc (strlen (test_dir) + 1 + strlen (base) -+ + sizeof ("XXXXXX")); -+ strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX"); -+ -+ fd = mkstemp (fname); -+ if (fd == -1) -+ { -+ printf ("cannot open temporary file '%s': %m\n", fname); -+ free (fname); -+ return -1; -+ } -+ -+ add_temp_file (fname); -+ if (filename != NULL) -+ *filename = fname; -+ else -+ free (fname); -+ -+ return fd; -+} -+ -+/* Helper functions called by the test skeleton follow. */ -+ -+void -+support_set_test_dir (const char *path) -+{ -+ test_dir = path; -+} -+ -+void -+support_delete_temp_files (void) -+{ -+ pid_t pid = getpid (); -+ while (temp_name_list != NULL) -+ { -+ /* Only perform the removal if the path was registed in the same -+ process, as identified by the PID. (This assumes that the -+ parent process which registered the temporary file sticks -+ around, to prevent PID reuse.) */ -+ if (temp_name_list->owner == pid) -+ { -+ if (remove (temp_name_list->name) != 0) -+ printf ("warning: could not remove temporary file: %s: %m\n", -+ temp_name_list->name); -+ } -+ free (temp_name_list->name); -+ -+ struct temp_name_list *next = temp_name_list->next; -+ free (temp_name_list); -+ temp_name_list = next; -+ } -+} -+ -+void -+support_print_temp_files (FILE *f) -+{ -+ if (temp_name_list != NULL) -+ { -+ struct temp_name_list *n; -+ fprintf (f, "temp_files=(\n"); -+ for (n = temp_name_list; n != NULL; n = n->next) -+ fprintf (f, " '%s'\n", n->name); -+ fprintf (f, ")\n"); -+ } -+} -diff --git a/support/temp_file.h b/support/temp_file.h -new file mode 100644 -index 0000000000..6fed8df1ea ---- /dev/null -+++ b/support/temp_file.h -@@ -0,0 +1,37 @@ -+/* Declarations for temporary file handling. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEMP_FILE_H -+#define SUPPORT_TEMP_FILE_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+/* Schedule a temporary file for deletion on exit. */ -+void add_temp_file (const char *name); -+ -+/* Create a temporary file. Return the opened file descriptor on -+ success, or -1 on failure. Write the file name to *FILENAME if -+ FILENAME is not NULL. In this case, the caller is expected to free -+ *FILENAME. */ -+int create_temp_file (const char *base, char **filename); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_TEMP_FILE_H */ -diff --git a/support/test-driver.c b/support/test-driver.c -new file mode 100644 -index 0000000000..482066dbeb ---- /dev/null -+++ b/support/test-driver.c -@@ -0,0 +1,156 @@ -+/* Main function for test programs. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This file should be included from test cases. It will define a -+ main function which provides the test wrapper. -+ -+ It assumes that the test case defines a function -+ -+ int do_test (void); -+ -+ and arranges for that function being called under the test wrapper. -+ The do_test function should return 0 to indicate a passing test, 1 -+ to indicate a failing test, or 77 to indicate an unsupported test. -+ Other result values could be used to indicate a failing test, but -+ the result of the expression is passed to exit and exit only -+ returns the lower 8 bits of its input. A non-zero return with some -+ values could cause a test to incorrectly be considered passing when -+ it really failed. For this reason, the function should always -+ return 0 (EXIT_SUCCESS), 1 (EXIT_FAILURE), or 77 -+ (EXIT_UNSUPPORTED). -+ -+ The test function may print out diagnostic or warning messages as well -+ as messages about failures. These messages should be printed to stdout -+ and not stderr so that the output is properly ordered with respect to -+ the rest of the glibc testsuite run output. -+ -+ Several preprocessors macros can be defined before including this -+ file. -+ -+ The name of the do_test function can be changed with the -+ TEST_FUNCTION macro. It must expand to the desired function name. -+ -+ If the test case needs access to command line parameters, it must -+ define the TEST_FUNCTION_ARGV macro with the name of the test -+ function. It must have the following type: -+ -+ int TEST_FUNCTION_ARGV (int argc, char **argv); -+ -+ This overrides the do_test default function and is incompatible -+ with the TEST_FUNCTION macro. -+ -+ If PREPARE is defined, it must expand to the name of a function of -+ the type -+ -+ void PREPARE (int argc, char **); -+ -+ This function will be called early, after parsing the command line, -+ but before running the test, in the parent process which acts as -+ the test supervisor. -+ -+ If CLEANUP_HANDLER is defined, it must expand to the name of a -+ function of the type -+ -+ void CLEANUP_HANDLER (void); -+ -+ This function will be called from the timeout (SIGALRM) signal -+ handler. -+ -+ If EXPECTED_SIGNAL is defined, it must expanded to a constant which -+ denotes the expected signal number. -+ -+ If EXPECTED_STATUS is defined, it must expand to the expected exit -+ status. -+ -+ If TIMEOUT is defined, it must be positive constant. It overrides -+ the default test timeout and is measured in seconds. -+ -+ If TEST_NO_MALLOPT is defined, the test wrapper will not call -+ mallopt. -+ -+ Custom command line handling can be implemented by defining the -+ CMDLINE_OPTION macro (after including the header; this -+ requires _GNU_SOURCE to be defined). This macro must expand to a -+ to a comma-separated list of braced initializers for struct option -+ from , with a trailing comma. CMDLINE_PROCESS can be -+ defined as the name of a function which is called to process these -+ options. The function is passed the option character/number and -+ has this type: -+ -+ void CMDLINE_PROCESS (int); -+*/ -+ -+#include -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ struct test_config test_config; -+ memset (&test_config, 0, sizeof (test_config)); -+ -+#ifdef PREPARE -+ test_config.prepare_function = (PREPARE); -+#endif -+ -+#if defined (TEST_FUNCTION) && defined (TEST_FUNCTON_ARGV) -+# error TEST_FUNCTION and TEST_FUNCTION_ARGV cannot be defined at the same time -+#endif -+#if defined (TEST_FUNCTION) -+ test_config.test_function = TEST_FUNCTION; -+#elif defined (TEST_FUNCTION_ARGV) -+ test_config.test_function_argv = TEST_FUNCTION_ARGV; -+#else -+ test_config.test_function = do_test; -+#endif -+ -+#ifdef CLEANUP_HANDLER -+ test_config.cleanup_function = CLEANUP_HANDLER; -+#endif -+ -+#ifdef EXPECTED_SIGNAL -+ test_config.expected_signal = (EXPECTED_SIGNAL); -+#endif -+ -+#ifdef EXPECTED_STATUS -+ test_config.expected_status = (EXPECTED_STATUS); -+#endif -+ -+#ifdef TEST_NO_MALLOPT -+ test_config.no_mallopt = 1; -+#endif -+ -+#ifdef TIMEOUT -+ test_config.timeout = TIMEOUT; -+#endif -+ -+#ifdef CMDLINE_OPTIONS -+ struct option options[] = -+ { -+ CMDLINE_OPTIONS -+ TEST_DEFAULT_OPTIONS -+ }; -+ test_config.options = &options; -+#endif -+#ifdef CMDLINE_PROCESS -+ test_config.cmdline_function = CMDLINE_PROCESS; -+#endif -+ -+ return support_test_main (argc, argv, &test_config); -+} -diff --git a/support/test-driver.h b/support/test-driver.h -new file mode 100644 -index 0000000000..af1971a9ca ---- /dev/null -+++ b/support/test-driver.h -@@ -0,0 +1,74 @@ -+/* Interfaces for the test driver. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEST_DRIVER_H -+#define SUPPORT_TEST_DRIVER_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+struct test_config -+{ -+ void (*prepare_function) (int argc, char **argv); -+ int (*test_function) (void); -+ int (*test_function_argv) (int argc, char **argv); -+ void (*cleanup_function) (void); -+ void (*cmdline_function) (int); -+ const void *options; /* Custom options if not NULL. */ -+ int timeout; /* Test timeout in seconds. */ -+ int expected_status; /* Expected exit status. */ -+ int expected_signal; /* If non-zero, expect termination by signal. */ -+ char no_mallopt; /* Boolean flag to disable mallopt. */ -+}; -+ -+enum -+ { -+ /* Test exit status which indicates that the feature is -+ unsupported. */ -+ EXIT_UNSUPPORTED = 77, -+ -+ /* Default timeout is twenty seconds. Tests should normally -+ complete faster than this, but if they don't, that's abnormal -+ (a bug) anyways. */ -+ DEFAULT_TIMEOUT = 20, -+ -+ /* Used for command line argument parsing. */ -+ OPT_DIRECT = 1000, -+ OPT_TESTDIR, -+ }; -+ -+/* Options provided by the test driver. */ -+#define TEST_DEFAULT_OPTIONS \ -+ { "verbose", no_argument, NULL, 'v' }, \ -+ { "direct", no_argument, NULL, OPT_DIRECT }, \ -+ { "test-dir", required_argument, NULL, OPT_TESTDIR }, \ -+ -+/* The directory the test should use for temporary files. */ -+extern const char *test_dir; -+ -+/* The number of --verbose arguments specified during program -+ invocation. This variable can be used to control the verbosity of -+ tests. */ -+extern unsigned int test_verbose; -+ -+int support_test_main (int argc, char **argv, const struct test_config *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_TEST_DRIVER_H */ -diff --git a/support/tst-support-namespace.c b/support/tst-support-namespace.c -new file mode 100644 -index 0000000000..a50b074f5e ---- /dev/null -+++ b/support/tst-support-namespace.c -@@ -0,0 +1,34 @@ -+/* Test entering namespaces. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ if (support_become_root ()) -+ printf ("info: acquired root-like privileges\n"); -+ if (support_enter_network_namespace ()) -+ printf ("info: entered network namespace\n"); -+ if (support_in_uts_namespace ()) -+ printf ("info: also entered UTS namespace\n"); -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_capture_subprocess.c b/support/tst-support_capture_subprocess.c -new file mode 100644 -index 0000000000..5672fba0f7 ---- /dev/null -+++ b/support/tst-support_capture_subprocess.c -@@ -0,0 +1,188 @@ -+/* Test capturing output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Write one byte at *P to FD and advance *P. Do nothing if *P is -+ '\0'. */ -+static void -+transfer (const unsigned char **p, int fd) -+{ -+ if (**p != '\0') -+ { -+ TEST_VERIFY (write (fd, *p, 1) == 1); -+ ++*p; -+ } -+} -+ -+/* Determine the order in which stdout and stderr are written. */ -+enum write_mode { out_first, err_first, interleave, -+ write_mode_last = interleave }; -+ -+/* Describe what to write in the subprocess. */ -+struct test -+{ -+ char *out; -+ char *err; -+ enum write_mode write_mode; -+ int signal; -+ int status; -+}; -+ -+/* For use with support_capture_subprocess. */ -+static void -+callback (void *closure) -+{ -+ const struct test *test = closure; -+ bool mode_ok = false; -+ switch (test->write_mode) -+ { -+ case out_first: -+ TEST_VERIFY (fputs (test->out, stdout) >= 0); -+ TEST_VERIFY (fflush (stdout) == 0); -+ TEST_VERIFY (fputs (test->err, stderr) >= 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ mode_ok = true; -+ break; -+ case err_first: -+ TEST_VERIFY (fputs (test->err, stderr) >= 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ TEST_VERIFY (fputs (test->out, stdout) >= 0); -+ TEST_VERIFY (fflush (stdout) == 0); -+ mode_ok = true; -+ break; -+ case interleave: -+ { -+ const unsigned char *pout = (const unsigned char *) test->out; -+ const unsigned char *perr = (const unsigned char *) test->err; -+ do -+ { -+ transfer (&pout, STDOUT_FILENO); -+ transfer (&perr, STDERR_FILENO); -+ } -+ while (*pout != '\0' || *perr != '\0'); -+ } -+ mode_ok = true; -+ break; -+ } -+ TEST_VERIFY (mode_ok); -+ -+ if (test->signal != 0) -+ raise (test->signal); -+ exit (test->status); -+} -+ -+/* Create a heap-allocated random string of letters. */ -+static char * -+random_string (size_t length) -+{ -+ char *result = xmalloc (length + 1); -+ for (size_t i = 0; i < length; ++i) -+ result[i] = 'a' + (rand () % 26); -+ result[length] = '\0'; -+ return result; -+} -+ -+/* Check that the specific stream from the captured subprocess matches -+ expectations. */ -+static void -+check_stream (const char *what, const struct xmemstream *stream, -+ const char *expected) -+{ -+ if (strcmp (stream->buffer, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: captured %s data incorrect\n" -+ " expected: %s\n" -+ " actual: %s\n", -+ what, expected, stream->buffer); -+ } -+ if (stream->length != strlen (expected)) -+ { -+ support_record_failure (); -+ printf ("error: captured %s data length incorrect\n" -+ " expected: %zu\n" -+ " actual: %zu\n", -+ what, strlen (expected), stream->length); -+ } -+} -+ -+static int -+do_test (void) -+{ -+ const int lengths[] = {0, 1, 17, 512, 20000, -1}; -+ -+ /* Test multiple combinations of support_capture_subprocess. -+ -+ length_idx_stdout: Index into the lengths array above, -+ controls how many bytes are written by the subprocess to -+ standard output. -+ length_idx_stderr: Same for standard error. -+ write_mode: How standard output and standard error writes are -+ ordered. -+ signal: Exit with no signal if zero, with SIGTERM if one. -+ status: Process exit status: 0 if zero, 3 if one. */ -+ for (int length_idx_stdout = 0; lengths[length_idx_stdout] >= 0; -+ ++length_idx_stdout) -+ for (int length_idx_stderr = 0; lengths[length_idx_stderr] >= 0; -+ ++length_idx_stderr) -+ for (int write_mode = 0; write_mode < write_mode_last; ++write_mode) -+ for (int signal = 0; signal < 2; ++signal) -+ for (int status = 0; status < 2; ++status) -+ { -+ struct test test = -+ { -+ .out = random_string (lengths[length_idx_stdout]), -+ .err = random_string (lengths[length_idx_stderr]), -+ .write_mode = write_mode, -+ .signal = signal * SIGTERM, /* 0 or SIGTERM. */ -+ .status = status * 3, /* 0 or 3. */ -+ }; -+ TEST_VERIFY (strlen (test.out) == lengths[length_idx_stdout]); -+ TEST_VERIFY (strlen (test.err) == lengths[length_idx_stderr]); -+ -+ struct support_capture_subprocess result -+ = support_capture_subprocess (callback, &test); -+ check_stream ("stdout", &result.out, test.out); -+ check_stream ("stderr", &result.err, test.err); -+ if (test.signal != 0) -+ { -+ TEST_VERIFY (WIFSIGNALED (result.status)); -+ TEST_VERIFY (WTERMSIG (result.status) == test.signal); -+ } -+ else -+ { -+ TEST_VERIFY (WIFEXITED (result.status)); -+ TEST_VERIFY (WEXITSTATUS (result.status) == test.status); -+ } -+ support_capture_subprocess_free (&result); -+ free (test.out); -+ free (test.err); -+ } -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_format_dns_packet.c b/support/tst-support_format_dns_packet.c -new file mode 100644 -index 0000000000..9c8589c09c ---- /dev/null -+++ b/support/tst-support_format_dns_packet.c -@@ -0,0 +1,101 @@ -+/* Tests for the support_format_dns_packet function. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+static void -+check_packet (const void *buffer, size_t length, -+ const char *name, const char *expected) -+{ -+ char *actual = support_format_dns_packet (buffer, length); -+ if (strcmp (actual, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: formatted packet does not match: %s\n", name); -+ support_run_diff ("expected", expected, -+ "actual", actual); -+ } -+ free (actual); -+} -+ -+static void -+test_aaaa_length (void) -+{ -+ static const char packet[] = -+ /* Header: Response with two records. */ -+ "\x12\x34\x80\x00\x00\x01\x00\x02\x00\x00\x00\x00" -+ /* Question section. www.example/IN/AAAA. */ -+ "\x03www\x07""example\x00\x00\x1c\x00\x01" -+ /* Answer section. www.example AAAA [corrupted]. */ -+ "\xc0\x0c" -+ "\x00\x1c\x00\x01\x00\x00\x00\x00\x00\x10" -+ "\x20\x01\x0d\xb8\x05\x06\x07\x08" -+ "\x11\x12\x13\x14\x15\x16\x17\x18" -+ /* www.example AAAA [corrupted]. */ -+ "\xc0\x0c" -+ "\x00\x1c\x00\x01\x00\x00\x00\x00\x00\x11" -+ "\x01\x02\x03\x04\x05\x06\x07\x08" -+ "\x11\x12\x13\x14\x15\x16\x17\x18" "\xff"; -+ check_packet (packet, sizeof (packet) - 1, __func__, -+ "name: www.example\n" -+ "address: 2001:db8:506:708:1112:1314:1516:1718\n" -+ "error: AAAA record of size 17: www.example\n"); -+} -+ -+static void -+test_multiple_cnames (void) -+{ -+ static const char packet[] = -+ /* Header: Response with three records. */ -+ "\x12\x34\x80\x00\x00\x01\x00\x03\x00\x00\x00\x00" -+ /* Question section. www.example/IN/A. */ -+ "\x03www\x07""example\x00\x00\x01\x00\x01" -+ /* Answer section. www.example CNAME www1.example. */ -+ "\xc0\x0c" -+ "\x00\x05\x00\x01\x00\x00\x00\x00\x00\x07" -+ "\x04www1\xc0\x10" -+ /* www1 CNAME www2. */ -+ "\x04www1\xc0\x10" -+ "\x00\x05\x00\x01\x00\x00\x00\x00\x00\x07" -+ "\x04www2\xc0\x10" -+ /* www2 A 192.0.2.1. */ -+ "\x04www2\xc0\x10" -+ "\x00\x01\x00\x01\x00\x00\x00\x00\x00\x04" -+ "\xc0\x00\x02\x01"; -+ check_packet (packet, sizeof (packet) - 1, __func__, -+ "name: www.example\n" -+ "name: www1.example\n" -+ "name: www2.example\n" -+ "address: 192.0.2.1\n"); -+} -+ -+static int -+do_test (void) -+{ -+ test_aaaa_length (); -+ test_multiple_cnames (); -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_record_failure-2.sh b/support/tst-support_record_failure-2.sh -new file mode 100644 -index 0000000000..2c9372cc29 ---- /dev/null -+++ b/support/tst-support_record_failure-2.sh -@@ -0,0 +1,69 @@ -+#!/bin/sh -+# Test failure recording (with and without --direct). -+# Copyright (C) 2016-2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+# -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . */ -+ -+set -e -+ -+common_objpfx=$1; shift -+test_program_prefix_before_env=$1; shift -+run_program_env=$1; shift -+test_program_prefix_after_env=$1; shift -+ -+run_test () { -+ expected_status="$1" -+ expected_output="$2" -+ shift 2 -+ args="${common_objpfx}support/tst-support_record_failure $*" -+ echo "running: $args" -+ set +e -+ output="$(${test_program_prefix_before_env} \ -+ ${run_program} ${test_program_prefix_after_env} $args)" -+ status=$? -+ set -e -+ echo " exit status: $status" -+ if test "$output" != "$expected_output" ; then -+ echo "error: unexpected output: $output" -+ exit 1 -+ fi -+ if test "$status" -ne "$expected_status" ; then -+ echo "error: exit status $expected_status expected" -+ exit 1 -+ fi -+} -+ -+different_status () { -+ direct="$1" -+ run_test 1 "error: 1 test failures" $direct --status=0 -+ run_test 1 "error: 1 test failures" $direct --status=1 -+ run_test 2 "error: 1 test failures" $direct --status=2 -+ run_test 1 "error: 1 test failures" $direct --status=77 -+ run_test 2 "error: tst-support_record_failure.c:109: not true: false -+error: 1 test failures" $direct --test-verify -+ run_test 2 "error: tst-support_record_failure.c:109: not true: false -+info: execution passed failed TEST_VERIFY -+error: 1 test failures" $direct --test-verify --verbose -+} -+ -+different_status -+different_status --direct -+ -+run_test 1 "error: tst-support_record_failure.c:116: not true: false -+error: 1 test failures" --test-verify-exit -+# --direct does not print the summary error message if exit is called. -+run_test 1 "error: tst-support_record_failure.c:116: not true: false" \ -+ --direct --test-verify-exit -diff --git a/support/tst-support_record_failure.c b/support/tst-support_record_failure.c -new file mode 100644 -index 0000000000..e739e739c3 ---- /dev/null -+++ b/support/tst-support_record_failure.c -@@ -0,0 +1,153 @@ -+/* Test support_record_failure state sharing. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int exit_status_with_failure = -1; -+static bool test_verify; -+static bool test_verify_exit; -+enum -+ { -+ OPT_STATUS = 10001, -+ OPT_TEST_VERIFY, -+ OPT_TEST_VERIFY_EXIT, -+ }; -+#define CMDLINE_OPTIONS \ -+ { "status", required_argument, NULL, OPT_STATUS }, \ -+ { "test-verify", no_argument, NULL, OPT_TEST_VERIFY }, \ -+ { "test-verify-exit", no_argument, NULL, OPT_TEST_VERIFY_EXIT }, -+static void -+cmdline_process (int c) -+{ -+ switch (c) -+ { -+ case OPT_STATUS: -+ exit_status_with_failure = atoi (optarg); -+ break; -+ case OPT_TEST_VERIFY: -+ test_verify = true; -+ break; -+ case OPT_TEST_VERIFY_EXIT: -+ test_verify_exit = true; -+ break; -+ } -+} -+#define CMDLINE_PROCESS cmdline_process -+ -+static void -+check_failure_reporting (int phase, int zero, int unsupported) -+{ -+ int status = support_report_failure (0); -+ if (status != zero) -+ { -+ printf ("real-error (phase %d): support_report_failure (0) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (1); -+ if (status != 1) -+ { -+ printf ("real-error (phase %d): support_report_failure (1) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (2); -+ if (status != 2) -+ { -+ printf ("real-error (phase %d): support_report_failure (2) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (EXIT_UNSUPPORTED); -+ if (status != unsupported) -+ { -+ printf ("real-error (phase %d): " -+ "support_report_failure (EXIT_UNSUPPORTED) == %d\n", -+ phase, status); -+ exit (1); -+ } -+} -+ -+static int -+do_test (void) -+{ -+ if (exit_status_with_failure >= 0) -+ { -+ /* External invocation with requested error status. Used by -+ tst-support_report_failure-2.sh. */ -+ support_record_failure (); -+ return exit_status_with_failure; -+ } -+ TEST_VERIFY (true); -+ TEST_VERIFY_EXIT (true); -+ if (test_verify) -+ { -+ TEST_VERIFY (false); -+ if (test_verbose) -+ printf ("info: execution passed failed TEST_VERIFY\n"); -+ return 2; /* Expected exit status. */ -+ } -+ if (test_verify_exit) -+ { -+ TEST_VERIFY_EXIT (false); -+ return 3; /* Not reached. Expected exit status is 1. */ -+ } -+ -+ printf ("info: This test tests the test framework.\n" -+ "info: It reports some expected errors on stdout.\n"); -+ -+ /* Check that the status is passed through unchanged. */ -+ check_failure_reporting (1, 0, EXIT_UNSUPPORTED); -+ -+ /* Check state propagation from a subprocess. */ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ support_record_failure (); -+ _exit (0); -+ } -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (status != 0) -+ { -+ printf ("real-error: incorrect status from subprocess: %d\n", status); -+ return 1; -+ } -+ check_failure_reporting (2, 1, 1); -+ -+ /* Also test directly in the parent process. */ -+ support_record_failure_reset (); -+ check_failure_reporting (3, 0, EXIT_UNSUPPORTED); -+ support_record_failure (); -+ check_failure_reporting (4, 1, 1); -+ -+ /* We need to mask the failure above. */ -+ support_record_failure_reset (); -+ return 0; -+} -+ -+#include -diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/support/write_message.c -similarity index 68% -rename from sysdeps/unix/sysv/linux/sh/pwrite64.c -rename to support/write_message.c -index 683a5d9886..f03ed931d6 100644 ---- a/sysdeps/unix/sysv/linux/sh/pwrite64.c -+++ b/support/write_message.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* Write a message to standard output. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ralf Baechle , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,14 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+ -+#include -+#include -+ -+void -+write_message (const char *message) -+{ -+ ssize_t unused __attribute__ ((unused)); -+ unused = write (STDOUT_FILENO, message, strlen (message)); -+} -diff --git a/support/xaccept.c b/support/xaccept.c -new file mode 100644 -index 0000000000..7b25af3b05 ---- /dev/null -+++ b/support/xaccept.c -@@ -0,0 +1,32 @@ -+/* accept with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xaccept (int fd, struct sockaddr *sa, socklen_t *salen) -+{ -+ int clientfd = accept (fd, sa, salen); -+ if (clientfd < 0) -+ FAIL_EXIT1 ("accept (%d): %m", fd); -+ return clientfd; -+} -diff --git a/support/xaccept4.c b/support/xaccept4.c -new file mode 100644 -index 0000000000..67dd95e9fb ---- /dev/null -+++ b/support/xaccept4.c -@@ -0,0 +1,32 @@ -+/* accept4 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xaccept4 (int fd, struct sockaddr *sa, socklen_t *salen, int flags) -+{ -+ int clientfd = accept4 (fd, sa, salen, flags); -+ if (clientfd < 0) -+ FAIL_EXIT1 ("accept4 (%d, 0x%x): %m", fd, flags); -+ return clientfd; -+} -diff --git a/support/xasprintf.c b/support/xasprintf.c -new file mode 100644 -index 0000000000..5157680fa2 ---- /dev/null -+++ b/support/xasprintf.c -@@ -0,0 +1,36 @@ -+/* Error-checking wrapper for asprintf. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+char * -+xasprintf (const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ char *result; -+ if (vasprintf (&result, format, ap) < 0) -+ FAIL_EXIT1 ("asprintf: %m"); -+ va_end (ap); -+ return result; -+} -diff --git a/support/xbind.c b/support/xbind.c -new file mode 100644 -index 0000000000..cfc6dd8fa8 ---- /dev/null -+++ b/support/xbind.c -@@ -0,0 +1,30 @@ -+/* bind with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xbind (int fd, const struct sockaddr *sa, socklen_t sa_len) -+{ -+ if (bind (fd, sa, sa_len) != 0) -+ FAIL_EXIT1 ("bind (%d), family %d: %m", fd, sa->sa_family); -+} -diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/support/xcalloc.c -similarity index 68% -rename from sysdeps/unix/sysv/linux/sh/pread.c -rename to support/xcalloc.c -index d3f99f35db..135f42dab2 100644 ---- a/sysdeps/unix/sysv/linux/sh/pread.c -+++ b/support/xcalloc.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* Error-checking wrapper for calloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,19 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+ -+#include -+#include -+#include -+ -+void * -+xcalloc (size_t n, size_t s) -+{ -+ void *p; -+ -+ p = calloc (n, s); -+ if (p == NULL) -+ oom_error ("calloc", n * s); -+ return p; -+} -diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/support/xchroot.c -similarity index 67% -rename from sysdeps/unix/sysv/linux/sh/pread64.c -rename to support/xchroot.c -index b2e8a25788..abcc299e00 100644 ---- a/sysdeps/unix/sysv/linux/sh/pread64.c -+++ b/support/xchroot.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* chroot with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,13 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+#include -+#include -+ -+void -+xchroot (const char *path) -+{ -+ if (chroot (path) != 0) -+ FAIL_EXIT1 ("chroot (\"%s\"): %m", path); -+} -diff --git a/support/xclose.c b/support/xclose.c -new file mode 100644 -index 0000000000..c931e08421 ---- /dev/null -+++ b/support/xclose.c -@@ -0,0 +1,28 @@ -+/* close with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xclose (int fd) -+{ -+ if (close (fd) < 0 && errno != EINTR) -+ FAIL_EXIT1 ("close of descriptor %d failed: %m", fd); -+} -diff --git a/support/xconnect.c b/support/xconnect.c -new file mode 100644 -index 0000000000..0266dbc643 ---- /dev/null -+++ b/support/xconnect.c -@@ -0,0 +1,30 @@ -+/* connect with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xconnect (int fd, const struct sockaddr *sa, socklen_t sa_len) -+{ -+ if (connect (fd, sa, sa_len) != 0) -+ FAIL_EXIT1 ("connect (%d), family %d: %m", fd, sa->sa_family); -+} -diff --git a/support/xdup2.c b/support/xdup2.c -new file mode 100644 -index 0000000000..dc08c94518 ---- /dev/null -+++ b/support/xdup2.c -@@ -0,0 +1,28 @@ -+/* dup2 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xdup2 (int from, int to) -+{ -+ if (dup2 (from, to) < 0) -+ FAIL_EXIT1 ("dup2 (%d, %d): %m", from, to); -+} -diff --git a/support/xfclose.c b/support/xfclose.c -new file mode 100644 -index 0000000000..2737f05044 ---- /dev/null -+++ b/support/xfclose.c -@@ -0,0 +1,33 @@ -+/* fclose with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+ -+void -+xfclose (FILE *fp) -+{ -+ if (ferror (fp)) -+ FAIL_EXIT1 ("stdio stream closed with pending errors"); -+ if (fflush (fp) != 0) -+ FAIL_EXIT1 ("fflush: %m"); -+ if (fclose (fp) != 0) -+ FAIL_EXIT1 ("fclose: %m"); -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S b/support/xfopen.c -similarity index 67% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S -rename to support/xfopen.c -index 081fc15b62..14532a09f3 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S -+++ b/support/xfopen.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9+vis3. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* fopen with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,16 +16,16 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf_vis3) -- movwtos %o0, %f0 -- movwtos %o1, %f1 -- fcmps %f0, %f1 -- fbug 1f -- nop -- fzeros %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf_vis3) -+#include -+#include -+ -+FILE * -+xfopen (const char *path, const char *mode) -+{ -+ FILE *fp = fopen (path, mode); -+ if (fp == NULL) -+ FAIL_EXIT1 ("could not open %s (mode \"%s\"): %m", path, mode); -+ return fp; -+} -diff --git a/support/xfork.c b/support/xfork.c -new file mode 100644 -index 0000000000..aa52ba62c5 ---- /dev/null -+++ b/support/xfork.c -@@ -0,0 +1,32 @@ -+/* fork with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+pid_t -+xfork (void) -+{ -+ pid_t result = fork (); -+ if (result < 0) -+ FAIL_EXIT1 ("fork: %m"); -+ return result; -+} -diff --git a/support/xgetsockname.c b/support/xgetsockname.c -new file mode 100644 -index 0000000000..c3bd884f8d ---- /dev/null -+++ b/support/xgetsockname.c -@@ -0,0 +1,30 @@ -+/* getsockname with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xgetsockname (int fd, struct sockaddr *sa, socklen_t *plen) -+{ -+ if (getsockname (fd, sa, plen) != 0) -+ FAIL_EXIT1 ("setsockopt (%d): %m", fd); -+} -diff --git a/support/xlisten.c b/support/xlisten.c -new file mode 100644 -index 0000000000..1953e5900a ---- /dev/null -+++ b/support/xlisten.c -@@ -0,0 +1,30 @@ -+/* listen with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xlisten (int fd, int backlog) -+{ -+ if (listen (fd, backlog) != 0) -+ FAIL_EXIT1 ("listen (%d, %d): %m", fd, backlog); -+} -diff --git a/support/xmalloc.c b/support/xmalloc.c -new file mode 100644 -index 0000000000..450f699789 ---- /dev/null -+++ b/support/xmalloc.c -@@ -0,0 +1,34 @@ -+/* Error-checking wrapper for malloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void * -+xmalloc (size_t n) -+{ -+ void *p; -+ -+ p = malloc (n); -+ if (p == NULL) -+ oom_error ("malloc", n); -+ return p; -+} -diff --git a/sysdeps/sparc/sparc32/fpu/s_fdim.S b/support/xmemstream.c -similarity index 54% -rename from sysdeps/sparc/sparc32/fpu/s_fdim.S -rename to support/xmemstream.c -index e93970faae..bce6dc9170 100644 ---- a/sysdeps/sparc/sparc32/fpu/s_fdim.S -+++ b/support/xmemstream.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Error-checking wrappers for memstream functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,26 +16,27 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- std %o0, [%sp + 72] -- std %o2, [%sp + 80] -- ldd [%sp + 72], %f0 -- ldd [%sp + 80], %f2 -- fcmpd %f0, %f2 -- st %g0, [%sp + 72] -- fbug 1f -- st %g0, [%sp + 76] -- ldd [%sp + 72], %f0 -- fnegs %f0, %f2 -- fmovs %f1, %f3 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+#include -+#include -+#include -+#include - --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); --#endif -+void -+xopen_memstream (struct xmemstream *stream) -+{ -+ int old_errno = errno; -+ *stream = (struct xmemstream) {}; -+ stream->out = open_memstream (&stream->buffer, &stream->length); -+ if (stream->out == NULL) -+ FAIL_EXIT1 ("open_memstream: %m"); -+ errno = old_errno; -+} -+ -+void -+xfclose_memstream (struct xmemstream *stream) -+{ -+ xfclose (stream->out); -+ stream->out = NULL; -+} -diff --git a/support/xmemstream.h b/support/xmemstream.h -new file mode 100644 -index 0000000000..e5ba231e4d ---- /dev/null -+++ b/support/xmemstream.h -@@ -0,0 +1,49 @@ -+/* Error-checking wrappers for memstream functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XMEMSTREAM_H -+#define SUPPORT_XMEMSTREAM_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Wrappers for other libc functions. */ -+struct xmemstream -+{ -+ FILE *out; -+ char *buffer; -+ size_t length; -+}; -+ -+/* Create a new in-memory stream. Initializes *STREAM. After this -+ function returns, STREAM->out is a file descriptor open for -+ writing. errno is preserved, so that the %m format specifier can -+ be used for writing to STREAM->out. */ -+void xopen_memstream (struct xmemstream *stream); -+ -+/* Closes STREAM->OUT. After this function returns, STREAM->buffer -+ and STREAM->length denote a memory range which contains the bytes -+ written to the output stream. The caller should free -+ STREAM->buffer. */ -+void xfclose_memstream (struct xmemstream *stream); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XMEMSTREAM_H */ -diff --git a/support/xmkdir.c b/support/xmkdir.c -new file mode 100644 -index 0000000000..ea17d49391 ---- /dev/null -+++ b/support/xmkdir.c -@@ -0,0 +1,28 @@ -+/* mkdir with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xmkdir (const char *path, mode_t mode) -+{ -+ if (mkdir (path, mode) != 0) -+ FAIL_EXIT1 ("mkdir (\"%s\", 0%o): %m", path, mode); -+} -diff --git a/support/xmmap.c b/support/xmmap.c -new file mode 100644 -index 0000000000..435b1eb733 ---- /dev/null -+++ b/support/xmmap.c -@@ -0,0 +1,31 @@ -+/* mmap with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void * -+xmmap (void *addr, size_t length, int prot, int flags, int fd) -+{ -+ void *result = mmap (addr, length, prot, flags, fd, 0); -+ if (result == MAP_FAILED) -+ FAIL_EXIT1 ("mmap of %zu bytes, prot=0x%x, flags=0x%x: %m", -+ length, prot, flags); -+ return result; -+} -diff --git a/support/xmunmap.c b/support/xmunmap.c -new file mode 100644 -index 0000000000..6ef5a4a468 ---- /dev/null -+++ b/support/xmunmap.c -@@ -0,0 +1,28 @@ -+/* munmap with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xmunmap (void *addr, size_t length) -+{ -+ if (munmap (addr, length) != 0) -+ FAIL_EXIT1 ("munmap of %zu bytes: %m", length); -+} -diff --git a/support/xopen.c b/support/xopen.c -new file mode 100644 -index 0000000000..7f033a03a7 ---- /dev/null -+++ b/support/xopen.c -@@ -0,0 +1,30 @@ -+/* open64 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+xopen (const char *path, int flags, mode_t mode) -+{ -+ int ret = open64 (path, flags, mode); -+ if (ret < 0) -+ FAIL_EXIT1 ("open64 (\"%s\", 0x%x, 0%o): %m", path, flags, mode); -+ return ret; -+} -diff --git a/support/xpipe.c b/support/xpipe.c -new file mode 100644 -index 0000000000..89a64a55c1 ---- /dev/null -+++ b/support/xpipe.c -@@ -0,0 +1,28 @@ -+/* pipe with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xpipe (int fds[2]) -+{ -+ if (pipe (fds) < 0) -+ FAIL_EXIT1 ("pipe: %m"); -+} -diff --git a/support/xpoll.c b/support/xpoll.c -new file mode 100644 -index 0000000000..bec2521ffc ---- /dev/null -+++ b/support/xpoll.c -@@ -0,0 +1,32 @@ -+/* poll with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xpoll (struct pollfd *fds, nfds_t nfds, int timeout) -+{ -+ int ret = poll (fds, nfds, timeout); -+ if (ret < 0) -+ FAIL_EXIT1 ("poll: %m"); -+ return ret; -+} -diff --git a/support/xpthread_attr_destroy.c b/support/xpthread_attr_destroy.c -new file mode 100644 -index 0000000000..664c809e9f ---- /dev/null -+++ b/support/xpthread_attr_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_attr_destroy with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_destroy (pthread_attr_t *attr) -+{ -+ xpthread_check_return ("pthread_attr_destroy", -+ pthread_attr_destroy (attr)); -+} -diff --git a/support/xpthread_attr_init.c b/support/xpthread_attr_init.c -new file mode 100644 -index 0000000000..2e30ade9ab ---- /dev/null -+++ b/support/xpthread_attr_init.c -@@ -0,0 +1,25 @@ -+/* pthread_attr_init with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_init (pthread_attr_t *attr) -+{ -+ xpthread_check_return ("pthread_attr_init", pthread_attr_init (attr)); -+} -diff --git a/support/xpthread_attr_setdetachstate.c b/support/xpthread_attr_setdetachstate.c -new file mode 100644 -index 0000000000..b544dbaa42 ---- /dev/null -+++ b/support/xpthread_attr_setdetachstate.c -@@ -0,0 +1,27 @@ -+/* pthread_attr_setdetachstate with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) -+{ -+ xpthread_check_return ("pthread_attr_setdetachstate", -+ pthread_attr_setdetachstate (attr, -+ detachstate)); -+} -diff --git a/support/xpthread_attr_setstacksize.c b/support/xpthread_attr_setstacksize.c -new file mode 100644 -index 0000000000..02d06310a9 ---- /dev/null -+++ b/support/xpthread_attr_setstacksize.c -@@ -0,0 +1,26 @@ -+/* pthread_attr_setstacksize with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) -+{ -+ xpthread_check_return ("pthread_attr_setstacksize", -+ pthread_attr_setstacksize (attr, stacksize)); -+} -diff --git a/support/xpthread_barrier_destroy.c b/support/xpthread_barrier_destroy.c -new file mode 100644 -index 0000000000..efc0719a63 ---- /dev/null -+++ b/support/xpthread_barrier_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_barrier_destroy with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_barrier_destroy (pthread_barrier_t *barrier) -+{ -+ xpthread_check_return ("pthread_barrier_destroy", -+ pthread_barrier_destroy (barrier)); -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S b/support/xpthread_barrier_init.c -similarity index 65% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S -rename to support/xpthread_barrier_init.c -index 4a479b1a59..b32dad1315 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S -+++ b/support/xpthread_barrier_init.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9+vis3. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* pthread_barrier_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,18 +16,12 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdim_vis3) -- movwtos %o0, %f0 -- movwtos %o1, %f1 -- movwtos %o2, %f2 -- movwtos %o3, %f3 -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim_vis3) -+void -+xpthread_barrier_init (pthread_barrier_t *barrier, -+ pthread_barrierattr_t *attr, unsigned int count) -+{ -+ xpthread_check_return ("pthread_barrier_init", -+ pthread_barrier_init (barrier, attr, count)); -+} -diff --git a/support/xpthread_barrier_wait.c b/support/xpthread_barrier_wait.c -new file mode 100644 -index 0000000000..7cee44d0a3 ---- /dev/null -+++ b/support/xpthread_barrier_wait.c -@@ -0,0 +1,28 @@ -+/* pthread_barrier_wait with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int -+xpthread_barrier_wait (pthread_barrier_t *barrier) -+{ -+ int ret = pthread_barrier_wait (barrier); -+ if (ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD) -+ xpthread_check_return ("pthread_barrier_wait", ret); -+ return ret == PTHREAD_BARRIER_SERIAL_THREAD; -+} -diff --git a/support/xpthread_cancel.c b/support/xpthread_cancel.c -new file mode 100644 -index 0000000000..3af16f9b54 ---- /dev/null -+++ b/support/xpthread_cancel.c -@@ -0,0 +1,25 @@ -+/* pthread_cancel with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_cancel (pthread_t thr) -+{ -+ xpthread_check_return ("pthread_cancel", pthread_cancel (thr)); -+} -diff --git a/support/xpthread_check_return.c b/support/xpthread_check_return.c -new file mode 100644 -index 0000000000..3094d82e9c ---- /dev/null -+++ b/support/xpthread_check_return.c -@@ -0,0 +1,34 @@ -+/* Return value checking for pthread functions, exit variant. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void -+xpthread_check_return (const char *function, int value) -+{ -+ if (value != 0) -+ { -+ errno = value; -+ FAIL_EXIT1 ("%s: %m", function); -+ } -+} -diff --git a/support/xpthread_cond_wait.c b/support/xpthread_cond_wait.c -new file mode 100644 -index 0000000000..b0e9b2a232 ---- /dev/null -+++ b/support/xpthread_cond_wait.c -@@ -0,0 +1,26 @@ -+/* pthread_cond_wait with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) -+{ -+ xpthread_check_return -+ ("pthread_cond_wait", pthread_cond_wait (cond, mutex)); -+} -diff --git a/support/xpthread_create.c b/support/xpthread_create.c -new file mode 100644 -index 0000000000..98c63e54c3 ---- /dev/null -+++ b/support/xpthread_create.c -@@ -0,0 +1,29 @@ -+/* pthread_create with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+pthread_t -+xpthread_create (pthread_attr_t *attr, -+ void *(*thread_func) (void *), void *closure) -+{ -+ pthread_t thr; -+ xpthread_check_return -+ ("pthread_create", pthread_create (&thr, attr, thread_func, closure)); -+ return thr; -+} -diff --git a/support/xpthread_detach.c b/support/xpthread_detach.c -new file mode 100644 -index 0000000000..2088af2f57 ---- /dev/null -+++ b/support/xpthread_detach.c -@@ -0,0 +1,25 @@ -+/* pthread_detach with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_detach (pthread_t thr) -+{ -+ xpthread_check_return ("pthread_detach", pthread_detach (thr)); -+} -diff --git a/support/xpthread_join.c b/support/xpthread_join.c -new file mode 100644 -index 0000000000..f23bb9a5ae ---- /dev/null -+++ b/support/xpthread_join.c -@@ -0,0 +1,27 @@ -+/* pthread_join with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void * -+xpthread_join (pthread_t thr) -+{ -+ void *result; -+ xpthread_check_return ("pthread_join", pthread_join (thr, &result)); -+ return result; -+} -diff --git a/support/xpthread_mutex_consistent.c b/support/xpthread_mutex_consistent.c -new file mode 100644 -index 0000000000..52364be365 ---- /dev/null -+++ b/support/xpthread_mutex_consistent.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_consistent with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_consistent (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_consistent", -+ pthread_mutex_consistent (mutex)); -+} -diff --git a/support/xpthread_mutex_destroy.c b/support/xpthread_mutex_destroy.c -new file mode 100644 -index 0000000000..f11f8f0acd ---- /dev/null -+++ b/support/xpthread_mutex_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_destroy with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_destroy (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_destroy", -+ pthread_mutex_destroy (mutex)); -+} -diff --git a/support/xpthread_mutex_init.c b/support/xpthread_mutex_init.c -new file mode 100644 -index 0000000000..2d16d1b9d9 ---- /dev/null -+++ b/support/xpthread_mutex_init.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutex_init", -+ pthread_mutex_init (mutex, attr)); -+} -diff --git a/support/xpthread_mutex_lock.c b/support/xpthread_mutex_lock.c -new file mode 100644 -index 0000000000..af727b45f3 ---- /dev/null -+++ b/support/xpthread_mutex_lock.c -@@ -0,0 +1,25 @@ -+/* pthread_mutex_lock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_lock (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_lock", pthread_mutex_lock (mutex)); -+} -diff --git a/support/xpthread_mutex_unlock.c b/support/xpthread_mutex_unlock.c -new file mode 100644 -index 0000000000..161b41edf6 ---- /dev/null -+++ b/support/xpthread_mutex_unlock.c -@@ -0,0 +1,25 @@ -+/* pthread_mutex_unlock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_unlock (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_unlock", pthread_mutex_unlock (mutex)); -+} -diff --git a/support/xpthread_mutexattr_destroy.c b/support/xpthread_mutexattr_destroy.c -new file mode 100644 -index 0000000000..c699e32b41 ---- /dev/null -+++ b/support/xpthread_mutexattr_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_destroy with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_destroy (pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutexattr_destroy", -+ pthread_mutexattr_destroy (attr)); -+} -diff --git a/support/xpthread_mutexattr_init.c b/support/xpthread_mutexattr_init.c -new file mode 100644 -index 0000000000..fa93fab178 ---- /dev/null -+++ b/support/xpthread_mutexattr_init.c -@@ -0,0 +1,25 @@ -+/* pthread_mutexattr_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_init (pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutexattr_init", pthread_mutexattr_init (attr)); -+} -diff --git a/sysdeps/sparc/sparc64/fpu/s_fdim.S b/support/xpthread_mutexattr_setprotocol.c -similarity index 67% -rename from sysdeps/sparc/sparc64/fpu/s_fdim.S -rename to support/xpthread_mutexattr_setprotocol.c -index 7fae72a251..353f75e3d7 100644 ---- a/sysdeps/sparc/sparc64/fpu/s_fdim.S -+++ b/support/xpthread_mutexattr_setprotocol.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 64-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* pthread_mutexattr_setprotocol with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,16 +16,11 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+void -+xpthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setprotocol", -+ pthread_mutexattr_setprotocol (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_setpshared.c b/support/xpthread_mutexattr_setpshared.c -new file mode 100644 -index 0000000000..242da1aeca ---- /dev/null -+++ b/support/xpthread_mutexattr_setpshared.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_setpshared with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setpshared", -+ pthread_mutexattr_setpshared (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_setrobust.c b/support/xpthread_mutexattr_setrobust.c -new file mode 100644 -index 0000000000..d7d6fa8630 ---- /dev/null -+++ b/support/xpthread_mutexattr_setrobust.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_setrobust with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setrobust", -+ pthread_mutexattr_setrobust (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_settype.c b/support/xpthread_mutexattr_settype.c -new file mode 100644 -index 0000000000..cf22170b56 ---- /dev/null -+++ b/support/xpthread_mutexattr_settype.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_settype with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_settype (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_settype", -+ pthread_mutexattr_settype (attr, flag)); -+} -diff --git a/support/xpthread_once.c b/support/xpthread_once.c -new file mode 100644 -index 0000000000..70d58dbab2 ---- /dev/null -+++ b/support/xpthread_once.c -@@ -0,0 +1,25 @@ -+/* pthread_once with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_once (pthread_once_t *guard, void (*func) (void)) -+{ -+ xpthread_check_return ("pthread_once", pthread_once (guard, func)); -+} -diff --git a/support/xpthread_sigmask.c b/support/xpthread_sigmask.c -new file mode 100644 -index 0000000000..0ba9ca02dc ---- /dev/null -+++ b/support/xpthread_sigmask.c -@@ -0,0 +1,34 @@ -+/* pthread_sigmask with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+#include -+ -+void -+xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset) -+{ -+ if (pthread_sigmask (how, set, oldset) != 0) -+ { -+ write_message ("error: pthread_setmask failed\n"); -+ /* Do not use exit because pthread_sigmask can be called from a -+ signal handler. */ -+ _exit (1); -+ } -+} -diff --git a/support/xpthread_spin_lock.c b/support/xpthread_spin_lock.c -new file mode 100644 -index 0000000000..6975215b17 ---- /dev/null -+++ b/support/xpthread_spin_lock.c -@@ -0,0 +1,25 @@ -+/* pthread_spin_lock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_spin_lock (pthread_spinlock_t *lock) -+{ -+ xpthread_check_return ("pthread_spin_lock", pthread_spin_lock (lock)); -+} -diff --git a/support/xpthread_spin_unlock.c b/support/xpthread_spin_unlock.c -new file mode 100644 -index 0000000000..4f19a44c48 ---- /dev/null -+++ b/support/xpthread_spin_unlock.c -@@ -0,0 +1,25 @@ -+/* pthread_spin_unlock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_spin_unlock (pthread_spinlock_t *lock) -+{ -+ xpthread_check_return ("pthread_spin_unlock", pthread_spin_unlock (lock)); -+} -diff --git a/support/xrealloc.c b/support/xrealloc.c -new file mode 100644 -index 0000000000..00c313880c ---- /dev/null -+++ b/support/xrealloc.c -@@ -0,0 +1,32 @@ -+/* Error-checking wrapper for realloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void * -+xrealloc (void *p, size_t n) -+{ -+ void *result = realloc (p, n); -+ if (result == NULL && (n > 0 || p == NULL)) -+ oom_error ("realloc", n); -+ return result; -+} -diff --git a/support/xrecvfrom.c b/support/xrecvfrom.c -new file mode 100644 -index 0000000000..17809c4dd2 ---- /dev/null -+++ b/support/xrecvfrom.c -@@ -0,0 +1,33 @@ -+/* recvfrom with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+size_t -+xrecvfrom (int fd, void *buf, size_t buflen, int flags, -+ struct sockaddr *sa, socklen_t *salen) -+{ -+ ssize_t ret = recvfrom (fd, buf, buflen, flags, sa, salen); -+ if (ret < 0) -+ FAIL_EXIT1 ("error: recvfrom (%d), %zu bytes buffer: %m", fd, buflen); -+ return ret; -+} -diff --git a/support/xsendto.c b/support/xsendto.c -new file mode 100644 -index 0000000000..20bddf6965 ---- /dev/null -+++ b/support/xsendto.c -@@ -0,0 +1,35 @@ -+/* sendto with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xsendto (int fd, const void *buf, size_t buflen, int flags, -+ const struct sockaddr *sa, socklen_t salen) -+{ -+ ssize_t ret = sendto (fd, buf, buflen, flags, sa, salen); -+ if (ret < 0) -+ FAIL_EXIT1 ("sendto (%d), %zu bytes, family %d: %m", -+ fd, buflen, sa->sa_family); -+ if (ret != buflen) -+ FAIL_EXIT1 ("sendto (%d) sent %zd bytes instead of %zu", fd, ret, buflen); -+} -diff --git a/sysdeps/sparc/sparc32/fpu/s_fdimf.S b/support/xsetsockopt.c -similarity index 62% -rename from sysdeps/sparc/sparc32/fpu/s_fdimf.S -rename to support/xsetsockopt.c -index c3fe8afa98..9931882e75 100644 ---- a/sysdeps/sparc/sparc32/fpu/s_fdimf.S -+++ b/support/xsetsockopt.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* setsockopt with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,19 +16,16 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- st %o0, [%sp + 72] -- st %o1, [%sp + 76] -- ld [%sp + 72], %f0 -- ld [%sp + 76], %f1 -- fcmps %f0, %f1 -- fbug 1f -- st %g0, [%sp + 72] -- ld [%sp + 72], %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+#include -+#include -+ -+void -+xsetsockopt (int fd, int level, int name, const void *val, socklen_t vallen) -+{ -+ if (setsockopt (fd, level, name, val, vallen) != 0) -+ FAIL_EXIT1 ("setsockopt (%d, %d, %d), %zu bytes: %m", -+ fd, level, name, (size_t) vallen); -+} -diff --git a/support/xsignal.h b/support/xsignal.h -new file mode 100644 -index 0000000000..3dc0d9d5ce ---- /dev/null -+++ b/support/xsignal.h -@@ -0,0 +1,34 @@ -+/* Support functionality for using signals. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_SIGNAL_H -+#define SUPPORT_SIGNAL_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* The following functions call the corresponding libpthread functions -+ and terminate the process on error. */ -+ -+void xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_SIGNAL_H */ -diff --git a/support/xsocket.c b/support/xsocket.c -new file mode 100644 -index 0000000000..c1deaee924 ---- /dev/null -+++ b/support/xsocket.c -@@ -0,0 +1,32 @@ -+/* socket with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xsocket (int domain, int type, int protocol) -+{ -+ int fd = socket (domain, type, protocol); -+ if (fd < 0) -+ FAIL_EXIT1 ("socket (%d, %d, %d): %m\n", domain, type, protocol); -+ return fd; -+} -diff --git a/support/xsocket.h b/support/xsocket.h -new file mode 100644 -index 0000000000..d6724948d8 ---- /dev/null -+++ b/support/xsocket.h -@@ -0,0 +1,39 @@ -+/* Error-checking wrappers for socket functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XSOCKET_H -+#define SUPPORT_XSOCKET_H -+ -+#include -+#include -+#include -+ -+int xsocket (int, int, int); -+void xsetsockopt (int, int, int, const void *, socklen_t); -+void xgetsockname (int, struct sockaddr *, socklen_t *); -+void xconnect (int, const struct sockaddr *, socklen_t); -+void xbind (int, const struct sockaddr *, socklen_t); -+void xlisten (int, int); -+int xaccept (int, struct sockaddr *, socklen_t *); -+int xaccept4 (int, struct sockaddr *, socklen_t *, int); -+void xsendto (int, const void *, size_t, int, -+ const struct sockaddr *, socklen_t); -+size_t xrecvfrom (int, void *, size_t, int, struct sockaddr *, socklen_t *); -+int xpoll (struct pollfd *, nfds_t, int); -+ -+#endif /* SUPPORT_XSOCKET_H */ -diff --git a/support/xstdio.h b/support/xstdio.h -new file mode 100644 -index 0000000000..bcc2e863bf ---- /dev/null -+++ b/support/xstdio.h -@@ -0,0 +1,32 @@ -+/* Error-checking wrappers for stdio functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XSTDIO_H -+#define SUPPORT_XSTDIO_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+FILE *xfopen (const char *path, const char *mode); -+void xfclose (FILE *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XSTDIO_H */ -diff --git a/support/xstrdup.c b/support/xstrdup.c -new file mode 100644 -index 0000000000..d6a8c04baf ---- /dev/null -+++ b/support/xstrdup.c -@@ -0,0 +1,30 @@ -+/* strdup with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+char * -+xstrdup (const char *s) -+{ -+ char *p = strdup (s); -+ if (p == NULL) -+ oom_error ("strdup", strlen (s)); -+ return p; -+} -diff --git a/support/xthread.h b/support/xthread.h -new file mode 100644 -index 0000000000..6dd7e709be ---- /dev/null -+++ b/support/xthread.h -@@ -0,0 +1,77 @@ -+/* Support functionality for using threads. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_THREAD_H -+#define SUPPORT_THREAD_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Terminate the process (with exit status 0) after SECONDS have -+ elapsed, from a helper thread. The process is terminated with the -+ exit function, so atexit handlers are executed. */ -+void delayed_exit (int seconds); -+ -+/* Terminate the process (with exit status 1) if VALUE is not zero. -+ In that case, print a failure message to standard output mentioning -+ FUNCTION. The process is terminated with the exit function, so -+ atexit handlers are executed. */ -+void xpthread_check_return (const char *function, int value); -+ -+/* The following functions call the corresponding libpthread functions -+ and terminate the process on error. */ -+ -+void xpthread_barrier_init (pthread_barrier_t *barrier, -+ pthread_barrierattr_t *attr, unsigned int count); -+void xpthread_barrier_destroy (pthread_barrier_t *barrier); -+void xpthread_mutexattr_destroy (pthread_mutexattr_t *); -+void xpthread_mutexattr_init (pthread_mutexattr_t *); -+void xpthread_mutexattr_setprotocol (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_setpshared (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_setrobust (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_settype (pthread_mutexattr_t *, int); -+void xpthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); -+void xpthread_mutex_destroy (pthread_mutex_t *); -+void xpthread_mutex_lock (pthread_mutex_t *mutex); -+void xpthread_mutex_unlock (pthread_mutex_t *mutex); -+void xpthread_mutex_consistent (pthread_mutex_t *); -+void xpthread_spin_lock (pthread_spinlock_t *lock); -+void xpthread_spin_unlock (pthread_spinlock_t *lock); -+void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex); -+pthread_t xpthread_create (pthread_attr_t *attr, -+ void *(*thread_func) (void *), void *closure); -+void xpthread_detach (pthread_t thr); -+void xpthread_cancel (pthread_t thr); -+void *xpthread_join (pthread_t thr); -+void xpthread_once (pthread_once_t *guard, void (*func) (void)); -+void xpthread_attr_destroy (pthread_attr_t *attr); -+void xpthread_attr_init (pthread_attr_t *attr); -+void xpthread_attr_setdetachstate (pthread_attr_t *attr, -+ int detachstate); -+void xpthread_attr_setstacksize (pthread_attr_t *attr, -+ size_t stacksize); -+ -+/* This function returns non-zero if pthread_barrier_wait returned -+ PTHREAD_BARRIER_SERIAL_THREAD. */ -+int xpthread_barrier_wait (pthread_barrier_t *barrier); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_THREAD_H */ -diff --git a/support/xunistd.h b/support/xunistd.h -new file mode 100644 -index 0000000000..151d743e1f ---- /dev/null -+++ b/support/xunistd.h -@@ -0,0 +1,56 @@ -+/* POSIX-specific extra functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* These wrapper functions use POSIX types and therefore cannot be -+ declared in . */ -+ -+#ifndef SUPPORT_XUNISTD_H -+#define SUPPORT_XUNISTD_H -+ -+#include -+#include -+#include -+ -+__BEGIN_DECLS -+ -+struct stat64; -+ -+pid_t xfork (void); -+pid_t xwaitpid (pid_t, int *status, int flags); -+void xpipe (int[2]); -+void xdup2 (int, int); -+int xopen (const char *path, int flags, mode_t); -+void xstat (const char *path, struct stat64 *); -+void xmkdir (const char *path, mode_t); -+void xchroot (const char *path); -+ -+/* Close the file descriptor. Ignore EINTR errors, but terminate the -+ process on other errors. */ -+void xclose (int); -+ -+/* Write the buffer. Retry on short writes. */ -+void xwrite (int, const void *, size_t); -+ -+/* Invoke mmap with a zero file offset. */ -+void *xmmap (void *addr, size_t length, int prot, int flags, int fd); -+ -+void xmunmap (void *addr, size_t length); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XUNISTD_H */ -diff --git a/support/xwaitpid.c b/support/xwaitpid.c -new file mode 100644 -index 0000000000..204795e4c0 ---- /dev/null -+++ b/support/xwaitpid.c -@@ -0,0 +1,33 @@ -+/* waitpid with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+int -+xwaitpid (int pid, int *status, int flags) -+{ -+ pid_t result = waitpid (pid, status, flags); -+ if (result < 0) -+ FAIL_EXIT1 ("waitpid: %m\n"); -+ return result; -+} -diff --git a/support/xwrite.c b/support/xwrite.c -new file mode 100644 -index 0000000000..134e8ee4c1 ---- /dev/null -+++ b/support/xwrite.c -@@ -0,0 +1,39 @@ -+/* write with error checking and retries. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xwrite (int fd, const void *buffer, size_t length) -+{ -+ const char *p = buffer; -+ const char *end = p + length; -+ while (p < end) -+ { -+ ssize_t ret = write (fd, p, end - p); -+ if (ret < 0) -+ FAIL_EXIT1 ("write of %zu bytes failed after %td: %m", -+ length, p - (const char *) buffer); -+ if (ret == 0) -+ FAIL_EXIT1 ("write return 0 after writing %td bytes of %zu", -+ p - (const char *) buffer, length); -+ p += ret; -+ } -+} -diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h -index 282805e396..e86d8b5b63 100644 ---- a/sysdeps/aarch64/dl-machine.h -+++ b/sysdeps/aarch64/dl-machine.h -@@ -172,8 +172,8 @@ _dl_start_user: \n\ - cmp x0, #0 \n\ - bne 1b \n\ - // Update _dl_argv \n\ -- adrp x3, _dl_argv \n\ -- str x2, [x3, #:lo12:_dl_argv] \n\ -+ adrp x3, __GI__dl_argv \n\ -+ str x2, [x3, #:lo12:__GI__dl_argv] \n\ - .L_done_stack_adjust: \n\ - // compute envp \n\ - add x3, x2, x1, lsl #3 \n\ -diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym b/sysdeps/aarch64/nptl/tcb-offsets.sym -index 0677aeabff..238647dd47 100644 ---- a/sysdeps/aarch64/nptl/tcb-offsets.sym -+++ b/sysdeps/aarch64/nptl/tcb-offsets.sym -@@ -2,6 +2,5 @@ - #include - - PTHREAD_MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) --PTHREAD_PID_OFFSET offsetof (struct pthread, pid) - PTHREAD_TID_OFFSET offsetof (struct pthread, tid) - PTHREAD_SIZEOF sizeof (struct pthread) -diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c -index c1ff864d4b..e9c350af1c 100644 ---- a/sysdeps/alpha/fpu/s_ceil.c -+++ b/sysdeps/alpha/fpu/s_ceil.c -@@ -26,17 +26,16 @@ - double - __ceil (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - new_x = -x; - __asm ( --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(new_x)); -diff --git a/sysdeps/alpha/fpu/s_ceilf.c b/sysdeps/alpha/fpu/s_ceilf.c -index 7e63a6fe94..77e01a99f7 100644 ---- a/sysdeps/alpha/fpu/s_ceilf.c -+++ b/sysdeps/alpha/fpu/s_ceilf.c -@@ -25,6 +25,9 @@ - float - __ceilf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -@@ -36,11 +39,7 @@ __ceilf (float x) - - new_x = -x; - __asm ("cvtst/s %3,%2\n\t" --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(new_x)); -diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c -index 1a6f8c4617..9930f6be42 100644 ---- a/sysdeps/alpha/fpu/s_floor.c -+++ b/sysdeps/alpha/fpu/s_floor.c -@@ -27,16 +27,15 @@ - double - __floor (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - __asm ( --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(x)); -diff --git a/sysdeps/alpha/fpu/s_floorf.c b/sysdeps/alpha/fpu/s_floorf.c -index 8cd80e2b42..015c04f40d 100644 ---- a/sysdeps/alpha/fpu/s_floorf.c -+++ b/sysdeps/alpha/fpu/s_floorf.c -@@ -26,6 +26,9 @@ - float - __floorf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -@@ -36,11 +39,7 @@ __floorf (float x) - float tmp1, tmp2, new_x; - - __asm ("cvtst/s %3,%2\n\t" --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(x)); -diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c -index f33fe72c11..259348afc0 100644 ---- a/sysdeps/alpha/fpu/s_rint.c -+++ b/sysdeps/alpha/fpu/s_rint.c -@@ -23,6 +23,9 @@ - double - __rint (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; -diff --git a/sysdeps/alpha/fpu/s_rintf.c b/sysdeps/alpha/fpu/s_rintf.c -index 1400dfe8d7..645728ad5b 100644 ---- a/sysdeps/alpha/fpu/s_rintf.c -+++ b/sysdeps/alpha/fpu/s_rintf.c -@@ -22,6 +22,9 @@ - float - __rintf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -diff --git a/sysdeps/alpha/fpu/s_trunc.c b/sysdeps/alpha/fpu/s_trunc.c -index 16cb114a72..4b986a6926 100644 ---- a/sysdeps/alpha/fpu/s_trunc.c -+++ b/sysdeps/alpha/fpu/s_trunc.c -@@ -28,12 +28,11 @@ __trunc (double x) - double two52 = copysign (0x1.0p52, x); - double r, tmp; - -+ if (isgreaterequal (fabs (x), 0x1.0p52)) -+ return x; -+ - __asm ( --#ifdef _IEEE_FP_INEXACT -- "addt/suic %2, %3, %1\n\tsubt/suic %1, %3, %0" --#else - "addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0" --#endif - : "=&f"(r), "=&f"(tmp) - : "f"(x), "f"(two52)); - -diff --git a/sysdeps/alpha/fpu/s_truncf.c b/sysdeps/alpha/fpu/s_truncf.c -index 2290f28295..3e93356166 100644 ---- a/sysdeps/alpha/fpu/s_truncf.c -+++ b/sysdeps/alpha/fpu/s_truncf.c -@@ -27,12 +27,11 @@ __truncf (float x) - float two23 = copysignf (0x1.0p23, x); - float r, tmp; - -+ if (isgreaterequal (fabsf (x), 0x1.0p23)) -+ return x; -+ - __asm ( --#ifdef _IEEE_FP_INEXACT -- "adds/suic %2, %3, %1\n\tsubs/suic %1, %3, %0" --#else - "adds/suc %2, %3, %1\n\tsubs/suc %1, %3, %0" --#endif - : "=&f"(r), "=&f"(tmp) - : "f"(x), "f"(two23)); - -diff --git a/sysdeps/alpha/nptl/tcb-offsets.sym b/sysdeps/alpha/nptl/tcb-offsets.sym -index c21a791040..1005621b37 100644 ---- a/sysdeps/alpha/nptl/tcb-offsets.sym -+++ b/sysdeps/alpha/nptl/tcb-offsets.sym -@@ -10,5 +10,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/arm/nacl/libc.abilist b/sysdeps/arm/nacl/libc.abilist -index 2f7751d167..dfa7198306 100644 ---- a/sysdeps/arm/nacl/libc.abilist -+++ b/sysdeps/arm/nacl/libc.abilist -@@ -1840,4 +1840,5 @@ GLIBC_2.23 fts64_close F - GLIBC_2.23 fts64_open F - GLIBC_2.23 fts64_read F - GLIBC_2.23 fts64_set F -+GLIBC_2.24 GLIBC_2.24 A - GLIBC_2.24 quick_exit F -diff --git a/sysdeps/arm/nptl/tcb-offsets.sym b/sysdeps/arm/nptl/tcb-offsets.sym -index 92cc441d3d..bf9c0a1c17 100644 ---- a/sysdeps/arm/nptl/tcb-offsets.sym -+++ b/sysdeps/arm/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h -index d5b8119c9c..ac57bd5db0 100644 ---- a/sysdeps/generic/unsecvars.h -+++ b/sysdeps/generic/unsecvars.h -@@ -4,11 +4,13 @@ - #define UNSECURE_ENVVARS \ - "GCONV_PATH\0" \ - "GETCONF_DIR\0" \ -+ "GLIBC_TUNABLES\0" \ - "HOSTALIASES\0" \ - "LD_AUDIT\0" \ - "LD_DEBUG\0" \ - "LD_DEBUG_OUTPUT\0" \ - "LD_DYNAMIC_WEAK\0" \ -+ "LD_HWCAP_MASK\0" \ - "LD_LIBRARY_PATH\0" \ - "LD_ORIGIN_PATH\0" \ - "LD_PRELOAD\0" \ -diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h -index 9404211819..01bd5bf197 100644 ---- a/sysdeps/hppa/dl-machine.h -+++ b/sysdeps/hppa/dl-machine.h -@@ -302,6 +302,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - #define ARCH_LA_PLTENTER hppa_gnu_pltenter - #define ARCH_LA_PLTEXIT hppa_gnu_pltexit - -+/* Adjust DL_STACK_END to get value we want in __libc_stack_end. */ -+#define DL_STACK_END(cookie) \ -+ ((void *) (((long) (cookie)) + 0x160)) -+ - /* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ -@@ -401,11 +405,6 @@ asm ( \ - /* Save the entry point in %r3. */ \ - " copy %ret0,%r3\n" \ - \ -- /* Remember the lowest stack address. */ \ --" addil LT'__libc_stack_end,%r19\n" \ --" ldw RT'__libc_stack_end(%r1),%r20\n" \ --" stw %sp,0(%r20)\n" \ -- \ - /* See if we were called as a command with the executable file \ - name as an extra leading argument. */ \ - " addil LT'_dl_skip_args,%r19\n" \ -diff --git a/sysdeps/hppa/nptl/tcb-offsets.sym b/sysdeps/hppa/nptl/tcb-offsets.sym -index c2f326ee3d..6e852f35b1 100644 ---- a/sysdeps/hppa/nptl/tcb-offsets.sym -+++ b/sysdeps/hppa/nptl/tcb-offsets.sym -@@ -3,7 +3,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) -@@ -14,6 +13,5 @@ MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) - -- This way we get the offset of a member in the struct pthread that - -- preceeds the thread pointer (which points to the dtv). - #define thread_offsetof(mem) (unsigned int)(offsetof(struct pthread, mem) - sizeof(struct pthread)) --PID_THREAD_OFFSET thread_offsetof (pid) - TID_THREAD_OFFSET thread_offsetof (tid) - MULTIPLE_THREADS_THREAD_OFFSET thread_offsetof (header.multiple_threads) -diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/i686/multiarch/strcspn-c.c -index 6d61e190a8..ec230fb383 100644 ---- a/sysdeps/i386/i686/multiarch/strcspn-c.c -+++ b/sysdeps/i386/i686/multiarch/strcspn-c.c -@@ -1,2 +1,4 @@ --#define __strcspn_sse2 __strcspn_ia32 --#include -+#if IS_IN (libc) -+# define __strcspn_sse2 __strcspn_ia32 -+# include -+#endif -diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/i686/multiarch/varshift.c -index 7760b966e2..6742a35d41 100644 ---- a/sysdeps/i386/i686/multiarch/varshift.c -+++ b/sysdeps/i386/i686/multiarch/varshift.c -@@ -1 +1,3 @@ --#include -+#if IS_IN (libc) -+# include -+#endif -diff --git a/sysdeps/i386/nptl/tcb-offsets.sym b/sysdeps/i386/nptl/tcb-offsets.sym -index 7bdf161b29..695a810386 100644 ---- a/sysdeps/i386/nptl/tcb-offsets.sym -+++ b/sysdeps/i386/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) -diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile -index 48f1327446..1e6be8eea8 100644 ---- a/sysdeps/ia64/nptl/Makefile -+++ b/sysdeps/ia64/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask -+libpthread-shared-only-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask - endif -diff --git a/sysdeps/ia64/nptl/tcb-offsets.sym b/sysdeps/ia64/nptl/tcb-offsets.sym -index e1707ab1c8..b01f712be2 100644 ---- a/sysdeps/ia64/nptl/tcb-offsets.sym -+++ b/sysdeps/ia64/nptl/tcb-offsets.sym -@@ -1,7 +1,6 @@ - #include - #include - --PID offsetof (struct pthread, pid) - TLS_PRE_TCB_SIZE - TID offsetof (struct pthread, tid) - TLS_PRE_TCB_SIZE - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - TLS_PRE_TCB_SIZE - SYSINFO_OFFSET offsetof (tcbhead_t, __private) -diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c -index 663fa392c2..bd758b5979 100644 ---- a/sysdeps/ieee754/dbl-64/e_pow.c -+++ b/sysdeps/ieee754/dbl-64/e_pow.c -@@ -466,15 +466,15 @@ checkint (double x) - return (n & 1) ? -1 : 1; /* odd or even */ - if (k > 20) - { -- if (n << (k - 20)) -+ if (n << (k - 20) != 0) - return 0; /* if not integer */ -- return (n << (k - 21)) ? -1 : 1; -+ return (n << (k - 21) != 0) ? -1 : 1; - } - if (n) - return 0; /*if not integer */ - if (k == 20) - return (m & 1) ? -1 : 1; -- if (m << (k + 12)) -+ if (m << (k + 12) != 0) - return 0; -- return (m << (k + 11)) ? -1 : 1; -+ return (m << (k + 11) != 0) ? -1 : 1; - } -diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m680x0/m68020/atomic-machine.h -index 24bc5c5ef7..65965cca9e 100644 ---- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h -+++ b/sysdeps/m68k/m680x0/m68020/atomic-machine.h -@@ -73,7 +73,7 @@ typedef uintmax_t uatomic_max_t; - __typeof (mem) __memp = (mem); \ - __asm __volatile ("cas2%.l %0:%R0,%1:%R1,(%2):(%3)" \ - : "=d" (__ret) \ -- : "d" (newval), "r" (__memp), \ -+ : "d" ((__typeof (*(mem))) (newval)), "r" (__memp), \ - "r" ((char *) __memp + 4), "0" (oldval) \ - : "memory"); \ - __ret; }) -@@ -101,8 +101,9 @@ typedef uintmax_t uatomic_max_t; - __asm __volatile ("1: cas2%.l %0:%R0,%1:%R1,(%2):(%3);" \ - " jbne 1b" \ - : "=d" (__result) \ -- : "d" (newvalue), "r" (__memp), \ -- "r" ((char *) __memp + 4), "0" (__result) \ -+ : "d" ((__typeof (*(mem))) (newvalue)), \ -+ "r" (__memp), "r" ((char *) __memp + 4), \ -+ "0" (__result) \ - : "memory"); \ - } \ - __result; }) -@@ -144,7 +145,7 @@ typedef uintmax_t uatomic_max_t; - " cas2%.l %0:%R0,%1:%R1,(%3):(%4);" \ - " jbne 1b" \ - : "=d" (__result), "=&d" (__temp) \ -- : "d" (value), "r" (__memp), \ -+ : "d" ((__typeof (*(mem))) (value)), "r" (__memp), \ - "r" ((char *) __memp + 4), "0" (__result) \ - : "memory"); \ - } \ -@@ -175,8 +176,9 @@ typedef uintmax_t uatomic_max_t; - " cas2%.l %0:%R0,%1:%R1,(%3):(%4);" \ - " jbne 1b" \ - : "=d" (__oldval), "=&d" (__temp) \ -- : "d" (value), "r" (__memp), \ -- "r" ((char *) __memp + 4), "0" (__oldval) \ -+ : "d" ((__typeof (*(mem))) (value)), \ -+ "r" (__memp), "r" ((char *) __memp + 4), \ -+ "0" (__oldval) \ - : "memory"); \ - } \ - }) -diff --git a/sysdeps/m68k/nptl/tcb-offsets.sym b/sysdeps/m68k/nptl/tcb-offsets.sym -index b1bba65868..241fb8b47c 100644 ---- a/sysdeps/m68k/nptl/tcb-offsets.sym -+++ b/sysdeps/m68k/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/microblaze/nptl/tcb-offsets.sym b/sysdeps/microblaze/nptl/tcb-offsets.sym -index 18afbee291..614f0dfed6 100644 ---- a/sysdeps/microblaze/nptl/tcb-offsets.sym -+++ b/sysdeps/microblaze/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - sizeof (struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile -index 3d3552322b..7c1d77941e 100644 ---- a/sysdeps/mips/Makefile -+++ b/sysdeps/mips/Makefile -@@ -9,6 +9,7 @@ endif - - ifeq ($(subdir),rt) - librt-sysdep_routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),debug) -diff --git a/sysdeps/mips/mips32/crti.S b/sysdeps/mips/mips32/crti.S -index 5c0ad7328a..dfbbdc4f8f 100644 ---- a/sysdeps/mips/mips32/crti.S -+++ b/sysdeps/mips/mips32/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - lw $25,%got(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/mips64/n32/crti.S b/sysdeps/mips/mips64/n32/crti.S -index 00b89f3894..afe6d8edaa 100644 ---- a/sysdeps/mips/mips64/n32/crti.S -+++ b/sysdeps/mips/mips64/n32/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - lw $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/mips64/n64/crti.S b/sysdeps/mips/mips64/n64/crti.S -index f59b20c631..4049d29290 100644 ---- a/sysdeps/mips/mips64/n64/crti.S -+++ b/sysdeps/mips/mips64/n64/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - ld $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile -index 117744ffe2..dda154d842 100644 ---- a/sysdeps/mips/nptl/Makefile -+++ b/sysdeps/mips/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-sysdep_routines += nptl-sysdep -+libpthread-shared-only-routines += nptl-sysdep - endif -diff --git a/sysdeps/mips/nptl/tcb-offsets.sym b/sysdeps/mips/nptl/tcb-offsets.sym -index e0e71dc430..9ea25b94a8 100644 ---- a/sysdeps/mips/nptl/tcb-offsets.sym -+++ b/sysdeps/mips/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/nacl/clock.c b/sysdeps/nacl/clock.c -index 664ad650c3..b6fbcfd2dd 100644 ---- a/sysdeps/nacl/clock.c -+++ b/sysdeps/nacl/clock.c -@@ -24,6 +24,6 @@ - clock_t - clock (void) - { -- nacl_abi_clock_t result; -+ nacl_irt_clock_t result; - return NACL_CALL (__nacl_irt_basic.clock (&result), result); - } -diff --git a/sysdeps/nacl/dup.c b/sysdeps/nacl/dup.c -index 34a7cd46d4..cbce3f5a5a 100644 ---- a/sysdeps/nacl/dup.c -+++ b/sysdeps/nacl/dup.c -@@ -27,4 +27,5 @@ __dup (int fd) - int result; - return NACL_CALL (__nacl_irt_fdio.dup (fd, &result), result); - } -+libc_hidden_def (__dup) - weak_alias (__dup, dup) -diff --git a/sysdeps/nios2/nptl/tcb-offsets.sym b/sysdeps/nios2/nptl/tcb-offsets.sym -index d9ae952585..3cd8d984ac 100644 ---- a/sysdeps/nios2/nptl/tcb-offsets.sym -+++ b/sysdeps/nios2/nptl/tcb-offsets.sym -@@ -9,6 +9,5 @@ - # define thread_offsetof(mem) ((ptrdiff_t) THREAD_SELF + offsetof (struct pthread, mem)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c -index 616d897a36..a5d1e86d71 100644 ---- a/sysdeps/nptl/fork.c -+++ b/sysdeps/nptl/fork.c -@@ -131,16 +131,6 @@ __libc_fork (void) - __malloc_fork_lock_parent (); - } - --#ifndef NDEBUG -- pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid); --#endif -- -- /* We need to prevent the getpid() code to update the PID field so -- that, if a signal arrives in the child very early and the signal -- handler uses getpid(), the value returned is correct. */ -- pid_t parentpid = THREAD_GETMEM (THREAD_SELF, pid); -- THREAD_SETMEM (THREAD_SELF, pid, -parentpid); -- - #ifdef ARCH_FORK - pid = ARCH_FORK (); - #else -@@ -153,15 +143,10 @@ __libc_fork (void) - { - struct pthread *self = THREAD_SELF; - -- assert (THREAD_GETMEM (self, tid) != ppid); -- - /* See __pthread_once. */ - if (__fork_generation_pointer != NULL) - *__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR; - -- /* Adjust the PID field for the new process. */ -- THREAD_SETMEM (self, pid, THREAD_GETMEM (self, tid)); -- - #if HP_TIMING_AVAIL - /* The CPU clock of the thread and process have to be set to zero. */ - hp_timing_t now; -@@ -231,11 +216,6 @@ __libc_fork (void) - } - else - { -- assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid); -- -- /* Restore the PID value. */ -- THREAD_SETMEM (THREAD_SELF, pid, parentpid); -- - /* Release acquired locks in the multi-threaded case. */ - if (multiple_threads) - { -diff --git a/sysdeps/posix/wait3.c b/sysdeps/posix/wait3.c -index cf43d973a7..73722d2be6 100644 ---- a/sysdeps/posix/wait3.c -+++ b/sysdeps/posix/wait3.c -@@ -33,7 +33,7 @@ __wait3 (int *stat_loc, int options, struct rusage *usage) - __set_errno (ENOSYS); - return (pid_t) -1; - } -- return __waitpid (WAIT_ANY, stat_loc.__iptr, options); -+ return __waitpid (WAIT_ANY, stat_loc, options); - } - - weak_alias (__wait3, wait3) -diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps -index 7f37c813d0..36b700c520 100644 ---- a/sysdeps/powerpc/fpu/libm-test-ulps -+++ b/sysdeps/powerpc/fpu/libm-test-ulps -@@ -36,8 +36,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "acosh_downward": - double: 1 -@@ -52,8 +52,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "acosh_upward": - double: 2 -@@ -122,8 +122,8 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 4 --ldouble: 4 -+ildouble: 7 -+ldouble: 7 - - Function: "atan": - double: 1 -@@ -216,8 +216,8 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "cabs": - double: 1 -@@ -272,8 +272,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "cacos_towardzero": - double: 2 -@@ -288,8 +288,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "cacos_upward": - double: 2 -@@ -328,8 +328,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "cacosh_downward": - double: 2 -@@ -344,8 +344,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "cacosh_towardzero": - double: 2 -@@ -432,8 +432,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "casin_towardzero": - double: 3 -@@ -448,8 +448,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "casin_upward": - double: 2 -@@ -488,8 +488,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "casinh_downward": - double: 3 -@@ -504,8 +504,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "casinh_towardzero": - double: 3 -@@ -696,8 +696,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Real part of "ccos_downward": - double: 1 -@@ -1132,8 +1132,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Imaginary part of "csin": - ildouble: 1 -@@ -1198,8 +1198,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Real part of "csinh_downward": - double: 2 -@@ -1318,8 +1318,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: Imaginary part of "ctan": - double: 2 -@@ -1390,8 +1390,8 @@ double: 2 - float: 1 - idouble: 2 - ifloat: 1 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: Real part of "ctanh_downward": - double: 4 -@@ -1478,8 +1478,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: "erfc_downward": - double: 3 -@@ -1564,8 +1564,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "exp2_upward": - double: 1 -@@ -1588,8 +1588,8 @@ ildouble: 2 - ldouble: 2 - - Function: "exp_upward": --float: 1 - double: 1 -+float: 1 - idouble: 1 - ifloat: 1 - ildouble: 1 -@@ -1624,8 +1624,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 4 --ldouble: 4 -+ildouble: 6 -+ldouble: 6 - - Function: "fma": - ildouble: 1 -@@ -1688,8 +1688,8 @@ double: 4 - float: 5 - idouble: 4 - ifloat: 5 --ildouble: 10 --ldouble: 10 -+ildouble: 11 -+ldouble: 11 - - Function: "hypot": - double: 1 -@@ -1752,8 +1752,8 @@ double: 1 - float: 2 - idouble: 1 - ifloat: 2 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "j1_downward": - double: 3 -@@ -1840,8 +1840,8 @@ double: 4 - float: 5 - idouble: 4 - ifloat: 5 --ildouble: 10 --ldouble: 10 -+ildouble: 11 -+ldouble: 11 - - Function: "log": - float: 1 -@@ -1910,8 +1910,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: "log2": - double: 1 -@@ -2184,16 +2184,16 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "tanh_towardzero": - double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "tanh_upward": - double: 3 -diff --git a/sysdeps/powerpc/ifunc-sel.h b/sysdeps/powerpc/ifunc-sel.h -index 526d8ed88b..ac589bd3c0 100644 ---- a/sysdeps/powerpc/ifunc-sel.h -+++ b/sysdeps/powerpc/ifunc-sel.h -@@ -17,15 +17,17 @@ ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void)) - "addis %0,11,%2-1b@ha\n\t" - "addi %0,%0,%2-1b@l\n\t" - "cmpwi 12,1\n\t" -- "beqlr\n\t" -+ "beq 2f\n\t" - "addis %0,11,%3-1b@ha\n\t" - "addi %0,%0,%3-1b@l\n\t" - "cmpwi 12,-1\n\t" -- "beqlr\n\t" -+ "beq 2f\n\t" - "addis %0,11,%4-1b@ha\n\t" -- "addi %0,%0,%4-1b@l" -+ "addi %0,%0,%4-1b@l\n\t" -+ "2:" - : "=r" (ret) -- : "X" (&global), "X" (f1), "X" (f2), "X" (f3)); -+ : "i" (&global), "i" (f1), "i" (f2), "i" (f3) -+ : "11", "12", "cr0"); - return ret; - } - -@@ -40,7 +42,8 @@ ifunc_one (int (*f1) (void)) - "addis %0,%0,%1-1b@ha\n\t" - "addi %0,%0,%1-1b@l" - : "=r" (ret) -- : "X" (f1)); -+ : "i" (f1) -+ : "12"); - return ret; - } - #endif -diff --git a/sysdeps/powerpc/nptl/tcb-offsets.sym b/sysdeps/powerpc/nptl/tcb-offsets.sym -index f580e69555..7c9fd33562 100644 ---- a/sysdeps/powerpc/nptl/tcb-offsets.sym -+++ b/sysdeps/powerpc/nptl/tcb-offsets.sym -@@ -13,7 +13,6 @@ - #if TLS_MULTIPLE_THREADS_IN_TCB - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) - #endif --PID thread_offsetof (pid) - TID thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) - TAR_SAVE (offsetof (tcbhead_t, tar_save) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S -index b2a222edd2..d5dbe83af2 100644 ---- a/sysdeps/powerpc/powerpc32/power6/memset.S -+++ b/sysdeps/powerpc/powerpc32/power6/memset.S -@@ -394,7 +394,7 @@ L(cacheAlignedx): - /* A simple loop for the longer (>640 bytes) lengths. This form limits - the branch miss-predicted to exactly 1 at loop exit.*/ - L(cacheAligned512): -- cmpli cr1,rLEN,128 -+ cmplwi cr1,rLEN,128 - blt cr1,L(cacheAligned1) - dcbz 0,rMEMP - addi rLEN,rLEN,-128 -diff --git a/sysdeps/powerpc/powerpc32/power9/multiarch/Implies b/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -index 4393b56872..1a46ef0035 100644 ---- a/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -+++ b/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -@@ -1 +1 @@ --powerpc/powerpc32/power8/fpu/multiarch -+powerpc/powerpc32/power8/multiarch -diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S -index c2d1c4e600..d445b1e1ef 100644 ---- a/sysdeps/powerpc/powerpc64/power6/memset.S -+++ b/sysdeps/powerpc/powerpc64/power6/memset.S -@@ -251,7 +251,7 @@ L(cacheAlignedx): - /* A simple loop for the longer (>640 bytes) lengths. This form limits - the branch miss-predicted to exactly 1 at loop exit.*/ - L(cacheAligned512): -- cmpli cr1,rLEN,128 -+ cmpldi cr1,rLEN,128 - blt cr1,L(cacheAligned1) - dcbz 0,rMEMP - addi rLEN,rLEN,-128 -diff --git a/sysdeps/powerpc/powerpc64/power9/fpu/Implies b/sysdeps/powerpc/powerpc64/power9/fpu/Implies -index fad2505ab9..ae0dbaf857 100644 ---- a/sysdeps/powerpc/powerpc64/power9/fpu/Implies -+++ b/sysdeps/powerpc/powerpc64/power9/fpu/Implies -@@ -1,2 +1 @@ - powerpc/powerpc64/power8/fpu --powerpc/powerpc64/power8 -diff --git a/sysdeps/s390/nptl/Makefile b/sysdeps/s390/nptl/Makefile -index 5734b983b0..3a391c8217 100644 ---- a/sysdeps/s390/nptl/Makefile -+++ b/sysdeps/s390/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-routines += ptw-sysdep -+libpthread-shared-only-routines += ptw-sysdep - endif -diff --git a/sysdeps/s390/nptl/tcb-offsets.sym b/sysdeps/s390/nptl/tcb-offsets.sym -index 9cfae211e0..9c1c01f353 100644 ---- a/sysdeps/s390/nptl/tcb-offsets.sym -+++ b/sysdeps/s390/nptl/tcb-offsets.sym -@@ -3,5 +3,4 @@ - - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) - STACK_GUARD offsetof (tcbhead_t, stack_guard) --PID offsetof (struct pthread, pid) - TID offsetof (struct pthread, tid) -diff --git a/sysdeps/sh/nptl/tcb-offsets.sym b/sysdeps/sh/nptl/tcb-offsets.sym -index ac63b5b93b..4963e1506f 100644 ---- a/sysdeps/sh/nptl/tcb-offsets.sym -+++ b/sysdeps/sh/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) -diff --git a/sysdeps/sparc/nptl/tcb-offsets.sym b/sysdeps/sparc/nptl/tcb-offsets.sym -index 923af8a5b7..f75d02065e 100644 ---- a/sysdeps/sparc/nptl/tcb-offsets.sym -+++ b/sysdeps/sparc/nptl/tcb-offsets.sym -@@ -3,5 +3,4 @@ - - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) - POINTER_GUARD offsetof (tcbhead_t, pointer_guard) --PID offsetof (struct pthread, pid) - TID offsetof (struct pthread, tid) -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -index ebbe28b07f..13d3c6db51 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -@@ -4,8 +4,8 @@ libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \ - s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \ - s_rintf-vis3 s_rint-vis3 w_sqrt-vis3 w_sqrtf-vis3 \ - s_fminf-vis3 s_fmin-vis3 s_fmaxf-vis3 s_fmax-vis3 \ -- s_fmaf-vis3 s_fma-vis3 s_fdimf-vis3 s_fdim-vis3 \ -- s_nearbyint-vis3 s_nearbyintf-vis3 -+ s_fmaf-vis3 s_fma-vis3 s_nearbyint-vis3 \ -+ s_nearbyintf-vis3 - sysdep_routines += s_copysignf-vis3 s_copysign-vis3 - endif - endif -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S -deleted file mode 100644 -index 4b13408244..0000000000 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S -+++ /dev/null -@@ -1,19 +0,0 @@ --#include --#include -- --SPARC_ASM_VIS3_IFUNC(fdim) -- --weak_alias (__fdim, fdim) -- --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); --#endif -- --# undef weak_alias --# define weak_alias(a, b) --# undef compat_symbol --# define compat_symbol(a, b, c, d) -- --#define __fdim __fdim_generic -- --#include "../s_fdim.S" -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S -deleted file mode 100644 -index 30381d6a59..0000000000 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S -+++ /dev/null -@@ -1,12 +0,0 @@ --#include -- --SPARC_ASM_VIS3_IFUNC(fdimf) -- --weak_alias (__fdimf, fdimf) -- --# undef weak_alias --# define weak_alias(a, b) -- --#define __fdimf __fdimf_generic -- --#include "../s_fdimf.S" -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -index d9ff0cc288..ff81b0da83 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -@@ -36,15 +36,15 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyint_vis3) -+ sllx %o0, 32, %o0 -+ or %o0, %o1, %o0 -+ movxtod %o0, %f0 - fcmpd %fcc3, %f0, %f0 /* Check for sNaN */ - st %fsr, [%sp + 88] - sethi %hi(TWO_FIFTYTWO), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -- sllx %o0, 32, %o0 - or %o5, %lo(0xf8003e0), %o5 -- or %o0, %o1, %o0 -- movxtod %o0, %f0 - andn %o4, %o5, %o4 - fzero ZERO - st %o4, [%sp + 80] -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -index 5cd1eb02db..833a0dfc24 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -@@ -35,9 +35,9 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyintf_vis3) -+ movwtos %o0, %f1 - fcmps %fcc3, %f1, %f1 /* Check for sNaN */ - st %fsr, [%sp + 88] -- movwtos %o0, %f1 - sethi %hi(TWO_TWENTYTHREE), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -index 84a10971a4..198440a5bc 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -@@ -36,21 +36,21 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyint) -+ sllx %o0, 32, %o0 -+ or %o0, %o1, %o0 -+ stx %o0, [%sp + 72] -+ ldd [%sp + 72], %f0 - fcmpd %fcc3, %f0, %f0 /* Check for sNaN */ - st %fsr, [%sp + 88] - sethi %hi(TWO_FIFTYTWO), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -- sllx %o0, 32, %o0 - or %o5, %lo(0xf8003e0), %o5 -- or %o0, %o1, %o0 - andn %o4, %o5, %o4 - fzero ZERO - st %o4, [%sp + 80] -- stx %o0, [%sp + 72] - sllx %o2, 32, %o2 - fnegd ZERO, SIGN_BIT -- ldd [%sp + 72], %f0 - ld [%sp + 80], %fsr - stx %o2, [%sp + 72] - fabsd %f0, %f14 -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -index d5cf5ce815..9be41f6c22 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -@@ -35,9 +35,10 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyintf) -+ st %o0, [%sp + 68] -+ ld [%sp + 68], %f1 - fcmps %fcc3, %f1, %f1 /* Check for sNaN */ - st %fsr, [%sp + 88] -- st %o0, [%sp + 68] - sethi %hi(TWO_TWENTYTHREE), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -@@ -46,7 +47,6 @@ ENTRY (__nearbyintf) - fnegs ZERO, SIGN_BIT - andn %o4, %o5, %o4 - st %o4, [%sp + 80] -- ld [%sp + 68], %f1 - ld [%sp + 80], %fsr - st %o2, [%sp + 68] - fabss %f1, %f14 -diff --git a/sysdeps/tile/nptl/tcb-offsets.sym b/sysdeps/tile/nptl/tcb-offsets.sym -index 6740bc976f..0147ffafb7 100644 ---- a/sysdeps/tile/nptl/tcb-offsets.sym -+++ b/sysdeps/tile/nptl/tcb-offsets.sym -@@ -9,7 +9,6 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) - FEEDBACK_DATA_OFFSET (offsetof (tcbhead_t, feedback_data) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/unix/alpha/Makefile b/sysdeps/unix/alpha/Makefile -index 441aa02a83..0660847f15 100644 ---- a/sysdeps/unix/alpha/Makefile -+++ b/sysdeps/unix/alpha/Makefile -@@ -1,3 +1,4 @@ - ifeq ($(subdir),rt) - librt-sysdep_routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif -diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h -index 94a2ce0e37..38c2432002 100644 ---- a/sysdeps/unix/sysdep.h -+++ b/sysdeps/unix/sysdep.h -@@ -24,42 +24,79 @@ - #define SYSCALL__(name, args) PSEUDO (__##name, name, args) - #define SYSCALL(name, args) PSEUDO (name, name, args) - --#define __SYSCALL0(name) \ -+#define __SYSCALL_CONCAT_X(a,b) a##b -+#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) -+ -+ -+#define __INTERNAL_SYSCALL0(name, err) \ -+ INTERNAL_SYSCALL (name, err, 0) -+#define __INTERNAL_SYSCALL1(name, err, a1) \ -+ INTERNAL_SYSCALL (name, err, 1, a1) -+#define __INTERNAL_SYSCALL2(name, err, a1, a2) \ -+ INTERNAL_SYSCALL (name, err, 2, a1, a2) -+#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ -+ INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) -+#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ -+ INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) -+#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ -+ INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) -+#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ -+ INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) -+#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ -+ INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) -+ -+#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o -+#define __INTERNAL_SYSCALL_NARGS(...) \ -+ __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) -+#define __INTERNAL_SYSCALL_DISP(b,...) \ -+ __SYSCALL_CONCAT (b,__INTERNAL_SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) -+ -+/* Issue a syscall defined by syscall number plus any other argument required. -+ It is similar to INTERNAL_SYSCALL macro, but without the need to pass the -+ expected argument number as second parameter. */ -+#define INTERNAL_SYSCALL_CALL(...) \ -+ __INTERNAL_SYSCALL_DISP (__INTERNAL_SYSCALL, __VA_ARGS__) -+ -+#define __INLINE_SYSCALL0(name) \ - INLINE_SYSCALL (name, 0) --#define __SYSCALL1(name, a1) \ -+#define __INLINE_SYSCALL1(name, a1) \ - INLINE_SYSCALL (name, 1, a1) --#define __SYSCALL2(name, a1, a2) \ -+#define __INLINE_SYSCALL2(name, a1, a2) \ - INLINE_SYSCALL (name, 2, a1, a2) --#define __SYSCALL3(name, a1, a2, a3) \ -+#define __INLINE_SYSCALL3(name, a1, a2, a3) \ - INLINE_SYSCALL (name, 3, a1, a2, a3) --#define __SYSCALL4(name, a1, a2, a3, a4) \ -+#define __INLINE_SYSCALL4(name, a1, a2, a3, a4) \ - INLINE_SYSCALL (name, 4, a1, a2, a3, a4) --#define __SYSCALL5(name, a1, a2, a3, a4, a5) \ -+#define __INLINE_SYSCALL5(name, a1, a2, a3, a4, a5) \ - INLINE_SYSCALL (name, 5, a1, a2, a3, a4, a5) --#define __SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ -+#define __INLINE_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ - INLINE_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6) --#define __SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ -+#define __INLINE_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ - INLINE_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7) - --#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n --#define __SYSCALL_NARGS(...) \ -- __SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) --#define __SYSCALL_CONCAT_X(a,b) a##b --#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) --#define __SYSCALL_DISP(b,...) \ -- __SYSCALL_CONCAT (b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) -+#define __INLINE_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n -+#define __INLINE_SYSCALL_NARGS(...) \ -+ __INLINE_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) -+#define __INLINE_SYSCALL_DISP(b,...) \ -+ __SYSCALL_CONCAT (b,__INLINE_SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) - --#define __SYSCALL_CALL(...) __SYSCALL_DISP (__SYSCALL, __VA_ARGS__) -+/* Issue a syscall defined by syscall number plus any other argument -+ required. Any error will be handled using arch defined macros and errno -+ will be set accordingly. -+ It is similar to INLINE_SYSCALL macro, but without the need to pass the -+ expected argument number as second parameter. */ -+#define INLINE_SYSCALL_CALL(...) \ -+ __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) - - #define SYSCALL_CANCEL(...) \ - ({ \ - long int sc_ret; \ - if (SINGLE_THREAD_P) \ -- sc_ret = __SYSCALL_CALL (__VA_ARGS__); \ -+ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ - else \ - { \ - int sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \ -- sc_ret = __SYSCALL_CALL (__VA_ARGS__); \ -+ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ - LIBC_CANCEL_RESET (sc_cancel_oldtype); \ - } \ - sc_ret; \ -diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S -index 76baa7a698..96482e53c0 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/clone.S -+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S -@@ -72,16 +72,6 @@ thread_start: - cfi_undefined (x30) - mov x29, 0 - -- tbnz x11, #CLONE_VM_BIT, 1f -- -- mov x8, #SYS_ify(getpid) -- svc 0x0 -- mrs x1, tpidr_el0 -- sub x1, x1, #PTHREAD_SIZEOF -- str w0, [x1, #PTHREAD_PID_OFFSET] -- str w0, [x1, #PTHREAD_TID_OFFSET] --1: -- - /* Pick the function arg and execute. */ - mov x0, x12 - blr x10 -diff --git a/sysdeps/unix/sysv/linux/aarch64/vfork.S b/sysdeps/unix/sysv/linux/aarch64/vfork.S -index 577895eeb2..aeed0b29ce 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/vfork.S -+++ b/sysdeps/unix/sysv/linux/aarch64/vfork.S -@@ -27,27 +27,10 @@ - - ENTRY (__vfork) - -- /* Save the TCB-cached PID away in w3, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- mrs x2, tpidr_el0 -- sub x2, x2, #PTHREAD_SIZEOF -- ldr w3, [x2, #PTHREAD_PID_OFFSET] -- mov w1, #0x80000000 -- negs w0, w3 -- csel w0, w1, w0, eq -- str w0, [x2, #PTHREAD_PID_OFFSET] -- - mov x0, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */ - mov x1, sp - DO_CALL (clone, 2) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- cbz x0, 1f -- str w3, [x2, #PTHREAD_PID_OFFSET] --1: - cmn x0, #4095 - b.cs .Lsyscall_error - RET -diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile -index c089545e9b..3b523b70cf 100644 ---- a/sysdeps/unix/sysv/linux/alpha/Makefile -+++ b/sysdeps/unix/sysv/linux/alpha/Makefile -@@ -40,4 +40,5 @@ endif # math - ifeq ($(subdir),nptl) - # pull in __syscall_error routine, __sigprocmask, __syscall_rt_sigaction - libpthread-routines += ptw-sysdep ptw-sigprocmask ptw-rt_sigaction -+libpthread-shared-only-routines += ptw-sysdep ptw-sigprocmask ptw-rt_sigaction - endif -diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S -index 6a3154f9a7..2757bf20c3 100644 ---- a/sysdeps/unix/sysv/linux/alpha/clone.S -+++ b/sysdeps/unix/sysv/linux/alpha/clone.S -@@ -91,13 +91,6 @@ thread_start: - cfi_def_cfa_register(fp) - cfi_undefined(ra) - -- /* Check and see if we need to reset the PID. */ -- ldq t0, 16(sp) -- lda t1, CLONE_VM -- and t0, t1, t2 -- beq t2, 2f --1: -- - /* Load up the arguments. */ - ldq pv, 0(sp) - ldq a0, 8(sp) -@@ -120,15 +113,6 @@ thread_start: - halt - - .align 4 --2: -- rduniq -- mov v0, s0 -- lda v0, __NR_getxpid -- callsys --3: -- stl v0, PID_OFFSET(s0) -- stl v0, TID_OFFSET(s0) -- br 1b - cfi_endproc - .end thread_start - -diff --git a/sysdeps/unix/sysv/linux/alpha/vfork.S b/sysdeps/unix/sysv/linux/alpha/vfork.S -index 9fc199ac41..e5f7ed0661 100644 ---- a/sysdeps/unix/sysv/linux/alpha/vfork.S -+++ b/sysdeps/unix/sysv/linux/alpha/vfork.S -@@ -25,24 +25,9 @@ ENTRY(__libc_vfork) - rduniq - mov v0, a1 - -- /* Save the TCB-cached PID away in A2, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- ldl a2, PID_OFFSET(v0) -- ldah t0, -0x8000 -- negl a2, t1 -- cmovne a2, t1, t0 -- stl t0, PID_OFFSET(v0); -- - lda v0, SYS_ify(vfork) - call_pal PAL_callsys - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- beq v0, 1f -- stl a2, PID_OFFSET(a1) --1: - /* Normal error check and return. */ - bne a3, SYSCALL_ERROR_LABEL - ret -diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S -index 7ff681804b..4c6325d088 100644 ---- a/sysdeps/unix/sysv/linux/arm/clone.S -+++ b/sysdeps/unix/sysv/linux/arm/clone.S -@@ -70,16 +70,6 @@ PSEUDO_END (__clone) - 1: - .fnstart - .cantunwind -- tst ip, #CLONE_VM -- bne 2f -- GET_TLS (lr) -- mov r1, r0 -- ldr r7, =SYS_ify(getpid) -- swi 0x0 -- NEGOFF_ADJ_BASE (r1, TID_OFFSET) -- str r0, NEGOFF_OFF1 (r1, TID_OFFSET) -- str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET) --2: - @ pick the function arg and call address off the stack and execute - ldr r0, [sp, #4] - ldr ip, [sp], #8 -diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S -index 603e508858..d1f168fece 100644 ---- a/sysdeps/unix/sysv/linux/arm/setcontext.S -+++ b/sysdeps/unix/sysv/linux/arm/setcontext.S -@@ -86,12 +86,19 @@ weak_alias(__setcontext, setcontext) - - /* Called when a makecontext() context returns. Start the - context in R4 or fall through to exit(). */ -+ /* Unwind descriptors are looked up based on PC - 2, so we have to -+ make sure to mark the instruction preceding the __startcontext -+ label as .cantunwind. */ -+ .fnstart -+ .cantunwind -+ nop - ENTRY(__startcontext) - movs r0, r4 - bne PLTJMP(__setcontext) - - @ New context was 0 - exit - b PLTJMP(HIDDEN_JUMPTARGET(exit)) -+ .fnend - END(__startcontext) - - #ifdef PIC -diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S -index 500f5ca4be..794372ee12 100644 ---- a/sysdeps/unix/sysv/linux/arm/vfork.S -+++ b/sysdeps/unix/sysv/linux/arm/vfork.S -@@ -28,16 +28,6 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__vfork) -- /* Save the PID value. */ -- GET_TLS (r2) -- NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET) /* Save the TLS addr in r2. */ -- ldr r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* Load the saved PID. */ -- rsbs r0, r3, #0 /* Negate it, and test for zero. */ -- /* Use 0x80000000 if it was 0. See raise.c for how this is used. */ -- it eq -- moveq r0, #0x80000000 -- str r0, NEGOFF_OFF1 (r2, PID_OFFSET) /* Store the temp PID. */ -- - /* The DO_CALL macro saves r7 on the stack, to enable generation - of ARM unwind info. Since the stack is initially shared between - parent and child of vfork, that saved value could be corrupted. -@@ -57,11 +47,6 @@ ENTRY (__vfork) - mov r7, ip - cfi_restore (r7) - -- /* Restore the old PID value in the parent. */ -- cmp r0, #0 /* If we are the parent... */ -- it ne -- strne r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* restore the saved PID. */ -- - cmn a1, #4096 - it cc - RETINSTR(cc, lr) -diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c -index 6d32cece48..ec86f50814 100644 ---- a/sysdeps/unix/sysv/linux/createthread.c -+++ b/sysdeps/unix/sysv/linux/createthread.c -@@ -128,10 +128,10 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, - /* The operation failed. We have to kill the thread. - We let the normal cancellation mechanism do the work. */ - -+ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err2); -- (void) INTERNAL_SYSCALL (tgkill, err2, 3, -- THREAD_GETMEM (THREAD_SELF, pid), -- pd->tid, SIGCANCEL); -+ (void) INTERNAL_SYSCALL_CALL (tgkill, err2, pid, pd->tid, -+ SIGCANCEL); - - return INTERNAL_SYSCALL_ERRNO (res, err); - } -diff --git a/sysdeps/unix/sysv/linux/getpid.c b/sysdeps/unix/sysv/linux/getpid.c -deleted file mode 100644 -index 1124549326..0000000000 ---- a/sysdeps/unix/sysv/linux/getpid.c -+++ /dev/null -@@ -1,64 +0,0 @@ --/* Copyright (C) 2003-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 2003. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- . */ -- --#include --#include --#include -- -- --#if IS_IN (libc) --static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval); -- --static inline __attribute__((always_inline)) pid_t --really_getpid (pid_t oldval) --{ -- if (__glibc_likely (oldval == 0)) -- { -- pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid); -- if (__glibc_likely (selftid != 0)) -- return selftid; -- } -- -- INTERNAL_SYSCALL_DECL (err); -- pid_t result = INTERNAL_SYSCALL (getpid, err, 0); -- -- /* We do not set the PID field in the TID here since we might be -- called from a signal handler while the thread executes fork. */ -- if (oldval == 0) -- THREAD_SETMEM (THREAD_SELF, tid, result); -- return result; --} --#endif -- --pid_t --__getpid (void) --{ --#if !IS_IN (libc) -- INTERNAL_SYSCALL_DECL (err); -- pid_t result = INTERNAL_SYSCALL (getpid, err, 0); --#else -- pid_t result = THREAD_GETMEM (THREAD_SELF, pid); -- if (__glibc_unlikely (result <= 0)) -- result = really_getpid (result); --#endif -- return result; --} -- --libc_hidden_def (__getpid) --weak_alias (__getpid, getpid) --libc_hidden_def (getpid) -diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S -index 3d037f1430..25fcd497f7 100644 ---- a/sysdeps/unix/sysv/linux/hppa/clone.S -+++ b/sysdeps/unix/sysv/linux/hppa/clone.S -@@ -132,18 +132,6 @@ ENTRY(__clone) - ldwm -64(%sp), %r4 - - .LthreadStart: --# define CLONE_VM_BIT 23 /* 0x00000100 */ -- /* Load original clone flags. -- If CLONE_VM was passed, don't modify PID/TID. -- Otherwise store the result of getpid to PID/TID. */ -- ldw -56(%sp), %r26 -- bb,<,n %r26, CLONE_VM_BIT, 1f -- ble 0x100(%sr2, %r0) -- ldi __NR_getpid, %r20 -- mfctl %cr27, %r26 -- stw %ret0, PID_THREAD_OFFSET(%r26) -- stw %ret0, TID_THREAD_OFFSET(%r26) --1: - /* Load up the arguments. */ - ldw -60(%sp), %arg0 - ldw -64(%sp), %r22 -diff --git a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S b/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -index df532362d2..4684048502 100644 ---- a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -+++ b/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -@@ -25,26 +25,6 @@ - replaced by a call to `execve'. Return -1 for errors, 0 to the new process, - and the process ID of the new process to the old process. */ - --/* Load the thread register. -- Load the saved PID value. -- Negate the value. -- Store the temporary PID. */ --#define SAVE_PID \ -- mfctl %cr27, %r26 ASM_LINE_SEP \ -- ldw PID_THREAD_OFFSET(%r26),%r1 ASM_LINE_SEP \ -- sub %r0,%r1,%r1 ASM_LINE_SEP \ -- stw %r1,PID_THREAD_OFFSET(%r26) ASM_LINE_SEP --/* If we are the parent... -- Get the thread pointer. -- Load the saved PID. -- Negate the value (got back original) -- Restore the PID. */ --#define RESTORE_PID \ -- cmpb,=,n %r0,%ret0,.Lthread_start ASM_LINE_SEP \ -- mfctl %cr27, %r26 ASM_LINE_SEP \ -- ldw PID_THREAD_OFFSET(%r26),%r1 ASM_LINE_SEP \ -- sub %r0,%r1,%r1 ASM_LINE_SEP \ -- stw %r1,PID_THREAD_OFFSET(%r26) ASM_LINE_SEP \ - .Lthread_start: ASM_LINE_SEP - - /* r26, r25, r24, r23 are free since vfork has no arguments */ -@@ -58,16 +38,10 @@ ENTRY(__vfork) - copy %r19, %r25 /* parent */ - #endif - -- /* Save the process PID */ -- SAVE_PID -- - /* Syscall saves and restores all register states */ - ble 0x100(%sr2,%r0) - ldi __NR_vfork,%r20 - -- /* Conditionally restore the PID */ -- RESTORE_PID -- - /* Check for error */ - ldi -4096,%r1 - comclr,>>= %r1,%ret0,%r0 /* Note: unsigned compare. */ -diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile -index 71ba61e9d7..6073a9fe04 100644 ---- a/sysdeps/unix/sysv/linux/i386/Makefile -+++ b/sysdeps/unix/sysv/linux/i386/Makefile -@@ -31,6 +31,7 @@ endif - # libpthread uses six-argument inline syscalls. - ifeq ($(subdir),nptl) - libpthread-sysdep_routines += libc-do-syscall -+libpthread-shared-only-routines += libc-do-syscall - endif - - ifeq ($(subdir),resource) -@@ -48,9 +49,11 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif - - ifeq ($(subdir),rt) - # pull in __syscall_error routine - librt-routines += sysdep -+librt-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S -index 25f2a9c340..feae504ce6 100644 ---- a/sysdeps/unix/sysv/linux/i386/clone.S -+++ b/sysdeps/unix/sysv/linux/i386/clone.S -@@ -107,9 +107,6 @@ L(thread_start): - cfi_undefined (eip); - /* Note: %esi is zero. */ - movl %esi,%ebp /* terminate the stack frame */ -- testl $CLONE_VM, %edi -- je L(newpid) --L(haspid): - call *%ebx - #ifdef PIC - call L(here) -@@ -121,18 +118,6 @@ L(here): - movl $SYS_ify(exit), %eax - ENTER_KERNEL - -- .subsection 2 --L(newpid): -- movl $SYS_ify(getpid), %eax -- ENTER_KERNEL --L(nomoregetpid): -- movl %eax, %gs:PID -- movl %eax, %gs:TID -- jmp L(haspid) -- .previous -- cfi_endproc; -- -- cfi_startproc - PSEUDO_END (__clone) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S -index 7a1d3373bb..a865de2201 100644 ---- a/sysdeps/unix/sysv/linux/i386/vfork.S -+++ b/sysdeps/unix/sysv/linux/i386/vfork.S -@@ -34,17 +34,6 @@ ENTRY (__vfork) - cfi_adjust_cfa_offset (-4) - cfi_register (%eip, %ecx) - -- /* Save the TCB-cached PID away in %edx, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- movl %gs:PID, %edx -- movl %edx, %eax -- negl %eax -- jne 1f -- movl $0x80000000, %eax --1: movl %eax, %gs:PID -- -- - /* Stuff the syscall number in EAX and enter into the kernel. */ - movl $SYS_ify (vfork), %eax - int $0x80 -@@ -55,14 +44,6 @@ ENTRY (__vfork) - pushl %ecx - cfi_adjust_cfa_offset (4) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- testl %eax, %eax -- je 1f -- movl %edx, %gs:PID --1: -- - cmpl $-4095, %eax - /* Branch forward if it failed. */ - jae SYSCALL_ERROR_LABEL -diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile -index 1de62c528a..4d6766db5e 100644 ---- a/sysdeps/unix/sysv/linux/ia64/Makefile -+++ b/sysdeps/unix/sysv/linux/ia64/Makefile -@@ -19,6 +19,7 @@ endif - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),nptl) -diff --git a/sysdeps/unix/sysv/linux/ia64/clone2.S b/sysdeps/unix/sysv/linux/ia64/clone2.S -index b4cfdfc959..e637b6d4a5 100644 ---- a/sysdeps/unix/sysv/linux/ia64/clone2.S -+++ b/sysdeps/unix/sysv/linux/ia64/clone2.S -@@ -67,19 +67,7 @@ ENTRY(__clone2) - (CHILD) mov loc0=gp - (PARENT) ret - ;; -- tbit.nz p6,p0=in3,8 /* CLONE_VM */ --(p6) br.cond.dptk 1f -- ;; -- mov r15=SYS_ify (getpid) --(p7) break __BREAK_SYSCALL -- ;; -- add r9=PID,r13 -- add r10=TID,r13 -- ;; -- st4 [r9]=r8 -- st4 [r10]=r8 -- ;; --1: ld8 out1=[in0],8 /* Retrieve code pointer. */ -+ ld8 out1=[in0],8 /* Retrieve code pointer. */ - mov out0=in4 /* Pass proper argument to fn */ - ;; - ld8 gp=[in0] /* Load function gp. */ -diff --git a/sysdeps/unix/sysv/linux/ia64/vfork.S b/sysdeps/unix/sysv/linux/ia64/vfork.S -index 9154d7c0fd..84bfdd5d8a 100644 ---- a/sysdeps/unix/sysv/linux/ia64/vfork.S -+++ b/sysdeps/unix/sysv/linux/ia64/vfork.S -@@ -33,32 +33,12 @@ ENTRY (__libc_vfork) - .prologue // work around a GAS bug which triggers if - .body // first .prologue is not at the beginning of proc. - alloc r2=ar.pfs,0,0,2,0 -- adds r14=PID,r13 -- ;; -- ld4 r16=[r14] -- ;; -- sub r15=0,r16 -- cmp.eq p6,p0=0,r16 -- ;; --(p6) movl r15=0x80000000 - mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD - mov out1=0 /* Standard sp value. */ - ;; -- st4 [r14]=r15 - DO_CALL (SYS_ify (clone)) - cmp.eq p6,p0=0,r8 -- adds r14=PID,r13 - (p6) br.cond.dptk 1f -- ;; -- ld4 r15=[r14] -- ;; -- extr.u r16=r15,0,31 -- ;; -- cmp.eq p0,p6=0,r16 -- ;; --(p6) sub r16=0,r15 -- ;; -- st4 [r14]=r16 - 1: - cmp.eq p6,p0=-1,r10 - (p6) br.cond.spnt.few __syscall_error -diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S -index 3a828443dc..630a29209d 100644 ---- a/sysdeps/unix/sysv/linux/m68k/clone.S -+++ b/sysdeps/unix/sysv/linux/m68k/clone.S -@@ -98,19 +98,6 @@ ENTRY (__clone) - cfi_startproc - cfi_undefined (pc) /* Mark end of stack */ - subl %fp, %fp /* terminate the stack frame */ -- /* Check and see if we need to reset the PID. */ -- andl #CLONE_VM, %d1 -- jne 1f -- movel #SYS_ify (getpid), %d0 -- trap #0 -- movel %a0, -(%sp) -- movel %d0, -(%sp) -- bsrl __m68k_read_tp@PLTPC -- movel (%sp)+, %d0 -- movel %d0, PID_OFFSET(%a0) -- movel %d0, TID_OFFSET(%a0) -- movel (%sp)+, %a0 --1: - jsr (%a0) - movel %d0, %d1 - movel #SYS_ify (exit), %d0 -diff --git a/sysdeps/unix/sysv/linux/m68k/vfork.S b/sysdeps/unix/sysv/linux/m68k/vfork.S -index 1625a7b7a0..e27479361b 100644 ---- a/sysdeps/unix/sysv/linux/m68k/vfork.S -+++ b/sysdeps/unix/sysv/linux/m68k/vfork.S -@@ -28,18 +28,6 @@ - - ENTRY (__vfork) - -- /* Save the TCB-cached PID away in %d1, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- jbsr __m68k_read_tp@PLTPC -- movel %a0, %a1 -- movel PID_OFFSET(%a1), %d0 -- movel %d0, %d1 -- negl %d0 -- jne 1f -- movel #0x80000000, %d0 --1: movel %d0, PID_OFFSET(%a1) -- - /* Pop the return PC value into A0. */ - movel %sp@+, %a0 - cfi_adjust_cfa_offset (-4) -@@ -49,14 +37,6 @@ ENTRY (__vfork) - movel #SYS_ify (vfork), %d0 - trap #0 - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- tstl %d0 -- jeq 1f -- movel %d1, PID_OFFSET(%a1) --1: -- - tstl %d0 - jmi .Lerror /* Branch forward if it failed. */ - -diff --git a/sysdeps/unix/sysv/linux/microblaze/Makefile b/sysdeps/unix/sysv/linux/microblaze/Makefile -index 44a838fa11..d178bc6f34 100644 ---- a/sysdeps/unix/sysv/linux/microblaze/Makefile -+++ b/sysdeps/unix/sysv/linux/microblaze/Makefile -@@ -5,4 +5,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep --endif -\ No newline at end of file -+libpthread-shared-only-routines += sysdep -+endif -diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S -index 39634c5cf0..7ae65ef723 100644 ---- a/sysdeps/unix/sysv/linux/mips/clone.S -+++ b/sysdeps/unix/sysv/linux/mips/clone.S -@@ -130,11 +130,6 @@ L(thread_start): - SAVE_GP (GPOFF) - /* The stackframe has been created on entry of clone(). */ - -- /* Check and see if we need to reset the PID. */ -- and a1,a0,CLONE_VM -- beqz a1,L(restore_pid) --L(donepid): -- - /* Restore the arg for user's function. */ - PTR_L t9,0(sp) /* Function pointer. */ - PTR_L a0,PTRSIZE(sp) /* Argument pointer. */ -@@ -151,14 +146,6 @@ L(donepid): - jal _exit - #endif - --L(restore_pid): -- li v0,__NR_getpid -- syscall -- READ_THREAD_POINTER(v1) -- INT_S v0,PID_OFFSET(v1) -- INT_S v0,TID_OFFSET(v1) -- b L(donepid) -- - END(__thread_start) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -index 890a74494a..26ab6d0b75 100644 ---- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -@@ -4,6 +4,8 @@ mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64 - - sync_file_range - sync_file_range Ci:iiii sync_file_range - -+readahead - readahead i:iii __readahead readahead -+ - prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 - - fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark -diff --git a/sysdeps/unix/sysv/linux/mips/vfork.S b/sysdeps/unix/sysv/linux/mips/vfork.S -index 1867c8626e..0b9244b7f8 100644 ---- a/sysdeps/unix/sysv/linux/mips/vfork.S -+++ b/sysdeps/unix/sysv/linux/mips/vfork.S -@@ -60,14 +60,6 @@ NESTED(__libc_vfork,FRAMESZ,sp) - PTR_ADDU sp, FRAMESZ - cfi_adjust_cfa_offset (-FRAMESZ) - -- /* Save the PID value. */ -- READ_THREAD_POINTER(v1) /* Get the thread pointer. */ -- lw a2, PID_OFFSET(v1) /* Load the saved PID. */ -- subu a2, $0, a2 /* Negate it. */ -- bnez a2, 1f /* If it was zero... */ -- lui a2, 0x8000 /* use 0x80000000 instead. */ --1: sw a2, PID_OFFSET(v1) /* Store the temporary PID. */ -- - li a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */ - move a1, sp - -@@ -75,17 +67,6 @@ NESTED(__libc_vfork,FRAMESZ,sp) - li v0,__NR_clone - syscall - -- /* Restore the old PID value in the parent. */ -- beqz v0, 1f /* If we are the parent... */ -- READ_THREAD_POINTER(v1) /* Get the thread pointer. */ -- lw a2, PID_OFFSET(v1) /* Load the saved PID. */ -- subu a2, $0, a2 /* Re-negate it. */ -- lui a0, 0x8000 /* Load 0x80000000... */ -- bne a2, a0, 2f /* ... compare against it... */ -- li a2, 0 /* ... use 0 instead. */ --2: sw a2, PID_OFFSET(v1) /* Restore the PID. */ --1: -- - cfi_remember_state - bnez a3,L(error) - -diff --git a/sysdeps/unix/sysv/linux/nios2/clone.S b/sysdeps/unix/sysv/linux/nios2/clone.S -index 30b6e4a6c8..c9fa00f94c 100644 ---- a/sysdeps/unix/sysv/linux/nios2/clone.S -+++ b/sysdeps/unix/sysv/linux/nios2/clone.S -@@ -68,14 +68,6 @@ thread_start: - cfi_startproc - cfi_undefined (ra) - -- /* We expect the argument registers to be preserved across system -- calls and across task cloning, so flags should be in r4 here. */ -- andi r2, r4, CLONE_VM -- bne r2, zero, 2f -- DO_CALL (getpid, 0) -- stw r2, PID_OFFSET(r23) -- stw r2, TID_OFFSET(r23) --2: - ldw r5, 4(sp) /* Function pointer. */ - ldw r4, 0(sp) /* Argument pointer. */ - addi sp, sp, 8 -diff --git a/sysdeps/unix/sysv/linux/nios2/vfork.S b/sysdeps/unix/sysv/linux/nios2/vfork.S -index c1bb9c7134..8997269199 100644 ---- a/sysdeps/unix/sysv/linux/nios2/vfork.S -+++ b/sysdeps/unix/sysv/linux/nios2/vfork.S -@@ -21,20 +21,10 @@ - - ENTRY(__vfork) - -- ldw r6, PID_OFFSET(r23) -- sub r7, zero, r6 -- bne r7, zero, 2f -- movhi r7, %hi(0x80000000) --2: -- stw r7, PID_OFFSET(r23) -- - movi r4, 0x4111 /* (CLONE_VM | CLONE_VFORK | SIGCHLD) */ - mov r5, zero - DO_CALL (clone, 2) - -- beq r2, zero, 1f -- stw r6, PID_OFFSET(r23) --1: - bne r7, zero, SYSCALL_ERROR_LABEL - ret - -diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile -index c89ed9ec7d..2cfb46eca3 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/Makefile -+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile -@@ -8,6 +8,7 @@ abi-64-v2-condition := __WORDSIZE == 64 && _CALL_ELF == 2 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),stdlib) -@@ -34,4 +35,5 @@ ifeq ($(subdir),nptl) - libpthread-routines += sysdep - libpthread-sysdep_routines += elision-lock elision-unlock elision-timed \ - elision-trylock -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -index dd1e4c3b17..7dd3d835b6 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -@@ -45,7 +45,9 @@ - int - __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - { -- if (*adapt_count > 0) -+ /* adapt_count is accessed concurrently but is just a hint. Thus, -+ use atomic accesses but relaxed MO is sufficient. */ -+ if (atomic_load_relaxed (adapt_count) > 0) - { - goto use_lock; - } -@@ -67,7 +69,8 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) - { - if (aconf.skip_lock_internal_abort > 0) -- *adapt_count = aconf.skip_lock_internal_abort; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_lock_internal_abort); - goto use_lock; - } - } -@@ -75,7 +78,8 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - - /* Fall back to locks for a bit if retries have been exhausted */ - if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0) -- *adapt_count = aconf.skip_lock_out_of_tbegin_retries; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_lock_out_of_tbegin_retries); - - use_lock: - return LLL_LOCK ((*lock), pshared); -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -index 0807a6a432..606185670d 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -@@ -34,7 +34,7 @@ __lll_trylock_elision (int *futex, short *adapt_count) - __libc_tabort (_ABORT_NESTED_TRYLOCK); - - /* Only try a transaction if it's worth it. */ -- if (*adapt_count > 0) -+ if (atomic_load_relaxed (adapt_count) > 0) - { - goto use_lock; - } -@@ -49,7 +49,7 @@ __lll_trylock_elision (int *futex, short *adapt_count) - __libc_tend (0); - - if (aconf.skip_lock_busy > 0) -- *adapt_count = aconf.skip_lock_busy; -+ atomic_store_relaxed (adapt_count, aconf.skip_lock_busy); - } - else - { -@@ -59,7 +59,8 @@ __lll_trylock_elision (int *futex, short *adapt_count) - result in another failure. Use normal locking now and - for the next couple of calls. */ - if (aconf.skip_trylock_internal_abort > 0) -- *adapt_count = aconf.skip_trylock_internal_abort; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_trylock_internal_abort); - } - } - -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -index 43c5a67df2..51d7018e4c 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -@@ -28,13 +28,16 @@ __lll_unlock_elision (int *lock, short *adapt_count, int pshared) - __libc_tend (0); - else - { -- lll_unlock ((*lock), pshared); -+ /* Update adapt_count in the critical section to prevent a -+ write-after-destroy error as mentioned in BZ 20822. The -+ following update of adapt_count has to be contained within -+ the critical region of the fall-back lock in order to not violate -+ the mutex destruction requirements. */ -+ short __tmp = atomic_load_relaxed (adapt_count); -+ if (__tmp > 0) -+ atomic_store_relaxed (adapt_count, __tmp - 1); - -- /* Update the adapt count AFTER completing the critical section. -- Doing this here prevents unneeded stalling when entering -- a critical section. Saving about 8% runtime on P8. */ -- if (*adapt_count > 0) -- (*adapt_count)--; -+ lll_unlock ((*lock), pshared); - } - return 0; - } -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -index bebadbfbb9..49fe01ecde 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -@@ -76,15 +76,6 @@ ENTRY (__clone) - crandc cr1*4+eq,cr1*4+eq,cr0*4+so - bne- cr1,L(parent) /* The '-' is to minimise the race. */ - -- /* If CLONE_VM is set do not update the pid/tid field. */ -- andi. r0,r28,CLONE_VM -- bne+ cr0,L(oldpid) -- -- DO_CALL(SYS_ify(getpid)) -- stw r3,TID(r2) -- stw r3,PID(r2) --L(oldpid): -- - /* Call procedure. */ - mtctr r30 - mr r3,r31 -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -index edbc7de1e6..0a724953a4 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -@@ -27,34 +27,8 @@ - - ENTRY (__vfork) - -- /* Load the TCB-cached PID value and negates it. If It it is zero -- sets it to 0x800000. And then sets its value again on TCB field. -- See raise.c for the logic that relies on this value. */ -- -- lwz r0,PID(r2) -- cmpwi cr0,r0,0 -- neg r0,r0 -- bne- cr0,1f -- lis r0,0x8000 --1: stw r0,PID(r2) -- - DO_CALL (SYS_ify (vfork)) - -- cmpwi cr1,r3,0 -- beqlr- 1 -- -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- lwz r0,PID(r2) -- /* Cannot use clrlwi. here, because cr0 needs to be preserved -- until PSEUDO_RET. */ -- clrlwi r4,r0,1 -- cmpwi cr1,r4,0 -- beq- cr1,1f -- neg r4,r0 --1: stw r4,PID(r2) -- - PSEUDO_RET - - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -index 7c59b9b4e9..d8604f6731 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -@@ -78,15 +78,6 @@ ENTRY (__clone) - crandc cr1*4+eq,cr1*4+eq,cr0*4+so - bne- cr1,L(parent) /* The '-' is to minimise the race. */ - -- /* If CLONE_VM is set do not update the pid/tid field. */ -- rldicl. r0,r29,56,63 /* flags & CLONE_VM. */ -- bne+ cr0,L(oldpid) -- -- DO_CALL(SYS_ify(getpid)) -- stw r3,TID(r13) -- stw r3,PID(r13) --L(oldpid): -- - std r2,FRAME_TOC_SAVE(r1) - /* Call procedure. */ - PPC64_LOAD_FUNCPTR r30 -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -index 3083ab7b3c..6b4cf432c1 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -@@ -28,31 +28,8 @@ - ENTRY (__vfork) - CALL_MCOUNT 0 - -- /* Load the TCB-cached PID value and negates it. If It it is zero -- sets it to 0x800000. And then sets its value again on TCB field. -- See raise.c for the logic that relies on this value. */ -- lwz r0,PID(r13) -- cmpwi cr0,r0,0 -- neg r0,r0 -- bne- cr0,1f -- lis r0,0x8000 --1: stw r0,PID(r13) -- - DO_CALL (SYS_ify (vfork)) - -- cmpwi cr1,r3,0 -- beqlr- 1 -- -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- lwz r0,PID(r13) -- clrlwi r4,r0,1 -- cmpwi cr1,r4,0 -- beq- cr1,1f -- neg r4,r0 --1: stw r4,PID(r13) -- - PSEUDO_RET - - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c -index 1bcff64781..46d974d952 100644 ---- a/sysdeps/unix/sysv/linux/pread.c -+++ b/sysdeps/unix/sysv/linux/pread.c -@@ -28,8 +28,7 @@ - ssize_t - __libc_pread (int fd, void *buf, size_t count, off_t offset) - { -- return SYSCALL_CANCEL (pread, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL (offset)); -+ return SYSCALL_CANCEL (pread, fd, buf, count, SYSCALL_LL_PRW (offset)); - } - - strong_alias (__libc_pread, __pread) -diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c -index 58c6aeb541..f51beae77a 100644 ---- a/sysdeps/unix/sysv/linux/pread64.c -+++ b/sysdeps/unix/sysv/linux/pread64.c -@@ -26,8 +26,7 @@ - ssize_t - __libc_pread64 (int fd, void *buf, size_t count, off64_t offset) - { -- return SYSCALL_CANCEL (pread64, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL64 (offset)); -+ return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset)); - } - - weak_alias (__libc_pread64, __pread64) -diff --git a/sysdeps/unix/sysv/linux/pthread-pids.h b/sysdeps/unix/sysv/linux/pthread-pids.h -index d42bba03cf..618a5b1b9f 100644 ---- a/sysdeps/unix/sysv/linux/pthread-pids.h -+++ b/sysdeps/unix/sysv/linux/pthread-pids.h -@@ -26,5 +26,5 @@ static inline void - __pthread_initialize_pids (struct pthread *pd) - { - INTERNAL_SYSCALL_DECL (err); -- pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); -+ pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, err, &pd->tid); - } -diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c -index bcb3009675..cc109973cc 100644 ---- a/sysdeps/unix/sysv/linux/pthread_kill.c -+++ b/sysdeps/unix/sysv/linux/pthread_kill.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - - int -@@ -49,15 +50,9 @@ __pthread_kill (pthread_t threadid, int signo) - /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - -- /* One comment: The PID field in the TCB can temporarily be changed -- (in fork). But this must not affect this code here. Since this -- function would have to be called while the thread is executing -- fork, it would have to happen in a signal handler. But this is -- no allowed, pthread_kill is not guaranteed to be async-safe. */ -- int val; -- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid), -- tid, signo); -+ pid_t pid = __getpid (); - -+ int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); - } -diff --git a/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/sysdeps/unix/sysv/linux/pthread_sigqueue.c -index 7694d5467c..e393e0bd73 100644 ---- a/sysdeps/unix/sysv/linux/pthread_sigqueue.c -+++ b/sysdeps/unix/sysv/linux/pthread_sigqueue.c -@@ -49,27 +49,22 @@ pthread_sigqueue (pthread_t threadid, int signo, const union sigval value) - if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID) - return EINVAL; - -+ pid_t pid = getpid (); -+ - /* Set up the siginfo_t structure. */ - siginfo_t info; - memset (&info, '\0', sizeof (siginfo_t)); - info.si_signo = signo; - info.si_code = SI_QUEUE; -- info.si_pid = THREAD_GETMEM (THREAD_SELF, pid); -+ info.si_pid = pid; - info.si_uid = getuid (); - info.si_value = value; - - /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - -- /* One comment: The PID field in the TCB can temporarily be changed -- (in fork). But this must not affect this code here. Since this -- function would have to be called while the thread is executing -- fork, it would have to happen in a signal handler. But this is -- no allowed, pthread_sigqueue is not guaranteed to be async-safe. */ -- int val = INTERNAL_SYSCALL (rt_tgsigqueueinfo, err, 4, -- THREAD_GETMEM (THREAD_SELF, pid), -- tid, signo, &info); -- -+ int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, err, pid, tid, signo, -+ &info); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); - #else -diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c -index 9c502beac1..1371df8a60 100644 ---- a/sysdeps/unix/sysv/linux/pwrite.c -+++ b/sysdeps/unix/sysv/linux/pwrite.c -@@ -28,8 +28,7 @@ - ssize_t - __libc_pwrite (int fd, const void *buf, size_t count, off_t offset) - { -- return SYSCALL_CANCEL (pwrite, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL (offset)); -+ return SYSCALL_CANCEL (pwrite, fd, buf, count, SYSCALL_LL_PRW (offset)); - } - - strong_alias (__libc_pwrite, __pwrite) -diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c -index b49e6bc286..22f1f05a44 100644 ---- a/sysdeps/unix/sysv/linux/pwrite64.c -+++ b/sysdeps/unix/sysv/linux/pwrite64.c -@@ -26,8 +26,7 @@ - ssize_t - __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset) - { -- return SYSCALL_CANCEL (pwrite64, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL64 (offset)); -+ return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset)); - } - weak_alias (__libc_pwrite64, __pwrite64) - libc_hidden_weak (__pwrite64) -diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c -index 470033e83d..49bb7cb0d4 100644 ---- a/sysdeps/unix/sysv/linux/raise.c -+++ b/sysdeps/unix/sysv/linux/raise.c -@@ -26,13 +26,6 @@ - int - raise (int sig) - { -- /* raise is an async-safe function so it could be called while the -- fork/vfork function temporarily invalidated the PID field. To avoid -- relying on cached value we block all user-defined signal handler -- (which might call fork/vfork) and issue the getpid and gettid -- syscalls directly. */ -- -- - /* rt_sigprocmask may fail if: - - 1. sigsetsize != sizeof (sigset_t) (EINVAL) -diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile -index 497ffd566c..f8ed013e9e 100644 ---- a/sysdeps/unix/sysv/linux/s390/Makefile -+++ b/sysdeps/unix/sysv/linux/s390/Makefile -@@ -6,6 +6,7 @@ abi-64-condition := __WORDSIZE == 64 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),stdlib) -diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -index 2f8fa0b840..b1de1480d1 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -@@ -54,13 +54,6 @@ error: - PSEUDO_END (__clone) - - thread_start: -- tml %r3,256 /* CLONE_VM == 0x00000100 */ -- jne 1f -- svc SYS_ify(getpid) -- ear %r3,%a0 -- st %r2,PID(%r3) -- st %r2,TID(%r3) --1: - /* fn is in gpr 1, arg in gpr 0 */ - lr %r2,%r0 /* set first parameter to void *arg */ - ahi %r15,-96 /* make room on the stack for the save area */ -diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S b/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -index b7588ebd7c..cc60e139ba 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -@@ -28,21 +28,9 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- ear %r4,%a0 -- lhi %r1,1 -- icm %r3,15,PID(%r4) -- sll %r1,31 -- je 1f -- lcr %r1,%r3 --1: st %r1,PID(%r4) -- - /* Do vfork system call. */ - svc SYS_ify (vfork) - -- ltr %r2,%r2 -- je 1f -- st %r3,PID(%r4) --1: - /* Check for error. */ - lhi %r4,-4095 - clr %r2,%r4 -diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -index fb816922ca..29606acf03 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -@@ -55,15 +55,6 @@ error: - PSEUDO_END (__clone) - - thread_start: -- tmll %r3,256 /* CLONE_VM == 0x00000100 */ -- jne 1f -- svc SYS_ify(getpid) -- ear %r3,%a0 -- sllg %r3,%r3,32 -- ear %r3,%a1 -- st %r2,PID(%r3) -- st %r2,TID(%r3) --1: - /* fn is in gpr 1, arg in gpr 0 */ - lgr %r2,%r0 /* set first parameter to void *arg */ - aghi %r15,-160 /* make room on the stack for the save area */ -diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S b/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -index 0bd2161381..b9a813f2cc 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -@@ -28,22 +28,9 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- ear %r4,%a0 -- sllg %r4,%r4,32 -- ear %r4,%a1 -- icm %r3,15,PID(%r4) -- llilh %r1,32768 -- je 1f -- lcr %r1,%r3 --1: st %r1,PID(%r4) -- - /* Do vfork system call. */ - svc SYS_ify (vfork) - -- ltgr %r2,%r2 -- je 1f -- st %r3,PID(%r4) --1: - /* Check for error. */ - lghi %r4,-4095 - clgr %r2,%r4 -diff --git a/sysdeps/unix/sysv/linux/sh/clone.S b/sysdeps/unix/sysv/linux/sh/clone.S -index 4cd7df117c..ce7cddcb19 100644 ---- a/sysdeps/unix/sysv/linux/sh/clone.S -+++ b/sysdeps/unix/sysv/linux/sh/clone.S -@@ -66,23 +66,7 @@ ENTRY(__clone) - 2: - /* terminate the stack frame */ - mov #0, r14 -- mov r4, r0 -- shlr8 r0 -- tst #1, r0 // CLONE_VM = (1 << 8) -- bf/s 4f -- mov r4, r0 -- /* new pid */ -- mov #+SYS_ify(getpid), r3 -- trapa #0x15 --3: -- stc gbr, r1 -- mov.w .Lpidoff, r2 -- add r1, r2 -- mov.l r0, @r2 -- mov.w .Ltidoff, r2 -- add r1, r2 -- mov.l r0, @r2 --4: -+ - /* thread starts */ - mov.l @r15, r1 - jsr @r1 -@@ -113,10 +97,6 @@ ENTRY(__clone) - .long _GLOBAL_OFFSET_TABLE_ - .L3: - .long PLTJMP(C_SYMBOL_NAME(_exit)) --.Lpidoff: -- .word PID - TLS_PRE_TCB_SIZE --.Ltidoff: -- .word TID - TLS_PRE_TCB_SIZE - PSEUDO_END (__clone) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h -index ad05fc39e1..c5240fafbd 100644 ---- a/sysdeps/unix/sysv/linux/sh/kernel-features.h -+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h -@@ -44,3 +44,8 @@ - - /* SH does not have a 64-bit inode field. */ - #undef __ASSUME_ST_INO_64_BIT -+ -+/* SH4 ABI does not really require argument alignment for 64-bits, but -+ the kernel interface for p{read,write}64 adds a dummy long argument -+ before the offset. */ -+#define __ASSUME_PRW_DUMMY_ARG 1 -diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c -deleted file mode 100644 -index 391ed5e17b..0000000000 ---- a/sysdeps/unix/sysv/linux/sh/pwrite.c -+++ /dev/null -@@ -1,23 +0,0 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- . */ -- --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pwrite adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -index 17397c5511..25f914a93b 100644 ---- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -@@ -13,22 +13,22 @@ SIG_SETMASK - oLINK ucontext (uc_link) - oSS_SP ucontext (uc_stack.ss_sp) - oSS_SIZE ucontext (uc_stack.ss_size) --oR0 mcontext (gregs[R0]) --oR1 mcontext (gregs[R1]) --oR2 mcontext (gregs[R2]) --oR3 mcontext (gregs[R3]) --oR4 mcontext (gregs[R4]) --oR5 mcontext (gregs[R5]) --oR6 mcontext (gregs[R6]) --oR7 mcontext (gregs[R7]) --oR8 mcontext (gregs[R8]) --oR9 mcontext (gregs[R9]) --oR10 mcontext (gregs[R10]) --oR11 mcontext (gregs[R11]) --oR12 mcontext (gregs[R12]) --oR13 mcontext (gregs[R13]) --oR14 mcontext (gregs[R14]) --oR15 mcontext (gregs[R15]) -+oR0 mcontext (gregs[REG_R0]) -+oR1 mcontext (gregs[REG_R1]) -+oR2 mcontext (gregs[REG_R2]) -+oR3 mcontext (gregs[REG_R3]) -+oR4 mcontext (gregs[REG_R4]) -+oR5 mcontext (gregs[REG_R5]) -+oR6 mcontext (gregs[REG_R6]) -+oR7 mcontext (gregs[REG_R7]) -+oR8 mcontext (gregs[REG_R8]) -+oR9 mcontext (gregs[REG_R9]) -+oR10 mcontext (gregs[REG_R10]) -+oR11 mcontext (gregs[REG_R11]) -+oR12 mcontext (gregs[REG_R12]) -+oR13 mcontext (gregs[REG_R13]) -+oR14 mcontext (gregs[REG_R14]) -+oR15 mcontext (gregs[REG_R15]) - oPC mcontext (pc) - oPR mcontext (pr) - oSR mcontext (sr) -diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -index 65633fbcf4..130f60cd96 100644 ---- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -@@ -13,22 +13,22 @@ SIG_SETMASK - oLINK ucontext (uc_link) - oSS_SP ucontext (uc_stack.ss_sp) - oSS_SIZE ucontext (uc_stack.ss_size) --oR0 mcontext (gregs[R0]) --oR1 mcontext (gregs[R1]) --oR2 mcontext (gregs[R2]) --oR3 mcontext (gregs[R3]) --oR4 mcontext (gregs[R4]) --oR5 mcontext (gregs[R5]) --oR6 mcontext (gregs[R6]) --oR7 mcontext (gregs[R7]) --oR8 mcontext (gregs[R8]) --oR9 mcontext (gregs[R9]) --oR10 mcontext (gregs[R10]) --oR11 mcontext (gregs[R11]) --oR12 mcontext (gregs[R12]) --oR13 mcontext (gregs[R13]) --oR14 mcontext (gregs[R14]) --oR15 mcontext (gregs[R15]) -+oR0 mcontext (gregs[REG_R0]) -+oR1 mcontext (gregs[REG_R1]) -+oR2 mcontext (gregs[REG_R2]) -+oR3 mcontext (gregs[REG_R3]) -+oR4 mcontext (gregs[REG_R4]) -+oR5 mcontext (gregs[REG_R5]) -+oR6 mcontext (gregs[REG_R6]) -+oR7 mcontext (gregs[REG_R7]) -+oR8 mcontext (gregs[REG_R8]) -+oR9 mcontext (gregs[REG_R9]) -+oR10 mcontext (gregs[REG_R10]) -+oR11 mcontext (gregs[REG_R11]) -+oR12 mcontext (gregs[REG_R12]) -+oR13 mcontext (gregs[REG_R13]) -+oR14 mcontext (gregs[REG_R14]) -+oR15 mcontext (gregs[REG_R15]) - oPC mcontext (pc) - oPR mcontext (pr) - oSR mcontext (sr) -diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -index ab9a7e66bf..037fbb73e8 100644 ---- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -@@ -31,49 +31,47 @@ - typedef int greg_t; - - /* Number of general registers. */ --#define NGPREG 16 -+#define NGREG 16 - - /* Container for all general registers. */ --typedef greg_t gregset_t[NGPREG]; -+typedef greg_t gregset_t[NGREG]; - --#ifdef __USE_GNU - /* Number of each register is the `gregset_t' array. */ - enum - { -- R0 = 0, --#define R0 R0 -- R1 = 1, --#define R1 R1 -- R2 = 2, --#define R2 R2 -- R3 = 3, --#define R3 R3 -- R4 = 4, --#define R4 R4 -- R5 = 5, --#define R5 R5 -- R6 = 6, --#define R6 R6 -- R7 = 7, --#define R7 R7 -- R8 = 8, --#define R8 R8 -- R9 = 9, --#define R9 R9 -- R10 = 10, --#define R10 R10 -- R11 = 11, --#define R11 R11 -- R12 = 12, --#define R12 R12 -- R13 = 13, --#define R13 R13 -- R14 = 14, --#define R14 R14 -- R15 = 15, --#define R15 R15 -+ REG_R0 = 0, -+#define REG_R0 REG_R0 -+ REG_R1 = 1, -+#define REG_R1 REG_R1 -+ REG_R2 = 2, -+#define REG_R2 REG_R2 -+ REG_R3 = 3, -+#define REG_R3 REG_R3 -+ REG_R4 = 4, -+#define REG_R4 REG_R4 -+ REG_R5 = 5, -+#define REG_R5 REG_R5 -+ REG_R6 = 6, -+#define REG_R6 REG_R6 -+ REG_R7 = 7, -+#define REG_R7 REG_R7 -+ REG_R8 = 8, -+#define REG_R8 REG_R8 -+ REG_R9 = 9, -+#define REG_R9 REG_R9 -+ REG_R10 = 10, -+#define REG_R10 REG_R10 -+ REG_R11 = 11, -+#define REG_R11 REG_R11 -+ REG_R12 = 12, -+#define REG_R12 REG_R12 -+ REG_R13 = 13, -+#define REG_R13 REG_R13 -+ REG_R14 = 14, -+#define REG_R14 REG_R14 -+ REG_R15 = 15, -+#define REG_R15 REG_R15 - }; --#endif - - #if (defined(__SH4__) || defined(__SH4A__)) - typedef int freg_t; -diff --git a/sysdeps/unix/sysv/linux/sh/vfork.S b/sysdeps/unix/sysv/linux/sh/vfork.S -index 6895bc5491..df559cb439 100644 ---- a/sysdeps/unix/sysv/linux/sh/vfork.S -+++ b/sysdeps/unix/sysv/linux/sh/vfork.S -@@ -26,30 +26,11 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- /* Save the PID value. */ -- stc gbr, r2 -- mov.w .L2, r0 -- mov.l @(r0,r2), r4 -- neg r4, r1 -- tst r1, r1 -- bf 1f -- mov #1, r1 -- rotr r1 --1: -- mov.l r1, @(r0,r2) - - mov.w .L1, r3 - trapa #0x10 - mov r0, r1 - -- /* Restore the old PID value in the parent. */ -- tst r0, r0 -- bt.s 2f -- stc gbr, r2 -- mov.w .L2, r0 -- mov.l r4, @(r0,r2) -- mov r1, r0 --2: - mov #-12, r2 - shad r2, r1 - not r1, r1 // r1=0 means r0 = -1 to -4095 -@@ -61,8 +42,6 @@ ENTRY (__libc_vfork) - nop - .L1: - .word __NR_vfork --.L2: -- .word PID - TLS_PRE_TCB_SIZE - .align 2 - PSEUDO_END (__libc_vfork) - -diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile -index e67aecf8f0..a67d199eb5 100644 ---- a/sysdeps/unix/sysv/linux/sparc/Makefile -+++ b/sysdeps/unix/sysv/linux/sparc/Makefile -@@ -6,6 +6,7 @@ abi-64-condition := __WORDSIZE == 64 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),sysvipc) -@@ -15,4 +16,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -index d6c92f6133..0456a0d16e 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -@@ -79,13 +79,6 @@ END(__clone) - - .type __thread_start,@function - __thread_start: -- andcc %g4, CLONE_VM, %g0 -- bne 1f -- set __NR_getpid,%g1 -- ta 0x10 -- st %o0,[%g7 + PID] -- st %o0,[%g7 + TID] --1: - mov %g0, %fp /* terminate backtrace */ - call %g2 - mov %g3,%o0 -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -index 0d0a3b5298..6d985034f0 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -@@ -22,24 +22,14 @@ - .text - .globl __syscall_error - ENTRY(__libc_vfork) -- ld [%g7 + PID], %o5 -- cmp %o5, 0 -- bne 1f -- sub %g0, %o5, %o4 -- sethi %hi(0x80000000), %o4 --1: st %o4, [%g7 + PID] -- - LOADSYSCALL(vfork) - ta 0x10 - bcc 2f - mov %o7, %g1 -- st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 - 2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 -- bne,a 1f -- st %o5, [%g7 + PID] - 1: retl - nop - END(__libc_vfork) -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -index b0f62660a7..6ffead88e2 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -@@ -76,13 +76,6 @@ END(__clone) - - .type __thread_start,@function - __thread_start: -- andcc %g4, CLONE_VM, %g0 -- bne,pt %icc, 1f -- set __NR_getpid,%g1 -- ta 0x6d -- st %o0,[%g7 + PID] -- st %o0,[%g7 + TID] --1: - mov %g0, %fp /* terminate backtrace */ - call %g2 - mov %g3,%o0 -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -index 0818eba02e..298dd197a9 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -@@ -22,24 +22,14 @@ - .text - .globl __syscall_error - ENTRY(__libc_vfork) -- ld [%g7 + PID], %o5 -- sethi %hi(0x80000000), %o3 -- cmp %o5, 0 -- sub %g0, %o5, %o4 -- move %icc, %o3, %o4 -- st %o4, [%g7 + PID] -- - LOADSYSCALL(vfork) - ta 0x6d - bcc,pt %xcc, 2f - mov %o7, %g1 -- st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 - 2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 -- bne,a,pt %icc, 1f -- st %o5, [%g7 + PID] - 1: retl - nop - END(__libc_vfork) -diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c -index bb3eecfde1..b5f20a710b 100644 ---- a/sysdeps/unix/sysv/linux/spawni.c -+++ b/sysdeps/unix/sysv/linux/spawni.c -@@ -58,22 +58,19 @@ - normal program exit with the exit code 127. */ - #define SPAWN_ERROR 127 - --/* We need to block both SIGCANCEL and SIGSETXID. */ --#define SIGALL_SET \ -- ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }) -- - #ifdef __ia64__ --# define CLONE(__fn, __stack, __stacksize, __flags, __args) \ -- __clone2 (__fn, __stack, __stacksize, __flags, __args, 0, 0, 0) -+# define CLONE(__fn, __stackbase, __stacksize, __flags, __args) \ -+ __clone2 (__fn, __stackbase, __stacksize, __flags, __args, 0, 0, 0) - #else - # define CLONE(__fn, __stack, __stacksize, __flags, __args) \ - __clone (__fn, __stack, __flags, __args) - #endif - --#if _STACK_GROWS_DOWN --# define STACK(__stack, __stack_size) (__stack + __stack_size) --#elif _STACK_GROWS_UP -+/* Since ia64 wants the stackbase w/clone2, re-use the grows-up macro. */ -+#if _STACK_GROWS_UP || defined (__ia64__) - # define STACK(__stack, __stack_size) (__stack) -+#elif _STACK_GROWS_DOWN -+# define STACK(__stack, __stack_size) (__stack + __stack_size) - #endif - - -@@ -329,6 +326,11 @@ __spawnix (pid_t * pid, const char *file, - - /* Add a slack area for child's stack. */ - size_t argv_size = (argc * sizeof (void *)) + 512; -+ /* We need at least a few pages in case the compiler's stack checking is -+ enabled. In some configs, it is known to use at least 24KiB. We use -+ 32KiB to be "safe" from anything the compiler might do. Besides, the -+ extra pages won't actually be allocated unless they get used. */ -+ argv_size += (32 * 1024); - size_t stack_size = ALIGN_UP (argv_size, GLRO(dl_pagesize)); - void *stack = __mmap (NULL, stack_size, prot, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); -@@ -340,7 +342,9 @@ __spawnix (pid_t * pid, const char *file, - } - - /* Disable asynchronous cancellation. */ -- int cs = LIBC_CANCEL_ASYNC (); -+ int state; -+ __libc_ptf_call (__pthread_setcancelstate, -+ (PTHREAD_CANCEL_DISABLE, &state), 0); - - args.file = file; - args.exec = exec; -@@ -351,7 +355,7 @@ __spawnix (pid_t * pid, const char *file, - args.envp = envp; - args.xflags = xflags; - -- __sigprocmask (SIG_BLOCK, &SIGALL_SET, &args.oldmask); -+ __libc_signal_block_all (&args.oldmask); - - /* The clone flags used will create a new child that will run in the same - memory space (CLONE_VM) and the execution of calling thread will be -@@ -384,9 +388,9 @@ __spawnix (pid_t * pid, const char *file, - if ((ec == 0) && (pid != NULL)) - *pid = new_pid; - -- __sigprocmask (SIG_SETMASK, &args.oldmask, 0); -+ __libc_signal_restore_set (&args.oldmask); - -- LIBC_CANCEL_RESET (cs); -+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0); - - return ec; - } -diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list -index 7ae2541f8f..248641b830 100644 ---- a/sysdeps/unix/sysv/linux/syscalls.list -+++ b/sysdeps/unix/sysv/linux/syscalls.list -@@ -18,6 +18,7 @@ execve - execve i:spp __execve execve - fdatasync - fdatasync Ci:i fdatasync - flock - flock i:ii __flock flock - get_kernel_syms EXTRA get_kernel_syms i:p __compat_get_kernel_syms get_kernel_syms@GLIBC_2.0:GLIBC_2.23 -+getpid - getpid Ei: __getpid getpid - getegid - getegid Ei: __getegid getegid - geteuid - geteuid Ei: __geteuid geteuid - getpgid - getpgid i:i __getpgid getpgid -diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h -index a469f57121..e3ecd5638e 100644 ---- a/sysdeps/unix/sysv/linux/sysdep.h -+++ b/sysdeps/unix/sysv/linux/sysdep.h -@@ -48,6 +48,16 @@ - __LONG_LONG_PAIR ((long) ((val) >> 32), (long) ((val) & 0xffffffff)) - #endif - -+/* Provide a common macro to pass 64-bit value on pread and pwrite -+ syscalls. */ -+#ifdef __ASSUME_PRW_DUMMY_ARG -+# define SYSCALL_LL_PRW(val) 0, SYSCALL_LL (val) -+# define SYSCALL_LL64_PRW(val) 0, SYSCALL_LL64 (val) -+#else -+# define SYSCALL_LL_PRW(val) __ALIGNMENT_ARG SYSCALL_LL (val) -+# define SYSCALL_LL64_PRW(val) __ALIGNMENT_ARG SYSCALL_LL64 (val) -+#endif -+ - /* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}. */ - #define LO_HI_LONG(val) \ - (long) (val), \ -diff --git a/sysdeps/unix/sysv/linux/tile/Makefile b/sysdeps/unix/sysv/linux/tile/Makefile -index 1c1cfff280..43acea3633 100644 ---- a/sysdeps/unix/sysv/linux/tile/Makefile -+++ b/sysdeps/unix/sysv/linux/tile/Makefile -@@ -25,4 +25,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/tile/clone.S b/sysdeps/unix/sysv/linux/tile/clone.S -index d1d36462e7..3f9e3d56c4 100644 ---- a/sysdeps/unix/sysv/linux/tile/clone.S -+++ b/sysdeps/unix/sysv/linux/tile/clone.S -@@ -163,22 +163,6 @@ ENTRY (__clone) - .Lthread_start: - cfi_def_cfa_offset (FRAME_SIZE) - cfi_undefined (lr) -- /* Check and see if we need to reset the PID, which we do if -- CLONE_VM isn't set, i.e. it's a fork-like clone with a new -- address space. In that case we update the cached values -- from the true system pid (retrieved via __NR_getpid syscall). */ -- moveli r0, CLONE_VM -- and r0, r30, r0 -- BNEZ r0, .Lno_reset_pid /* CLONE_VM is set */ -- moveli TREG_SYSCALL_NR_NAME, __NR_getpid -- swint1 -- ADDLI_PTR r2, tp, PID_OFFSET -- { -- ST4 r2, r0 -- ADDLI_PTR r2, tp, TID_OFFSET -- } -- ST4 r2, r0 --.Lno_reset_pid: - { - /* Invoke user function with specified argument. */ - move r0, r31 -diff --git a/sysdeps/unix/sysv/linux/tile/vfork.S b/sysdeps/unix/sysv/linux/tile/vfork.S -index d8c5ce3e24..2272777187 100644 ---- a/sysdeps/unix/sysv/linux/tile/vfork.S -+++ b/sysdeps/unix/sysv/linux/tile/vfork.S -@@ -29,18 +29,6 @@ - - .text - ENTRY (__vfork) -- { -- addli r11, tp, PID_OFFSET /* Point at PID. */ -- movei r13, 1 -- } -- { -- LD4U r12, r11 /* Load the saved PID. */ -- shli r13, r13, 31 /* Build 0x80000000. */ -- } -- sub r12, zero, r12 /* Negate it. */ -- CMOVEQZ r12, r12, r13 /* Replace zero pids. */ -- ST4 r11, r12 /* Store the temporary PID. */ -- - { - moveli r0, CLONE_VFORK | CLONE_VM | SIGCHLD - move r1, zero -@@ -52,22 +40,6 @@ ENTRY (__vfork) - moveli TREG_SYSCALL_NR_NAME, __NR_clone - swint1 - -- BEQZ r0, 1f /* If we are the parent... */ -- { -- addli r11, tp, PID_OFFSET /* Point at PID. */ -- movei r13, 1 -- } -- { -- LD4U r12, r11 /* Load the saved PID. */ -- shli r13, r13, 31 /* Build 0x80000000. */ -- } -- { -- CMPEQ r13, r12, r12 /* Test for that value. */ -- sub r12, zero, r12 /* Re-negate it. */ -- } -- CMOVNEZ r12, r13, zero /* Replace zero pids. */ -- ST4 r11, r12 /* Restore the PID. */ --1: - BNEZ r1, 0f - jrp lr - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/tst-clone2.c b/sysdeps/unix/sysv/linux/tst-clone2.c -index 68a7e6d6e2..1472311947 100644 ---- a/sysdeps/unix/sysv/linux/tst-clone2.c -+++ b/sysdeps/unix/sysv/linux/tst-clone2.c -@@ -28,8 +28,11 @@ - #include - #include - #include -+#include - --#include /* for THREAD_* macros. */ -+#include /* For _STACK_GROWS_{UP,DOWN}. */ -+ -+#include - - static int sig; - static int pipefd[2]; -@@ -39,39 +42,35 @@ f (void *a) - { - close (pipefd[0]); - -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); -- pid_t tid = THREAD_GETMEM (THREAD_SELF, tid); -+ pid_t ppid = getppid (); -+ pid_t pid = getpid (); -+ pid_t tid = syscall (__NR_gettid); - -- while (write (pipefd[1], &pid, sizeof pid) < 0) -- continue; -- while (write (pipefd[1], &tid, sizeof tid) < 0) -- continue; -+ if (write (pipefd[1], &ppid, sizeof ppid) != sizeof (ppid)) -+ FAIL_EXIT1 ("write ppid failed\n"); -+ if (write (pipefd[1], &pid, sizeof pid) != sizeof (pid)) -+ FAIL_EXIT1 ("write pid failed\n"); -+ if (write (pipefd[1], &tid, sizeof tid) != sizeof (tid)) -+ FAIL_EXIT1 ("write tid failed\n"); - - return 0; - } - - - static int --clone_test (int clone_flags) -+do_test (void) - { - sig = SIGRTMIN; - sigset_t ss; - sigemptyset (&ss); - sigaddset (&ss, sig); - if (sigprocmask (SIG_BLOCK, &ss, NULL) != 0) -- { -- printf ("sigprocmask failed: %m\n"); -- return 1; -- } -+ FAIL_EXIT1 ("sigprocmask failed: %m"); - - if (pipe2 (pipefd, O_CLOEXEC)) -- { -- printf ("sigprocmask failed: %m\n"); -- return 1; -- } -- -- pid_t ppid = getpid (); -+ FAIL_EXIT1 ("pipe failed: %m"); - -+ int clone_flags = 0; - #ifdef __ia64__ - extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, - size_t __child_stack_size, int __flags, -@@ -88,61 +87,47 @@ clone_test (int clone_flags) - #error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" - #endif - #endif -+ - close (pipefd[1]); - - if (p == -1) -+ FAIL_EXIT1("clone failed: %m"); -+ -+ pid_t ppid, pid, tid; -+ if (read (pipefd[0], &ppid, sizeof pid) != sizeof pid) - { -- printf ("clone failed: %m\n"); -- return 1; -+ kill (p, SIGKILL); -+ FAIL_EXIT1 ("read ppid failed: %m"); - } -- -- pid_t pid, tid; - if (read (pipefd[0], &pid, sizeof pid) != sizeof pid) - { -- printf ("read pid failed: %m\n"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("read pid failed: %m"); - } - if (read (pipefd[0], &tid, sizeof tid) != sizeof tid) - { -- printf ("read pid failed: %m\n"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("read tid failed: %m"); - } - - close (pipefd[0]); - - int ret = 0; - -- /* For CLONE_VM glibc clone implementation does not change the pthread -- pid/tid field. */ -- if ((clone_flags & CLONE_VM) == CLONE_VM) -- { -- if ((ppid != pid) || (ppid != tid)) -- { -- printf ("parent pid (%i) != received pid/tid (%i/%i)\n", -- (int)ppid, (int)pid, (int)tid); -- ret = 1; -- } -- } -- /* For any other flag clone updates the new pthread pid and tid with -- the clone return value. */ -- else -- { -- if ((p != pid) || (p != tid)) -- { -- printf ("child pid (%i) != received pid/tid (%i/%i)\n", -- (int)p, (int)pid, (int)tid); -- ret = 1; -- } -- } -+ pid_t own_pid = getpid (); -+ pid_t own_tid = syscall (__NR_gettid); -+ -+ /* Some sanity checks for clone syscall: returned ppid should be current -+ pid and both returned tid/pid should be different from current one. */ -+ if ((ppid != own_pid) || (pid == own_pid) || (tid == own_tid)) -+ FAIL_RET ("ppid=%i pid=%i tid=%i | own_pid=%i own_tid=%i", -+ (int)ppid, (int)pid, (int)tid, (int)own_pid, (int)own_tid); - - int e; - if (waitpid (p, &e, __WCLONE) != p) - { -- puts ("waitpid failed"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("waitpid failed"); - } - if (!WIFEXITED (e)) - { -@@ -150,29 +135,12 @@ clone_test (int clone_flags) - printf ("died from signal %s\n", strsignal (WTERMSIG (e))); - else - puts ("did not terminate correctly"); -- return 1; -+ exit (EXIT_FAILURE); - } - if (WEXITSTATUS (e) != 0) -- { -- printf ("exit code %d\n", WEXITSTATUS (e)); -- return 1; -- } -+ FAIL_EXIT1 ("exit code %d", WEXITSTATUS (e)); - - return ret; - } - --int --do_test (void) --{ -- /* First, check that the clone implementation, without any flag, updates -- the struct pthread to contain the new PID and TID. */ -- int ret = clone_test (0); -- /* Second, check that with CLONE_VM the struct pthread PID and TID fields -- remain unmodified after the clone. Any modifications would cause problem -- for the parent as described in bug 19957. */ -- ret += clone_test (CLONE_VM); -- return ret; --} -- --#define TEST_FUNCTION do_test () --#include "../test-skeleton.c" -+#include -diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S -index 66f4b11490..5629aed395 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/clone.S -+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S -@@ -91,14 +91,6 @@ L(thread_start): - the outermost frame obviously. */ - xorl %ebp, %ebp - -- andq $CLONE_VM, %rdi -- jne 1f -- movl $SYS_ify(getpid), %eax -- syscall -- movl %eax, %fs:PID -- movl %eax, %fs:TID --1: -- - /* Set up arguments for the function call. */ - popq %rax /* Function to call. */ - popq %rdi /* Argument. */ -diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S -index 8332ade9fb..cdd2dea32a 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/vfork.S -+++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S -@@ -34,16 +34,6 @@ ENTRY (__vfork) - cfi_adjust_cfa_offset(-8) - cfi_register(%rip, %rdi) - -- /* Save the TCB-cached PID away in %esi, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- movl %fs:PID, %esi -- movl $0x80000000, %ecx -- movl %esi, %edx -- negl %edx -- cmove %ecx, %edx -- movl %edx, %fs:PID -- - /* Stuff the syscall number in RAX and enter into the kernel. */ - movl $SYS_ify (vfork), %eax - syscall -@@ -52,14 +42,6 @@ ENTRY (__vfork) - pushq %rdi - cfi_adjust_cfa_offset(8) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- testq %rax, %rax -- je 1f -- movl %esi, %fs:PID --1: -- - cmpl $-4095, %eax - jae SYSCALL_ERROR_LABEL /* Branch forward if it failed. */ - -diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c -index 9ce4b495a5..508ad2ae7b 100644 ---- a/sysdeps/x86/cpu-features.c -+++ b/sysdeps/x86/cpu-features.c -@@ -133,8 +133,6 @@ init_cpu_features (struct cpu_features *cpu_features) - - case 0x57: - /* Knights Landing. Enable Silvermont optimizations. */ -- cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] -- |= bit_arch_Prefer_No_VZEROUPPER; - - case 0x5c: - case 0x5f: -@@ -205,6 +203,33 @@ init_cpu_features (struct cpu_features *cpu_features) - if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)) - cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load] - |= bit_arch_AVX_Fast_Unaligned_Load; -+ -+ /* Since AVX512ER is unique to Xeon Phi, set Prefer_No_VZEROUPPER -+ if AVX512ER is available. Don't use AVX512 to avoid lower CPU -+ frequency if AVX512ER isn't available. */ -+ if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER)) -+ cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] -+ |= bit_arch_Prefer_No_VZEROUPPER; -+ else -+ cpu_features->feature[index_arch_Prefer_No_AVX512] -+ |= bit_arch_Prefer_No_AVX512; -+ -+ /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow. -+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. -+ Use _dl_runtime_resolve_opt only with AVX512F since it is -+ slower than _dl_runtime_resolve_slow with AVX. */ -+ cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow] -+ |= bit_arch_Use_dl_runtime_resolve_slow; -+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) -+ && cpu_features->max_cpuid >= 0xd) -+ { -+ unsigned int eax; -+ -+ __cpuid_count (0xd, 1, eax, ebx, ecx, edx); -+ if ((eax & (1 << 2)) != 0) -+ cpu_features->feature[index_arch_Use_dl_runtime_resolve_opt] -+ |= bit_arch_Use_dl_runtime_resolve_opt; -+ } - } - /* This spells out "AuthenticAMD". */ - else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) -diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h -index 97ffe765f4..2609ac0999 100644 ---- a/sysdeps/x86/cpu-features.h -+++ b/sysdeps/x86/cpu-features.h -@@ -37,6 +37,9 @@ - #define bit_arch_Prefer_No_VZEROUPPER (1 << 17) - #define bit_arch_Fast_Unaligned_Copy (1 << 18) - #define bit_arch_Prefer_ERMS (1 << 19) -+#define bit_arch_Use_dl_runtime_resolve_opt (1 << 20) -+#define bit_arch_Use_dl_runtime_resolve_slow (1 << 21) -+#define bit_arch_Prefer_No_AVX512 (1 << 22) - - /* CPUID Feature flags. */ - -@@ -60,6 +63,11 @@ - #define bit_cpu_AVX2 (1 << 5) - #define bit_cpu_AVX512F (1 << 16) - #define bit_cpu_AVX512DQ (1 << 17) -+#define bit_cpu_AVX512PF (1 << 26) -+#define bit_cpu_AVX512ER (1 << 27) -+#define bit_cpu_AVX512CD (1 << 28) -+#define bit_cpu_AVX512BW (1 << 30) -+#define bit_cpu_AVX512VL (1u << 31) - - /* XCR0 Feature flags. */ - #define bit_XMM_state (1 << 1) -@@ -107,6 +115,9 @@ - # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1*FEATURE_SIZE - # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1*FEATURE_SIZE - # define index_arch_Prefer_ERMS FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1*FEATURE_SIZE - - - # if defined (_LIBC) && !IS_IN (nonlib) -@@ -232,6 +243,11 @@ extern const struct cpu_features *__get_cpu_features (void) - # define index_cpu_AVX2 COMMON_CPUID_INDEX_7 - # define index_cpu_AVX512F COMMON_CPUID_INDEX_7 - # define index_cpu_AVX512DQ COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512PF COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512ER COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512CD COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512BW COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512VL COMMON_CPUID_INDEX_7 - # define index_cpu_ERMS COMMON_CPUID_INDEX_7 - # define index_cpu_RTM COMMON_CPUID_INDEX_7 - # define index_cpu_FMA COMMON_CPUID_INDEX_1 -@@ -250,6 +266,11 @@ extern const struct cpu_features *__get_cpu_features (void) - # define reg_AVX2 ebx - # define reg_AVX512F ebx - # define reg_AVX512DQ ebx -+# define reg_AVX512PF ebx -+# define reg_AVX512ER ebx -+# define reg_AVX512CD ebx -+# define reg_AVX512BW ebx -+# define reg_AVX512VL ebx - # define reg_ERMS ebx - # define reg_RTM ebx - # define reg_FMA ecx -@@ -277,6 +298,9 @@ extern const struct cpu_features *__get_cpu_features (void) - # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1 - # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1 - # define index_arch_Prefer_ERMS FEATURE_INDEX_1 -+# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1 -+# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1 -+# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1 - - #endif /* !__ASSEMBLER__ */ - -diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile -index 6d99284cd0..cc990a9685 100644 ---- a/sysdeps/x86_64/Makefile -+++ b/sysdeps/x86_64/Makefile -@@ -27,7 +27,7 @@ ifeq ($(subdir),elf) - CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ - -mno-mmx) - --sysdep-dl-routines += tlsdesc dl-tlsdesc -+sysdep-dl-routines += tlsdesc dl-tlsdesc tls_get_addr - - tests += ifuncmain8 - modules-names += ifuncmod8 -@@ -49,9 +49,12 @@ extra-test-objs += tst-quadmod1pie.o tst-quadmod2pie.o - $(objpfx)tst-quad1pie: $(objpfx)tst-quadmod1pie.o - $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o - --tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 tst-audit10 --test-extras += tst-audit4-aux tst-audit10-aux --extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o -+tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \ -+ tst-audit10 tst-sse tst-avx tst-avx512 -+test-extras += tst-audit4-aux tst-audit10-aux \ -+ tst-avx-aux tst-avx512-aux -+extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o \ -+ tst-avx-aux.o tst-avx512-aux.o - - tests += tst-split-dynreloc - LDFLAGS-tst-split-dynreloc = -Wl,-T,$(..)sysdeps/x86_64/tst-split-dynreloc.lds -@@ -62,7 +65,8 @@ modules-names += tst-auditmod3a tst-auditmod3b \ - tst-auditmod5a tst-auditmod5b \ - tst-auditmod6a tst-auditmod6b tst-auditmod6c \ - tst-auditmod7a tst-auditmod7b \ -- tst-auditmod10a tst-auditmod10b -+ tst-auditmod10a tst-auditmod10b \ -+ tst-ssemod tst-avxmod tst-avx512mod - - $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so - $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so -@@ -89,6 +93,10 @@ $(objpfx)tst-audit10: $(objpfx)tst-audit10-aux.o $(objpfx)tst-auditmod10a.so - $(objpfx)tst-audit10.out: $(objpfx)tst-auditmod10b.so - tst-audit10-ENV = LD_AUDIT=$(objpfx)tst-auditmod10b.so - -+$(objpfx)tst-sse: $(objpfx)tst-ssemod.so -+$(objpfx)tst-avx: $(objpfx)tst-avx-aux.o $(objpfx)tst-avxmod.so -+$(objpfx)tst-avx512: $(objpfx)tst-avx512-aux.o $(objpfx)tst-avx512mod.so -+ - AVX-CFLAGS=-mavx -mno-vzeroupper - CFLAGS-tst-audit4-aux.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS) -@@ -96,14 +104,18 @@ CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS) -+CFLAGS-tst-avx-aux.c += $(AVX-CFLAGS) -+CFLAGS-tst-avxmod.c += $(AVX-CFLAGS) - ifeq (yes,$(config-cflags-avx512)) - AVX512-CFLAGS = -mavx512f - CFLAGS-tst-audit10-aux.c += $(AVX512-CFLAGS) - CFLAGS-tst-auditmod10a.c += $(AVX512-CFLAGS) - CFLAGS-tst-auditmod10b.c += $(AVX512-CFLAGS) -+CFLAGS-tst-avx512-aux.c += $(AVX512-CFLAGS) -+CFLAGS-tst-avx512mod.c += $(AVX512-CFLAGS) - endif - endif - - ifeq ($(subdir),csu) --gen-as-const-headers += tlsdesc.sym -+gen-as-const-headers += tlsdesc.sym rtld-offsets.sym - endif -diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h -index ed0c1a8efd..c0f0fa16a2 100644 ---- a/sysdeps/x86_64/dl-machine.h -+++ b/sysdeps/x86_64/dl-machine.h -@@ -68,7 +68,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - Elf64_Addr *got; - extern void _dl_runtime_resolve_sse (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_resolve_avx (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx_slow (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx_opt (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_resolve_avx512 (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx512_opt (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_sse (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_avx (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_avx512 (ElfW(Word)) attribute_hidden; -@@ -118,9 +121,26 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - indicated by the offset on the stack, and then jump to - the resolved address. */ - if (HAS_ARCH_FEATURE (AVX512F_Usable)) -- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_avx512; -+ { -+ if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx512_opt; -+ else -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx512; -+ } - else if (HAS_ARCH_FEATURE (AVX_Usable)) -- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_avx; -+ { -+ if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx_opt; -+ else if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_slow)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx_slow; -+ else -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx; -+ } - else - *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_sse; - } -diff --git a/sysdeps/x86_64/dl-tls.c b/sysdeps/x86_64/dl-tls.c -new file mode 100644 -index 0000000000..3584805c8e ---- /dev/null -+++ b/sysdeps/x86_64/dl-tls.c -@@ -0,0 +1,53 @@ -+/* Thread-local storage handling in the ELF dynamic linker. x86-64 version. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifdef SHARED -+/* Work around GCC PR58066, due to which __tls_get_addr may be called -+ with an unaligned stack. The compat implementation is in -+ tls_get_addr-compat.S. */ -+ -+# include -+ -+/* Define __tls_get_addr within elf/dl-tls.c under a different -+ name. */ -+extern __typeof__ (__tls_get_addr) ___tls_get_addr; -+ -+# define __tls_get_addr ___tls_get_addr -+# include -+# undef __tls_get_addr -+ -+hidden_ver (___tls_get_addr, __tls_get_addr) -+ -+/* Only handle slow paths for __tls_get_addr. */ -+attribute_hidden -+void * -+__tls_get_addr_slow (GET_ADDR_ARGS) -+{ -+ dtv_t *dtv = THREAD_DTV (); -+ -+ if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation))) -+ return update_get_addr (GET_ADDR_PARAM); -+ -+ return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL); -+} -+#else -+ -+/* No compatibility symbol needed. */ -+# include -+ -+#endif -diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h -index cf6c107f54..fa5bf6cd93 100644 ---- a/sysdeps/x86_64/dl-tls.h -+++ b/sysdeps/x86_64/dl-tls.h -@@ -16,6 +16,9 @@ - License along with the GNU C Library; if not, see - . */ - -+#ifndef _X86_64_DL_TLS_H -+#define _X86_64_DL_TLS_H -+ - #include - - /* Type used for the representation of TLS information in the GOT. */ -@@ -27,3 +30,5 @@ typedef struct dl_tls_index - - - extern void *__tls_get_addr (tls_index *ti); -+ -+#endif /* _X86_64_DL_TLS_H */ -diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S -index 12f1a5cf84..50b23633e3 100644 ---- a/sysdeps/x86_64/dl-trampoline.S -+++ b/sysdeps/x86_64/dl-trampoline.S -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - - #ifndef DL_STACK_ALIGNMENT -@@ -104,9 +105,11 @@ - #endif - #define VEC(i) ymm##i - #define _dl_runtime_resolve _dl_runtime_resolve_avx -+#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx_opt - #define _dl_runtime_profile _dl_runtime_profile_avx - #include "dl-trampoline.h" - #undef _dl_runtime_resolve -+#undef _dl_runtime_resolve_opt - #undef _dl_runtime_profile - #undef VEC - #undef VMOV -@@ -126,3 +129,19 @@ - #define _dl_runtime_profile _dl_runtime_profile_sse - #undef RESTORE_AVX - #include "dl-trampoline.h" -+#undef _dl_runtime_resolve -+#undef _dl_runtime_profile -+#undef VMOV -+#undef VMOVA -+ -+/* Used by _dl_runtime_resolve_avx_opt/_dl_runtime_resolve_avx512_opt -+ to preserve the full vector registers with zero upper bits. */ -+#define VMOVA vmovdqa -+#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT -+# define VMOV vmovdqa -+#else -+# define VMOV vmovdqu -+#endif -+#define _dl_runtime_resolve _dl_runtime_resolve_sse_vex -+#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt -+#include "dl-trampoline.h" -diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h -index b90836ab13..d21c5a987a 100644 ---- a/sysdeps/x86_64/dl-trampoline.h -+++ b/sysdeps/x86_64/dl-trampoline.h -@@ -50,6 +50,106 @@ - #endif - - .text -+#ifdef _dl_runtime_resolve_opt -+/* Use the smallest vector registers to preserve the full YMM/ZMM -+ registers to avoid SSE transition penalty. */ -+ -+# if VEC_SIZE == 32 -+/* Check if the upper 128 bits in %ymm0 - %ymm7 registers are non-zero -+ and preserve %xmm0 - %xmm7 registers with the zero upper bits. Since -+ there is no SSE transition penalty on AVX512 processors which don't -+ support XGETBV with ECX == 1, _dl_runtime_resolve_avx512_slow isn't -+ provided. */ -+ .globl _dl_runtime_resolve_avx_slow -+ .hidden _dl_runtime_resolve_avx_slow -+ .type _dl_runtime_resolve_avx_slow, @function -+ .align 16 -+_dl_runtime_resolve_avx_slow: -+ cfi_startproc -+ cfi_adjust_cfa_offset(16) # Incorporate PLT -+ vorpd %ymm0, %ymm1, %ymm8 -+ vorpd %ymm2, %ymm3, %ymm9 -+ vorpd %ymm4, %ymm5, %ymm10 -+ vorpd %ymm6, %ymm7, %ymm11 -+ vorpd %ymm8, %ymm9, %ymm9 -+ vorpd %ymm10, %ymm11, %ymm10 -+ vpcmpeqd %xmm8, %xmm8, %xmm8 -+ vorpd %ymm9, %ymm10, %ymm10 -+ vptest %ymm10, %ymm8 -+ # Preserve %ymm0 - %ymm7 registers if the upper 128 bits of any -+ # %ymm0 - %ymm7 registers aren't zero. -+ PRESERVE_BND_REGS_PREFIX -+ jnc _dl_runtime_resolve_avx -+ # Use vzeroupper to avoid SSE transition penalty. -+ vzeroupper -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits -+ # when the upper 128 bits of %ymm0 - %ymm7 registers are zero. -+ PRESERVE_BND_REGS_PREFIX -+ jmp _dl_runtime_resolve_sse_vex -+ cfi_adjust_cfa_offset(-16) # Restore PLT adjustment -+ cfi_endproc -+ .size _dl_runtime_resolve_avx_slow, .-_dl_runtime_resolve_avx_slow -+# endif -+ -+/* Use XGETBV with ECX == 1 to check which bits in vector registers are -+ non-zero and only preserve the non-zero lower bits with zero upper -+ bits. */ -+ .globl _dl_runtime_resolve_opt -+ .hidden _dl_runtime_resolve_opt -+ .type _dl_runtime_resolve_opt, @function -+ .align 16 -+_dl_runtime_resolve_opt: -+ cfi_startproc -+ cfi_adjust_cfa_offset(16) # Incorporate PLT -+ pushq %rax -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rax, 0) -+ pushq %rcx -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rcx, 0) -+ pushq %rdx -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rdx, 0) -+ movl $1, %ecx -+ xgetbv -+ movl %eax, %r11d -+ popq %rdx -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rdx) -+ popq %rcx -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rcx) -+ popq %rax -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rax) -+# if VEC_SIZE == 32 -+ # For YMM registers, check if YMM state is in use. -+ andl $bit_YMM_state, %r11d -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits if -+ # YMM state isn't in use. -+ PRESERVE_BND_REGS_PREFIX -+ jz _dl_runtime_resolve_sse_vex -+# elif VEC_SIZE == 16 -+ # For ZMM registers, check if YMM state and ZMM state are in -+ # use. -+ andl $(bit_YMM_state | bit_ZMM0_15_state), %r11d -+ cmpl $bit_YMM_state, %r11d -+ # Preserve %zmm0 - %zmm7 registers if ZMM state is in use. -+ PRESERVE_BND_REGS_PREFIX -+ jg _dl_runtime_resolve_avx512 -+ # Preserve %ymm0 - %ymm7 registers with the zero upper 256 bits if -+ # ZMM state isn't in use. -+ PRESERVE_BND_REGS_PREFIX -+ je _dl_runtime_resolve_avx -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if -+ # neither YMM state nor ZMM state are in use. -+# else -+# error Unsupported VEC_SIZE! -+# endif -+ cfi_adjust_cfa_offset(-16) # Restore PLT adjustment -+ cfi_endproc -+ .size _dl_runtime_resolve_opt, .-_dl_runtime_resolve_opt -+#endif - .globl _dl_runtime_resolve - .hidden _dl_runtime_resolve - .type _dl_runtime_resolve, @function -@@ -69,7 +169,9 @@ _dl_runtime_resolve: - and $-VEC_SIZE, %RSP_LP - #endif - sub $REGISTER_SAVE_AREA, %RSP_LP -+#if !DL_RUNTIME_RESOLVE_REALIGN_STACK - cfi_adjust_cfa_offset(REGISTER_SAVE_AREA) -+#endif - # Preserve registers otherwise clobbered. - movq %rax, REGISTER_SAVE_RAX(%rsp) - movq %rcx, REGISTER_SAVE_RCX(%rsp) -@@ -162,7 +264,10 @@ _dl_runtime_resolve: - .size _dl_runtime_resolve, .-_dl_runtime_resolve - - --#ifndef PROF -+/* To preserve %xmm0 - %xmm7 registers, dl-trampoline.h is included -+ twice, for _dl_runtime_resolve_sse and _dl_runtime_resolve_sse_vex. -+ But we don't need another _dl_runtime_profile for XMM registers. */ -+#if !defined PROF && defined _dl_runtime_profile - # if (LR_VECTOR_OFFSET % VEC_SIZE) != 0 - # error LR_VECTOR_OFFSET must be multples of VEC_SIZE - # endif -diff --git a/sysdeps/x86_64/memcpy_chk.S b/sysdeps/x86_64/memcpy_chk.S -index 2296b55119..a95b3ad3cf 100644 ---- a/sysdeps/x86_64/memcpy_chk.S -+++ b/sysdeps/x86_64/memcpy_chk.S -@@ -19,7 +19,7 @@ - #include - #include "asm-syntax.h" - --#ifndef PIC -+#ifndef SHARED - /* For libc.so this is defined in memcpy.S. - For libc.a, this is a separate source to avoid - memcpy bringing in __chk_fail and all routines -diff --git a/sysdeps/x86_64/multiarch/memcpy.S b/sysdeps/x86_64/multiarch/memcpy.S -index b8677596f9..ea4ec70d1a 100644 ---- a/sysdeps/x86_64/multiarch/memcpy.S -+++ b/sysdeps/x86_64/multiarch/memcpy.S -@@ -32,6 +32,8 @@ ENTRY(__new_memcpy) - lea __memcpy_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memcpy_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memcpy_chk.S b/sysdeps/x86_64/multiarch/memcpy_chk.S -index 9d92c8a7e3..26b49de6f6 100644 ---- a/sysdeps/x86_64/multiarch/memcpy_chk.S -+++ b/sysdeps/x86_64/multiarch/memcpy_chk.S -@@ -30,6 +30,8 @@ - ENTRY(__memcpy_chk) - .type __memcpy_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memmove.S b/sysdeps/x86_64/multiarch/memmove.S -index ff5e041420..ef92afde5a 100644 ---- a/sysdeps/x86_64/multiarch/memmove.S -+++ b/sysdeps/x86_64/multiarch/memmove.S -@@ -30,6 +30,8 @@ ENTRY(__libc_memmove) - lea __memmove_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memmove_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memmove_chk.S b/sysdeps/x86_64/multiarch/memmove_chk.S -index 7f861206df..a9129c460a 100644 ---- a/sysdeps/x86_64/multiarch/memmove_chk.S -+++ b/sysdeps/x86_64/multiarch/memmove_chk.S -@@ -29,6 +29,8 @@ - ENTRY(__memmove_chk) - .type __memmove_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memmove_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/mempcpy.S b/sysdeps/x86_64/multiarch/mempcpy.S -index 51970687cf..87c8299fea 100644 ---- a/sysdeps/x86_64/multiarch/mempcpy.S -+++ b/sysdeps/x86_64/multiarch/mempcpy.S -@@ -32,6 +32,8 @@ ENTRY(__mempcpy) - lea __mempcpy_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __mempcpy_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.S b/sysdeps/x86_64/multiarch/mempcpy_chk.S -index 9e49f6f26e..642c67973b 100644 ---- a/sysdeps/x86_64/multiarch/mempcpy_chk.S -+++ b/sysdeps/x86_64/multiarch/mempcpy_chk.S -@@ -30,6 +30,8 @@ - ENTRY(__mempcpy_chk) - .type __mempcpy_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __mempcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -index 28e71fd576..acf448c9a6 100644 ---- a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -+++ b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -@@ -110,6 +110,8 @@ ENTRY (__memset_erms) - ENTRY (MEMSET_SYMBOL (__memset, erms)) - # endif - L(stosb): -+ /* Issue vzeroupper before rep stosb. */ -+ VZEROUPPER - movq %rdx, %rcx - movzbl %sil, %eax - movq %rdi, %rdx -diff --git a/sysdeps/x86_64/multiarch/memset.S b/sysdeps/x86_64/multiarch/memset.S -index 96e99341aa..eae39e2ecd 100644 ---- a/sysdeps/x86_64/multiarch/memset.S -+++ b/sysdeps/x86_64/multiarch/memset.S -@@ -41,6 +41,8 @@ ENTRY(memset) - jnz L(AVX512F) - lea __memset_avx2_unaligned(%rip), %RAX_LP - L(AVX512F): -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 2f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 2f - lea __memset_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memset_chk.S b/sysdeps/x86_64/multiarch/memset_chk.S -index 2efe6ed909..38d7bef6df 100644 ---- a/sysdeps/x86_64/multiarch/memset_chk.S -+++ b/sysdeps/x86_64/multiarch/memset_chk.S -@@ -38,6 +38,8 @@ ENTRY(__memset_chk) - jnz L(AVX512F) - lea __memset_chk_avx2_unaligned(%rip), %RAX_LP - L(AVX512F): -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 2f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 2f - lea __memset_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/nptl/tcb-offsets.sym b/sysdeps/x86_64/nptl/tcb-offsets.sym -index aeb752673a..8a25c482cb 100644 ---- a/sysdeps/x86_64/nptl/tcb-offsets.sym -+++ b/sysdeps/x86_64/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - CLEANUP offsetof (struct pthread, cleanup) -diff --git a/sysdeps/x86_64/rtld-offsets.sym b/sysdeps/x86_64/rtld-offsets.sym -new file mode 100644 -index 0000000000..fd41b51521 ---- /dev/null -+++ b/sysdeps/x86_64/rtld-offsets.sym -@@ -0,0 +1,6 @@ -+#define SHARED -+#include -+ -+-- -+ -+GL_TLS_GENERATION_OFFSET offsetof (struct rtld_global, _dl_tls_generation) -diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h -index 75ac747be8..4b67fa80c1 100644 ---- a/sysdeps/x86_64/sysdep.h -+++ b/sysdeps/x86_64/sysdep.h -@@ -89,13 +89,14 @@ lose: \ - END (name) - - #undef JUMPTARGET --#ifdef PIC -+#ifdef SHARED - # ifdef BIND_NOW - # define JUMPTARGET(name) *name##@GOTPCREL(%rip) - # else - # define JUMPTARGET(name) name##@PLT - # endif - #else -+/* For static archives, branch to target directly. */ - # define JUMPTARGET(name) name - #endif - -diff --git a/sysdeps/x86_64/tls_get_addr.S b/sysdeps/x86_64/tls_get_addr.S -new file mode 100644 -index 0000000000..9d38fb3be5 ---- /dev/null -+++ b/sysdeps/x86_64/tls_get_addr.S -@@ -0,0 +1,61 @@ -+/* Stack-aligning implementation of __tls_get_addr. x86-64 version. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifdef SHARED -+ -+# include -+# include "tlsdesc.h" -+# include "rtld-offsets.h" -+ -+/* See __tls_get_addr and __tls_get_addr_slow in dl-tls.c. This function -+ call __tls_get_addr_slow on both slow paths. It realigns the stack -+ before the call to work around GCC PR58066. */ -+ -+ENTRY (__tls_get_addr) -+ mov %fs:DTV_OFFSET, %RDX_LP -+ mov GL_TLS_GENERATION_OFFSET+_rtld_local(%rip), %RAX_LP -+ /* GL(dl_tls_generation) == dtv[0].counter */ -+ cmp %RAX_LP, (%rdx) -+ jne 1f -+ mov TI_MODULE_OFFSET(%rdi), %RAX_LP -+ /* dtv[ti->ti_module] */ -+# ifdef __LP64__ -+ salq $4, %rax -+ movq (%rdx,%rax), %rax -+# else -+ movl (%rdx,%rax, 8), %eax -+# endif -+ cmp $-1, %RAX_LP -+ je 1f -+ add TI_OFFSET_OFFSET(%rdi), %RAX_LP -+ ret -+1: -+ /* On the slow path, align the stack. */ -+ pushq %rbp -+ cfi_def_cfa_offset (16) -+ cfi_offset (%rbp, -16) -+ mov %RSP_LP, %RBP_LP -+ cfi_def_cfa_register (%rbp) -+ and $-16, %RSP_LP -+ call __tls_get_addr_slow -+ mov %RBP_LP, %RSP_LP -+ popq %rbp -+ cfi_def_cfa (%rsp, 8) -+ ret -+END (__tls_get_addr) -+#endif /* SHARED */ -diff --git a/sysdeps/x86_64/tlsdesc.sym b/sysdeps/x86_64/tlsdesc.sym -index 33854975d0..fc897ab4b5 100644 ---- a/sysdeps/x86_64/tlsdesc.sym -+++ b/sysdeps/x86_64/tlsdesc.sym -@@ -15,3 +15,6 @@ TLSDESC_ARG offsetof(struct tlsdesc, arg) - TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count) - TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module) - TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset) -+ -+TI_MODULE_OFFSET offsetof(tls_index, ti_module) -+TI_OFFSET_OFFSET offsetof(tls_index, ti_offset) -diff --git a/sysdeps/x86_64/tst-avx-aux.c b/sysdeps/x86_64/tst-avx-aux.c -new file mode 100644 -index 0000000000..e3807de7bb ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx-aux.c -@@ -0,0 +1,47 @@ -+/* Test case for preserved AVX registers in dynamic linker, -mavx part. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+tst_avx_aux (void) -+{ -+#ifdef __AVX__ -+ extern __m256i avx_test (__m256i, __m256i, __m256i, __m256i, -+ __m256i, __m256i, __m256i, __m256i); -+ -+ __m256i ymm0 = _mm256_set1_epi32 (0); -+ __m256i ymm1 = _mm256_set1_epi32 (1); -+ __m256i ymm2 = _mm256_set1_epi32 (2); -+ __m256i ymm3 = _mm256_set1_epi32 (3); -+ __m256i ymm4 = _mm256_set1_epi32 (4); -+ __m256i ymm5 = _mm256_set1_epi32 (5); -+ __m256i ymm6 = _mm256_set1_epi32 (6); -+ __m256i ymm7 = _mm256_set1_epi32 (7); -+ __m256i ret = avx_test (ymm0, ymm1, ymm2, ymm3, -+ ymm4, ymm5, ymm6, ymm7); -+ ymm0 = _mm256_set1_epi32 (0x12349876); -+ if (memcmp (&ymm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+#else /* __AVX__ */ -+ return 77; -+#endif /* __AVX__ */ -+} -diff --git a/sysdeps/x86_64/tst-avx.c b/sysdeps/x86_64/tst-avx.c -new file mode 100644 -index 0000000000..ec2e3a79ff ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx.c -@@ -0,0 +1,49 @@ -+/* Test case for preserved AVX registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int tst_avx_aux (void); -+ -+static int -+avx_enabled (void) -+{ -+ unsigned int eax, ebx, ecx, edx; -+ -+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 -+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) -+ return 0; -+ -+ /* Check the OS has AVX and SSE saving enabled. */ -+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); -+ -+ return (eax & 6) == 6; -+} -+ -+static int -+do_test (void) -+{ -+ /* Run AVX test only if AVX is supported. */ -+ if (avx_enabled ()) -+ return tst_avx_aux (); -+ else -+ return 77; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-avx512-aux.c b/sysdeps/x86_64/tst-avx512-aux.c -new file mode 100644 -index 0000000000..6cebc523f2 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512-aux.c -@@ -0,0 +1,48 @@ -+/* Test case for preserved AVX512 registers in dynamic linker, -+ -mavx512 part. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+tst_avx512_aux (void) -+{ -+#ifdef __AVX512F__ -+ extern __m512i avx512_test (__m512i, __m512i, __m512i, __m512i, -+ __m512i, __m512i, __m512i, __m512i); -+ -+ __m512i zmm0 = _mm512_set1_epi32 (0); -+ __m512i zmm1 = _mm512_set1_epi32 (1); -+ __m512i zmm2 = _mm512_set1_epi32 (2); -+ __m512i zmm3 = _mm512_set1_epi32 (3); -+ __m512i zmm4 = _mm512_set1_epi32 (4); -+ __m512i zmm5 = _mm512_set1_epi32 (5); -+ __m512i zmm6 = _mm512_set1_epi32 (6); -+ __m512i zmm7 = _mm512_set1_epi32 (7); -+ __m512i ret = avx512_test (zmm0, zmm1, zmm2, zmm3, -+ zmm4, zmm5, zmm6, zmm7); -+ zmm0 = _mm512_set1_epi32 (0x12349876); -+ if (memcmp (&zmm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+#else /* __AVX512F__ */ -+ return 77; -+#endif /* __AVX512F__ */ -+} -diff --git a/sysdeps/x86_64/tst-avx512.c b/sysdeps/x86_64/tst-avx512.c -new file mode 100644 -index 0000000000..a8e42ef553 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512.c -@@ -0,0 +1,57 @@ -+/* Test case for preserved AVX512 registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int tst_avx512_aux (void); -+ -+static int -+avx512_enabled (void) -+{ -+#ifdef bit_AVX512F -+ unsigned int eax, ebx, ecx, edx; -+ -+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 -+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) -+ return 0; -+ -+ __cpuid_count (7, 0, eax, ebx, ecx, edx); -+ if (!(ebx & bit_AVX512F)) -+ return 0; -+ -+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); -+ -+ /* Verify that ZMM, YMM and XMM states are enabled. */ -+ return (eax & 0xe6) == 0xe6; -+#else -+ return 0; -+#endif -+} -+ -+static int -+do_test (void) -+{ -+ /* Run AVX512 test only if AVX512 is supported. */ -+ if (avx512_enabled ()) -+ return tst_avx512_aux (); -+ else -+ return 77; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-avx512mod.c b/sysdeps/x86_64/tst-avx512mod.c -new file mode 100644 -index 0000000000..4cfb3a2c3d ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512mod.c -@@ -0,0 +1,48 @@ -+/* Test case for x86-64 preserved AVX512 registers in dynamic linker. */ -+ -+#ifdef __AVX512F__ -+#include -+#include -+#include -+ -+__m512i -+avx512_test (__m512i x0, __m512i x1, __m512i x2, __m512i x3, -+ __m512i x4, __m512i x5, __m512i x6, __m512i x7) -+{ -+ __m512i zmm; -+ -+ zmm = _mm512_set1_epi32 (0); -+ if (memcmp (&zmm, &x0, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (1); -+ if (memcmp (&zmm, &x1, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (2); -+ if (memcmp (&zmm, &x2, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (3); -+ if (memcmp (&zmm, &x3, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (4); -+ if (memcmp (&zmm, &x4, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (5); -+ if (memcmp (&zmm, &x5, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (6); -+ if (memcmp (&zmm, &x6, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (7); -+ if (memcmp (&zmm, &x7, sizeof (zmm))) -+ abort (); -+ -+ return _mm512_set1_epi32 (0x12349876); -+} -+#endif -diff --git a/sysdeps/x86_64/tst-avxmod.c b/sysdeps/x86_64/tst-avxmod.c -new file mode 100644 -index 0000000000..6e5b154997 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avxmod.c -@@ -0,0 +1,48 @@ -+/* Test case for x86-64 preserved AVX registers in dynamic linker. */ -+ -+#ifdef __AVX__ -+#include -+#include -+#include -+ -+__m256i -+avx_test (__m256i x0, __m256i x1, __m256i x2, __m256i x3, -+ __m256i x4, __m256i x5, __m256i x6, __m256i x7) -+{ -+ __m256i ymm; -+ -+ ymm = _mm256_set1_epi32 (0); -+ if (memcmp (&ymm, &x0, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (1); -+ if (memcmp (&ymm, &x1, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (2); -+ if (memcmp (&ymm, &x2, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (3); -+ if (memcmp (&ymm, &x3, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (4); -+ if (memcmp (&ymm, &x4, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (5); -+ if (memcmp (&ymm, &x5, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (6); -+ if (memcmp (&ymm, &x6, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (7); -+ if (memcmp (&ymm, &x7, sizeof (ymm))) -+ abort (); -+ -+ return _mm256_set1_epi32 (0x12349876); -+} -+#endif -diff --git a/sysdeps/x86_64/tst-sse.c b/sysdeps/x86_64/tst-sse.c -new file mode 100644 -index 0000000000..dd1537cf27 ---- /dev/null -+++ b/sysdeps/x86_64/tst-sse.c -@@ -0,0 +1,46 @@ -+/* Test case for preserved SSE registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+extern __m128i sse_test (__m128i, __m128i, __m128i, __m128i, -+ __m128i, __m128i, __m128i, __m128i); -+ -+static int -+do_test (void) -+{ -+ __m128i xmm0 = _mm_set1_epi32 (0); -+ __m128i xmm1 = _mm_set1_epi32 (1); -+ __m128i xmm2 = _mm_set1_epi32 (2); -+ __m128i xmm3 = _mm_set1_epi32 (3); -+ __m128i xmm4 = _mm_set1_epi32 (4); -+ __m128i xmm5 = _mm_set1_epi32 (5); -+ __m128i xmm6 = _mm_set1_epi32 (6); -+ __m128i xmm7 = _mm_set1_epi32 (7); -+ __m128i ret = sse_test (xmm0, xmm1, xmm2, xmm3, -+ xmm4, xmm5, xmm6, xmm7); -+ xmm0 = _mm_set1_epi32 (0x12349876); -+ if (memcmp (&xmm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-ssemod.c b/sysdeps/x86_64/tst-ssemod.c -new file mode 100644 -index 0000000000..907a64c69e ---- /dev/null -+++ b/sysdeps/x86_64/tst-ssemod.c -@@ -0,0 +1,46 @@ -+/* Test case for x86-64 preserved SSE registers in dynamic linker. */ -+ -+#include -+#include -+#include -+ -+__m128i -+sse_test (__m128i x0, __m128i x1, __m128i x2, __m128i x3, -+ __m128i x4, __m128i x5, __m128i x6, __m128i x7) -+{ -+ __m128i xmm; -+ -+ xmm = _mm_set1_epi32 (0); -+ if (memcmp (&xmm, &x0, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (1); -+ if (memcmp (&xmm, &x1, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (2); -+ if (memcmp (&xmm, &x2, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (3); -+ if (memcmp (&xmm, &x3, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (4); -+ if (memcmp (&xmm, &x4, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (5); -+ if (memcmp (&xmm, &x5, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (6); -+ if (memcmp (&xmm, &x6, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (7); -+ if (memcmp (&xmm, &x7, sizeof (xmm))) -+ abort (); -+ -+ return _mm_set1_epi32 (0x12349876); -+} diff --git a/glibc-32/glibc-2.25-updates.patch b/glibc-32/glibc-2.25-updates.patch new file mode 100644 index 00000000..39564241 --- /dev/null +++ b/glibc-32/glibc-2.25-updates.patch @@ -0,0 +1,3079 @@ +diff --git a/ChangeLog b/ChangeLog +index f140ee67de..73546da9e9 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,215 @@ ++2017-06-14 Florian Weimer ++ ++ * sysdeps/i386/i686/multiarch/strcspn-c.c: Add IS_IN (libc) guard. ++ * sysdeps/i386/i686/multiarch/varshift.c: Likewise. ++ ++2017-03-07 Siddhesh Poyarekar ++ ++ [BZ #21209] ++ * elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for ++ AT_SECURE processes. ++ * sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK. ++ * elf/tst-env-setuid.c (test_parent): Test LD_HWCAP_MASK. ++ (test_child): Likewise. ++ * elf/Makefile (tst-env-setuid-ENV): Add LD_HWCAP_MASK. ++ ++2017-06-19 Florian Weimer ++ ++ * elf/rtld.c (audit_list_string): New variable. ++ (audit_list): Update comment. ++ (struct audit_list_iter): Define. ++ (audit_list_iter_init, audit_list_iter_next): New function. ++ (dl_main): Use struct audit_list_iter to process audit modules. ++ (process_dl_audit): Call dso_name_valid_for_suid. ++ (process_envvars): Set audit_list_string instead of calling ++ process_dl_audit. ++ ++2017-06-19 Florian Weimer ++ ++ * elf/rtld.c (SECURE_NAME_LIMIT, SECURE_PATH_LIMIT): Define. ++ (dso_name_valid_for_suid): New function. ++ (handle_ld_preload): Likewise. ++ (dl_main): Call it. Remove alloca. ++ ++2017-06-19 Florian Weimer ++ ++ [BZ #21624] ++ CVE-2017-1000366 ++ * elf/rtld.c (process_envvars): Ignore LD_LIBRARY_PATH for ++ __libc_enable_secure. ++ ++2017-05-12 Florian Weimer ++ ++ [BZ #21386] ++ * sysdeps/nptl/fork.c (__libc_fork): Remove assertions on the ++ parent PID. The assertion in the child is incorrect with PID ++ namespaces. ++ ++2017-03-15 Joseph Myers ++ ++ * sysdeps/x86/fpu/test-math-vector-sincos.h (INIT_VEC_PTRS_LOOP): ++ Use a union when storing pointers. ++ (VECTOR_WRAPPER_fFF_2): Do not take address of integer vector and ++ cast result when passing to INIT_VEC_PTRS_LOOP. ++ (VECTOR_WRAPPER_fFF_3): Likewise. ++ (VECTOR_WRAPPER_fFF_4): Likewise. ++ ++2017-05-01 Adhemerval Zanella ++ ++ [BZ# 21182] ++ * string/test-memchr.c (do_test): Add BZ#21182 checks for address ++ near end of a page. ++ * sysdeps/i386/i686/multiarch/memchr-sse2.S (__memchr): Fix ++ overflow calculation. ++ ++2017-04-28 H.J. Lu ++ ++ [BZ #21396] ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Set ++ Prefer_No_AVX512 if AVX512ER isn't available. ++ * sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New. ++ (index_arch_Prefer_No_AVX512): Likewise. ++ * sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use ++ AVX512 version if Prefer_No_AVX512 is set. ++ * sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): ++ Likewise. ++ * sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise. ++ * sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk): ++ Likewise. ++ * sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise. ++ * sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): ++ Likewise. ++ * sysdeps/x86_64/multiarch/memset.S (memset): Likewise. ++ * sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk): ++ Likewise. ++ ++2017-04-28 H.J. Lu ++ ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Set ++ Prefer_No_VZEROUPPER if AVX512ER is available. ++ * sysdeps/x86/cpu-features.h ++ (bit_cpu_AVX512PF): New. ++ (bit_cpu_AVX512ER): Likewise. ++ (bit_cpu_AVX512CD): Likewise. ++ (bit_cpu_AVX512BW): Likewise. ++ (bit_cpu_AVX512VL): Likewise. ++ (index_cpu_AVX512PF): Likewise. ++ (index_cpu_AVX512ER): Likewise. ++ (index_cpu_AVX512CD): Likewise. ++ (index_cpu_AVX512BW): Likewise. ++ (index_cpu_AVX512VL): Likewise. ++ (reg_AVX512PF): Likewise. ++ (reg_AVX512ER): Likewise. ++ (reg_AVX512CD): Likewise. ++ (reg_AVX512BW): Likewise. ++ (reg_AVX512VL): Likewise. ++ ++2017-04-11 Adhemerval Zanella ++ ++ * posix/globtest.sh: Add cleanup routine on trap 0. ++ ++2017-04-07 H.J. Lu ++ ++ [BZ #21258] ++ * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt): ++ Define only if _dl_runtime_resolve is defined to ++ _dl_runtime_resolve_sse_vex. ++ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt): ++ Fallthrough to _dl_runtime_resolve_sse_vex. ++ ++2017-04-03 Mike Frysinger ++ ++ [BZ #21253] ++ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Increase argv_size ++ slack space by 32KiB. ++ ++2017-04-03 Wladimir van der Laan ++ ++ [BZ# 21338] ++ * malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX ++ instead of incorrect do_set_arena_test ++ ++2017-03-31 Slava Barinov ++ ++ [BZ #21289] ++ * io/fts.h (fts_set): Replace __REDIRECT with __REDIRECT_NTH. ++ ++2017-03-20 Mike Frysinger ++ ++ [BZ #21275] ++ * sysdeps/unix/sysv/linux/spawni.c [__ia64__] (CLONE): Rename ++ __stack to __stackbase. ++ (STACK): Invert _STACK_GROWS_DOWN and _STACK_GROWS_UP order of ++ checks so we can include defined(__ia64__) first. ++ ++2017-03-15 Mike Frysinger ++ ++ * sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED ++ instead of PIC. ++ ++2017-03-15 John David Anglin ++ ++ * sysdeps/hppa/dl-machine.h (DL_STACK_END): Define. ++ (RTLD_START): Don't record stack end address in _dl_start_user. ++ ++2017-03-02 Florian Weimer ++ ++ [BZ #21015] ++ * manual/install.texi (Configuring and compiling): Document ++ --enable-bind-now. ++ * Makeconfig [bind-now] (LDFLAGS-lib.so): Set. ++ (build-shlib-helper): Use $(LDFLAGS-lib.so). ++ (format.lds): Likewise. ++ [bind-now] (LDFLAGS-c.so): Remove. ++ * sysdeps/x86_64/localplt.data (libm.so): matherr relocation can ++ be R_X86_64_GLOB_DAT. ++ * sysdeps/unix/sysv/linux/i386/localplt.data (libm.so): matherr ++ relocation can be R_386_GLOB_DAT. ++ * sysdeps/unix/sysv/linux/alpha/localplt.data (libm.so): matherr ++ relocaiton can be R_ALPHA_GLOB_DAT. ++ * iconvdata/Makefile [bind-now] (LDFLAGS.so): Add -Wl,-z,now. ++ ++2017-02-28 Florian Weimer ++ ++ [BZ #20257] ++ * inet/Makefile (routines): Add deadline. ++ (tests-static): Add tst-deadline. ++ * inet/net-internal.h (struct deadline_current_time) ++ (__deadline_current_time, struct deadline, __deadline_is_infinite) ++ (__deadline_elapsed, __deadline_first, __deadline_from_timeval) ++ (__deadline_to_ms, __is_timeval_valid_timeout): Declare. ++ * inet/deadline.c: New file. ++ * inet/tst-deadline.c: Likewise. ++ * sunrpc/Makefile (tests): Add tst-udp-nonblocking, ++ tst-udp-timeout, tst-udp-garbage. ++ (tst-udp-nonblocking, tst-udp-timeout): Link against libc.so ++ explicitly. ++ (tst-udp-garbage): Likewise. Also link against thread library. ++ * sunrpc/clnt_udp.c (struct cu_data): Mention in comment that the ++ struct layout is part of the ABI. ++ (clntudp_call): Rework timeout handling. ++ * sunrpc/tst-udp-garbage.c: New file. ++ * sunrpc/tst-udp-nonblocking.c: Likewise. ++ * sunrpc/tst-udp-timeout.c: Likewise. ++ ++2017-02-27 Florian Weimer ++ ++ [BZ #21115] ++ * sunrpc/clnt_udp.c (clntudp_call): Free ancillary data later. ++ * sunrpc/Makefile (tests): Add tst-udp-error. ++ (tst-udp-error): Link against libc.so explicitly. ++ * sunrpc/tst-udp-error: New file. ++ ++2017-02-08 Siddhesh Poyarekar ++ ++ [BZ #21109] ++ * elf/dl-tunable-types.h (tunable_callback_t): Accept ++ tunable_val_t as argument. ++ * elf/dl-tunables.c (__tunable_set_val): Add comment. ++ * malloc/arena.c (set_mallopt_check): Take tunable_val_t as ++ argument. ++ (DL_TUNABLE_CALLBACK_FNDECL): Likewise. ++ + 2017-02-05 Siddhesh Poyarekar + + * version.h (RELEASE): Set to "stable" +diff --git a/INSTALL b/INSTALL +index 3b3fd121b2..e77cb2d4e2 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -146,6 +146,12 @@ will be used, and CFLAGS sets optimization options for the compiler. + of routines called directly from assembler are excluded from this + protection. + ++'--enable-bind-now' ++ Disable lazy binding for installed shared objects. This provides ++ additional security hardening because it enables full RELRO and a ++ read-only global offset table (GOT), at the cost of slightly ++ increased program load times. ++ + '--enable-pt_chown' + The file 'pt_chown' is a helper binary for 'grantpt' (*note + Pseudo-Terminals: Allocation.) that is installed setuid root to fix +diff --git a/Makeconfig b/Makeconfig +index 97a15b569e..1c815113b9 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -386,6 +386,13 @@ LDFLAGS.so += $(hashstyle-LDFLAGS) + LDFLAGS-rtld += $(hashstyle-LDFLAGS) + endif + ++# If lazy relocations are disabled, add the -z now flag. Use ++# LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to ++# test modules. ++ifeq ($(bind-now),yes) ++LDFLAGS-lib.so += -Wl,-z,now ++endif ++ + # Command to run after every final link (executable or shared object). + # This is invoked with $(call after-link,...), so it should operate on + # the file $1. This can be set to do some sort of post-processing on +diff --git a/Makerules b/Makerules +index e9194e54cf..7f0eef8096 100644 +--- a/Makerules ++++ b/Makerules +@@ -588,7 +588,7 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \ + $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \ + $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \ + -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \ +- $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \ ++ $(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \ + -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) + endef + +@@ -686,10 +686,6 @@ LDFLAGS-c.so = -nostdlib -nostartfiles + LDLIBS-c.so += $(libc.so-gnulib) + # Give libc.so an entry point and make it directly runnable itself. + LDFLAGS-c.so += -e __libc_main +-# If lazy relocation is disabled add the -z now flag. +-ifeq ($(bind-now),yes) +-LDFLAGS-c.so += -Wl,-z,now +-endif + # Pre-link the objects of libc_pic.a so that we can locally resolve + # COMMON symbols before we link against ld.so. This is because ld.so + # contains some of libc_pic.a already, which will prevent the COMMONs +@@ -1104,7 +1100,8 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \ + ifneq (unknown,$(output-format)) + echo > $@.new 'OUTPUT_FORMAT($(output-format))' + else +- $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ ++ $(LINK.o) -shared $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \ ++ $(LDFLAGS.so) $(LDFLAGS-lib.so) \ + -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \ + | sed -n -f $< > $@.new + test -s $@.new +diff --git a/NEWS b/NEWS +index ec15dde761..7be238c404 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,19 @@ See the end for copying conditions. + Please send GNU C library bug reports via + using `glibc' in the "product" field. + ++Version 2.25.1 ++ ++The following bugs are resolved with this release: ++ ++ [20257] sunrpc: clntudp_call does not enforce timeout when receiving data ++ [21015] Document and fix --enable-bind-now ++ [21109] Tunables broken on big-endian ++ [21115] sunrpc: Use-after-free in error path in clntudp_call ++ [21209] Ignore and remove LD_HWCAP_MASK for AT_SECURE programs ++ [21289] Fix symbol redirect for fts_set ++ [21386] Assertion in fork for distinct parent PID is incorrect ++ [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366) ++ + Version 2.25 + + * The feature test macro __STDC_WANT_LIB_EXT2__, from ISO/IEC TR +diff --git a/elf/Makefile b/elf/Makefile +index 61abeb59ee..cc4aeb25b6 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -1398,6 +1398,7 @@ $(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so + $(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \ + $(objpfx)tst-nodelete-dlclose-plugin.so + +-tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 ++tst-env-setuid-ENV = MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 \ ++ LD_HWCAP_MASK=0xffffffff + tst-env-setuid-tunables-ENV = \ + GLIBC_TUNABLES=glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096 +diff --git a/elf/dl-tunable-types.h b/elf/dl-tunable-types.h +index a986f0b593..37a4e8021f 100644 +--- a/elf/dl-tunable-types.h ++++ b/elf/dl-tunable-types.h +@@ -21,8 +21,6 @@ + # define _TUNABLE_TYPES_H_ + #include + +-typedef void (*tunable_callback_t) (void *); +- + typedef enum + { + TUNABLE_TYPE_INT_32, +@@ -43,6 +41,8 @@ typedef union + const char *strval; + } tunable_val_t; + ++typedef void (*tunable_callback_t) (tunable_val_t *); ++ + /* Security level for tunables. This decides what to do with individual + tunables for AT_SECURE binaries. */ + typedef enum +diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c +index a8d53d6a31..e42aa67003 100644 +--- a/elf/dl-tunables.c ++++ b/elf/dl-tunables.c +@@ -455,6 +455,8 @@ __tunable_set_val (tunable_id_t id, void *valp, tunable_callback_t callback) + if (cur->strval == NULL) + return; + ++ /* Caller does not need the value, just call the callback with our tunable ++ value. */ + if (valp == NULL) + goto cb; + +diff --git a/elf/rtld.c b/elf/rtld.c +index a036ece956..9362a21e73 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -99,14 +99,121 @@ uintptr_t __pointer_chk_guard_local + strong_alias (__pointer_chk_guard_local, __pointer_chk_guard) + #endif + ++/* Length limits for names and paths, to protect the dynamic linker, ++ particularly when __libc_enable_secure is active. */ ++#ifdef NAME_MAX ++# define SECURE_NAME_LIMIT NAME_MAX ++#else ++# define SECURE_NAME_LIMIT 255 ++#endif ++#ifdef PATH_MAX ++# define SECURE_PATH_LIMIT PATH_MAX ++#else ++# define SECURE_PATH_LIMIT 1024 ++#endif ++ ++/* Check that AT_SECURE=0, or that the passed name does not contain ++ directories and is not overly long. Reject empty names ++ unconditionally. */ ++static bool ++dso_name_valid_for_suid (const char *p) ++{ ++ if (__glibc_unlikely (__libc_enable_secure)) ++ { ++ /* Ignore pathnames with directories for AT_SECURE=1 ++ programs, and also skip overlong names. */ ++ size_t len = strlen (p); ++ if (len >= SECURE_NAME_LIMIT || memchr (p, '/', len) != NULL) ++ return false; ++ } ++ return *p != '\0'; ++} + +-/* List of auditing DSOs. */ ++/* LD_AUDIT variable contents. Must be processed before the ++ audit_list below. */ ++const char *audit_list_string; ++ ++/* Cyclic list of auditing DSOs. audit_list->next is the first ++ element. */ + static struct audit_list + { + const char *name; + struct audit_list *next; + } *audit_list; + ++/* Iterator for audit_list_string followed by audit_list. */ ++struct audit_list_iter ++{ ++ /* Tail of audit_list_string still needing processing, or NULL. */ ++ const char *audit_list_tail; ++ ++ /* The list element returned in the previous iteration. NULL before ++ the first element. */ ++ struct audit_list *previous; ++ ++ /* Scratch buffer for returning a name which is part of ++ audit_list_string. */ ++ char fname[SECURE_NAME_LIMIT]; ++}; ++ ++/* Initialize an audit list iterator. */ ++static void ++audit_list_iter_init (struct audit_list_iter *iter) ++{ ++ iter->audit_list_tail = audit_list_string; ++ iter->previous = NULL; ++} ++ ++/* Iterate through both audit_list_string and audit_list. */ ++static const char * ++audit_list_iter_next (struct audit_list_iter *iter) ++{ ++ if (iter->audit_list_tail != NULL) ++ { ++ /* First iterate over audit_list_string. */ ++ while (*iter->audit_list_tail != '\0') ++ { ++ /* Split audit list at colon. */ ++ size_t len = strcspn (iter->audit_list_tail, ":"); ++ if (len > 0 && len < sizeof (iter->fname)) ++ { ++ memcpy (iter->fname, iter->audit_list_tail, len); ++ iter->fname[len] = '\0'; ++ } ++ else ++ /* Do not return this name to the caller. */ ++ iter->fname[0] = '\0'; ++ ++ /* Skip over the substring and the following delimiter. */ ++ iter->audit_list_tail += len; ++ if (*iter->audit_list_tail == ':') ++ ++iter->audit_list_tail; ++ ++ /* If the name is valid, return it. */ ++ if (dso_name_valid_for_suid (iter->fname)) ++ return iter->fname; ++ /* Otherwise, wrap around and try the next name. */ ++ } ++ /* Fall through to the procesing of audit_list. */ ++ } ++ ++ if (iter->previous == NULL) ++ { ++ if (audit_list == NULL) ++ /* No pre-parsed audit list. */ ++ return NULL; ++ /* Start of audit list. The first list element is at ++ audit_list->next (cyclic list). */ ++ iter->previous = audit_list->next; ++ return iter->previous->name; ++ } ++ if (iter->previous == audit_list) ++ /* Cyclic list wrap-around. */ ++ return NULL; ++ iter->previous = iter->previous->next; ++ return iter->previous->name; ++} ++ + #ifndef HAVE_INLINED_SYSCALLS + /* Set nonzero during loading and initialization of executable and + libraries, cleared before the executable's entry point runs. This +@@ -716,6 +823,42 @@ static const char *preloadlist attribute_relro; + /* Nonzero if information about versions has to be printed. */ + static int version_info attribute_relro; + ++/* The LD_PRELOAD environment variable gives list of libraries ++ separated by white space or colons that are loaded before the ++ executable's dependencies and prepended to the global scope list. ++ (If the binary is running setuid all elements containing a '/' are ++ ignored since it is insecure.) Return the number of preloads ++ performed. */ ++unsigned int ++handle_ld_preload (const char *preloadlist, struct link_map *main_map) ++{ ++ unsigned int npreloads = 0; ++ const char *p = preloadlist; ++ char fname[SECURE_PATH_LIMIT]; ++ ++ while (*p != '\0') ++ { ++ /* Split preload list at space/colon. */ ++ size_t len = strcspn (p, " :"); ++ if (len > 0 && len < sizeof (fname)) ++ { ++ memcpy (fname, p, len); ++ fname[len] = '\0'; ++ } ++ else ++ fname[0] = '\0'; ++ ++ /* Skip over the substring and the following delimiter. */ ++ p += len; ++ if (*p != '\0') ++ ++p; ++ ++ if (dso_name_valid_for_suid (fname)) ++ npreloads += do_preload (fname, main_map, "LD_PRELOAD"); ++ } ++ return npreloads; ++} ++ + static void + dl_main (const ElfW(Phdr) *phdr, + ElfW(Word) phnum, +@@ -1238,11 +1381,13 @@ of this helper program; chances are you did not intend to run this program.\n\ + GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid (); + + /* If we have auditing DSOs to load, do it now. */ +- if (__glibc_unlikely (audit_list != NULL)) ++ bool need_security_init = true; ++ if (__glibc_unlikely (audit_list != NULL) ++ || __glibc_unlikely (audit_list_string != NULL)) + { +- /* Iterate over all entries in the list. The order is important. */ + struct audit_ifaces *last_audit = NULL; +- struct audit_list *al = audit_list->next; ++ struct audit_list_iter al_iter; ++ audit_list_iter_init (&al_iter); + + /* Since we start using the auditing DSOs right away we need to + initialize the data structures now. */ +@@ -1253,9 +1398,14 @@ of this helper program; chances are you did not intend to run this program.\n\ + use different values (especially the pointer guard) and will + fail later on. */ + security_init (); ++ need_security_init = false; + +- do ++ while (true) + { ++ const char *name = audit_list_iter_next (&al_iter); ++ if (name == NULL) ++ break; ++ + int tls_idx = GL(dl_tls_max_dtv_idx); + + /* Now it is time to determine the layout of the static TLS +@@ -1264,7 +1414,7 @@ of this helper program; chances are you did not intend to run this program.\n\ + no DF_STATIC_TLS bit is set. The reason is that we know + glibc will use the static model. */ + struct dlmopen_args dlmargs; +- dlmargs.fname = al->name; ++ dlmargs.fname = name; + dlmargs.map = NULL; + + const char *objname; +@@ -1277,7 +1427,7 @@ of this helper program; chances are you did not intend to run this program.\n\ + not_loaded: + _dl_error_printf ("\ + ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", +- al->name, err_str); ++ name, err_str); + if (malloced) + free ((char *) err_str); + } +@@ -1381,10 +1531,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + goto not_loaded; + } + } +- +- al = al->next; + } +- while (al != audit_list->next); + + /* If we have any auditing modules, announce that we already + have two objects loaded. */ +@@ -1462,23 +1609,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + + if (__glibc_unlikely (preloadlist != NULL)) + { +- /* The LD_PRELOAD environment variable gives list of libraries +- separated by white space or colons that are loaded before the +- executable's dependencies and prepended to the global scope +- list. If the binary is running setuid all elements +- containing a '/' are ignored since it is insecure. */ +- char *list = strdupa (preloadlist); +- char *p; +- + HP_TIMING_NOW (start); +- +- /* Prevent optimizing strsep. Speed is not important here. */ +- while ((p = (strsep) (&list, " :")) != NULL) +- if (p[0] != '\0' +- && (__builtin_expect (! __libc_enable_secure, 1) +- || strchr (p, '/') == NULL)) +- npreloads += do_preload (p, main_map, "LD_PRELOAD"); +- ++ npreloads += handle_ld_preload (preloadlist, main_map); + HP_TIMING_NOW (stop); + HP_TIMING_DIFF (diff, start, stop); + HP_TIMING_ACCUM_NT (load_time, diff); +@@ -1663,7 +1795,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + if (tcbp == NULL) + tcbp = init_tls (); + +- if (__glibc_likely (audit_list == NULL)) ++ if (__glibc_likely (need_security_init)) + /* Initialize security features. But only if we have not done it + earlier. */ + security_init (); +@@ -2294,9 +2426,7 @@ process_dl_audit (char *str) + char *p; + + while ((p = (strsep) (&str, ":")) != NULL) +- if (p[0] != '\0' +- && (__builtin_expect (! __libc_enable_secure, 1) +- || strchr (p, '/') == NULL)) ++ if (dso_name_valid_for_suid (p)) + { + /* This is using the local malloc, not the system malloc. The + memory can never be freed. */ +@@ -2360,7 +2490,7 @@ process_envvars (enum mode *modep) + break; + } + if (memcmp (envline, "AUDIT", 5) == 0) +- process_dl_audit (&envline[6]); ++ audit_list_string = &envline[6]; + break; + + case 7: +@@ -2404,7 +2534,8 @@ process_envvars (enum mode *modep) + + case 10: + /* Mask for the important hardware capabilities. */ +- if (memcmp (envline, "HWCAP_MASK", 10) == 0) ++ if (!__libc_enable_secure ++ && memcmp (envline, "HWCAP_MASK", 10) == 0) + GLRO(dl_hwcap_mask) = __strtoul_internal (&envline[11], NULL, + 0, 0); + break; +@@ -2418,7 +2549,8 @@ process_envvars (enum mode *modep) + + case 12: + /* The library search path. */ +- if (memcmp (envline, "LIBRARY_PATH", 12) == 0) ++ if (!__libc_enable_secure ++ && memcmp (envline, "LIBRARY_PATH", 12) == 0) + { + library_path = &envline[13]; + break; +diff --git a/elf/tst-env-setuid.c b/elf/tst-env-setuid.c +index 6ec3fa5874..eec408eb5d 100644 +--- a/elf/tst-env-setuid.c ++++ b/elf/tst-env-setuid.c +@@ -213,6 +213,12 @@ test_child (void) + return 1; + } + ++ if (getenv ("LD_HWCAP_MASK") != NULL) ++ { ++ printf ("LD_HWCAP_MASK still set\n"); ++ return 1; ++ } ++ + return 0; + } + #endif +@@ -233,6 +239,12 @@ test_parent (void) + return 1; + } + ++ if (getenv ("LD_HWCAP_MASK") == NULL) ++ { ++ printf ("LD_HWCAP_MASK lost\n"); ++ return 1; ++ } ++ + return 0; + } + #endif +diff --git a/iconvdata/Makefile b/iconvdata/Makefile +index 04157b25c5..e4845871f5 100644 +--- a/iconvdata/Makefile ++++ b/iconvdata/Makefile +@@ -63,6 +63,11 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ + MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \ + CP770 CP771 CP772 CP773 CP774 + ++# If lazy binding is disabled, use BIND_NOW for the gconv modules. ++ifeq ($(bind-now),yes) ++LDFLAGS.so += -Wl,-z,now ++endif ++ + modules.so := $(addsuffix .so, $(modules)) + + ifeq (yes,$(build-shared)) +diff --git a/inet/Makefile b/inet/Makefile +index 010792af8f..6a7d3e0664 100644 +--- a/inet/Makefile ++++ b/inet/Makefile +@@ -45,14 +45,18 @@ routines := htonl htons \ + in6_addr getnameinfo if_index ifaddrs inet6_option \ + getipv4sourcefilter setipv4sourcefilter \ + getsourcefilter setsourcefilter inet6_opt inet6_rth \ +- inet6_scopeid_pton ++ inet6_scopeid_pton deadline + + aux := check_pf check_native ifreq + + tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \ + tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \ + tst-getni1 tst-getni2 tst-inet6_rth tst-checks tst-checks-posix \ +- tst-sockaddr tst-inet6_scopeid_pton test-hnto-types ++ tst-sockaddr tst-inet6_scopeid_pton test-hnto-types tst-deadline ++ ++# tst-deadline must be linked statically so that we can access ++# internal functions. ++tests-static += tst-deadline + + include ../Rules + +diff --git a/inet/deadline.c b/inet/deadline.c +new file mode 100644 +index 0000000000..c1fa415a39 +--- /dev/null ++++ b/inet/deadline.c +@@ -0,0 +1,122 @@ ++/* Computing deadlines for timeouts. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct deadline_current_time internal_function ++__deadline_current_time (void) ++{ ++ struct deadline_current_time result; ++ if (__clock_gettime (CLOCK_MONOTONIC, &result.current) != 0) ++ { ++ struct timeval current_tv; ++ if (__gettimeofday (¤t_tv, NULL) == 0) ++ __libc_fatal ("Fatal error: gettimeofday system call failed\n"); ++ result.current.tv_sec = current_tv.tv_sec; ++ result.current.tv_nsec = current_tv.tv_usec * 1000; ++ } ++ assert (result.current.tv_sec >= 0); ++ return result; ++} ++ ++/* A special deadline value for which __deadline_is_infinite is ++ true. */ ++static inline struct deadline ++infinite_deadline (void) ++{ ++ return (struct deadline) { { -1, -1 } }; ++} ++ ++struct deadline internal_function ++__deadline_from_timeval (struct deadline_current_time current, ++ struct timeval tv) ++{ ++ assert (__is_timeval_valid_timeout (tv)); ++ ++ /* Compute second-based deadline. Perform the addition in ++ uintmax_t, which is unsigned, to simply overflow detection. */ ++ uintmax_t sec = current.current.tv_sec; ++ sec += tv.tv_sec; ++ if (sec < (uintmax_t) tv.tv_sec) ++ return infinite_deadline (); ++ ++ /* Compute nanosecond deadline. */ ++ int nsec = current.current.tv_nsec + tv.tv_usec * 1000; ++ if (nsec >= 1000 * 1000 * 1000) ++ { ++ /* Carry nanosecond overflow to seconds. */ ++ nsec -= 1000 * 1000 * 1000; ++ if (sec + 1 < sec) ++ return infinite_deadline (); ++ ++sec; ++ } ++ /* This uses a GCC extension, otherwise these casts for detecting ++ overflow would not be defined. */ ++ if ((time_t) sec < 0 || sec != (uintmax_t) (time_t) sec) ++ return infinite_deadline (); ++ ++ return (struct deadline) { { sec, nsec } }; ++} ++ ++int internal_function ++__deadline_to_ms (struct deadline_current_time current, ++ struct deadline deadline) ++{ ++ if (__deadline_is_infinite (deadline)) ++ return INT_MAX; ++ ++ if (current.current.tv_sec > deadline.absolute.tv_sec ++ || (current.current.tv_sec == deadline.absolute.tv_sec ++ && current.current.tv_nsec >= deadline.absolute.tv_nsec)) ++ return 0; ++ time_t sec = deadline.absolute.tv_sec - current.current.tv_sec; ++ if (sec >= INT_MAX) ++ /* This value will overflow below. */ ++ return INT_MAX; ++ int nsec = deadline.absolute.tv_nsec - current.current.tv_nsec; ++ if (nsec < 0) ++ { ++ /* Borrow from the seconds field. */ ++ assert (sec > 0); ++ --sec; ++ nsec += 1000 * 1000 * 1000; ++ } ++ ++ /* Prepare for rounding up to milliseconds. */ ++ nsec += 999999; ++ if (nsec > 1000 * 1000 * 1000) ++ { ++ assert (sec < INT_MAX); ++ ++sec; ++ nsec -= 1000 * 1000 * 1000; ++ } ++ ++ unsigned int msec = nsec / (1000 * 1000); ++ if (sec > INT_MAX / 1000) ++ return INT_MAX; ++ msec += sec * 1000; ++ if (msec > INT_MAX) ++ return INT_MAX; ++ return msec; ++} +diff --git a/inet/net-internal.h b/inet/net-internal.h +index 087597ed99..2b2632c7ba 100644 +--- a/inet/net-internal.h ++++ b/inet/net-internal.h +@@ -20,11 +20,100 @@ + #define _NET_INTERNAL_H 1 + + #include ++#include + #include ++#include + + int __inet6_scopeid_pton (const struct in6_addr *address, + const char *scope, uint32_t *result) + internal_function attribute_hidden; + libc_hidden_proto (__inet6_scopeid_pton) + ++ ++/* Deadline handling for enforcing timeouts. ++ ++ Code should call __deadline_current_time to obtain the current time ++ and cache it locally. The cache needs updating after every ++ long-running or potentially blocking operation. Deadlines relative ++ to the current time can be computed using __deadline_from_timeval. ++ The deadlines may have to be recomputed in response to certain ++ events (such as an incoming packet), but they are absolute (not ++ relative to the current time). A timeout suitable for use with the ++ poll function can be computed from such a deadline using ++ __deadline_to_ms. ++ ++ The fields in the structs defined belowed should only be used ++ within the implementation. */ ++ ++/* Cache of the current time. Used to compute deadlines from relative ++ timeouts and vice versa. */ ++struct deadline_current_time ++{ ++ struct timespec current; ++}; ++ ++/* Return the current time. Terminates the process if the current ++ time is not available. */ ++struct deadline_current_time __deadline_current_time (void) ++ internal_function attribute_hidden; ++ ++/* Computed absolute deadline. */ ++struct deadline ++{ ++ struct timespec absolute; ++}; ++ ++ ++/* For internal use only. */ ++static inline bool ++__deadline_is_infinite (struct deadline deadline) ++{ ++ return deadline.absolute.tv_nsec < 0; ++} ++ ++/* Return true if the current time is at the deadline or past it. */ ++static inline bool ++__deadline_elapsed (struct deadline_current_time current, ++ struct deadline deadline) ++{ ++ return !__deadline_is_infinite (deadline) ++ && (current.current.tv_sec > deadline.absolute.tv_sec ++ || (current.current.tv_sec == deadline.absolute.tv_sec ++ && current.current.tv_nsec >= deadline.absolute.tv_nsec)); ++} ++ ++/* Return the deadline which occurs first. */ ++static inline struct deadline ++__deadline_first (struct deadline left, struct deadline right) ++{ ++ if (__deadline_is_infinite (right) ++ || left.absolute.tv_sec < right.absolute.tv_sec ++ || (left.absolute.tv_sec == right.absolute.tv_sec ++ && left.absolute.tv_nsec < right.absolute.tv_nsec)) ++ return left; ++ else ++ return right; ++} ++ ++/* Add TV to the current time and return it. Returns a special ++ infinite absolute deadline on overflow. */ ++struct deadline __deadline_from_timeval (struct deadline_current_time, ++ struct timeval tv) ++ internal_function attribute_hidden; ++ ++/* Compute the number of milliseconds until the specified deadline, ++ from the current time in the argument. The result is mainly for ++ use with poll. If the deadline has already passed, return 0. If ++ the result would overflow an int, return INT_MAX. */ ++int __deadline_to_ms (struct deadline_current_time, struct deadline) ++ internal_function attribute_hidden; ++ ++/* Return true if TV.tv_sec is non-negative and TV.tv_usec is in the ++ interval [0, 999999]. */ ++static inline bool ++__is_timeval_valid_timeout (struct timeval tv) ++{ ++ return tv.tv_sec >= 0 && tv.tv_usec >= 0 && tv.tv_usec < 1000 * 1000; ++} ++ + #endif /* _NET_INTERNAL_H */ +diff --git a/inet/tst-deadline.c b/inet/tst-deadline.c +new file mode 100644 +index 0000000000..ed04345c35 +--- /dev/null ++++ b/inet/tst-deadline.c +@@ -0,0 +1,188 @@ ++/* Tests for computing deadlines for timeouts. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++/* Find the maximum value which can be represented in a time_t. */ ++static time_t ++time_t_max (void) ++{ ++ _Static_assert (0 > (time_t) -1, "time_t is signed"); ++ uintmax_t current = 1; ++ while (true) ++ { ++ uintmax_t next = current * 2; ++ /* This cannot happen because time_t is signed. */ ++ TEST_VERIFY_EXIT (next > current); ++ ++next; ++ if ((time_t) next < 0 || next != (uintmax_t) (time_t) next) ++ /* Value cannot be represented in time_t. Return the previous ++ value. */ ++ return current; ++ current = next; ++ } ++} ++ ++static int ++do_test (void) ++{ ++ { ++ struct deadline_current_time current_time = __deadline_current_time (); ++ TEST_VERIFY (current_time.current.tv_sec >= 0); ++ current_time = __deadline_current_time (); ++ /* Due to CLOCK_MONOTONIC, either seconds or nanoseconds are ++ greater than zero. This is also true for the gettimeofday ++ fallback. */ ++ TEST_VERIFY (current_time.current.tv_sec >= 0); ++ TEST_VERIFY (current_time.current.tv_sec > 0 ++ || current_time.current.tv_nsec > 0); ++ } ++ ++ /* Check basic computations of deadlines. */ ++ struct deadline_current_time current_time = { { 1, 123456789 } }; ++ struct deadline deadline = __deadline_from_timeval ++ (current_time, (struct timeval) { 0, 1 }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 123457789); ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1); ++ ++ deadline = __deadline_from_timeval ++ (current_time, ((struct timeval) { 0, 2 })); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 123458789); ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1); ++ ++ deadline = __deadline_from_timeval ++ (current_time, ((struct timeval) { 1, 0 })); ++ TEST_VERIFY (deadline.absolute.tv_sec == 2); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 123456789); ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1000); ++ ++ /* Check if timeouts are correctly rounded up to the next ++ millisecond. */ ++ for (int i = 0; i < 999999; ++i) ++ { ++ ++current_time.current.tv_nsec; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1000); ++ } ++ ++ /* A full millisecond has elapsed, so the time to the deadline is ++ now less than 1000. */ ++ ++current_time.current.tv_nsec; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 999); ++ ++ /* Check __deadline_to_ms carry-over. */ ++ current_time = (struct deadline_current_time) { { 9, 123456789 } }; ++ deadline = (struct deadline) { { 10, 122456789 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 999); ++ deadline = (struct deadline) { { 10, 122456790 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1000); ++ deadline = (struct deadline) { { 10, 123456788 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1000); ++ deadline = (struct deadline) { { 10, 123456789 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 1000); ++ ++ /* Check __deadline_to_ms overflow. */ ++ deadline = (struct deadline) { { INT_MAX - 1, 1 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == INT_MAX); ++ ++ /* Check __deadline_to_ms for elapsed deadlines. */ ++ current_time = (struct deadline_current_time) { { 9, 123456789 } }; ++ deadline.absolute = current_time.current; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 0); ++ current_time = (struct deadline_current_time) { { 9, 123456790 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 0); ++ current_time = (struct deadline_current_time) { { 10, 0 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 0); ++ current_time = (struct deadline_current_time) { { 10, 123456788 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 0); ++ current_time = (struct deadline_current_time) { { 10, 123456789 } }; ++ TEST_VERIFY (__deadline_to_ms (current_time, deadline) == 0); ++ ++ /* Check carry-over in __deadline_from_timeval. */ ++ current_time = (struct deadline_current_time) { { 9, 998000001 } }; ++ for (int i = 0; i < 2000; ++i) ++ { ++ deadline = __deadline_from_timeval ++ (current_time, (struct timeval) { 1, i }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 10); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 998000001 + i * 1000); ++ } ++ for (int i = 2000; i < 3000; ++i) ++ { ++ deadline = __deadline_from_timeval ++ (current_time, (struct timeval) { 2, i }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 12); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 1 + (i - 2000) * 1000); ++ } ++ ++ /* Check infinite deadlines. */ ++ deadline = __deadline_from_timeval ++ ((struct deadline_current_time) { { 0, 1000 * 1000 * 1000 - 1000 } }, ++ (struct timeval) { time_t_max (), 1 }); ++ TEST_VERIFY (__deadline_is_infinite (deadline)); ++ deadline = __deadline_from_timeval ++ ((struct deadline_current_time) { { 0, 1000 * 1000 * 1000 - 1001 } }, ++ (struct timeval) { time_t_max (), 1 }); ++ TEST_VERIFY (!__deadline_is_infinite (deadline)); ++ deadline = __deadline_from_timeval ++ ((struct deadline_current_time) ++ { { time_t_max (), 1000 * 1000 * 1000 - 1000 } }, ++ (struct timeval) { 0, 1 }); ++ TEST_VERIFY (__deadline_is_infinite (deadline)); ++ deadline = __deadline_from_timeval ++ ((struct deadline_current_time) ++ { { time_t_max () / 2 + 1, 0 } }, ++ (struct timeval) { time_t_max () / 2 + 1, 0 }); ++ TEST_VERIFY (__deadline_is_infinite (deadline)); ++ ++ /* Check __deadline_first behavior. */ ++ deadline = __deadline_first ++ ((struct deadline) { { 1, 2 } }, ++ (struct deadline) { { 1, 3 } }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 2); ++ deadline = __deadline_first ++ ((struct deadline) { { 1, 3 } }, ++ (struct deadline) { { 1, 2 } }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 2); ++ deadline = __deadline_first ++ ((struct deadline) { { 1, 2 } }, ++ (struct deadline) { { 2, 1 } }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 2); ++ deadline = __deadline_first ++ ((struct deadline) { { 1, 2 } }, ++ (struct deadline) { { 2, 4 } }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 2); ++ deadline = __deadline_first ++ ((struct deadline) { { 2, 4 } }, ++ (struct deadline) { { 1, 2 } }); ++ TEST_VERIFY (deadline.absolute.tv_sec == 1); ++ TEST_VERIFY (deadline.absolute.tv_nsec == 2); ++ ++ return 0; ++} ++ ++#include +diff --git a/io/fts.h b/io/fts.h +index b9cff534e9..ab15567001 100644 +--- a/io/fts.h ++++ b/io/fts.h +@@ -193,7 +193,7 @@ FTS *__REDIRECT (fts_open, (char * const *, int, + int (*)(const FTSENT **, const FTSENT **)), + fts64_open); + FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); +-int __REDIRECT (fts_set, (FTS *, FTSENT *, int), fts64_set) __THROW; ++int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set); + # else + # define fts_children fts64_children + # define fts_close fts64_close +diff --git a/localedata/ChangeLog b/localedata/ChangeLog +index 0cdb097ab6..127c1cfb35 100644 +--- a/localedata/ChangeLog ++++ b/localedata/ChangeLog +@@ -1,3 +1,11 @@ ++2017-06-11 Santhosh Thottingal ++ ++ [BZ #19922] ++ * locales/iso14651_t1_common: Add collation rules for U+07DA to U+07DF. ++ ++ [BZ #19919] ++ * locales/iso14651_t1_common: Correct collation of U+0D36 and U+0D37. ++ + 2017-01-01 Joseph Myers + + * All files with FSF copyright notices: Update copyright dates +diff --git a/localedata/locales/iso14651_t1_common b/localedata/locales/iso14651_t1_common +index eef75ba65e..0e64f26a12 100644 +--- a/localedata/locales/iso14651_t1_common ++++ b/localedata/locales/iso14651_t1_common +@@ -1042,9 +1042,9 @@ collating-element from "" + collating-element from "" + collating-element from "" + collating-element from "" +-collating-element from "" + collating-element from "" + collating-element from "" ++collating-element from "" + collating-element from "" + collating-element from "" + collating-element from "" +@@ -1103,8 +1103,8 @@ collating-symbol + collating-symbol + collating-symbol + collating-symbol +-collating-symbol + collating-symbol ++collating-symbol + collating-symbol + collating-symbol + collating-symbol +@@ -1126,6 +1126,12 @@ collating-symbol + collating-symbol + collating-symbol + collating-symbol ++collating-symbol ++collating-symbol ++collating-symbol ++collating-symbol ++collating-symbol ++collating-symbol + # + # + # +@@ -4552,6 +4558,12 @@ collating-symbol + + + ++ ++ ++ ++ ++ ++ + # + # + # +@@ -7252,6 +7264,7 @@ order_start ;forward;forward;forward;forward,position + ;;;IGNORE + ;;;IGNORE + "";;;IGNORE ++ "";;;IGNORE + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE +@@ -7280,6 +7293,7 @@ order_start ;forward;forward;forward;forward,position + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE # ണ്‍ = ണ + ് + zwj ++ "";;;IGNORE + "";;;IGNORE # ണ = ണ + ് + അ + "";;;IGNORE + "";;;IGNORE +@@ -7290,6 +7304,7 @@ order_start ;forward;forward;forward;forward,position + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE # ന്‍= ന + ് + zwj ++ "";;;IGNORE + "";;;IGNORE #ന = ന + ് + അ + "";;;IGNORE + "";;;IGNORE +@@ -7305,20 +7320,23 @@ order_start ;forward;forward;forward;forward,position + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE # ര = ര + ് + zwj ++ "";;;IGNORE + "";;;IGNORE # ര = ര + ് + അ + ;;;IGNORE # ല്‍ = ല + ് + zwj ++ "";;;IGNORE + "";;;IGNORE # ല = ല + ് + അ + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE +- "";;;IGNORE ++ "";;;IGNORE + "";;;IGNORE +- "";;;IGNORE ++ "";;;IGNORE + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE + "";;;IGNORE # ള്‍ = ള + ് + zwj ++ "";;;IGNORE + "";;;IGNORE # ള = ള + ് + അ + "";;;IGNORE + "";;;IGNORE +diff --git a/malloc/arena.c b/malloc/arena.c +index b91d7d6b16..d49e4a21c8 100644 +--- a/malloc/arena.c ++++ b/malloc/arena.c +@@ -212,9 +212,9 @@ __malloc_fork_unlock_child (void) + #if HAVE_TUNABLES + static inline int do_set_mallopt_check (int32_t value); + void +-DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp) ++DL_TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp) + { +- int32_t value = *(int32_t *) valp; ++ int32_t value = (int32_t) valp->numval; + do_set_mallopt_check (value); + if (check_action != 0) + __malloc_check_init (); +@@ -223,9 +223,9 @@ DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp) + # define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \ + static inline int do_ ## __name (__type value); \ + void \ +-DL_TUNABLE_CALLBACK (__name) (void *valp) \ ++DL_TUNABLE_CALLBACK (__name) (tunable_val_t *valp) \ + { \ +- __type value = *(__type *) valp; \ ++ __type value = (__type) (valp)->numval; \ + do_ ## __name (value); \ + } + +diff --git a/malloc/malloc.c b/malloc/malloc.c +index 4885793905..4e076638b0 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -4902,7 +4902,7 @@ __libc_mallopt (int param_number, int value) + + case M_ARENA_MAX: + if (value > 0) +- do_set_arena_test (value); ++ do_set_arena_max (value); + break; + } + __libc_lock_unlock (av->mutex); +diff --git a/manual/install.texi b/manual/install.texi +index 266add8ba9..3398cfab02 100644 +--- a/manual/install.texi ++++ b/manual/install.texi +@@ -175,6 +175,12 @@ options to detect stack overruns. Only the dynamic linker and a small + number of routines called directly from assembler are excluded from this + protection. + ++@item --enable-bind-now ++Disable lazy binding for installed shared objects. This provides ++additional security hardening because it enables full RELRO and a ++read-only global offset table (GOT), at the cost of slightly increased ++program load times. ++ + @pindex pt_chown + @findex grantpt + @item --enable-pt_chown +diff --git a/posix/globtest.sh b/posix/globtest.sh +index f9cc80b4b5..73f7ae31cc 100755 +--- a/posix/globtest.sh ++++ b/posix/globtest.sh +@@ -47,7 +47,12 @@ testout=${common_objpfx}posix/globtest-out + rm -rf $testdir $testout + mkdir $testdir + +-trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 ++cleanup() { ++ chmod 777 $testdir/noread ++ rm -fr $testdir $testout ++} ++ ++trap cleanup 0 HUP INT QUIT TERM + + echo 1 > $testdir/file1 + echo 2 > $testdir/file2 +@@ -811,8 +816,6 @@ if test $failed -ne 0; then + fi + + if test $result -eq 0; then +- chmod 777 $testdir/noread +- rm -fr $testdir $testout + echo "All OK." > $logfile + fi + +diff --git a/string/test-memchr.c b/string/test-memchr.c +index d62889ff8f..6431605c7e 100644 +--- a/string/test-memchr.c ++++ b/string/test-memchr.c +@@ -208,6 +208,12 @@ test_main (void) + do_test (0, i, i + 1, i + 1, 0); + } + ++ /* BZ#21182 - wrong overflow calculation for i686 implementation ++ with address near end of the page. */ ++ for (i = 2; i < 16; ++i) ++ /* page_size is in fact getpagesize() * 2. */ ++ do_test (page_size / 2 - i, i, i, 1, 0x9B); ++ + do_random_tests (); + return ret; + } +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 0c1e6124ff..7e5d2955a0 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -93,11 +93,12 @@ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ + extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs)) + others += rpcgen + +-tests = tst-xdrmem tst-xdrmem2 test-rpcent ++tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ ++ tst-udp-nonblocking + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) +-xtests += thrsvc ++xtests += thrsvc tst-udp-garbage + endif + + ifeq ($(run-built-tests),yes) +@@ -155,6 +156,7 @@ BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS) + $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so + $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so ++$(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so + + $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) + +@@ -234,3 +236,8 @@ $(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen + $(built-program-cmd) -c $< -o $@; \ + $(evaluate-test) + endif ++ ++$(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so ++$(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so ++$(objpfx)tst-udp-garbage: \ ++ $(common-objpfx)linkobj/libc.so $(shared-thread-library) +diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c +index 4d9acb1e6a..6ce16eb298 100644 +--- a/sunrpc/clnt_udp.c ++++ b/sunrpc/clnt_udp.c +@@ -55,6 +55,7 @@ + #endif + + #include ++#include + + extern u_long _create_xid (void); + +@@ -80,7 +81,9 @@ static const struct clnt_ops udp_ops = + }; + + /* +- * Private data kept per client handle ++ * Private data kept per client handle. This private struct is ++ * unfortunately part of the ABI; ypbind contains a copy of it and ++ * accesses it through CLIENT::cl_private field. + */ + struct cu_data + { +@@ -278,28 +281,38 @@ clntudp_call (/* client handle */ + int inlen; + socklen_t fromlen; + struct pollfd fd; +- int milliseconds = (cu->cu_wait.tv_sec * 1000) + +- (cu->cu_wait.tv_usec / 1000); + struct sockaddr_in from; + struct rpc_msg reply_msg; + XDR reply_xdrs; +- struct timeval time_waited; + bool_t ok; + int nrefreshes = 2; /* number of times to refresh cred */ +- struct timeval timeout; + int anyup; /* any network interface up */ + +- if (cu->cu_total.tv_usec == -1) +- { +- timeout = utimeout; /* use supplied timeout */ +- } +- else ++ struct deadline_current_time current_time = __deadline_current_time (); ++ struct deadline total_deadline; /* Determined once by overall timeout. */ ++ struct deadline response_deadline; /* Determined anew for each query. */ ++ ++ /* Choose the timeout value. For non-sending usage (xargs == NULL), ++ the total deadline does not matter, only cu->cu_wait is used ++ below. */ ++ if (xargs != NULL) + { +- timeout = cu->cu_total; /* use default timeout */ ++ struct timeval tv; ++ if (cu->cu_total.tv_usec == -1) ++ /* Use supplied timeout. */ ++ tv = utimeout; ++ else ++ /* Use default timeout. */ ++ tv = cu->cu_total; ++ if (!__is_timeval_valid_timeout (tv)) ++ return (cu->cu_error.re_status = RPC_TIMEDOUT); ++ total_deadline = __deadline_from_timeval (current_time, tv); + } + +- time_waited.tv_sec = 0; +- time_waited.tv_usec = 0; ++ /* Guard against bad timeout specification. */ ++ if (!__is_timeval_valid_timeout (cu->cu_wait)) ++ return (cu->cu_error.re_status = RPC_TIMEDOUT); ++ + call_again: + xdrs = &(cu->cu_outxdrs); + if (xargs == NULL) +@@ -325,27 +338,46 @@ send_again: + return (cu->cu_error.re_status = RPC_CANTSEND); + } + +- /* +- * Hack to provide rpc-based message passing +- */ +- if (timeout.tv_sec == 0 && timeout.tv_usec == 0) +- { +- return (cu->cu_error.re_status = RPC_TIMEDOUT); +- } ++ /* sendto may have blocked, so recompute the current time. */ ++ current_time = __deadline_current_time (); + get_reply: +- /* +- * sub-optimal code appears here because we have +- * some clock time to spare while the packets are in flight. +- * (We assume that this is actually only executed once.) +- */ ++ response_deadline = __deadline_from_timeval (current_time, cu->cu_wait); ++ + reply_msg.acpted_rply.ar_verf = _null_auth; + reply_msg.acpted_rply.ar_results.where = resultsp; + reply_msg.acpted_rply.ar_results.proc = xresults; + fd.fd = cu->cu_sock; + fd.events = POLLIN; + anyup = 0; ++ ++ /* Per-response retry loop. current_time must be up-to-date at the ++ top of the loop. */ + for (;;) + { ++ int milliseconds; ++ if (xargs != NULL) ++ { ++ if (__deadline_elapsed (current_time, total_deadline)) ++ /* Overall timeout expired. */ ++ return (cu->cu_error.re_status = RPC_TIMEDOUT); ++ milliseconds = __deadline_to_ms ++ (current_time, __deadline_first (total_deadline, ++ response_deadline)); ++ if (milliseconds == 0) ++ /* Per-query timeout expired. */ ++ goto send_again; ++ } ++ else ++ { ++ /* xatgs == NULL. Collect a response without sending a ++ query. In this mode, we need to ignore the total ++ deadline. */ ++ milliseconds = __deadline_to_ms (current_time, response_deadline); ++ if (milliseconds == 0) ++ /* Cannot send again, so bail out. */ ++ return (cu->cu_error.re_status = RPC_CANTSEND); ++ } ++ + switch (__poll (&fd, 1, milliseconds)) + { + +@@ -356,27 +388,10 @@ send_again: + if (!anyup) + return (cu->cu_error.re_status = RPC_CANTRECV); + } +- +- time_waited.tv_sec += cu->cu_wait.tv_sec; +- time_waited.tv_usec += cu->cu_wait.tv_usec; +- while (time_waited.tv_usec >= 1000000) +- { +- time_waited.tv_sec++; +- time_waited.tv_usec -= 1000000; +- } +- if ((time_waited.tv_sec < timeout.tv_sec) || +- ((time_waited.tv_sec == timeout.tv_sec) && +- (time_waited.tv_usec < timeout.tv_usec))) +- goto send_again; +- return (cu->cu_error.re_status = RPC_TIMEDOUT); +- +- /* +- * buggy in other cases because time_waited is not being +- * updated. +- */ ++ goto next_response; + case -1: + if (errno == EINTR) +- continue; ++ goto next_response; + cu->cu_error.re_errno = errno; + return (cu->cu_error.re_status = RPC_CANTRECV); + } +@@ -421,9 +436,9 @@ send_again: + cmsg = CMSG_NXTHDR (&msg, cmsg)) + if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) + { +- free (cbuf); + e = (struct sock_extended_err *) CMSG_DATA(cmsg); + cu->cu_error.re_errno = e->ee_errno; ++ free (cbuf); + return (cu->cu_error.re_status = RPC_CANTRECV); + } + free (cbuf); +@@ -440,20 +455,22 @@ send_again: + if (inlen < 0) + { + if (errno == EWOULDBLOCK) +- continue; ++ goto next_response; + cu->cu_error.re_errno = errno; + return (cu->cu_error.re_status = RPC_CANTRECV); + } +- if (inlen < 4) +- continue; +- +- /* see if reply transaction id matches sent id. +- Don't do this if we only wait for a replay */ +- if (xargs != NULL +- && memcmp (cu->cu_inbuf, cu->cu_outbuf, sizeof (u_int32_t)) != 0) +- continue; +- /* we now assume we have the proper reply */ +- break; ++ /* Accept the response if the packet is sufficiently long and ++ the transaction ID matches the query (if available). */ ++ if (inlen >= 4 ++ && (xargs == NULL ++ || memcmp (cu->cu_inbuf, cu->cu_outbuf, ++ sizeof (u_int32_t)) == 0)) ++ break; ++ ++ next_response: ++ /* Update the current time because poll and recvmsg waited for ++ an unknown time. */ ++ current_time = __deadline_current_time (); + } + + /* +diff --git a/sunrpc/tst-udp-error.c b/sunrpc/tst-udp-error.c +new file mode 100644 +index 0000000000..1efc02f5c6 +--- /dev/null ++++ b/sunrpc/tst-udp-error.c +@@ -0,0 +1,62 @@ ++/* Check for use-after-free in clntudp_call (bug 21115). ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ support_enter_network_namespace (); ++ ++ /* Obtain a likely-unused port number. */ ++ struct sockaddr_in sin = ++ { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), ++ }; ++ { ++ int fd = xsocket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); ++ xbind (fd, (struct sockaddr *) &sin, sizeof (sin)); ++ socklen_t sinlen = sizeof (sin); ++ xgetsockname (fd, (struct sockaddr *) &sin, &sinlen); ++ /* Close the socket, so that we will receive an error below. */ ++ close (fd); ++ } ++ ++ int sock = RPC_ANYSOCK; ++ CLIENT *clnt = clntudp_create ++ (&sin, 1, 2, (struct timeval) { 1, 0 }, &sock); ++ TEST_VERIFY_EXIT (clnt != NULL); ++ TEST_VERIFY (clnt_call (clnt, 3, ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 3, 0 })) ++ == RPC_CANTRECV); ++ clnt_destroy (clnt); ++ ++ return 0; ++} ++ ++#include +diff --git a/sunrpc/tst-udp-garbage.c b/sunrpc/tst-udp-garbage.c +new file mode 100644 +index 0000000000..4abda93f08 +--- /dev/null ++++ b/sunrpc/tst-udp-garbage.c +@@ -0,0 +1,104 @@ ++/* Test that garbage packets do not affect timeout handling. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Descriptor for the server UDP socket. */ ++static int server_fd; ++ ++static void * ++garbage_sender_thread (void *unused) ++{ ++ while (true) ++ { ++ struct sockaddr_storage sa; ++ socklen_t salen = sizeof (sa); ++ char buf[1]; ++ if (recvfrom (server_fd, buf, sizeof (buf), 0, ++ (struct sockaddr *) &sa, &salen) < 0) ++ FAIL_EXIT1 ("recvfrom: %m"); ++ ++ /* Send garbage packets indefinitely. */ ++ buf[0] = 0; ++ while (true) ++ { ++ /* sendto can fail if the client closed the socket. */ ++ if (sendto (server_fd, buf, sizeof (buf), 0, ++ (struct sockaddr *) &sa, salen) < 0) ++ break; ++ ++ /* Wait a bit, to avoid burning too many CPU cycles in a ++ tight loop. The wait period must be much shorter than ++ the client timeouts configured below. */ ++ usleep (50 * 1000); ++ } ++ } ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ support_enter_network_namespace (); ++ ++ server_fd = xsocket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP); ++ struct sockaddr_in server_address = ++ { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), ++ }; ++ xbind (server_fd, ++ (struct sockaddr *) &server_address, sizeof (server_address)); ++ { ++ socklen_t sinlen = sizeof (server_address); ++ xgetsockname (server_fd, (struct sockaddr *) &server_address, &sinlen); ++ TEST_VERIFY (sizeof (server_address) == sinlen); ++ } ++ ++ /* Garbage packet source. */ ++ xpthread_detach (xpthread_create (NULL, garbage_sender_thread, NULL)); ++ ++ /* Test client. Use an arbitrary timeout of one second, which is ++ much longer than the garbage packet interval, but still ++ reasonably short, so that the test completes quickly. */ ++ int client_fd = RPC_ANYSOCK; ++ CLIENT *clnt = clntudp_create (&server_address, ++ 1, 2, /* Arbitrary RPC endpoint numbers. */ ++ (struct timeval) { 1, 0 }, ++ &client_fd); ++ if (clnt == NULL) ++ FAIL_EXIT1 ("clntudp_create: %m"); ++ ++ TEST_VERIFY (clnt_call (clnt, 3, /* Arbitrary RPC procedure number. */ ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 1, 0 }))); ++ ++ return 0; ++} ++ ++#include +diff --git a/sunrpc/tst-udp-nonblocking.c b/sunrpc/tst-udp-nonblocking.c +new file mode 100644 +index 0000000000..1d6a7f4b56 +--- /dev/null ++++ b/sunrpc/tst-udp-nonblocking.c +@@ -0,0 +1,333 @@ ++/* Test non-blocking use of the UDP client. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Test data serialization and deserialization. */ ++ ++struct test_query ++{ ++ uint32_t a; ++ uint32_t b; ++ uint32_t timeout_ms; ++}; ++ ++static bool_t ++xdr_test_query (XDR *xdrs, void *data, ...) ++{ ++ struct test_query *p = data; ++ return xdr_uint32_t (xdrs, &p->a) ++ && xdr_uint32_t (xdrs, &p->b) ++ && xdr_uint32_t (xdrs, &p->timeout_ms); ++} ++ ++struct test_response ++{ ++ uint32_t server_id; ++ uint32_t seq; ++ uint32_t sum; ++}; ++ ++static bool_t ++xdr_test_response (XDR *xdrs, void *data, ...) ++{ ++ struct test_response *p = data; ++ return xdr_uint32_t (xdrs, &p->server_id) ++ && xdr_uint32_t (xdrs, &p->seq) ++ && xdr_uint32_t (xdrs, &p->sum); ++} ++ ++/* Implementation of the test server. */ ++ ++enum ++ { ++ /* Number of test servers to run. */ ++ SERVER_COUNT = 3, ++ ++ /* RPC parameters, chosen at random. */ ++ PROGNUM = 8242, ++ VERSNUM = 19654, ++ ++ /* Main RPC operation. */ ++ PROC_ADD = 1, ++ ++ /* Request process termination. */ ++ PROC_EXIT, ++ ++ /* Special exit status to mark successful processing. */ ++ EXIT_MARKER = 55, ++ }; ++ ++/* Set by the parent process to tell test servers apart. */ ++static int server_id; ++ ++/* Implementation of the test server. */ ++static void ++server_dispatch (struct svc_req *request, SVCXPRT *transport) ++{ ++ /* Query sequence number. */ ++ static uint32_t seq = 0; ++ ++seq; ++ static bool proc_add_seen; ++ ++ if (test_verbose) ++ printf ("info: server_dispatch server_id=%d seq=%u rq_proc=%lu\n", ++ server_id, seq, request->rq_proc); ++ ++ switch (request->rq_proc) ++ { ++ case PROC_ADD: ++ { ++ struct test_query query; ++ memset (&query, 0xc0, sizeof (query)); ++ TEST_VERIFY_EXIT ++ (svc_getargs (transport, xdr_test_query, ++ (void *) &query)); ++ ++ if (test_verbose) ++ printf (" a=%u b=%u timeout_ms=%u\n", ++ query.a, query.b, query.timeout_ms); ++ ++ usleep (query.timeout_ms * 1000); ++ ++ struct test_response response = ++ { ++ .server_id = server_id, ++ .seq = seq, ++ .sum = query.a + query.b, ++ }; ++ TEST_VERIFY (svc_sendreply (transport, xdr_test_response, ++ (void *) &response)); ++ if (test_verbose) ++ printf (" server id %d response seq=%u sent\n", server_id, seq); ++ proc_add_seen = true; ++ } ++ break; ++ ++ case PROC_EXIT: ++ TEST_VERIFY (proc_add_seen); ++ TEST_VERIFY (svc_sendreply (transport, (xdrproc_t) xdr_void, NULL)); ++ _exit (EXIT_MARKER); ++ break; ++ ++ default: ++ FAIL_EXIT1 ("invalid rq_proc value: %lu", request->rq_proc); ++ break; ++ } ++} ++ ++/* Return the number seconds since an arbitrary point in time. */ ++static double ++get_ticks (void) ++{ ++ { ++ struct timespec ts; ++ if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0) ++ return ts.tv_sec + ts.tv_nsec * 1e-9; ++ } ++ { ++ struct timeval tv; ++ TEST_VERIFY_EXIT (gettimeofday (&tv, NULL) == 0); ++ return tv.tv_sec + tv.tv_usec * 1e-6; ++ } ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ support_enter_network_namespace (); ++ ++ /* Information about the test servers. */ ++ struct ++ { ++ SVCXPRT *transport; ++ struct sockaddr_in address; ++ pid_t pid; ++ uint32_t xid; ++ } servers[SERVER_COUNT]; ++ ++ /* Spawn the test servers. */ ++ for (int i = 0; i < SERVER_COUNT; ++i) ++ { ++ servers[i].transport = svcudp_create (RPC_ANYSOCK); ++ TEST_VERIFY_EXIT (servers[i].transport != NULL); ++ servers[i].address = (struct sockaddr_in) ++ { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), ++ .sin_port = htons (servers[i].transport->xp_port), ++ }; ++ servers[i].xid = 0xabcd0101 + i; ++ if (test_verbose) ++ printf ("info: setting up server %d xid=%x on port %d\n", ++ i, servers[i].xid, servers[i].transport->xp_port); ++ ++ server_id = i; ++ servers[i].pid = xfork (); ++ if (servers[i].pid == 0) ++ { ++ TEST_VERIFY (svc_register (servers[i].transport, ++ PROGNUM, VERSNUM, server_dispatch, 0)); ++ svc_run (); ++ FAIL_EXIT1 ("supposed to be unreachable"); ++ } ++ /* We need to close the socket so that we do not accidentally ++ consume the request. */ ++ TEST_VERIFY (close (servers[i].transport->xp_sock) == 0); ++ } ++ ++ ++ /* The following code mirrors what ypbind does. */ ++ ++ /* Copied from clnt_udp.c (like ypbind). */ ++ struct cu_data ++ { ++ int cu_sock; ++ bool_t cu_closeit; ++ struct sockaddr_in cu_raddr; ++ int cu_rlen; ++ struct timeval cu_wait; ++ struct timeval cu_total; ++ struct rpc_err cu_error; ++ XDR cu_outxdrs; ++ u_int cu_xdrpos; ++ u_int cu_sendsz; ++ char *cu_outbuf; ++ u_int cu_recvsz; ++ char cu_inbuf[1]; ++ }; ++ ++ int client_socket = xsocket (AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0); ++ CLIENT *clnt = clntudp_create (&servers[0].address, PROGNUM, VERSNUM, ++ /* 5 seconds per-response timeout. */ ++ ((struct timeval) { 5, 0 }), ++ &client_socket); ++ TEST_VERIFY (clnt != NULL); ++ clnt->cl_auth = authunix_create_default (); ++ { ++ struct timeval zero = { 0, 0 }; ++ TEST_VERIFY (clnt_control (clnt, CLSET_TIMEOUT, (void *) &zero)); ++ } ++ ++ /* Poke at internal data structures (like ypbind). */ ++ struct cu_data *cu = (struct cu_data *) clnt->cl_private; ++ ++ /* Send a ping to each server. */ ++ double before_pings = get_ticks (); ++ for (int i = 0; i < SERVER_COUNT; ++i) ++ { ++ if (test_verbose) ++ printf ("info: sending server %d ping\n", i); ++ /* Reset the xid because it is changed by each invocation of ++ clnt_call. Subtract one to compensate for the xid update ++ during the call. */ ++ *((u_int32_t *) (cu->cu_outbuf)) = servers[i].xid - 1; ++ cu->cu_raddr = servers[i].address; ++ ++ struct test_query query = { .a = 100, .b = i + 1 }; ++ if (i == 1) ++ /* Shorter timeout to prefer this server. These timeouts must ++ be much shorter than the 5-second per-response timeout ++ configured with clntudp_create. */ ++ query.timeout_ms = 700; ++ else ++ query.timeout_ms = 1400; ++ struct test_response response = { 0 }; ++ /* NB: Do not check the return value. The server reply will ++ prove that the call worked. */ ++ double before_one_ping = get_ticks (); ++ clnt_call (clnt, PROC_ADD, ++ xdr_test_query, (void *) &query, ++ xdr_test_response, (void *) &response, ++ ((struct timeval) { 0, 0 })); ++ double after_one_ping = get_ticks (); ++ if (test_verbose) ++ printf ("info: non-blocking send took %f seconds\n", ++ after_one_ping - before_one_ping); ++ /* clnt_call should return immediately. Accept some delay in ++ case the process is descheduled. */ ++ TEST_VERIFY (after_one_ping - before_one_ping < 0.3); ++ } ++ ++ /* Collect the non-blocking response. */ ++ if (test_verbose) ++ printf ("info: collecting response\n"); ++ struct test_response response = { 0 }; ++ TEST_VERIFY ++ (clnt_call (clnt, PROC_ADD, NULL, NULL, ++ xdr_test_response, (void *) &response, ++ ((struct timeval) { 0, 0 })) == RPC_SUCCESS); ++ double after_pings = get_ticks (); ++ if (test_verbose) ++ printf ("info: send/receive took %f seconds\n", ++ after_pings - before_pings); ++ /* Expected timeout is 0.7 seconds. */ ++ TEST_VERIFY (0.7 <= after_pings - before_pings); ++ TEST_VERIFY (after_pings - before_pings < 1.2); ++ ++ uint32_t xid; ++ memcpy (&xid, &cu->cu_inbuf, sizeof (xid)); ++ if (test_verbose) ++ printf ("info: non-blocking response: xid=%x server_id=%u seq=%u sum=%u\n", ++ xid, response.server_id, response.seq, response.sum); ++ /* Check that the reply from the preferred server was used. */ ++ TEST_VERIFY (servers[1].xid == xid); ++ TEST_VERIFY (response.server_id == 1); ++ TEST_VERIFY (response.seq == 1); ++ TEST_VERIFY (response.sum == 102); ++ ++ auth_destroy (clnt->cl_auth); ++ clnt_destroy (clnt); ++ ++ for (int i = 0; i < SERVER_COUNT; ++i) ++ { ++ if (test_verbose) ++ printf ("info: requesting server %d termination\n", i); ++ client_socket = RPC_ANYSOCK; ++ clnt = clntudp_create (&servers[i].address, PROGNUM, VERSNUM, ++ ((struct timeval) { 5, 0 }), ++ &client_socket); ++ TEST_VERIFY_EXIT (clnt != NULL); ++ TEST_VERIFY (clnt_call (clnt, PROC_EXIT, ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 3, 0 })) == RPC_SUCCESS); ++ clnt_destroy (clnt); ++ ++ int status; ++ xwaitpid (servers[i].pid, &status, 0); ++ TEST_VERIFY (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_MARKER); ++ } ++ ++ return 0; ++} ++ ++#include +diff --git a/sunrpc/tst-udp-timeout.c b/sunrpc/tst-udp-timeout.c +new file mode 100644 +index 0000000000..db9943a03e +--- /dev/null ++++ b/sunrpc/tst-udp-timeout.c +@@ -0,0 +1,402 @@ ++/* Test timeout handling in the UDP client. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Test data serialization and deserialization. */ ++ ++struct test_query ++{ ++ uint32_t a; ++ uint32_t b; ++ uint32_t timeout_ms; ++ uint32_t wait_for_seq; ++ uint32_t garbage_packets; ++}; ++ ++static bool_t ++xdr_test_query (XDR *xdrs, void *data, ...) ++{ ++ struct test_query *p = data; ++ return xdr_uint32_t (xdrs, &p->a) ++ && xdr_uint32_t (xdrs, &p->b) ++ && xdr_uint32_t (xdrs, &p->timeout_ms) ++ && xdr_uint32_t (xdrs, &p->wait_for_seq) ++ && xdr_uint32_t (xdrs, &p->garbage_packets); ++} ++ ++struct test_response ++{ ++ uint32_t seq; ++ uint32_t sum; ++}; ++ ++static bool_t ++xdr_test_response (XDR *xdrs, void *data, ...) ++{ ++ struct test_response *p = data; ++ return xdr_uint32_t (xdrs, &p->seq) ++ && xdr_uint32_t (xdrs, &p->sum); ++} ++ ++/* Implementation of the test server. */ ++ ++enum ++ { ++ /* RPC parameters, chosen at random. */ ++ PROGNUM = 15717, ++ VERSNUM = 13689, ++ ++ /* Main RPC operation. */ ++ PROC_ADD = 1, ++ ++ /* Reset the sequence number. */ ++ PROC_RESET_SEQ, ++ ++ /* Request process termination. */ ++ PROC_EXIT, ++ ++ /* Special exit status to mark successful processing. */ ++ EXIT_MARKER = 55, ++ }; ++ ++static void ++server_dispatch (struct svc_req *request, SVCXPRT *transport) ++{ ++ /* Query sequence number. */ ++ static uint32_t seq = 0; ++ ++seq; ++ ++ if (test_verbose) ++ printf ("info: server_dispatch seq=%u rq_proc=%lu\n", ++ seq, request->rq_proc); ++ ++ switch (request->rq_proc) ++ { ++ case PROC_ADD: ++ { ++ struct test_query query; ++ memset (&query, 0xc0, sizeof (query)); ++ TEST_VERIFY_EXIT ++ (svc_getargs (transport, xdr_test_query, ++ (void *) &query)); ++ ++ if (test_verbose) ++ printf (" a=%u b=%u timeout_ms=%u wait_for_seq=%u" ++ " garbage_packets=%u\n", ++ query.a, query.b, query.timeout_ms, query.wait_for_seq, ++ query.garbage_packets); ++ ++ if (seq < query.wait_for_seq) ++ { ++ /* No response at this point. */ ++ if (test_verbose) ++ printf (" skipped response\n"); ++ break; ++ } ++ ++ if (query.garbage_packets > 0) ++ { ++ int per_packet_timeout; ++ if (query.timeout_ms > 0) ++ per_packet_timeout ++ = query.timeout_ms * 1000 / query.garbage_packets; ++ else ++ per_packet_timeout = 0; ++ ++ char buf[20]; ++ memset (&buf, 0xc0, sizeof (buf)); ++ for (int i = 0; i < query.garbage_packets; ++i) ++ { ++ /* 13 is relatively prime to 20 = sizeof (buf) + 1, so ++ the len variable will cover the entire interval ++ [0, 20] if query.garbage_packets is sufficiently ++ large. */ ++ size_t len = (i * 13 + 1) % (sizeof (buf) + 1); ++ TEST_VERIFY (sendto (transport->xp_sock, ++ buf, len, MSG_NOSIGNAL, ++ (struct sockaddr *) &transport->xp_raddr, ++ transport->xp_addrlen) == len); ++ if (per_packet_timeout > 0) ++ usleep (per_packet_timeout); ++ } ++ } ++ else if (query.timeout_ms > 0) ++ usleep (query.timeout_ms * 1000); ++ ++ struct test_response response = ++ { ++ .seq = seq, ++ .sum = query.a + query.b, ++ }; ++ TEST_VERIFY (svc_sendreply (transport, xdr_test_response, ++ (void *) &response)); ++ } ++ break; ++ ++ case PROC_RESET_SEQ: ++ seq = 0; ++ TEST_VERIFY (svc_sendreply (transport, (xdrproc_t) xdr_void, NULL)); ++ break; ++ ++ case PROC_EXIT: ++ TEST_VERIFY (svc_sendreply (transport, (xdrproc_t) xdr_void, NULL)); ++ _exit (EXIT_MARKER); ++ break; ++ ++ default: ++ FAIL_EXIT1 ("invalid rq_proc value: %lu", request->rq_proc); ++ break; ++ } ++} ++ ++/* Implementation of the test client. */ ++ ++static struct test_response ++test_call (CLIENT *clnt, int proc, struct test_query query, ++ struct timeval timeout) ++{ ++ if (test_verbose) ++ printf ("info: test_call proc=%d timeout=%lu.%06lu\n", ++ proc, (unsigned long) timeout.tv_sec, ++ (unsigned long) timeout.tv_usec); ++ struct test_response response; ++ TEST_VERIFY_EXIT (clnt_call (clnt, proc, ++ xdr_test_query, (void *) &query, ++ xdr_test_response, (void *) &response, ++ timeout) ++ == RPC_SUCCESS); ++ return response; ++} ++ ++static void ++test_call_timeout (CLIENT *clnt, int proc, struct test_query query, ++ struct timeval timeout) ++{ ++ struct test_response response; ++ TEST_VERIFY (clnt_call (clnt, proc, ++ xdr_test_query, (void *) &query, ++ xdr_test_response, (void *) &response, ++ timeout) ++ == RPC_TIMEDOUT); ++} ++ ++/* Complete one regular RPC call to drain the server socket ++ buffer. Resets the sequence number. */ ++static void ++test_call_flush (CLIENT *clnt) ++{ ++ /* This needs a longer timeout to flush out all pending requests. ++ The choice of 5 seconds is larger than the per-response timeouts ++ requested via the timeout_ms field. */ ++ if (test_verbose) ++ printf ("info: flushing pending queries\n"); ++ TEST_VERIFY_EXIT (clnt_call (clnt, PROC_RESET_SEQ, ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 5, 0 })) ++ == RPC_SUCCESS); ++} ++ ++/* Return the number seconds since an arbitrary point in time. */ ++static double ++get_ticks (void) ++{ ++ { ++ struct timespec ts; ++ if (clock_gettime (CLOCK_MONOTONIC, &ts) == 0) ++ return ts.tv_sec + ts.tv_nsec * 1e-9; ++ } ++ { ++ struct timeval tv; ++ TEST_VERIFY_EXIT (gettimeofday (&tv, NULL) == 0); ++ return tv.tv_sec + tv.tv_usec * 1e-6; ++ } ++} ++ ++static void ++test_udp_server (int port) ++{ ++ struct sockaddr_in sin = ++ { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), ++ .sin_port = htons (port) ++ }; ++ int sock = RPC_ANYSOCK; ++ ++ /* The client uses a 1.5 second timeout for retries. The timeouts ++ are arbitrary, but chosen so that there is a substantial gap ++ between them, but the total time spent waiting is not too ++ large. */ ++ CLIENT *clnt = clntudp_create (&sin, PROGNUM, VERSNUM, ++ (struct timeval) { 1, 500 * 1000 }, ++ &sock); ++ TEST_VERIFY_EXIT (clnt != NULL); ++ ++ /* Basic call/response test. */ ++ struct test_response response = test_call ++ (clnt, PROC_ADD, ++ (struct test_query) { .a = 17, .b = 4 }, ++ (struct timeval) { 3, 0 }); ++ TEST_VERIFY (response.sum == 21); ++ TEST_VERIFY (response.seq == 1); ++ ++ /* Check that garbage packets do not interfere with timeout ++ processing. */ ++ double before = get_ticks (); ++ response = test_call ++ (clnt, PROC_ADD, ++ (struct test_query) { ++ .a = 19, .b = 4, .timeout_ms = 500, .garbage_packets = 21, ++ }, ++ (struct timeval) { 3, 0 }); ++ TEST_VERIFY (response.sum == 23); ++ TEST_VERIFY (response.seq == 2); ++ double after = get_ticks (); ++ if (test_verbose) ++ printf ("info: 21 garbage packets took %f seconds\n", after - before); ++ /* Expected timeout is 0.5 seconds. Add some slack in case process ++ scheduling delays processing the query or response, but do not ++ accept a retry (which would happen at 1.5 seconds). */ ++ TEST_VERIFY (0.5 <= after - before); ++ TEST_VERIFY (after - before < 1.2); ++ test_call_flush (clnt); ++ ++ /* Check that missing a response introduces a 1.5 second timeout, as ++ requested when calling clntudp_create. */ ++ before = get_ticks (); ++ response = test_call ++ (clnt, PROC_ADD, ++ (struct test_query) { .a = 170, .b = 40, .wait_for_seq = 2 }, ++ (struct timeval) { 3, 0 }); ++ TEST_VERIFY (response.sum == 210); ++ TEST_VERIFY (response.seq == 2); ++ after = get_ticks (); ++ if (test_verbose) ++ printf ("info: skipping one response took %f seconds\n", ++ after - before); ++ /* Expected timeout is 1.5 seconds. Do not accept a second retry ++ (which would happen at 3 seconds). */ ++ TEST_VERIFY (1.5 <= after - before); ++ TEST_VERIFY (after - before < 2.9); ++ test_call_flush (clnt); ++ ++ /* Check that the overall timeout wins against the per-query ++ timeout. */ ++ before = get_ticks (); ++ test_call_timeout ++ (clnt, PROC_ADD, ++ (struct test_query) { .a = 170, .b = 41, .wait_for_seq = 2 }, ++ (struct timeval) { 0, 750 * 1000 }); ++ after = get_ticks (); ++ if (test_verbose) ++ printf ("info: 0.75 second timeout took %f seconds\n", ++ after - before); ++ TEST_VERIFY (0.75 <= after - before); ++ TEST_VERIFY (after - before < 1.4); ++ test_call_flush (clnt); ++ ++ for (int with_garbage = 0; with_garbage < 2; ++with_garbage) ++ { ++ /* Check that no response at all causes the client to bail out. */ ++ before = get_ticks (); ++ test_call_timeout ++ (clnt, PROC_ADD, ++ (struct test_query) { ++ .a = 170, .b = 40, .timeout_ms = 1200, ++ .garbage_packets = with_garbage * 21 ++ }, ++ (struct timeval) { 0, 750 * 1000 }); ++ after = get_ticks (); ++ if (test_verbose) ++ printf ("info: test_udp_server: 0.75 second timeout took %f seconds" ++ " (garbage %d)\n", ++ after - before, with_garbage); ++ TEST_VERIFY (0.75 <= after - before); ++ TEST_VERIFY (after - before < 1.4); ++ test_call_flush (clnt); ++ ++ /* As above, but check the total timeout. */ ++ before = get_ticks (); ++ test_call_timeout ++ (clnt, PROC_ADD, ++ (struct test_query) { ++ .a = 170, .b = 40, .timeout_ms = 3000, ++ .garbage_packets = with_garbage * 30 ++ }, ++ (struct timeval) { 2, 300 * 1000 }); ++ after = get_ticks (); ++ if (test_verbose) ++ printf ("info: test_udp_server: 2.3 second timeout took %f seconds" ++ " (garbage %d)\n", ++ after - before, with_garbage); ++ TEST_VERIFY (2.3 <= after - before); ++ TEST_VERIFY (after - before < 3.0); ++ test_call_flush (clnt); ++ } ++ ++ TEST_VERIFY_EXIT (clnt_call (clnt, PROC_EXIT, ++ (xdrproc_t) xdr_void, NULL, ++ (xdrproc_t) xdr_void, NULL, ++ ((struct timeval) { 5, 0 })) ++ == RPC_SUCCESS); ++ clnt_destroy (clnt); ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ support_enter_network_namespace (); ++ ++ SVCXPRT *transport = svcudp_create (RPC_ANYSOCK); ++ TEST_VERIFY_EXIT (transport != NULL); ++ TEST_VERIFY (svc_register (transport, PROGNUM, VERSNUM, server_dispatch, 0)); ++ ++ pid_t pid = xfork (); ++ if (pid == 0) ++ { ++ svc_run (); ++ FAIL_EXIT1 ("supposed to be unreachable"); ++ } ++ test_udp_server (transport->xp_port); ++ ++ int status; ++ xwaitpid (pid, &status, 0); ++ TEST_VERIFY (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_MARKER); ++ ++ SVC_DESTROY (transport); ++ return 0; ++} ++ ++/* The minimum run time is around 17 seconds. */ ++#define TIMEOUT 25 ++#include +diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h +index a74083786e..5ea8a4a259 100644 +--- a/sysdeps/generic/unsecvars.h ++++ b/sysdeps/generic/unsecvars.h +@@ -16,6 +16,7 @@ + "LD_DEBUG\0" \ + "LD_DEBUG_OUTPUT\0" \ + "LD_DYNAMIC_WEAK\0" \ ++ "LD_HWCAP_MASK\0" \ + "LD_LIBRARY_PATH\0" \ + "LD_ORIGIN_PATH\0" \ + "LD_PRELOAD\0" \ +diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h +index 339c7bb771..787b95f502 100644 +--- a/sysdeps/hppa/dl-machine.h ++++ b/sysdeps/hppa/dl-machine.h +@@ -302,6 +302,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) + #define ARCH_LA_PLTENTER hppa_gnu_pltenter + #define ARCH_LA_PLTEXIT hppa_gnu_pltexit + ++/* Adjust DL_STACK_END to get value we want in __libc_stack_end. */ ++#define DL_STACK_END(cookie) \ ++ ((void *) (((long) (cookie)) + 0x160)) ++ + /* Initial entry point code for the dynamic linker. + The C function `_dl_start' is the real entry point; + its return value is the user program's entry point. */ +@@ -401,11 +405,6 @@ asm ( \ + /* Save the entry point in %r3. */ \ + " copy %ret0,%r3\n" \ + \ +- /* Remember the lowest stack address. */ \ +-" addil LT'__libc_stack_end,%r19\n" \ +-" ldw RT'__libc_stack_end(%r1),%r20\n" \ +-" stw %sp,0(%r20)\n" \ +- \ + /* See if we were called as a command with the executable file \ + name as an extra leading argument. */ \ + " addil LT'_dl_skip_args,%r19\n" \ +diff --git a/sysdeps/i386/i686/multiarch/memchr-sse2.S b/sysdeps/i386/i686/multiarch/memchr-sse2.S +index 910679cfc0..e41f324a77 100644 +--- a/sysdeps/i386/i686/multiarch/memchr-sse2.S ++++ b/sysdeps/i386/i686/multiarch/memchr-sse2.S +@@ -117,7 +117,6 @@ L(crosscache): + + # ifndef USE_AS_RAWMEMCHR + jnz L(match_case2_prolog1) +- lea -16(%edx), %edx + /* Calculate the last acceptable address and check for possible + addition overflow by using satured math: + edx = ecx + edx +@@ -125,6 +124,7 @@ L(crosscache): + add %ecx, %edx + sbb %eax, %eax + or %eax, %edx ++ sub $16, %edx + jbe L(return_null) + lea 16(%edi), %edi + # else +diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/i686/multiarch/strcspn-c.c +index 6d61e190a8..ec230fb383 100644 +--- a/sysdeps/i386/i686/multiarch/strcspn-c.c ++++ b/sysdeps/i386/i686/multiarch/strcspn-c.c +@@ -1,2 +1,4 @@ +-#define __strcspn_sse2 __strcspn_ia32 +-#include ++#if IS_IN (libc) ++# define __strcspn_sse2 __strcspn_ia32 ++# include ++#endif +diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/i686/multiarch/varshift.c +index 7760b966e2..6742a35d41 100644 +--- a/sysdeps/i386/i686/multiarch/varshift.c ++++ b/sysdeps/i386/i686/multiarch/varshift.c +@@ -1 +1,3 @@ +-#include ++#if IS_IN (libc) ++# include ++#endif +diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c +index db6d721fce..4bb87e2331 100644 +--- a/sysdeps/nptl/fork.c ++++ b/sysdeps/nptl/fork.c +@@ -131,10 +131,6 @@ __libc_fork (void) + call_function_static_weak (__malloc_fork_lock_parent); + } + +-#ifndef NDEBUG +- pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid); +-#endif +- + #ifdef ARCH_FORK + pid = ARCH_FORK (); + #else +@@ -147,8 +143,6 @@ __libc_fork (void) + { + struct pthread *self = THREAD_SELF; + +- assert (THREAD_GETMEM (self, tid) != ppid); +- + /* See __pthread_once. */ + if (__fork_generation_pointer != NULL) + *__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR; +@@ -230,8 +224,6 @@ __libc_fork (void) + } + else + { +- assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid); +- + /* Release acquired locks in the multi-threaded case. */ + if (multiple_threads) + { +diff --git a/sysdeps/unix/sysv/linux/alpha/localplt.data b/sysdeps/unix/sysv/linux/alpha/localplt.data +index cca17f1e34..1f0e3b494e 100644 +--- a/sysdeps/unix/sysv/linux/alpha/localplt.data ++++ b/sysdeps/unix/sysv/linux/alpha/localplt.data +@@ -20,7 +20,7 @@ libc.so: free + RELA R_ALPHA_GLOB_DAT + libc.so: malloc + RELA R_ALPHA_GLOB_DAT + libc.so: memalign + RELA R_ALPHA_GLOB_DAT + libc.so: realloc + RELA R_ALPHA_GLOB_DAT +-libm.so: matherr ++libm.so: matherr + RELA R_ALPHA_GLOB_DAT + # We used to offer inline functions that used this, so it must be exported. + # Ought to reorg things such that carg isn't thus forced to use a plt. + libm.so: __atan2 +diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data +index 2c2584956d..8ea4333846 100644 +--- a/sysdeps/unix/sysv/linux/i386/localplt.data ++++ b/sysdeps/unix/sysv/linux/i386/localplt.data +@@ -6,7 +6,7 @@ libc.so: free + REL R_386_GLOB_DAT + libc.so: malloc + REL R_386_GLOB_DAT + libc.so: memalign + REL R_386_GLOB_DAT + libc.so: realloc + REL R_386_GLOB_DAT +-libm.so: matherr ++libm.so: matherr + REL R_386_GLOB_DAT + # The main malloc is interposed into the dynamic linker, for + # allocations after the initial link (when dlopen is used). + ld.so: malloc + REL R_386_GLOB_DAT +diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c +index 2daf0c5ef0..29d8f25ab5 100644 +--- a/sysdeps/unix/sysv/linux/spawni.c ++++ b/sysdeps/unix/sysv/linux/spawni.c +@@ -61,17 +61,18 @@ + #define SPAWN_ERROR 127 + + #ifdef __ia64__ +-# define CLONE(__fn, __stack, __stacksize, __flags, __args) \ +- __clone2 (__fn, __stack, __stacksize, __flags, __args, 0, 0, 0) ++# define CLONE(__fn, __stackbase, __stacksize, __flags, __args) \ ++ __clone2 (__fn, __stackbase, __stacksize, __flags, __args, 0, 0, 0) + #else + # define CLONE(__fn, __stack, __stacksize, __flags, __args) \ + __clone (__fn, __stack, __flags, __args) + #endif + +-#if _STACK_GROWS_DOWN +-# define STACK(__stack, __stack_size) (__stack + __stack_size) +-#elif _STACK_GROWS_UP ++/* Since ia64 wants the stackbase w/clone2, re-use the grows-up macro. */ ++#if _STACK_GROWS_UP || defined (__ia64__) + # define STACK(__stack, __stack_size) (__stack) ++#elif _STACK_GROWS_DOWN ++# define STACK(__stack, __stack_size) (__stack + __stack_size) + #endif + + +@@ -318,6 +319,11 @@ __spawnix (pid_t * pid, const char *file, + + /* Add a slack area for child's stack. */ + size_t argv_size = (argc * sizeof (void *)) + 512; ++ /* We need at least a few pages in case the compiler's stack checking is ++ enabled. In some configs, it is known to use at least 24KiB. We use ++ 32KiB to be "safe" from anything the compiler might do. Besides, the ++ extra pages won't actually be allocated unless they get used. */ ++ argv_size += (32 * 1024); + size_t stack_size = ALIGN_UP (argv_size, GLRO(dl_pagesize)); + void *stack = __mmap (NULL, stack_size, prot, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); +diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c +index 1c714a4017..9afd74c42e 100644 +--- a/sysdeps/x86/cpu-features.c ++++ b/sysdeps/x86/cpu-features.c +@@ -139,8 +139,6 @@ init_cpu_features (struct cpu_features *cpu_features) + + case 0x57: + /* Knights Landing. Enable Silvermont optimizations. */ +- cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] +- |= bit_arch_Prefer_No_VZEROUPPER; + + case 0x5c: + case 0x5f: +@@ -226,6 +224,16 @@ init_cpu_features (struct cpu_features *cpu_features) + cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load] + |= bit_arch_AVX_Fast_Unaligned_Load; + ++ /* Since AVX512ER is unique to Xeon Phi, set Prefer_No_VZEROUPPER ++ if AVX512ER is available. Don't use AVX512 to avoid lower CPU ++ frequency if AVX512ER isn't available. */ ++ if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER)) ++ cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] ++ |= bit_arch_Prefer_No_VZEROUPPER; ++ else ++ cpu_features->feature[index_arch_Prefer_No_AVX512] ++ |= bit_arch_Prefer_No_AVX512; ++ + /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow. + If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */ + cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow] +diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h +index 95f0fcff87..a409db67d8 100644 +--- a/sysdeps/x86/cpu-features.h ++++ b/sysdeps/x86/cpu-features.h +@@ -39,6 +39,7 @@ + #define bit_arch_Prefer_ERMS (1 << 19) + #define bit_arch_Use_dl_runtime_resolve_opt (1 << 20) + #define bit_arch_Use_dl_runtime_resolve_slow (1 << 21) ++#define bit_arch_Prefer_No_AVX512 (1 << 22) + + /* CPUID Feature flags. */ + +@@ -62,6 +63,11 @@ + #define bit_cpu_AVX2 (1 << 5) + #define bit_cpu_AVX512F (1 << 16) + #define bit_cpu_AVX512DQ (1 << 17) ++#define bit_cpu_AVX512PF (1 << 26) ++#define bit_cpu_AVX512ER (1 << 27) ++#define bit_cpu_AVX512CD (1 << 28) ++#define bit_cpu_AVX512BW (1 << 30) ++#define bit_cpu_AVX512VL (1u << 31) + + /* XCR0 Feature flags. */ + #define bit_XMM_state (1 << 1) +@@ -111,6 +117,7 @@ + # define index_arch_Prefer_ERMS FEATURE_INDEX_1*FEATURE_SIZE + # define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1*FEATURE_SIZE + # define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1*FEATURE_SIZE ++# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1*FEATURE_SIZE + + + # if defined (_LIBC) && !IS_IN (nonlib) +@@ -236,6 +243,11 @@ extern const struct cpu_features *__get_cpu_features (void) + # define index_cpu_AVX2 COMMON_CPUID_INDEX_7 + # define index_cpu_AVX512F COMMON_CPUID_INDEX_7 + # define index_cpu_AVX512DQ COMMON_CPUID_INDEX_7 ++# define index_cpu_AVX512PF COMMON_CPUID_INDEX_7 ++# define index_cpu_AVX512ER COMMON_CPUID_INDEX_7 ++# define index_cpu_AVX512CD COMMON_CPUID_INDEX_7 ++# define index_cpu_AVX512BW COMMON_CPUID_INDEX_7 ++# define index_cpu_AVX512VL COMMON_CPUID_INDEX_7 + # define index_cpu_ERMS COMMON_CPUID_INDEX_7 + # define index_cpu_RTM COMMON_CPUID_INDEX_7 + # define index_cpu_FMA COMMON_CPUID_INDEX_1 +@@ -254,6 +266,11 @@ extern const struct cpu_features *__get_cpu_features (void) + # define reg_AVX2 ebx + # define reg_AVX512F ebx + # define reg_AVX512DQ ebx ++# define reg_AVX512PF ebx ++# define reg_AVX512ER ebx ++# define reg_AVX512CD ebx ++# define reg_AVX512BW ebx ++# define reg_AVX512VL ebx + # define reg_ERMS ebx + # define reg_RTM ebx + # define reg_FMA ecx +@@ -283,6 +300,7 @@ extern const struct cpu_features *__get_cpu_features (void) + # define index_arch_Prefer_ERMS FEATURE_INDEX_1 + # define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1 + # define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1 ++# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1 + + #endif /* !__ASSEMBLER__ */ + +diff --git a/sysdeps/x86/fpu/test-math-vector-sincos.h b/sysdeps/x86/fpu/test-math-vector-sincos.h +index 5043b32563..95282a3ac7 100644 +--- a/sysdeps/x86/fpu/test-math-vector-sincos.h ++++ b/sysdeps/x86/fpu/test-math-vector-sincos.h +@@ -17,14 +17,14 @@ + License along with the GNU C Library; if not, see + . */ + +-#define INIT_VEC_PTRS_LOOP(vec, val, len) \ +- do \ +- { \ +- for (i = 0; i < len; i++) \ +- { \ +- vec[i] = &val[i]; \ +- } \ +- } \ ++#define INIT_VEC_PTRS_LOOP(vec, val, len) \ ++ do \ ++ { \ ++ union { VEC_INT_TYPE v; __typeof__ ((val)[0]) *a[(len)]; } u; \ ++ for (i = 0; i < len; i++) \ ++ u.a[i] = &(val)[i]; \ ++ (vec) = u.v; \ ++ } \ + while (0) + + /* Wrapper for vector sincos/sincosf compatible with x86_64 and x32 variants +@@ -40,8 +40,8 @@ void scalar_func (FLOAT x, FLOAT * r, FLOAT * r1) \ + VEC_TYPE mx; \ + VEC_INT_TYPE mr, mr1; \ + INIT_VEC_LOOP (mx, x, VEC_LEN); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr), r_loc, VEC_LEN); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr1), r1_loc, VEC_LEN); \ ++ INIT_VEC_PTRS_LOOP (mr, r_loc, VEC_LEN); \ ++ INIT_VEC_PTRS_LOOP (mr1, r1_loc, VEC_LEN); \ + vector_func (mx, mr, mr1); \ + TEST_VEC_LOOP (r_loc, VEC_LEN); \ + TEST_VEC_LOOP (r1_loc, VEC_LEN); \ +@@ -63,8 +63,8 @@ void scalar_func (FLOAT x, FLOAT * r, FLOAT * r1) \ + VEC_TYPE mx; \ + VEC_INT_TYPE mr, mr1; \ + INIT_VEC_LOOP (mx, x, VEC_LEN); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr), r_loc, VEC_LEN/2); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr1), r1_loc, VEC_LEN/2); \ ++ INIT_VEC_PTRS_LOOP (mr, r_loc, VEC_LEN/2); \ ++ INIT_VEC_PTRS_LOOP (mr1, r1_loc, VEC_LEN/2); \ + vector_func (mx, mr, mr, mr1, mr1); \ + TEST_VEC_LOOP (r_loc, VEC_LEN/2); \ + TEST_VEC_LOOP (r1_loc, VEC_LEN/2); \ +@@ -87,8 +87,8 @@ void scalar_func (FLOAT x, FLOAT * r, FLOAT * r1) \ + VEC_TYPE mx; \ + VEC_INT_TYPE mr, mr1; \ + INIT_VEC_LOOP (mx, x, VEC_LEN); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr), r_loc, VEC_LEN/4); \ +- INIT_VEC_PTRS_LOOP (((FLOAT **) &mr1), r1_loc, VEC_LEN/4); \ ++ INIT_VEC_PTRS_LOOP (mr, r_loc, VEC_LEN/4); \ ++ INIT_VEC_PTRS_LOOP (mr1, r1_loc, VEC_LEN/4); \ + vector_func (mx, mr, mr, mr, mr, mr1, mr1, mr1, mr1); \ + TEST_VEC_LOOP (r_loc, VEC_LEN/4); \ + TEST_VEC_LOOP (r1_loc, VEC_LEN/4); \ +diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S +index 33d7fcf7d0..c14c61aa58 100644 +--- a/sysdeps/x86_64/dl-trampoline.S ++++ b/sysdeps/x86_64/dl-trampoline.S +@@ -87,11 +87,9 @@ + #endif + #define VEC(i) zmm##i + #define _dl_runtime_resolve _dl_runtime_resolve_avx512 +-#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt + #define _dl_runtime_profile _dl_runtime_profile_avx512 + #include "dl-trampoline.h" + #undef _dl_runtime_resolve +-#undef _dl_runtime_resolve_opt + #undef _dl_runtime_profile + #undef VEC + #undef VMOV +@@ -145,4 +143,5 @@ + # define VMOV vmovdqu + #endif + #define _dl_runtime_resolve _dl_runtime_resolve_sse_vex ++#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt + #include "dl-trampoline.h" +diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h +index b27fa06974..8db24c16ac 100644 +--- a/sysdeps/x86_64/dl-trampoline.h ++++ b/sysdeps/x86_64/dl-trampoline.h +@@ -129,19 +129,20 @@ _dl_runtime_resolve_opt: + # YMM state isn't in use. + PRESERVE_BND_REGS_PREFIX + jz _dl_runtime_resolve_sse_vex +-# elif VEC_SIZE == 64 ++# elif VEC_SIZE == 16 + # For ZMM registers, check if YMM state and ZMM state are in + # use. + andl $(bit_YMM_state | bit_ZMM0_15_state), %r11d + cmpl $bit_YMM_state, %r11d +- # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if +- # neither YMM state nor ZMM state are in use. ++ # Preserve %zmm0 - %zmm7 registers if ZMM state is in use. + PRESERVE_BND_REGS_PREFIX +- jl _dl_runtime_resolve_sse_vex ++ jg _dl_runtime_resolve_avx512 + # Preserve %ymm0 - %ymm7 registers with the zero upper 256 bits if + # ZMM state isn't in use. + PRESERVE_BND_REGS_PREFIX + je _dl_runtime_resolve_avx ++ # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if ++ # neither YMM state nor ZMM state are in use. + # else + # error Unsupported VEC_SIZE! + # endif +diff --git a/sysdeps/x86_64/localplt.data b/sysdeps/x86_64/localplt.data +index 014a9f4554..a1840cff31 100644 +--- a/sysdeps/x86_64/localplt.data ++++ b/sysdeps/x86_64/localplt.data +@@ -8,7 +8,7 @@ libc.so: free + RELA R_X86_64_GLOB_DAT + libc.so: malloc + RELA R_X86_64_GLOB_DAT + libc.so: memalign + RELA R_X86_64_GLOB_DAT + libc.so: realloc + RELA R_X86_64_GLOB_DAT +-libm.so: matherr ++libm.so: matherr + RELA R_X86_64_GLOB_DAT + # The main malloc is interposed into the dynamic linker, for + # allocations after the initial link (when dlopen is used). + ld.so: malloc + RELA R_X86_64_GLOB_DAT +diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S +index f8a9260e6e..f912291576 100644 +--- a/sysdeps/x86_64/mempcpy_chk.S ++++ b/sysdeps/x86_64/mempcpy_chk.S +@@ -19,7 +19,7 @@ + #include + #include "asm-syntax.h" + +-#ifndef PIC ++#ifndef SHARED + /* For libc.so this is defined in memcpy.S. + For libc.a, this is a separate source to avoid + mempcpy bringing in __chk_fail and all routines +diff --git a/sysdeps/x86_64/multiarch/memcpy.S b/sysdeps/x86_64/multiarch/memcpy.S +index 1f83ee3e84..af2770397c 100644 +--- a/sysdeps/x86_64/multiarch/memcpy.S ++++ b/sysdeps/x86_64/multiarch/memcpy.S +@@ -32,6 +32,8 @@ ENTRY(__new_memcpy) + lea __memcpy_erms(%rip), %RAX_LP + HAS_ARCH_FEATURE (Prefer_ERMS) + jnz 2f ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __memcpy_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/memcpy_chk.S b/sysdeps/x86_64/multiarch/memcpy_chk.S +index 54923420f1..8737fb9755 100644 +--- a/sysdeps/x86_64/multiarch/memcpy_chk.S ++++ b/sysdeps/x86_64/multiarch/memcpy_chk.S +@@ -30,6 +30,8 @@ + ENTRY(__memcpy_chk) + .type __memcpy_chk, @gnu_indirect_function + LOAD_RTLD_GLOBAL_RO_RDX ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __memcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/memmove.S b/sysdeps/x86_64/multiarch/memmove.S +index 2021bfc30c..8c534e83e0 100644 +--- a/sysdeps/x86_64/multiarch/memmove.S ++++ b/sysdeps/x86_64/multiarch/memmove.S +@@ -30,6 +30,8 @@ ENTRY(__libc_memmove) + lea __memmove_erms(%rip), %RAX_LP + HAS_ARCH_FEATURE (Prefer_ERMS) + jnz 2f ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __memmove_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/memmove_chk.S b/sysdeps/x86_64/multiarch/memmove_chk.S +index 8a252adcae..7870dd0247 100644 +--- a/sysdeps/x86_64/multiarch/memmove_chk.S ++++ b/sysdeps/x86_64/multiarch/memmove_chk.S +@@ -29,6 +29,8 @@ + ENTRY(__memmove_chk) + .type __memmove_chk, @gnu_indirect_function + LOAD_RTLD_GLOBAL_RO_RDX ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __memmove_chk_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/mempcpy.S b/sysdeps/x86_64/multiarch/mempcpy.S +index 79c840d075..b8b2b28094 100644 +--- a/sysdeps/x86_64/multiarch/mempcpy.S ++++ b/sysdeps/x86_64/multiarch/mempcpy.S +@@ -32,6 +32,8 @@ ENTRY(__mempcpy) + lea __mempcpy_erms(%rip), %RAX_LP + HAS_ARCH_FEATURE (Prefer_ERMS) + jnz 2f ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __mempcpy_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.S b/sysdeps/x86_64/multiarch/mempcpy_chk.S +index 6927962e81..072b22c49f 100644 +--- a/sysdeps/x86_64/multiarch/mempcpy_chk.S ++++ b/sysdeps/x86_64/multiarch/mempcpy_chk.S +@@ -30,6 +30,8 @@ + ENTRY(__mempcpy_chk) + .type __mempcpy_chk, @gnu_indirect_function + LOAD_RTLD_GLOBAL_RO_RDX ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 1f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 1f + lea __mempcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/memset.S b/sysdeps/x86_64/multiarch/memset.S +index c958b2f49f..9d33118cf8 100644 +--- a/sysdeps/x86_64/multiarch/memset.S ++++ b/sysdeps/x86_64/multiarch/memset.S +@@ -41,6 +41,8 @@ ENTRY(memset) + jnz L(AVX512F) + lea __memset_avx2_unaligned(%rip), %RAX_LP + L(AVX512F): ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 2f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 2f + lea __memset_avx512_no_vzeroupper(%rip), %RAX_LP +diff --git a/sysdeps/x86_64/multiarch/memset_chk.S b/sysdeps/x86_64/multiarch/memset_chk.S +index 79eaa37bb6..7e08311cdf 100644 +--- a/sysdeps/x86_64/multiarch/memset_chk.S ++++ b/sysdeps/x86_64/multiarch/memset_chk.S +@@ -38,6 +38,8 @@ ENTRY(__memset_chk) + jnz L(AVX512F) + lea __memset_chk_avx2_unaligned(%rip), %RAX_LP + L(AVX512F): ++ HAS_ARCH_FEATURE (Prefer_No_AVX512) ++ jnz 2f + HAS_ARCH_FEATURE (AVX512F_Usable) + jz 2f + lea __memset_chk_avx512_no_vzeroupper(%rip), %RAX_LP diff --git a/glibc/.footprint b/glibc/.footprint index 71e1426e..3c52cf5c 100644 --- a/glibc/.footprint +++ b/glibc/.footprint @@ -10,53 +10,47 @@ lrwxrwxrwx root/root etc/localtime -> ../usr/share/zoneinfo/UTC -rw-r--r-- root/root etc/resolv.conf -rw-r--r-- root/root etc/rpc drwxr-xr-x root/root lib/ --rwxr-xr-x root/root lib/ld-2.24.so -lrwxrwxrwx root/root lib/ld-linux-x86-64.so.2 -> ld-2.24.so --rwxr-xr-x root/root lib/libBrokenLocale-2.24.so -lrwxrwxrwx root/root lib/libBrokenLocale.so.1 -> libBrokenLocale-2.24.so +-rwxr-xr-x root/root lib/ld-2.26.so +lrwxrwxrwx root/root lib/ld-linux-x86-64.so.2 -> ld-2.26.so +-rwxr-xr-x root/root lib/libBrokenLocale-2.26.so +lrwxrwxrwx root/root lib/libBrokenLocale.so.1 -> libBrokenLocale-2.26.so -rwxr-xr-x root/root lib/libSegFault.so --rwxr-xr-x root/root lib/libanl-2.24.so -lrwxrwxrwx root/root lib/libanl.so.1 -> libanl-2.24.so --rwxr-xr-x root/root lib/libc-2.24.so -lrwxrwxrwx root/root lib/libc.so.6 -> libc-2.24.so --rwxr-xr-x root/root lib/libcidn-2.24.so -lrwxrwxrwx root/root lib/libcidn.so.1 -> libcidn-2.24.so --rwxr-xr-x root/root lib/libcrypt-2.24.so -lrwxrwxrwx root/root lib/libcrypt.so.1 -> libcrypt-2.24.so --rwxr-xr-x root/root lib/libdl-2.24.so -lrwxrwxrwx root/root lib/libdl.so.2 -> libdl-2.24.so --rwxr-xr-x root/root lib/libm-2.24.so -lrwxrwxrwx root/root lib/libm.so.6 -> libm-2.24.so +-rwxr-xr-x root/root lib/libanl-2.26.so +lrwxrwxrwx root/root lib/libanl.so.1 -> libanl-2.26.so +-rwxr-xr-x root/root lib/libc-2.26.so +lrwxrwxrwx root/root lib/libc.so.6 -> libc-2.26.so +-rwxr-xr-x root/root lib/libcidn-2.26.so +lrwxrwxrwx root/root lib/libcidn.so.1 -> libcidn-2.26.so +-rwxr-xr-x root/root lib/libcrypt-2.26.so +lrwxrwxrwx root/root lib/libcrypt.so.1 -> libcrypt-2.26.so +-rwxr-xr-x root/root lib/libdl-2.26.so +lrwxrwxrwx root/root lib/libdl.so.2 -> libdl-2.26.so +-rwxr-xr-x root/root lib/libm-2.26.so +lrwxrwxrwx root/root lib/libm.so.6 -> libm-2.26.so -rwxr-xr-x root/root lib/libmemusage.so --rwxr-xr-x root/root lib/libmvec-2.24.so -lrwxrwxrwx root/root lib/libmvec.so.1 -> libmvec-2.24.so --rwxr-xr-x root/root lib/libnsl-2.24.so -lrwxrwxrwx root/root lib/libnsl.so.1 -> libnsl-2.24.so --rwxr-xr-x root/root lib/libnss_compat-2.24.so -lrwxrwxrwx root/root lib/libnss_compat.so.2 -> libnss_compat-2.24.so --rwxr-xr-x root/root lib/libnss_db-2.24.so -lrwxrwxrwx root/root lib/libnss_db.so.2 -> libnss_db-2.24.so --rwxr-xr-x root/root lib/libnss_dns-2.24.so -lrwxrwxrwx root/root lib/libnss_dns.so.2 -> libnss_dns-2.24.so --rwxr-xr-x root/root lib/libnss_files-2.24.so -lrwxrwxrwx root/root lib/libnss_files.so.2 -> libnss_files-2.24.so --rwxr-xr-x root/root lib/libnss_hesiod-2.24.so -lrwxrwxrwx root/root lib/libnss_hesiod.so.2 -> libnss_hesiod-2.24.so --rwxr-xr-x root/root lib/libnss_nis-2.24.so -lrwxrwxrwx root/root lib/libnss_nis.so.2 -> libnss_nis-2.24.so --rwxr-xr-x root/root lib/libnss_nisplus-2.24.so -lrwxrwxrwx root/root lib/libnss_nisplus.so.2 -> libnss_nisplus-2.24.so +-rwxr-xr-x root/root lib/libmvec-2.26.so +lrwxrwxrwx root/root lib/libmvec.so.1 -> libmvec-2.26.so +-rwxr-xr-x root/root lib/libnsl-2.26.so +lrwxrwxrwx root/root lib/libnsl.so.1 -> libnsl-2.26.so +-rwxr-xr-x root/root lib/libnss_db-2.26.so +lrwxrwxrwx root/root lib/libnss_db.so.2 -> libnss_db-2.26.so +-rwxr-xr-x root/root lib/libnss_dns-2.26.so +lrwxrwxrwx root/root lib/libnss_dns.so.2 -> libnss_dns-2.26.so +-rwxr-xr-x root/root lib/libnss_files-2.26.so +lrwxrwxrwx root/root lib/libnss_files.so.2 -> libnss_files-2.26.so +-rwxr-xr-x root/root lib/libnss_hesiod-2.26.so +lrwxrwxrwx root/root lib/libnss_hesiod.so.2 -> libnss_hesiod-2.26.so -rwxr-xr-x root/root lib/libpcprofile.so --rwxr-xr-x root/root lib/libpthread-2.24.so -lrwxrwxrwx root/root lib/libpthread.so.0 -> libpthread-2.24.so --rwxr-xr-x root/root lib/libresolv-2.24.so -lrwxrwxrwx root/root lib/libresolv.so.2 -> libresolv-2.24.so --rwxr-xr-x root/root lib/librt-2.24.so -lrwxrwxrwx root/root lib/librt.so.1 -> librt-2.24.so +-rwxr-xr-x root/root lib/libpthread-2.26.so +lrwxrwxrwx root/root lib/libpthread.so.0 -> libpthread-2.26.so +-rwxr-xr-x root/root lib/libresolv-2.26.so +lrwxrwxrwx root/root lib/libresolv.so.2 -> libresolv-2.26.so +-rwxr-xr-x root/root lib/librt-2.26.so +lrwxrwxrwx root/root lib/librt.so.1 -> librt-2.26.so -rwxr-xr-x root/root lib/libthread_db-1.0.so lrwxrwxrwx root/root lib/libthread_db.so.1 -> libthread_db-1.0.so --rwxr-xr-x root/root lib/libutil-2.24.so -lrwxrwxrwx root/root lib/libutil.so.1 -> libutil-2.24.so +-rwxr-xr-x root/root lib/libutil-2.26.so +lrwxrwxrwx root/root lib/libutil.so.1 -> libutil-2.26.so drwxr-xr-x root/root sbin/ -rwxr-xr-x root/root sbin/ldconfig -rwxr-xr-x root/root sbin/sln @@ -200,6 +194,7 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/byteswap.h -rw-r--r-- root/root usr/include/bits/cmathcalls.h -rw-r--r-- root/root usr/include/bits/confname.h +-rw-r--r-- root/root usr/include/bits/cpu-set.h -rw-r--r-- root/root usr/include/bits/dirent.h -rw-r--r-- root/root usr/include/bits/dlfcn.h -rw-r--r-- root/root usr/include/bits/elfclass.h @@ -214,7 +209,15 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/fcntl2.h -rw-r--r-- root/root usr/include/bits/fenv.h -rw-r--r-- root/root usr/include/bits/fenvinline.h +-rw-r--r-- root/root usr/include/bits/floatn.h +-rw-r--r-- root/root usr/include/bits/flt-eval-method.h +-rw-r--r-- root/root usr/include/bits/fp-fast.h +-rw-r--r-- root/root usr/include/bits/fp-logb.h +-rw-r--r-- root/root usr/include/bits/getopt_core.h +-rw-r--r-- root/root usr/include/bits/getopt_ext.h +-rw-r--r-- root/root usr/include/bits/getopt_posix.h -rw-r--r-- root/root usr/include/bits/huge_val.h +-rw-r--r-- root/root usr/include/bits/huge_val_flt128.h -rw-r--r-- root/root usr/include/bits/huge_valf.h -rw-r--r-- root/root usr/include/bits/huge_vall.h -rw-r--r-- root/root usr/include/bits/hwcap.h @@ -226,13 +229,17 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/ioctls.h -rw-r--r-- root/root usr/include/bits/ipc.h -rw-r--r-- root/root usr/include/bits/ipctypes.h +-rw-r--r-- root/root usr/include/bits/iscanonical.h +-rw-r--r-- root/root usr/include/bits/libc-header-start.h -rw-r--r-- root/root usr/include/bits/libio-ldbl.h -rw-r--r-- root/root usr/include/bits/libm-simd-decl-stubs.h -rw-r--r-- root/root usr/include/bits/link.h -rw-r--r-- root/root usr/include/bits/local_lim.h -rw-r--r-- root/root usr/include/bits/locale.h +-rw-r--r-- root/root usr/include/bits/long-double.h -rw-r--r-- root/root usr/include/bits/math-finite.h -rw-r--r-- root/root usr/include/bits/math-vector.h +-rw-r--r-- root/root usr/include/bits/mathcalls-helper-functions.h -rw-r--r-- root/root usr/include/bits/mathcalls.h -rw-r--r-- root/root usr/include/bits/mathdef.h -rw-r--r-- root/root usr/include/bits/mathinline.h @@ -251,6 +258,7 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/posix2_lim.h -rw-r--r-- root/root usr/include/bits/posix_opt.h -rw-r--r-- root/root usr/include/bits/printf-ldbl.h +-rw-r--r-- root/root usr/include/bits/pthreadtypes-arch.h -rw-r--r-- root/root usr/include/bits/pthreadtypes.h -rw-r--r-- root/root usr/include/bits/resource.h -rw-r--r-- root/root usr/include/bits/sched.h @@ -263,20 +271,26 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/shm.h -rw-r--r-- root/root usr/include/bits/sigaction.h -rw-r--r-- root/root usr/include/bits/sigcontext.h --rw-r--r-- root/root usr/include/bits/siginfo.h +-rw-r--r-- root/root usr/include/bits/sigevent-consts.h +-rw-r--r-- root/root usr/include/bits/siginfo-arch.h +-rw-r--r-- root/root usr/include/bits/siginfo-consts-arch.h +-rw-r--r-- root/root usr/include/bits/siginfo-consts.h -rw-r--r-- root/root usr/include/bits/signalfd.h +-rw-r--r-- root/root usr/include/bits/signum-generic.h -rw-r--r-- root/root usr/include/bits/signum.h --rw-r--r-- root/root usr/include/bits/sigset.h -rw-r--r-- root/root usr/include/bits/sigstack.h -rw-r--r-- root/root usr/include/bits/sigthread.h -rw-r--r-- root/root usr/include/bits/sockaddr.h -rw-r--r-- root/root usr/include/bits/socket.h -rw-r--r-- root/root usr/include/bits/socket2.h -rw-r--r-- root/root usr/include/bits/socket_type.h +-rw-r--r-- root/root usr/include/bits/ss_flags.h -rw-r--r-- root/root usr/include/bits/stab.def -rw-r--r-- root/root usr/include/bits/stat.h -rw-r--r-- root/root usr/include/bits/statfs.h -rw-r--r-- root/root usr/include/bits/statvfs.h +-rw-r--r-- root/root usr/include/bits/stdint-intn.h +-rw-r--r-- root/root usr/include/bits/stdint-uintn.h -rw-r--r-- root/root usr/include/bits/stdio-ldbl.h -rw-r--r-- root/root usr/include/bits/stdio.h -rw-r--r-- root/root usr/include/bits/stdio2.h @@ -285,9 +299,8 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/stdlib-float.h -rw-r--r-- root/root usr/include/bits/stdlib-ldbl.h -rw-r--r-- root/root usr/include/bits/stdlib.h --rw-r--r-- root/root usr/include/bits/string.h --rw-r--r-- root/root usr/include/bits/string2.h --rw-r--r-- root/root usr/include/bits/string3.h +-rw-r--r-- root/root usr/include/bits/string_fortified.h +-rw-r--r-- root/root usr/include/bits/strings_fortified.h -rw-r--r-- root/root usr/include/bits/stropts.h -rw-r--r-- root/root usr/include/bits/sys_errlist.h -rw-r--r-- root/root usr/include/bits/syscall.h @@ -295,13 +308,45 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/syslog-ldbl.h -rw-r--r-- root/root usr/include/bits/syslog-path.h -rw-r--r-- root/root usr/include/bits/syslog.h +-rw-r--r-- root/root usr/include/bits/sysmacros.h -rw-r--r-- root/root usr/include/bits/termios.h +-rw-r--r-- root/root usr/include/bits/thread-shared-types.h -rw-r--r-- root/root usr/include/bits/time.h -rw-r--r-- root/root usr/include/bits/timerfd.h -rw-r--r-- root/root usr/include/bits/timex.h -rw-r--r-- root/root usr/include/bits/types.h +drwxr-xr-x root/root usr/include/bits/types/ +-rw-r--r-- root/root usr/include/bits/types/FILE.h +-rw-r--r-- root/root usr/include/bits/types/__FILE.h +-rw-r--r-- root/root usr/include/bits/types/__locale_t.h +-rw-r--r-- root/root usr/include/bits/types/__mbstate_t.h +-rw-r--r-- root/root usr/include/bits/types/__sigset_t.h +-rw-r--r-- root/root usr/include/bits/types/clock_t.h +-rw-r--r-- root/root usr/include/bits/types/clockid_t.h +-rw-r--r-- root/root usr/include/bits/types/locale_t.h +-rw-r--r-- root/root usr/include/bits/types/mbstate_t.h +-rw-r--r-- root/root usr/include/bits/types/res_state.h +-rw-r--r-- root/root usr/include/bits/types/sig_atomic_t.h +-rw-r--r-- root/root usr/include/bits/types/sigevent_t.h +-rw-r--r-- root/root usr/include/bits/types/siginfo_t.h +-rw-r--r-- root/root usr/include/bits/types/sigset_t.h +-rw-r--r-- root/root usr/include/bits/types/sigval_t.h +-rw-r--r-- root/root usr/include/bits/types/stack_t.h +-rw-r--r-- root/root usr/include/bits/types/struct_iovec.h +-rw-r--r-- root/root usr/include/bits/types/struct_itimerspec.h +-rw-r--r-- root/root usr/include/bits/types/struct_osockaddr.h +-rw-r--r-- root/root usr/include/bits/types/struct_rusage.h +-rw-r--r-- root/root usr/include/bits/types/struct_sigstack.h +-rw-r--r-- root/root usr/include/bits/types/struct_timespec.h +-rw-r--r-- root/root usr/include/bits/types/struct_timeval.h +-rw-r--r-- root/root usr/include/bits/types/struct_tm.h +-rw-r--r-- root/root usr/include/bits/types/time_t.h +-rw-r--r-- root/root usr/include/bits/types/timer_t.h +-rw-r--r-- root/root usr/include/bits/types/wint_t.h -rw-r--r-- root/root usr/include/bits/typesizes.h --rw-r--r-- root/root usr/include/bits/uio.h +-rw-r--r-- root/root usr/include/bits/uintn-identity.h +-rw-r--r-- root/root usr/include/bits/uio-ext.h +-rw-r--r-- root/root usr/include/bits/uio_lim.h -rw-r--r-- root/root usr/include/bits/unistd.h -rw-r--r-- root/root usr/include/bits/ustat.h -rw-r--r-- root/root usr/include/bits/utmp.h @@ -312,6 +357,7 @@ drwxr-xr-x root/root usr/include/bits/ -rw-r--r-- root/root usr/include/bits/wchar-ldbl.h -rw-r--r-- root/root usr/include/bits/wchar.h -rw-r--r-- root/root usr/include/bits/wchar2.h +-rw-r--r-- root/root usr/include/bits/wctype-wchar.h -rw-r--r-- root/root usr/include/bits/wordsize.h -rw-r--r-- root/root usr/include/bits/xopen_lim.h -rw-r--r-- root/root usr/include/bits/xtitypes.h @@ -1108,6 +1154,7 @@ drwxr-xr-x root/root usr/include/nfs/ -rw-r--r-- root/root usr/include/paths.h -rw-r--r-- root/root usr/include/poll.h -rw-r--r-- root/root usr/include/printf.h +-rw-r--r-- root/root usr/include/proc_service.h drwxr-xr-x root/root usr/include/protocols/ -rw-r--r-- root/root usr/include/protocols/routed.h -rw-r--r-- root/root usr/include/protocols/rwhod.h @@ -1167,13 +1214,6 @@ drwxr-xr-x root/root usr/include/rpcsvc/ -rw-r--r-- root/root usr/include/rpcsvc/mount.x -rw-r--r-- root/root usr/include/rpcsvc/nfs_prot.h -rw-r--r-- root/root usr/include/rpcsvc/nfs_prot.x --rw-r--r-- root/root usr/include/rpcsvc/nis.h --rw-r--r-- root/root usr/include/rpcsvc/nis.x --rw-r--r-- root/root usr/include/rpcsvc/nis_callback.h --rw-r--r-- root/root usr/include/rpcsvc/nis_callback.x --rw-r--r-- root/root usr/include/rpcsvc/nis_object.x --rw-r--r-- root/root usr/include/rpcsvc/nis_tags.h --rw-r--r-- root/root usr/include/rpcsvc/nislib.h -rw-r--r-- root/root usr/include/rpcsvc/nlm_prot.h -rw-r--r-- root/root usr/include/rpcsvc/nlm_prot.x -rw-r--r-- root/root usr/include/rpcsvc/rex.h @@ -1279,6 +1319,7 @@ drwxr-xr-x root/root usr/include/sys/ -rw-r--r-- root/root usr/include/sys/ptrace.h -rw-r--r-- root/root usr/include/sys/queue.h -rw-r--r-- root/root usr/include/sys/quota.h +-rw-r--r-- root/root usr/include/sys/random.h -rw-r--r-- root/root usr/include/sys/raw.h -rw-r--r-- root/root usr/include/sys/reboot.h -rw-r--r-- root/root usr/include/sys/reg.h @@ -1313,7 +1354,6 @@ drwxr-xr-x root/root usr/include/sys/ -rw-r--r-- root/root usr/include/sys/types.h -rw-r--r-- root/root usr/include/sys/ucontext.h -rw-r--r-- root/root usr/include/sys/uio.h --rw-r--r-- root/root usr/include/sys/ultrasound.h -rw-r--r-- root/root usr/include/sys/un.h -rw-r--r-- root/root usr/include/sys/unistd.h -rw-r--r-- root/root usr/include/sys/user.h @@ -1359,7 +1399,6 @@ drwxr-xr-x root/root usr/include/xen/ -rw-r--r-- root/root usr/include/xen/gntalloc.h -rw-r--r-- root/root usr/include/xen/gntdev.h -rw-r--r-- root/root usr/include/xen/privcmd.h --rw-r--r-- root/root usr/include/xlocale.h drwxr-xr-x root/root usr/lib/ -rw-r--r-- root/root usr/lib/Mcrt1.o -rw-r--r-- root/root usr/lib/Scrt1.o @@ -1641,6 +1680,7 @@ lrwxrwxrwx root/root usr/lib/libcrypt.so -> ../../lib/libcrypt.so.1 lrwxrwxrwx root/root usr/lib/libdl.so -> ../../lib/libdl.so.2 -rw-r--r-- root/root usr/lib/libg.a -rw-r--r-- root/root usr/lib/libieee.a +-rw-r--r-- root/root usr/lib/libm-2.26.a -rw-r--r-- root/root usr/lib/libm.a -rw-r--r-- root/root usr/lib/libm.so -rw-r--r-- root/root usr/lib/libmcheck.a @@ -1649,13 +1689,10 @@ lrwxrwxrwx root/root usr/lib/libmvec.so -> ../../lib/libmvec.so.1 -rw-r--r-- root/root usr/lib/libmvec_nonshared.a -rw-r--r-- root/root usr/lib/libnsl.a lrwxrwxrwx root/root usr/lib/libnsl.so -> ../../lib/libnsl.so.1 -lrwxrwxrwx root/root usr/lib/libnss_compat.so -> ../../lib/libnss_compat.so.2 lrwxrwxrwx root/root usr/lib/libnss_db.so -> ../../lib/libnss_db.so.2 lrwxrwxrwx root/root usr/lib/libnss_dns.so -> ../../lib/libnss_dns.so.2 lrwxrwxrwx root/root usr/lib/libnss_files.so -> ../../lib/libnss_files.so.2 lrwxrwxrwx root/root usr/lib/libnss_hesiod.so -> ../../lib/libnss_hesiod.so.2 -lrwxrwxrwx root/root usr/lib/libnss_nis.so -> ../../lib/libnss_nis.so.2 -lrwxrwxrwx root/root usr/lib/libnss_nisplus.so -> ../../lib/libnss_nisplus.so.2 -rw-r--r-- root/root usr/lib/libpthread.a -rw-r--r-- root/root usr/lib/libpthread.so -rw-r--r-- root/root usr/lib/libpthread_nonshared.a @@ -1913,6 +1950,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/aa_ER@saaho -rw-r--r-- root/root usr/share/i18n/locales/aa_ET -rw-r--r-- root/root usr/share/i18n/locales/af_ZA +-rw-r--r-- root/root usr/share/i18n/locales/agr_PE -rw-r--r-- root/root usr/share/i18n/locales/ak_GH -rw-r--r-- root/root usr/share/i18n/locales/am_ET -rw-r--r-- root/root usr/share/i18n/locales/an_ES @@ -1940,6 +1978,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/ast_ES -rw-r--r-- root/root usr/share/i18n/locales/ayc_PE -rw-r--r-- root/root usr/share/i18n/locales/az_AZ +-rw-r--r-- root/root usr/share/i18n/locales/az_IR -rw-r--r-- root/root usr/share/i18n/locales/be_BY -rw-r--r-- root/root usr/share/i18n/locales/be_BY@latin -rw-r--r-- root/root usr/share/i18n/locales/bem_ZM @@ -1948,6 +1987,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/bg_BG -rw-r--r-- root/root usr/share/i18n/locales/bhb_IN -rw-r--r-- root/root usr/share/i18n/locales/bho_IN +-rw-r--r-- root/root usr/share/i18n/locales/bi_VU -rw-r--r-- root/root usr/share/i18n/locales/bn_BD -rw-r--r-- root/root usr/share/i18n/locales/bn_IN -rw-r--r-- root/root usr/share/i18n/locales/bo_CN @@ -2065,6 +2105,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/hak_TW -rw-r--r-- root/root usr/share/i18n/locales/he_IL -rw-r--r-- root/root usr/share/i18n/locales/hi_IN +-rw-r--r-- root/root usr/share/i18n/locales/hif_FJ -rw-r--r-- root/root usr/share/i18n/locales/hne_IN -rw-r--r-- root/root usr/share/i18n/locales/hr_HR -rw-r--r-- root/root usr/share/i18n/locales/hsb_DE @@ -2109,6 +2150,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/lzh_TW -rw-r--r-- root/root usr/share/i18n/locales/mag_IN -rw-r--r-- root/root usr/share/i18n/locales/mai_IN +-rw-r--r-- root/root usr/share/i18n/locales/mai_NP -rw-r--r-- root/root usr/share/i18n/locales/mg_MG -rw-r--r-- root/root usr/share/i18n/locales/mhr_RU -rw-r--r-- root/root usr/share/i18n/locales/mi_NZ @@ -2169,6 +2211,7 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/sid_ET -rw-r--r-- root/root usr/share/i18n/locales/sk_SK -rw-r--r-- root/root usr/share/i18n/locales/sl_SI +-rw-r--r-- root/root usr/share/i18n/locales/sm_WS -rw-r--r-- root/root usr/share/i18n/locales/so_DJ -rw-r--r-- root/root usr/share/i18n/locales/so_ET -rw-r--r-- root/root usr/share/i18n/locales/so_KE @@ -2199,6 +2242,8 @@ drwxr-xr-x root/root usr/share/i18n/locales/ -rw-r--r-- root/root usr/share/i18n/locales/tk_TM -rw-r--r-- root/root usr/share/i18n/locales/tl_PH -rw-r--r-- root/root usr/share/i18n/locales/tn_ZA +-rw-r--r-- root/root usr/share/i18n/locales/to_TO +-rw-r--r-- root/root usr/share/i18n/locales/tpi_PG -rw-r--r-- root/root usr/share/i18n/locales/tr_CY -rw-r--r-- root/root usr/share/i18n/locales/tr_TR -rw-r--r-- root/root usr/share/i18n/locales/translit_circle diff --git a/glibc/.md5sum b/glibc/.md5sum deleted file mode 100644 index 757ebc60..00000000 --- a/glibc/.md5sum +++ /dev/null @@ -1,10 +0,0 @@ -bcfb2cb7f1cb0b4ecce27fcd5d5d2b21 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch -aaad345ff18993dafe3e44ac947f7157 glibc-2.20-multilib-dirs.patch -cb9c54c9d22b3ab597a69d05420b5e80 glibc-2.24.8.patch -97dc5517f92016f3d70d83e3162ad318 glibc-2.24.tar.xz -96156bec8e05de67384dc93e72bdc313 host.conf -fbbc215a9b15ba4846f326cc88108057 hosts -ac19b5dac0b160aa59a2e265998c3e91 kernel-headers-4.9.5.tar.xz -f7fefce570a3c776e26e778c5e401490 ld.so.conf -75931315bf9bc9be15a5e25e4ddd5f0d nsswitch.conf -acf9daad1ee85de5efd3543965596a63 resolv.conf diff --git a/glibc/.signature b/glibc/.signature index e37cfd3e..0fba2586 100644 --- a/glibc/.signature +++ b/glibc/.signature @@ -1,14 +1,13 @@ untrusted comment: verify with /etc/ports/core.pub -RWRJc1FUaeVeqgAZOOo9pTZ8Kkhyn33vUDz6ZScBxuUJQ6SeGXgbji+1Hk8NhAeXhzpTxD/z+samesI/MdBUnJ7FWpznMnezQgk= -SHA256 (Pkgfile) = 5d3c266de36bc04680358a4a7231bd7de49ead7e44da17d6a7edcb2a8d4cc3b5 -SHA256 (.footprint) = 9bfd444359441e61174162207102b96597aa3a7051b4c5d8401d9d0e2713ec81 -SHA256 (glibc-2.24.tar.xz) = 99d4a3e8efd144d71488e478f62587578c0f4e1fa0b4eed47ee3d4975ebeb5d3 +RWRJc1FUaeVeqlk3+Sl5PhEWH8+nhS86hesEiQGT0QVqoT23XJN2Vyjor44kOXaYG8+R18Znlw7kIKK72/ILVue4Z0qBUvm1dgM= +SHA256 (Pkgfile) = d26f0ceb51c2b95d4a42056c4d59437d49abab39b4192b9584bc57e74568132c +SHA256 (.footprint) = e13b37b674da4cbd3226dfc6e9cfdbbbd31bce4449c9c22240b4c47be740373d +SHA256 (glibc-2.26.tar.xz) = e54e0a934cd2bc94429be79da5e9385898d2306b9eaf3c92d5a77af96190f6bd SHA256 (kernel-headers-4.9.5.tar.xz) = 5783ad8f668ee71561fae370fbcdc477aaa6df249bd85635b87a8c204aeb4aa9 -SHA256 (glibc-2.20-multilib-dirs.patch) = 9cf0fbbb0fbb19f29cc540240fbe9a2256cdde5e7395e30970df1a4f3d8292c3 +SHA256 (glibc-multilib-dirs.patch) = 9cf0fbbb0fbb19f29cc540240fbe9a2256cdde5e7395e30970df1a4f3d8292c3 +SHA256 (glibc-2.26-6.patch) = a2155a40fb5f77fe5589d8533067ad9b2538d64a3f2cd811144fbe4656fdee58 SHA256 (hosts) = 5c02b256c105f1d4a12fb738d71c1bab9eb126533074d7a0c8a14b92670c9431 SHA256 (resolv.conf) = 72ccb58768a72a771ec37142bc361a18478a07ec9de6e925a20760794389bf51 SHA256 (nsswitch.conf) = 859b8984e5e90aff3cce8f9779996ae4033b280d2122840e9411e2f44a1c2e61 SHA256 (host.conf) = 1bffc6575eb6204458758c34656cd44d87e7d89f545055f8857dd8906b7fb277 SHA256 (ld.so.conf) = 441a37924864b5b063208922ea04a926cd9654e74ed3f160b9d455b56d23387f -SHA256 (glibc-2.24.8.patch) = 314fe8ec41042a85991e830a002abf2ff0b98dc4467afa238d8bb369d3be7cca -SHA256 (0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch) = 3f634bf301eb8bab57e5ea552de3f694fb063ab45af3cc91990e1bc24f280ddd diff --git a/glibc/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch b/glibc/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch deleted file mode 100644 index bc410b26..00000000 --- a/glibc/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch +++ /dev/null @@ -1,765 +0,0 @@ -From b9911eb529e51ebe7c5daa3b4f17e2caf7ddb9a4 Mon Sep 17 00:00:00 2001 -From: Fredrik Rinnestam -Date: Sun, 22 Oct 2017 16:18:40 +0200 -Subject: [PATCH] CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - ---- - ChangeLog | 10 + - NEWS | 701 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - posix/glob.c | 2 +- - 3 files changed, 712 insertions(+), 1 deletion(-) - -diff --git a/ChangeLog b/ChangeLog -index 84189ec762..1fb38cb7ee 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,4 @@ -+<<<<<<< HEAD - 2017-10-19 H.J. Lu - - * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and -@@ -20,6 +21,15 @@ - * sysdeps/x86_64/tst-avxmod.c: Likewise. - * sysdeps/x86_64/tst-sse.c: Likewise. - * sysdeps/x86_64/tst-ssemod.c: Likewise. -+======= -+2017-10-20 Paul Eggert -+ -+ [BZ #22320] -+ CVE-2017-15670 -+ * posix/glob.c (__glob): Fix one-byte overflow. -+ -+2017-10-20 Wilco Dijkstra -+>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - - 2017-10-19 H.J. Lu - -diff --git a/NEWS b/NEWS -index 4831542023..90cae42eee 100644 ---- a/NEWS -+++ b/NEWS -@@ -5,7 +5,708 @@ See the end for copying conditions. - Please send GNU C library bug reports via - using `glibc' in the "product" field. - -+<<<<<<< HEAD - Version 2.24.1 -+======= -+Version 2.27 -+ -+Major new features: -+ -+* Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin and tan -+ with FMA, contributed by Arjan van de Ven and H.J. Lu from Intel. -+ -+* Optimized x86-64 trunc and truncf for processors with SSE4.1. -+ -+* Optimized generic expf, exp2f, logf, log2f and powf. -+ -+* In order to support faster and safer process termination the malloc API -+ family of functions will no longer print a failure address and stack -+ backtrace after detecting heap corruption. The goal is to minimize the -+ amount of work done after corruption is detected and to avoid potential -+ security issues in continued process execution. Reducing shutdown time -+ leads to lower overall process restart latency, so there is benefit both -+ from a security and performance perspective. -+ -+* The abort function terminates the process immediately, without flushing -+ stdio streams. Previous glibc versions used to flush streams, resulting -+ in deadlocks and further data corruption. This change also affects -+ process aborts as the result of assertion failures. -+ -+* On platforms where long double has the IEEE binary128 format (aarch64, -+ alpha, mips64, s390 and sparc), the math library now implements _Float128 -+ interfaces for that type, as defined by ISO/IEC TS 18661-3:2015. These -+ are the same interfaces added in version 2.26 for some platforms where -+ this format is supported but is not the format of long double. -+ -+Deprecated and removed features, and other changes affecting compatibility: -+ -+* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer -+ defined by . -+ -+* libm no longer supports SVID error handling (calling a user-provided -+ matherr function on error) or the _LIB_VERSION variable to control error -+ handling. (SVID error handling and the _LIB_VERSION variable still work -+ for binaries linked against older versions of the GNU C Library.) The -+ libieee.a library is no longer provided. math.h no longer defines struct -+ exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW, -+ TLOSS, PLOSS and HUGE. -+ -+* The libm functions pow10, pow10f and pow10l are no longer supported for -+ new programs. Programs should use the standard names exp10, exp10f and -+ exp10l for these functions instead. -+ -+* The mcontext_t type is no longer the same as struct sigcontext. On -+ platforms where it was previously the same, this changes the C++ name -+ mangling for interfaces involving this type. -+ -+* The add-ons mechanism for building additional packages at the same time as -+ glibc has been removed. The --enable-add-ons configure option is now -+ ignored. -+ -+Changes to build and runtime requirements: -+ -+ [Add changes to build and runtime requirements here] -+ -+Security related changes: -+ -+ CVE-2009-5064: The ldd script would sometimes run the program under -+ examination directly, without preventing code execution through the -+ dynamic linker. (The glibc project disputes that this is a security -+ vulnerability; only trusted binaries must be examined using the ldd -+ script.) -+ -+ CVE-2017-15670: The glob function, when invoked with GLOB_TILDE, suffered -+ from a one-byte overflow during ~ operator processing (either on the stack -+ or the heap, depending on the length of the user name). -+ -+The following bugs are resolved with this release: -+ -+ [The release manager will add the list generated by -+ scripts/list-fixed-bugs.py just before the release.] -+ -+ -+Version 2.26 -+ -+Major new features: -+ -+* A per-thread cache has been added to malloc. Access to the cache requires -+ no locks and therefore significantly accelerates the fast path to allocate -+ and free small amounts of memory. Refilling an empty cache requires locking -+ the underlying arena. Performance measurements show significant gains in a -+ wide variety of user workloads. Workloads were captured using a special -+ instrumented malloc and analyzed with a malloc simulator. Contributed by -+ DJ Delorie with the help of Florian Weimer, and Carlos O'Donell. -+ -+* Unicode 10.0.0 Support: Character encoding, character type info, and -+ transliteration tables are all updated to Unicode 10.0.0, using -+ generator scripts contributed by Mike FABIAN (Red Hat). -+ These updates cause user visible changes, especially the changes in -+ wcwidth for many emoji characters cause problems when emoji sequences -+ are rendered with pango, see for example: -+ https://bugzilla.gnome.org/show_bug.cgi?id=780669#c5 -+ -+* Collation of Hungarian has been overhauled and is now consistent with "The -+ Rules of Hungarian Orthography, 12th edition" (Bug 18934). Contributed by -+ Egmont Koblinger. -+ -+* Improvements to the DNS stub resolver, contributed by Florian Weimer: -+ -+ - The GNU C Library will now detect when /etc/resolv.conf has been -+ modified and reload the changed configuration. The new resolver option -+ “no-reload” (RES_NORELOAD) disables this behavior. -+ -+ - The GNU C Library now supports an arbitrary number of search domains -+ (configured using the “search” directive in /etc/resolv.conf); -+ previously, there was a hard limit of six domains. For backward -+ compatibility, applications that directly modify the ‘_res’ global -+ object are still limited to six search domains. -+ -+ - When the “rotate” (RES_ROTATE) resolver option is active, the GNU C -+ Library will now randomly pick a name server from the configuration as a -+ starting point. (Previously, the second name server was always used.) -+ -+* The tunables feature is now enabled by default. This allows users to tweak -+ behavior of the GNU C Library using the GLIBC_TUNABLES environment variable. -+ -+* New function reallocarray, which resizes an allocated block (like realloc) -+ to the product of two sizes, with a guaranteed clean failure upon integer -+ overflow in the multiplication. Originally from OpenBSD, contributed by -+ Dennis Wölfing and Rüdiger Sonderfeld. -+ -+* New wrappers for the Linux-specific system calls preadv2 and pwritev2. -+ These are extended versions of preadv and pwritev, respectively, taking an -+ additional flags argument. The set of supported flags depends on the -+ running kernel; full support currently requires kernel 4.7 or later. -+ -+* posix_spawnattr_setflags now supports the flag POSIX_SPAWN_SETSID, to -+ create a new session ID for the spawned process. This feature is -+ scheduled to be added to the next major revision of POSIX; for the time -+ being, it is available under _GNU_SOURCE. -+ -+* errno.h is now safe to use from C-preprocessed assembly language on all -+ supported operating systems. In this context, it will only define the -+ Exxxx constants, as preprocessor macros expanding to integer literals. -+ -+* On ia64, powerpc64le, x86-32, and x86-64, the math library now implements -+ 128-bit floating point as defined by ISO/IEC/IEEE 60559:2011 (IEEE -+ 754-2008) and ISO/IEC TS 18661-3:2015. Contributed by Paul E. Murphy, -+ Gabriel F. T. Gomes, Tulio Magno Quites Machado Filho, and Joseph Myers. -+ -+ To compile programs that use this feature, the compiler must support -+ 128-bit floating point with the type name _Float128 (as defined by TS -+ 18661-3) or __float128 (the nonstandard name used by GCC for C++, and for -+ C prior to version 7). _GNU_SOURCE or __STDC_WANT_IEC_60559_TYPES_EXT__ -+ must be defined to make the new interfaces visible. -+ -+ The new functions and macros correspond to those present for other -+ floating-point types (except for a few obsolescent interfaces not -+ supported for the new type), with F128 or f128 suffixes; for example, -+ strtof128, HUGE_VAL_F128 and cosf128. Following TS 18661-3, there are no -+ printf or scanf formats for the new type; the strfromf128 and strtof128 -+ interfaces should be used instead. -+ -+Deprecated and removed features, and other changes affecting compatibility: -+ -+* The synchronization that pthread_spin_unlock performs has been changed to -+ now be equivalent to a C11 atomic store with release memory order to the -+ spin lock's memory location. Previously, several (but not all) -+ architectures used stronger synchronization (e.g., containing what is -+ often called a full barrier). This change can improve performance, but -+ may affect odd fringe uses of spin locks that depend on the previous -+ behavior (e.g., using spin locks as atomic variables to try to implement -+ Dekker's mutual exclusion algorithm). -+ -+* The port to Native Client running on ARMv7-A (--host=arm-nacl) has been -+ removed. -+ -+* Sun RPC is deprecated. The rpcgen program, librpcsvc, and Sun RPC headers -+ will only be built and installed when the GNU C Library is configured with -+ --enable-obsolete-rpc. This allows alternative RPC implementations, such -+ as TIRPC or rpcsvc-proto, to be used. -+ -+* The NIS(+) name service modules, libnss_nis, libnss_nisplus, and -+ libnss_compat, are deprecated, and will not be built or installed by -+ default. -+ -+ The NIS(+) support library, libnsl, is also deprecated. By default, a -+ compatibility shared library will be built and installed, but not headers -+ or development libraries. Only a few NIS-related programs require this -+ library. (In particular, the GNU C Library has never required programs -+ that use 'gethostbyname' to be linked with libnsl.) -+ -+ Replacement implementations based on TIRPC, which additionally support -+ IPv6, are available from . The configure -+ option --enable-obsolete-nsl will cause libnsl's headers, and the NIS(+) -+ name service modules, to be built and installed. -+ -+* The DNS stub resolver no longer performs EDNS fallback. If EDNS or DNSSEC -+ support is enabled, the configured recursive resolver must support EDNS. -+ (Responding to EDNS-enabled queries with responses which are not -+ EDNS-enabled is fine, but FORMERR responses are not.) -+ -+* res_mkquery and res_nmkquery no longer support the IQUERY opcode. DNS -+ servers have not supported this opcode for a long time. -+ -+* The _res_opcodes variable has been removed from libresolv. It had been -+ exported by accident. -+ -+* no longer includes inline versions of any string functions, -+ as this kind of optimization is better done by the compiler. The macros -+ __USE_STRING_INLINES and __NO_STRING_INLINES no longer have any effect. -+ -+* The nonstandard header has been removed. Most programs should -+ use instead. If you have a specific need for the definition of -+ locale_t with no other declarations, please contact -+ libc-alpha@sourceware.org and explain. -+ -+* The obsolete header has been removed. -+ -+* The obsolete signal constant SIGUNUSED is no longer defined by . -+ -+* The obsolete function cfree has been removed. Applications should use -+ free instead. -+ -+* The stack_t type no longer has the name struct sigaltstack. This changes -+ the C++ name mangling for interfaces involving this type. -+ -+* The ucontext_t type no longer has the name struct ucontext. This changes -+ the C++ name mangling for interfaces involving this type. -+ -+* On M68k GNU/Linux and MIPS GNU/Linux, the fpregset_t type no longer has -+ the name struct fpregset. On Nios II GNU/Linux, the mcontext_t type no -+ longer has the name struct mcontext. On SPARC GNU/Linux, the struct -+ mc_fq, struct rwindow, struct fpq and struct fq types are no longer -+ defined in sys/ucontext.h, the mc_fpu_t type no longer has the name struct -+ mc_fpu, the gwindows_t type no longer has the name struct gwindows and the -+ fpregset_t type no longer has the name struct fpu. This changes the C++ -+ name mangling for interfaces involving those types. -+ -+* On S/390 GNU/Linux, the constants defined by have been -+ synced with the kernel: -+ -+ - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS -+ are not supported on this architecture and have been removed. -+ -+ - PTRACE_SINGLEBLOCK, PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, -+ PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, -+ PTRACE_DISABLE_TE and PTRACE_TE_ABORT_RAND have been added. -+ -+ Programs that assume the GET/SETREGS ptrace requests are universally -+ available will now fail to build, instead of malfunctioning at runtime. -+ -+Changes to build and runtime requirements: -+ -+* Linux kernel 3.2 or later is required at runtime, on all architectures -+ supported by that kernel. (This is a change from version 2.25 only for -+ x86-32 and x86-64.) -+ -+* GNU Binutils 2.25 or later is now required to build the GNU C Library. -+ -+* On most architectures, GCC 4.9 or later is required to build the GNU C -+ Library. On powerpc64le, GCC 6.2 or later is required. -+ -+ Older GCC versions and non-GNU compilers are still supported when -+ compiling programs that use the GNU C Library. (We do not know exactly -+ how old, and some GNU extensions to C may be _de facto_ required. If you -+ are interested in helping us make this statement less vague, please -+ contact libc-alpha@sourceware.org.) -+ -+Security related changes: -+ -+* The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes, -+ to avoid fragmentation-based spoofing attacks (CVE-2017-12132). -+ -+* LD_LIBRARY_PATH is now ignored in binaries running in privileged AT_SECURE -+ mode to guard against local privilege escalation attacks (CVE-2017-1000366). -+ -+* Avoid printing a backtrace from the __stack_chk_fail function since it is -+ called on a corrupt stack and a backtrace is unreliable on a corrupt stack -+ (CVE-2010-3192). -+ -+* A use-after-free vulnerability in clntudp_call in the Sun RPC system has been -+ fixed (CVE-2017-12133). -+ -+The following bugs are resolved with this release: -+ -+ [984] network: Respond to changed resolv.conf in gethostbyname -+ [5010] network: sunrpc service cleanup causes unwanted port mapper traffic -+ [12068] localedata: sc_IT: misspelled yesexpr/day/abday/mon/abmon/date_fmt -+ fields -+ [12189] libc: __stack_chk_fail should not attempt a backtrace -+ (CVE-2010-3192) -+ [14096] time: Race condition on timezone/tst-timezone.out -+ [14172] localedata: az_IR: new locale -+ [14995] build: glibc fails to build if gold is the default linker, even if -+ ld.bfd is available -+ [15998] build: [powerpc] Set arch_minimum_kernel for powerpc LE -+ [16637] network: inet_pton function is accepting IPv6 with bad format -+ [16640] string: string/strtok.c: undefined behaviour inconsistent between -+ x86 and other generic code -+ [16875] localedata: ko_KR: fix lang_name -+ [17225] localedata: ar_SY: localized month names for May and June are -+ incorrect -+ [17297] localedata: da_DK: wrong date_fmt string -+ [18907] stdio: Incorrect order of __wur __THROW in -+ [18934] localedata: hu_HU: collate: fix multiple bugs and add tests -+ [18988] nptl: pthread wastes memory with mlockall(MCL_FUTURE) -+ [19066] localedata: ar_SA abbreviated day and month names are in English -+ [19569] network: resolv: Support an arbitrary number of search domains -+ [19570] network: Implement random DNS server selection in the stub -+ resolver -+ [19838] locale: localedef fails on PA-RISC -+ [19919] localedata: iso14651_t1_common: Correct the Malayalam sorting -+ order of 0D36 and 0D37 -+ [19922] localedata: iso14651_t1_common: Define collation for Malayalam -+ chillu characters -+ [20098] libc: FAIL: debug/backtrace-tst on hppa -+ [20257] network: sunrpc: clntudp_call does not enforce timeout when -+ receiving data -+ [20275] localedata: locale day/abday/mon/abmon should not have trailing -+ whitespace -+ [20313] localedata: Update locale data to Unicode 9.0 -+ [20424] manual: Document how to provide a malloc replacement -+ [20496] localedata: agr_PE: new language locale Awajún / Aguaruna (agr) -+ for Peru -+ [20686] locale: Add el_GR@euro to SUPPORTED. -+ [20831] dynamic-link: _dl_map_segments does not test for __mprotect -+ failures consistently -+ [21015] dynamic-link: Document and fix --enable-bind-now -+ [21016] nptl: pthread_cond support is broken on hppa -+ [21029] libc: glibc-2.23 (and later) fails to compile with -fno-omit- -+ frame-pointer on i386 -+ [21049] libc: segfault in longjmp_chk() due to clobbered processor -+ register -+ [21075] libc: unused assigment to %g4 in sparc/sparc{64,32}/clone.S -+ [21088] libc: Build fails with --enable-static-nss -+ [21094] math: cosf(1.57079697) has 3 ulp error on targets where the -+ generic c code is used -+ [21109] libc: Tunables broken on big-endian -+ [21112] math: powf has large ulp errors with base close to 1 and exponent -+ around 4000 -+ [21115] network: sunrpc: Use-after-free in error path in clntudp_call -+ (CVE-2017-12133) -+ [21120] malloc: glibc malloc is incompatible with GCC 7 -+ [21130] math: Incorrect return from y0l (-inf) and y1l (-inf) when linking -+ with -lieee -+ [21134] math: Exception (divide by zero) not set for y0/y1 (0.0) and y0/y1 -+ (-0.0) when linking with -lieee -+ [21171] math: log10, log2 and lgamma return incorrect results -+ [21179] libc: handle R_SPARC_DISP64 and R_SPARC_REGISTER relocs -+ [21182] libc: __memchr_sse2: regression in glibc-2.25 on i686 -+ [21207] localedata: ce_RU: update weekdays from CLDR -+ [21209] dynamic-link: LD_HWCAP_MASK read in setuid binaries -+ [21217] localedata: Update months from CLDR-31 -+ [21232] libc: miss posix_fadvise64 on MIPS64 when static linking -+ [21243] libc: support_delete_temp_file should issue warning for failed -+ remove() -+ [21244] libc: support resolv_test_start() socket fd close should be -+ checked for errors. -+ [21253] libc: localedef randomly segfaults when using -fstack-check due to -+ new posix_spawn implementation -+ [21258] dynamic-link: Branch predication in _dl_runtime_resolve_avx512_opt -+ leads to lower CPU frequency -+ [21259] libc: [alpha] termios.h missing IXANY for POSIX -+ [21261] libc: [sparc64] bits/setjmp.h namespace -+ [21267] network: [mips] bits/socket.h IOC* namespace -+ [21268] libc: [alpha] termios.h NL2, NL3 namespace -+ [21270] libc: mmap64 silently truncates large offset values -+ [21275] libc: posix_spawn always crashes on ia64 now -+ [21277] libc: [alpha] termios.h missing IUCLC for UNIX98 and older -+ [21280] math: [powerpc] logbl for POWER7 return incorrect results -+ [21289] libc: Incorrect declaration for 32-bit platforms with -+ _FILE_OFFSET_BITS=64 causes build error -+ [21295] network: GETAI(AF_UNSPEC) drops IPv6 addresses if nss module does -+ not support gethostbyname4_r -+ [21298] nptl: rwlock can deadlock on frequent reader/writer phase -+ switching -+ [21338] malloc: mallopt M_ARENA_MAX doesn't set the maximum number of -+ arenas -+ [21340] libc: Support POSIX_SPAWN_SETSID -+ [21357] libc: unwind-dw2-fde deadlock when using AddressSanitizer -+ [21359] network: ns_name_pack needs additional byte in destination buffer -+ [21361] network: resolv: Reduce advertised EDNS0 buffer size to guard -+ against fragmentation attacks (CVE-2017-12132) -+ [21369] network: resolv: Remove EDNS fallback -+ [21371] libc: Missing timespec definition when compiled with _XOPEN_SOURCE -+ and _POSIX_C_SOURCE -+ [21386] nptl: Assertion in fork for distinct parent PID is incorrect -+ [21391] dynamic-link: x86: Set dl_platform and dl_hwcap from CPU features -+ [21393] stdio: Missing dup3 error check in freopen, freopen64 -+ [21396] libc: Use AVX2 memcpy/memset on Skylake server -+ [21399] localedata: Bad description for U00EC in -+ localedata/charmaps/CP1254 -+ [21411] malloc: realloc documentation error -+ [21426] network: sys/socket.h uio.h namespace -+ [21428] libc: [aarch64] tst-backtrace5 testsuite failure -+ [21445] libc: signal.h bsd_signal namespace -+ [21455] network: Network headers stdint.h namespace -+ [21474] network: resolv: res_init does not use RES_DFLRETRY (2) but 4 for -+ retry value -+ [21475] network: resolv: Overlong search path is truncated mid-label -+ [21511] libc: sigstack namespace -+ [21512] libc: clone() ends up calling exit_group() through _exit() wrapper -+ [21514] libc: sysdeps/unix/sysv/linux/sys/syscall.h:31:27: fatal error: -+ bits/syscall.h: No such file or directory -+ [21517] libc: struct sigaltstack namespace -+ [21528] dynamic-link: Duplicated minimal strtoul implementations in ld.so -+ [21533] localedata: Update locale data to Unicode 10.0 -+ [21537] libc: -+ ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error: -+ junk at end of line, first unrecognized character is `@' -+ [21538] libc: SIG_HOLD missing for XPG4 -+ [21539] libc: S390: Mismatch between kernel and glibc ptrace.h with -+ request 12: PTRACE_SINGLEBLOCK vs PTRACE_GETREGS. -+ [21542] libc: Use conservative default for sysconf (_SC_NPROCESSORS_ONLN) -+ [21543] libc: sigevent namespace -+ [21548] libc: [mips] get/set/make/swap context for MIPS O32 assume wrong -+ size for general purpose registers in mcontext_t structure -+ [21550] libc: sigwait namespace -+ [21552] libc: XPG4 bsd_signal namespace -+ [21554] libc: sigpause namespace -+ [21560] libc: sys/wait.h signal.h namespace -+ [21561] libc: waitid namespace -+ [21573] nptl: GCC 7: /usr/bin/install: cannot remove -+ '/usr/include/stdlib.h': Permission denied -+ [21575] libc: sys/wait.h missing struct rusage definition -+ [21584] libc: sigaltstack etc namespace -+ [21597] libc: siginterrupt namespace -+ [21607] math: hppa: FAIL: math/test-tgmath -+ [21609] dynamic-link: Incomplete workaround for GCC __tls_get_addr ABI -+ issue on x86-64 -+ [21622] libc: [tile] missing SA_* for POSIX.1:2008 -+ [21624] dynamic-link: ld.so: Unsafe alloca allows local attackers to alias -+ stack and heap (CVE-2017-1000366) -+ [21625] libc: wait3 namespace -+ [21654] nss: Incorrect pointer alignment in NSS group merge result -+ construction -+ [21657] network: Parse interface zone id for node-local multicast -+ [21662] string: memcmp-avx2-movbe.S lacks saturating subtraction for -+ between_2_3 -+ [21666] libc: .symver is used on common symbol -+ [21668] network: resolv: res_init cross-thread broadcast introduces race -+ conditions -+ [21687] math: tgmath.h totalorder, totalordermag return type -+ [21694] locale: Current Glibc Locale Does Not Support Tok-Pisin and Fiji -+ Hindi Locale -+ [21696] libc: Incorrect assumption of of __cpu_mask in -+ posix/sched_cpucount.c -+ [21697] libc: sysdeps/posix/spawni.c: 2 * suspicious condition ? -+ [21706] localedata: yesstr and nostr are missing for Breton [LC_MESSAGES] -+ locale -+ [21707] math: ppc64le: Invalid IFUNC resolver from libgcc calls getauxval, -+ leading to relocation crash -+ [21709] libc: resolv_conf.c:552: update_from_conf: Assertion -+ `resolv_conf_matches (resp, conf)' failed. -+ [21710] localedata: Added Samoan language locale for Samoa -+ [21711] localedata: Pashto yesstr/nostr locale are missing -+ [21715] nptl: sysdeps/nptl/bits/pthreadtypes.h: typedef guard -+ __have_pthread_attr_t can cause redefinition of typedef ‘pthread_attr_t’ -+ [21721] localedata: Incorrect Full Weekday names for ks_IN@devanagari -+ [21723] localedata: yesstr/nostr missing for Chinese language locale -+ [21724] localedata: yesstr and nostr are missing for Xhosa [LC_MESSAGES] -+ locale -+ [21727] localedata: yesstr and nostr are missing for Tsonga [LC_MESSAGES] -+ locale -+ [21728] localedata: New Locale for Tongan language -+ [21729] localedata: incorrect LC_NAME fields for hi_IN -+ [21733] localedata: yesstr and nostr are missing for zh_HK -+ [21734] localedata: Missing yesstr and nostr are for kw_GB -+ [21738] libc: misc/tst-preadvwritev2 and misc/tst-preadvwritev64v2 fail -+ [21741] libc: Undefined __memmove_chk_XXX and __memset_chk_XXX in libc.a -+ [21742] libc: _dl_num_cache_relocations is undefined in libc.a -+ [21743] localedata: ks_IN@devanagari: abday strings mismatch the day -+ strings -+ [21744] libc: Tests failing on --enable-tunables --enable-stack- -+ protector=all -+ [21749] localedata: Wrong abbreviated day name (“abday”) for -+ ar_JO/ar_LB/ar_SY -+ [21756] localedata: missing yesstr, nostr for nds_DE and nds_NL -+ [21757] localedata: missing yesstr, nostr for pap_AW and pap_CW -+ [21759] localedata: missing yesstr and nostr for Tigrinya -+ [21760] localedata: Fix LC_MESSAGES and LC_ADDRESS for anp_IN -+ [21766] localedata: Wrong LC_MESSAGES for om_ET Locale -+ [21767] localedata: Missing Bislama locales -+ [21768] localedata: Missing yesstr and nostr for aa_ET -+ [21770] localedata: Missing Field in li_NL -+ [21778] nptl: Robust mutex may deadlock -+ [21779] libc: MicroBlaze segfaults when loading libpthread -+ [21783] localedata: Fix int_select international_call_prefixes -+ [21784] localedata: Inconsistency in country_isbn -+ [21788] localedata: Missing Country Postal Abbreviations -+ [21794] localedata: Added-country_isbn-for-Italy -+ [21795] localedata: Add/Fix country_isbn for France -+ [21796] localedata: Added country_isbn for Republic of Korea -+ [21797] localedata: Fix inconsistency in country_isbn and missing prefixes -+ [21799] localedata: Added int_select international_call_prefixes -+ [21801] localedata: Added int_select international_call_prefixes -+ [21804] nptl: Double semicolon in thread-shared-types.h -+ [21807] localedata: LC_ADDRESS fix for pap_CW -+ [21808] localedata: Fix LC_ADDRESS for pap_AW -+ [21821] localedata: Added country_name in mai_IN -+ [21822] localedata: Fix LC_TIME for mai_IN -+ [21823] localedata: missing yesstr, nostr for sa_IN -+ [21825] localedata: Fix name_mrs for mag_IN -+ [21828] localedata: 2.26 changelog should mention user visible changes -+ with unicode 9.0 -+ [21835] localedata: Added Maithili language locale for Nepal -+ [21838] localedata: Removed redundant data for the_NP -+ [21839] localedata: Fix LC_MONETARY for ta_LK -+ [21844] localedata: Fix Latin characters and Months Sequence. -+ [21848] localedata: Fix mai_NP Title Name -+ -+ -+Version 2.25 -+ -+* The feature test macro __STDC_WANT_LIB_EXT2__, from ISO/IEC TR -+ 24731-2:2010, is supported to enable declarations of functions from that -+ TR. Note that not all functions from that TR are supported by the GNU C -+ Library. -+ -+* The feature test macro __STDC_WANT_IEC_60559_BFP_EXT__, from ISO/IEC TS -+ 18661-1:2014, is supported to enable declarations of functions and macros -+ from that TS. Note that not all features from that TS are supported by -+ the GNU C Library. -+ -+* The feature test macro __STDC_WANT_IEC_60559_FUNCS_EXT__, from ISO/IEC TS -+ 18661-4:2015, is supported to enable declarations of functions and macros -+ from that TS. Note that most features from that TS are not supported by -+ the GNU C Library. -+ -+* The nonstandard feature selection macros _REENTRANT and _THREAD_SAFE are -+ now treated as compatibility synonyms for _POSIX_C_SOURCE=199506L. -+ Since the GNU C Library defaults to a much newer revision of POSIX, this -+ will only affect programs that specifically request an old conformance -+ mode. For instance, a program compiled with -std=c89 -D_REENTRANT will -+ see a change in the visible declarations, but a program compiled with -+ just -D_REENTRANT, or -std=c99 -D_POSIX_C_SOURCE=200809L -D_REENTRANT, -+ will not. -+ -+ Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be -+ defined by all multithreaded code, but glibc has not required this for -+ many years. -+ -+* The inclusion of by is deprecated. This -+ means that in a future release, the macros “major”, “minor”, and “makedev” -+ will only be available from . -+ -+ These macros are not part of POSIX nor XSI, and their names frequently -+ collide with user code; see for instance glibc bug 19239 and Red Hat bug -+ 130601. includes under _GNU_SOURCE, and C++ code -+ presently cannot avoid being compiled under _GNU_SOURCE, exacerbating the -+ problem. -+ -+* New features from TS 18661-1:2014 are added to libm: the -+ fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the -+ femode_t type and the FE_DFL_MODE and FE_SNANS_ALWAYS_SIGNAL macros. -+ -+* Integer width macros from TS 18661-1:2014 are added to : -+ CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH, -+ UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH; and to -+ : INT8_WIDTH, UINT8_WIDTH, INT16_WIDTH, UINT16_WIDTH, -+ INT32_WIDTH, UINT32_WIDTH, INT64_WIDTH, UINT64_WIDTH, INT_LEAST8_WIDTH, -+ UINT_LEAST8_WIDTH, INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH, -+ INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH, INT_LEAST64_WIDTH, -+ UINT_LEAST64_WIDTH, INT_FAST8_WIDTH, UINT_FAST8_WIDTH, INT_FAST16_WIDTH, -+ UINT_FAST16_WIDTH, INT_FAST32_WIDTH, UINT_FAST32_WIDTH, INT_FAST64_WIDTH, -+ UINT_FAST64_WIDTH, INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH, -+ UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH, -+ WINT_WIDTH. -+ -+* New features are added from TS 18661-1:2014: -+ -+ - Signaling NaN macros: SNANF, SNAN, SNANL. -+ -+ - Nearest integer functions: roundeven, roundevenf, roundevenl, fromfp, -+ fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf, -+ fromfpxl, ufromfpx, ufromfpxf, ufromfpxl. -+ -+ - llogb functions: the llogb, llogbf and llogbl functions, and the -+ FP_LLOGB0 and FP_LLOGBNAN macros. -+ -+ - Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag, -+ fminmagf, fminmagl. -+ -+ - Comparison macros: iseqsig. -+ -+ - Classification macros: iscanonical, issubnormal, iszero. -+ -+ - Total order functions: totalorder, totalorderf, totalorderl, -+ totalordermag, totalordermagf, totalordermagl. -+ -+ - Canonicalize functions: canonicalize, canonicalizef, canonicalizel. -+ -+ - NaN functions: getpayload, getpayloadf, getpayloadl, setpayload, -+ setpayloadf, setpayloadl, setpayloadsig, setpayloadsigf, setpayloadsigl. -+ -+* The functions strfromd, strfromf, and strfroml, from ISO/IEC TS 18661-1:2014, -+ are added to libc. They convert a floating-point number into string. -+ -+* Most of glibc can now be built with the stack smashing protector enabled. -+ It is recommended to build glibc with --enable-stack-protector=strong. -+ Implemented by Nick Alcock (Oracle). -+ -+* The function explicit_bzero, from OpenBSD, has been added to libc. It is -+ intended to be used instead of memset() to erase sensitive data after use; -+ the compiler will not optimize out calls to explicit_bzero even if they -+ are "unnecessary" (in the sense that no _correct_ program can observe the -+ effects of the memory clear). -+ -+* On ColdFire, MicroBlaze, Nios II and SH3, the float_t type is now defined -+ to float instead of double. This does not affect the ABI of any libraries -+ that are part of the GNU C Library, but may affect the ABI of other -+ libraries that use this type in their interfaces. -+ -+* On x86_64, when compiling with -mfpmath=387 or -mfpmath=sse+387, the -+ float_t and double_t types are now defined to long double instead of float -+ and double. These options are not the default, and this does not affect -+ the ABI of any libraries that are part of the GNU C Library, but it may -+ affect the ABI of other libraries that use this type in their interfaces, -+ if they are compiled or used with those options. -+ -+* The getentropy and getrandom functions, and the header file -+ have been added. -+ -+* The buffer size for byte-oriented stdio streams is now limited to 8192 -+ bytes by default. Previously, on Linux, the default buffer size on most -+ file systems was 4096 bytes (and thus remains unchanged), except on -+ network file systems, where the buffer size was unpredictable and could be -+ as large as several megabytes. -+ -+* The header now includes the header. Support -+ for the Linux quota interface which predates kernel version 2.4.22 has -+ been removed. -+ -+* The malloc_get_state and malloc_set_state functions have been removed. -+ Already-existing binaries that dynamically link to these functions will -+ get a hidden implementation in which malloc_get_state is a stub. As far -+ as we know, these functions are used only by GNU Emacs and this change -+ will not adversely affect already-built Emacs executables. Any undumped -+ Emacs executables, which normally exist only during an Emacs build, should -+ be rebuilt by re-running “./configure; make” in the Emacs build tree. -+ -+* The “ip6-dotint” and “no-ip6-dotint” resolver options, and the -+ corresponding RES_NOIP6DOTINT flag from have been removed. -+ “no-ip6-dotint” had already been the default, and support for the -+ “ip6-dotint” option was removed from the Internet in 2006. -+ -+* The "ip6-bytestring" resolver option and the corresponding RES_USEBSTRING -+ flag from have been removed. The option relied on a -+ backwards-incompatible DNS extension which was never deployed on the -+ Internet. -+ -+* The flags RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG, -+ RES_BLAST defined in the header file have been deprecated. -+ They were already unimplemented. -+ -+* The "inet6" option in /etc/resolv.conf and the RES_USE_INET6 flag for -+ _res.flags are deprecated. The flag was standardized in RFC 2133, but -+ removed again from the IETF name lookup interface specification in RFC -+ 2553. Applications should use getaddrinfo instead. -+ -+* DNSSEC-related declarations and definitions have been removed from the -+ header file, and libresolv will no longer attempt to -+ decode the data part of DNSSEC record types. Previous versions of glibc -+ only implemented minimal support for the previous version of DNSSEC, which -+ is incompatible with the currently deployed version. -+ -+* The resource record type classification macros ns_t_qt_p, ns_t_mrr_p, -+ ns_t_rr_p, ns_t_udp_p, ns_t_xfr_p have been removed from the -+ header file because the distinction between RR types and -+ meta-RR types is not officially standardized, subject to revision, and -+ thus not suitable for encoding in a macro. -+ -+* The types res_sendhookact, res_send_qhook, re_send_rhook, and the qhook -+ and rhook members of the res_state type in have been removed. -+ The glibc stub resolver did not support these hooks, but the header file -+ did not reflect that. -+ -+* For multi-arch support it is recommended to use a GCC which has -+ been built with support for GNU indirect functions. This ensures -+ that correct debugging information is generated for functions -+ selected by IFUNC resolvers. This support can either be enabled by -+ configuring GCC with '--enable-gnu-indirect-function', or by -+ enabling it by default by setting 'default_gnu_indirect_function' -+ variable for a particular architecture in the GCC source file -+ 'gcc/config.gcc'. -+ -+* GDB pretty printers have been added for mutex and condition variable -+ structures in POSIX Threads. When installed and loaded in gdb these pretty -+ printers show various pthread variables in human-readable form when read -+ using the 'print' or 'display' commands in gdb. -+ -+* Tunables feature added to allow tweaking of the runtime for an application -+ program. This feature can be enabled with the '--enable-tunables' configure -+ flag. The GNU C Library manual has details on usage and README.tunables has -+ instructions on adding new tunables to the library. -+ -+* A new version of condition variables functions have been implemented in -+ the NPTL implementation of POSIX Threads to provide stronger ordering -+ guarantees. -+ -+* A new version of pthread_rwlock functions have been implemented to use a more -+ scalable algorithm primarily through not using a critical section anymore to -+ make state changes. -+>>>>>>> c369d66e54... CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320] - - Security related changes: - -diff --git a/posix/glob.c b/posix/glob.c -index ea4b0b61eb..08f240a1ff 100644 ---- a/posix/glob.c -+++ b/posix/glob.c -@@ -856,7 +856,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), - *p = '\0'; - } - else -- *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) -+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) - = '\0'; - user_name = newp; - } --- -2.14.2 - diff --git a/glibc/Pkgfile b/glibc/Pkgfile index d69230e5..ce1c9b1e 100644 --- a/glibc/Pkgfile +++ b/glibc/Pkgfile @@ -3,13 +3,12 @@ # Maintainer: CRUX System Team, core-ports at crux dot nu name=glibc -version=2.24 -release=9 -source=(http://ftpmirror.gnu.org/gnu/glibc/glibc-2.24.tar.xz \ +version=2.26 +release=6 +source=(http://ftp.gnu.org/gnu/glibc/glibc-$version.tar.xz \ http://crux.nu/files/distfiles/kernel-headers-4.9.5.tar.xz \ - $name-2.20-multilib-dirs.patch \ - hosts resolv.conf nsswitch.conf host.conf ld.so.conf \ - glibc-2.24.8.patch 0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch) + $name-multilib-dirs.patch glibc-2.26-6.patch \ + hosts resolv.conf nsswitch.conf host.conf ld.so.conf) build() { # install kernel headers @@ -17,9 +16,8 @@ build() { cp -r $SRC/kernel-headers-4.9.5/include $PKG/usr chown root:root $PKG/usr - patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/glibc-2.24.8.patch - patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/$name-2.20-multilib-dirs.patch - patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/0001-CVE-2017-15670-glob-Fix-one-byte-overflow-BZ-22320.patch + patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/$name-multilib-dirs.patch + patch -p1 -d $SRC/$name-${version:0:4} -i $SRC/glibc-2.26-6.patch mkdir $SRC/build cd $SRC/build @@ -29,6 +27,8 @@ build() { --enable-kernel=3.12 \ --enable-add-ons \ --enable-static-nss \ + --enable-stack-protector=strong \ + --enable-obsolete-rpc \ --disable-profile \ --disable-werror \ --without-gd \ @@ -43,6 +43,10 @@ build() { install -m 0644 $SRC/{hosts,resolv.conf,nsswitch.conf,host.conf,ld.so.conf} $PKG/etc + # install needed headers + install -d $PKG/usr/include/rpcsvc + install -m 0644 $SRC/$name-${version:0:4}/nis/rpcsvc/yp* $PKG/usr/include/rpcsvc + ln -sf ../usr/share/zoneinfo/UTC $PKG/etc/localtime install -d $PKG/etc/ld.so.conf.d $PKG/usr/lib/locale touch $PKG/etc/ld.so.cache diff --git a/glibc/glibc-2.24.8.patch b/glibc/glibc-2.24.8.patch deleted file mode 100644 index 4f1db10c..00000000 --- a/glibc/glibc-2.24.8.patch +++ /dev/null @@ -1,16286 +0,0 @@ -diff --git a/ChangeLog b/ChangeLog -index c44c926094..84189ec762 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,685 @@ -+2017-10-19 H.J. Lu -+ -+ * sysdeps/x86_64/Makefile (tests): Add tst-sse, tst-avx and -+ tst-avx512. -+ (test-extras): Add tst-avx-aux and tst-avx512-aux. -+ (extra-test-objs): Add tst-avx-aux.o and tst-avx512-aux.o. -+ (modules-names): Add tst-ssemod, tst-avxmod and tst-avx512mod. -+ ($(objpfx)tst-sse): New rule. -+ ($(objpfx)tst-avx): Likewise. -+ ($(objpfx)tst-avx512): Likewise. -+ (CFLAGS-tst-avx-aux.c): New. -+ (CFLAGS-tst-avxmod.c): Likewise. -+ (CFLAGS-tst-avx512-aux.c): Likewise. -+ (CFLAGS-tst-avx512mod.c): Likewise. -+ * sysdeps/x86_64/tst-avx-aux.c: New file. -+ * sysdeps/x86_64/tst-avx.c: Likewise. -+ * sysdeps/x86_64/tst-avx512-aux.c: Likewise. -+ * sysdeps/x86_64/tst-avx512.c: Likewise. -+ * sysdeps/x86_64/tst-avx512mod.c: Likewise. -+ * sysdeps/x86_64/tst-avxmod.c: Likewise. -+ * sysdeps/x86_64/tst-sse.c: Likewise. -+ * sysdeps/x86_64/tst-ssemod.c: Likewise. -+ -+2017-10-19 H.J. Lu -+ -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't -+ adjust CFA when allocating register save area on re-aligned -+ stack. -+ -+2016-12-21 Joseph Myers -+ -+ [BZ #20978] -+ * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): -+ Compare name == NULL, not name != NULL. -+ -+2016-11-08 Joseph Myers -+ -+ [BZ #20790] -+ * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size -+ to MAXLINESIZE. -+ * sunrpc/bug20790.x: New file. -+ * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New -+ variable. -+ [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). -+ [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule. -+ -+2016-10-14 Steve Ellcey -+ -+ * sysdeps/ieee754/dbl-64/e_pow.c (checkint) Make conditions explicitly -+ boolean. -+ -+2017-07-19 DJ Delorie -+ -+ [BZ #21654] -+ * grp/grp-merge.c (libc_hidden_def): Fix cast-after-dereference. -+ -+2017-07-14 DJ Delorie -+ -+ [BZ #21654] -+ * grp/grp_merge.c (__copy_grp): Align char** to minimum pointer -+ alignment not char alignment. -+ (__merge_grp): Likewise. -+ -+2017-08-06 H.J. Lu -+ -+ [BZ #21871] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F. -+ -+2017-02-27 Florian Weimer -+ -+ [BZ #21115] -+ * sunrpc/clnt_udp.c (clntudp_call): Free ancillary data later. -+ * sunrpc/Makefile (tests): Add tst-udp-error. -+ (tst-udp-error): Link against libc.so explicitly. -+ * sunrpc/tst-udp-error: New file. -+ -+2017-01-24 James Clarke -+ -+ * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: Use new REG_R* -+ constants instead of the old R* ones. -+ * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: Likewise. -+ * sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGPREG): Rename... -+ (NGREG): ... to this, to fit in with other architectures. -+ (gpregset_t): Use new NGREG macro. -+ [__USE_GNU]: Remove condition; all architectures other than tile -+ are unconditional. -+ (R*): Rename to REG_R*. -+ -+2017-07-26 H.J. Lu -+ -+ [BZ #21666] -+ * misc/regexp.c (loc1): Add __attribute__ ((nocommon)); -+ (loc2): Likewise. -+ (locs): Likewise. -+ -+2017-07-12 Szabolcs Nagy -+ -+ * sysdeps/aarch64/dl-machine.h (RTLD_START_1): Change _dl_argv to the -+ hidden __GI__dl_argv symbol. -+ -+2016-09-05 Aurelien Jarno -+ -+ * conform/Makefile (conformtest-header-tests): Pass -I. to $(PERL). -+ (linknamespace-symlists-tests): Likewise. -+ (linknamespace-header-tests): Likewise. -+ -+2017-07-06 Florian Weimer -+ H.J. Lu -+ -+ [BZ #21609] -+ * sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr. -+ (gen-as-const-headers): Add rtld-offsets.sym. -+ * sysdeps/x86_64/dl-tls.c: New file. -+ * sysdeps/x86_64/rtld-offsets.sym: Likwise. -+ * sysdeps/x86_64/tls_get_addr.S: Likewise. -+ * sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards. -+ * sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New. -+ (TI_OFFSET_OFFSET): Likwise. -+ -+2017-06-14 Florian Weimer -+ -+ * sysdeps/i386/i686/multiarch/strcspn-c.c: Add IS_IN (libc) guard. -+ * sysdeps/i386/i686/multiarch/varshift.c: Likewise. -+ -+2017-03-07 Siddhesh Poyarekar -+ -+ [BZ #21209] -+ * elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for -+ AT_SECURE processes. -+ * sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK. -+ -+2017-06-19 Florian Weimer -+ -+ * elf/rtld.c (audit_list_string): New variable. -+ (audit_list): Update comment. -+ (struct audit_list_iter): Define. -+ (audit_list_iter_init, audit_list_iter_next): New function. -+ (dl_main): Use struct audit_list_iter to process audit modules. -+ (process_dl_audit): Call dso_name_valid_for_suid. -+ (process_envvars): Set audit_list_string instead of calling -+ process_dl_audit. -+ -+2017-06-19 Florian Weimer -+ -+ * elf/rtld.c (SECURE_NAME_LIMIT, SECURE_PATH_LIMIT): Define. -+ (dso_name_valid_for_suid): New function. -+ (handle_ld_preload): Likewise. -+ (dl_main): Call it. Remove alloca. -+ -+2017-06-19 Florian Weimer -+ -+ [BZ #21624] -+ CVE-2017-1000366 -+ * elf/rtld.c (process_envvars): Ignore LD_LIBRARY_PATH for -+ __libc_enable_secure. -+ -+2017-02-01 Andreas Schwab -+ -+ * sysdeps/m68k/m680x0/m68020/atomic-machine.h -+ (__arch_compare_and_exchange_val_64_acq, atomic_exchange_acq) -+ (atomic_exchange_and_add, atomic_add): Add casts to 64 bit asm -+ operands. -+ -+2017-05-12 Florian Weimer -+ -+ [BZ #21386] -+ * sysdeps/nptl/fork.c (__libc_fork): Remove assertions on the -+ parent PID. The assertion in the child is incorrect with PID -+ namespaces. -+ -+2017-06-07 Arjun Shankar -+ -+ * sysdeps/unix/sysv/linux/tst-clone2.c: Do not -+ include test-skeleton.c. -+ Include support/check.h and support/test-driver.c. -+ -+2016-11-24 Adhemerval Zanella -+ -+ * sysdeps/nptl/fork.c (__libc_fork): Remove pid cache setting. -+ * nptl/allocatestack.c (allocate_stack): Likewise. -+ (__reclaim_stacks): Likewise. -+ (setxid_signal_thread): Obtain pid through syscall. -+ * nptl/nptl-init.c (sigcancel_handler): Likewise. -+ (sighandle_setxid): Likewise. -+ * nptl/pthread_cancel.c (pthread_cancel): Likewise. -+ * sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise. -+ * sysdeps/unix/sysv/linux/pthread_sigqueue.c (pthread_sigqueue): -+ Likewise. -+ * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise. -+ * sysdeps/unix/sysv/linux/raise.c (raise): Remove old behaviour -+ comment. -+ * sysdeps/unix/sysv/linux/getpid.c: Remove file. -+ * nptl/descr.h (struct pthread): Change comment about pid value. -+ * nptl/pthread_getattr_np.c (pthread_getattr_np): Remove thread -+ pid assert. -+ * sysdeps/unix/sysv/linux/pthread-pids.h (__pthread_initialize_pids): -+ Do not set pid value. -+ * nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove thread -+ pid cache check. -+ * nptl_db/td_thr_validate.c (td_thr_validate): Likewise. -+ * sysdeps/aarch64/nptl/tcb-offsets.sym: Remove pid offset. -+ * sysdeps/alpha/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/arm/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/hppa/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/i386/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/ia64/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/m68k/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/microblaze/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/mips/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/nios2/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/powerpc/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/s390/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/sh/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/sparc/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/tile/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/x86_64/nptl/tcb-offsets.sym: Likewise. -+ * sysdeps/unix/sysv/linux/aarch64/clone.S: Remove pid and tid caching. -+ * sysdeps/unix/sysv/linux/alpha/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/arm/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/hppa/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/i386/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise. -+ * sysdeps/unix/sysv/linux/mips/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/nios2/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sh/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/tile/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/aarch64/vfork.S: Remove pid set and reset. -+ * sysdeps/unix/sysv/linux/alpha/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/arm/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/i386/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/m68k/clone.S: Likewise. -+ * sysdeps/unix/sysv/linux/m68k/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/mips/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/nios2/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sh/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/tile/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/hppa/pt-vfork.S: Likewise. -+ * sysdeps/unix/sysv/linux/tst-clone2.c (f): Remove direct pthread -+ struct access. -+ (clone_test): Remove function. -+ (do_test): Rewrite to take in consideration pid is not cached anymore. -+ -+2016-09-26 Adhemerval Zanella -+ -+ * sysdeps/unix/sysdep.h (__INTERNAL_SYSCALL0): New macro. -+ (__INTERNAL_SYSCALL1): Likewise. -+ (__INTERNAL_SYSCALL2): Likewise. -+ (__INTERNAL_SYSCALL3): Likewise. -+ (__INTERNAL_SYSCALL4): Likewise. -+ (__INTERNAL_SYSCALL5): Likewise. -+ (__INTERNAL_SYSCALL6): Likewise. -+ (__INTERNAL_SYSCALL7): Likewise. -+ (__INTERNAL_SYSCALL_NARGS_X): Likewise. -+ (__INTERNAL_SYSCALL_NARGS): Likewise. -+ (__INTERNAL_SYSCALL_DISP): Likewise. -+ (INTERNAL_SYSCALL_CALL): Likewise. -+ (__SYSCALL0): Rename to __INLINE_SYSCALL0. -+ (__SYSCALL1): Rename to __INLINE_SYSCALL1. -+ (__SYSCALL2): Rename to __INLINE_SYSCALL2. -+ (__SYSCALL3): Rename to __INLINE_SYSCALL3. -+ (__SYSCALL4): Rename to __INLINE_SYSCALL4. -+ (__SYSCALL5): Rename to __INLINE_SYSCALL5. -+ (__SYSCALL6): Rename to __INLINE_SYSCALL6. -+ (__SYSCALL7): Rename to __INLINE_SYSCALL7. -+ (__SYSCALL_NARGS_X): Rename to __INLINE_SYSCALL_NARGS_X. -+ (__SYSCALL_NARGS): Rename to __INLINE_SYSCALL_NARGS. -+ (__SYSCALL_DISP): Rename to __INLINE_SYSCALL_DISP. -+ (__SYSCALL_CALL): Rename to INLINE_SYSCALL_CALL. -+ (SYSCALL_CANCEL): Replace __SYSCALL_CALL with INLINE_SYSCALL_CALL. -+ -+2017-04-28 H.J. Lu -+ -+ [BZ #21396] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ Prefer_No_AVX512 if AVX512ER isn't available. -+ * sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New. -+ (index_arch_Prefer_No_AVX512): Likewise. -+ * sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use -+ AVX512 version if Prefer_No_AVX512 is set. -+ * sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise. -+ * sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise. -+ * sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): -+ Likewise. -+ * sysdeps/x86_64/multiarch/memset.S (memset): Likewise. -+ * sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk): -+ Likewise. -+ -+2017-04-28 H.J. Lu -+ -+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set -+ Prefer_No_VZEROUPPER if AVX512ER is available. -+ * sysdeps/x86/cpu-features.h -+ (bit_cpu_AVX512PF): New. -+ (bit_cpu_AVX512ER): Likewise. -+ (bit_cpu_AVX512CD): Likewise. -+ (bit_cpu_AVX512BW): Likewise. -+ (bit_cpu_AVX512VL): Likewise. -+ (index_cpu_AVX512PF): Likewise. -+ (index_cpu_AVX512ER): Likewise. -+ (index_cpu_AVX512CD): Likewise. -+ (index_cpu_AVX512BW): Likewise. -+ (index_cpu_AVX512VL): Likewise. -+ (reg_AVX512PF): Likewise. -+ (reg_AVX512ER): Likewise. -+ (reg_AVX512CD): Likewise. -+ (reg_AVX512BW): Likewise. -+ (reg_AVX512VL): Likewise. -+ -+2017-01-05 Joseph Myers -+ -+ [BZ #21026] -+ * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -+ (readahead): New syscall entry. -+ -+2017-04-07 H.J. Lu -+ -+ [BZ #21258] -+ * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt): -+ Define only if _dl_runtime_resolve is defined to -+ _dl_runtime_resolve_sse_vex. -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt): -+ Fallthrough to _dl_runtime_resolve_sse_vex. -+ -+2017-04-03 Mike Frysinger -+ -+ [BZ #21253] -+ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Increase argv_size -+ slack space by 32KiB. -+ -+2017-03-31 Slava Barinov -+ -+ [BZ #21289] -+ * io/fts.h (fts_set): Replace __REDIRECT with __REDIRECT_NTH. -+ -+2017-03-20 Mike Frysinger -+ -+ [BZ #21275] -+ * sysdeps/unix/sysv/linux/spawni.c [__ia64__] (CLONE): Rename -+ __stack to __stackbase. -+ (STACK): Invert _STACK_GROWS_DOWN and _STACK_GROWS_UP order of -+ checks so we can include defined(__ia64__) first. -+ -+2017-03-15 John David Anglin -+ -+ * sysdeps/hppa/dl-machine.h (DL_STACK_END): Define. -+ (RTLD_START): Don't record stack end address in _dl_start_user. -+ -+2017-01-30 H.J. Lu -+ -+ [BZ #21081] -+ * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -+ (L(stosb)): Add VZEROUPPER before ret. -+ -+2016-11-28 H.J. Lu -+ -+ [BZ #20750] -+ * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead -+ of PIC. -+ -+2016-12-31 Florian Weimer -+ -+ [BZ #18784] -+ CVE-2015-5180 -+ * include/arpa/nameser_compat.h (T_QUERY_A_AND_AAAA): Rename from -+ T_UNSPEC. Adjust value. -+ * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname4_r): Use it. -+ * resolv/res_query.c (__libc_res_nquery): Likewise. -+ * resolv/res_mkquery.c (res_nmkquery): Check for out-of-range -+ QTYPEs. -+ * resolv/tst-resolv-qtypes.c: New file. -+ * resolv/Makefile (xtests): Add tst-resolv-qtypes. -+ (tst-resolv-qtypes): Link against libresolv and libpthread. -+ -+2017-02-02 Siddhesh Poyarekar -+ -+ * sysdeps/generic/unsecvars.h: Add GLIBC_TUNABLES. -+ -+2017-01-23 Rajalakshmi Srinivasaraghavan -+ Steven Munroe -+ Tulio Magno Quites Machado Filho -+ -+ [BZ #20822] -+ * sysdeps/unix/sysv/linux/powerpc/elision-lock.c -+ (__lll_lock_elision): Access adapt_count via C11 atomics. -+ * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -+ (__lll_trylock_elision): Likewise. -+ * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -+ (__lll_unlock_elision): Update adapt_count variable inside the -+ critical section using C11 atomics. -+ -+2016-12-24 Carlos O'Donell -+ -+ [BZ #11941] -+ * elf/dl-close.c (_dl_close): Take dl_load_lock to examine map. -+ Remove assert (map->l_init_called); if DF_1_NODELETE is set. -+ * elf/Makefile [ifeq (yes,$(build-shared))] (tests): Add -+ tst-nodelete-dlclose. -+ (modules-names): Add tst-nodelete-dlclose-dso and -+ tst-nodelete-dlclose-plugin. -+ ($(objpfx)tst-nodelete-dlclose-dso.so): Define. -+ ($(objpfx)tst-nodelete-dlclose-plugin.so): Define. -+ ($(objpfx)tst-nodelete-dlclose): Define. -+ ($(objpfx)tst-nodelete-dlclose.out): Define. -+ -+2016-08-02 Aurelien Jarno -+ -+2016-08-02 Aurelien Jarno -+ -+ * sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself -+ when it is a NaN. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise. -+ * sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself -+ when it is a NaN. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise. -+ * sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself -+ when it is a NaN. -+ * sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise. -+ * sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value -+ when its absolute value is greater than 0x1.0p52. -+ [_IEEE_FP_INEXACT] Remove. -+ * sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value -+ when its absolute value is greater than 0x1.0p23. -+ [_IEEE_FP_INEXACT] Remove. -+ -+2016-11-30 H.J. Lu -+ -+ [BZ #20495] -+ [BZ #20508] -+ * sysdeps/x86/cpu-features.c (init_cpu_features): For Intel -+ processors, set Use_dl_runtime_resolve_slow and set -+ Use_dl_runtime_resolve_opt if XGETBV suports ECX == 1. -+ * sysdeps/x86/cpu-features.h (bit_arch_Use_dl_runtime_resolve_opt): -+ New. -+ (bit_arch_Use_dl_runtime_resolve_slow): Likewise. -+ (index_arch_Use_dl_runtime_resolve_opt): Likewise. -+ (index_arch_Use_dl_runtime_resolve_slow): Likewise. -+ * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup): Use -+ _dl_runtime_resolve_avx512_opt and _dl_runtime_resolve_avx_opt -+ if Use_dl_runtime_resolve_opt is set. Use -+ _dl_runtime_resolve_slow if Use_dl_runtime_resolve_slow is set. -+ * sysdeps/x86_64/dl-trampoline.S: Include . -+ (_dl_runtime_resolve_opt): New. Defined for AVX and AVX512. -+ (_dl_runtime_resolve): Add one for _dl_runtime_resolve_sse_vex. -+ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_avx_slow): -+ New. -+ (_dl_runtime_resolve_opt): Likewise. -+ (_dl_runtime_profile): Define only if _dl_runtime_profile is -+ defined. -+ -+2016-11-24 Aurelien Jarno -+ -+ * sysdeps/x86_64/memcpy_chk.S (__memcpy_chk): Check for SHARED -+ instead of PIC. -+ -+2016-11-23 Matthew Fortune -+ Maciej W. Rozycki -+ -+ * sysdeps/mips/mips32/crti.S (_init): Add `.insn' pseudo-op at -+ `.Lno_weak_fn' label. -+ * sysdeps/mips/mips64/n32/crti.S (_init): Likewise. -+ * sysdeps/mips/mips64/n64/crti.S (_init): Likewise. -+ -+2016-11-22 Adhemerval Zanella -+ -+ [BZ #20847] -+ * posix/execvpe.c (maybe_script_execute): Remove write past allocated -+ array bounds. -+ (__execvpe): Likewise. -+ -+2016-11-15 Denis Kaganovich -+ Magnus Granberg -+ Mike Frysinger -+ -+ [BZ #20662] -+ * configure.ac (libc_cv_predef_stack_protector): Also check for -+ __stack_chk_fail_local symbols. -+ * configure: Regenerated. -+ -+2016-11-03 Joseph Myers -+ -+ * conform/Makefile ($(linknamespace-header-tests)): Also depend on -+ $(linknamespace-symlists-tests). -+ -+2016-11-06 Aurelien Jarno -+ -+ * iconv/gconv.h (__gconv_info): Define __data element using a -+ zero-length array. -+ -+2016-10-25 Joseph Myers -+ -+ * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Use cmplwi -+ instead of cmpli. -+ * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Use cmpldi -+ instead of cmpli. -+ -+2016-10-24 Adhemerval Zanella -+ -+ * sysdeps/unix/sysv/linux/pread.c (__libc_pread): Use SYSCALL_LL_PRW. -+ * sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise. -+ * sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Use -+ SYSCALL_LL64_PRW. -+ * sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise. -+ * sysdeps/unix/sysv/linux/sh/kernel-features.h: Define -+ __ASSUME_PRW_DUMMY_ARG. -+ * sysdeps/unix/sysv/linux/sh/pread.c: Remove file. -+ * sysdeps/unix/sysv/linux/sh/pread64.c: Likewise. -+ * sysdeps/unix/sysv/linux/sh/pwrite.c: Likewise. -+ * sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise. -+ * sysdeps/unix/sysv/linux/sysdep.h: Define SYSCALL_LL_PRW and -+ SYSCALL_LL_PRW64 based on __ASSUME_PRW_DUMMY_ARG. -+ -+2016-10-05 Tulio Magno Quites Machado Filho -+ -+ * sysdeps/powerpc/fpu/libm-test-ulps: Regenerated. -+ -+2016-09-20 Adhemerval Zanella -+ -+ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Correctly block and unblock -+ all signals when executing the clone vfork child. -+ (SIGALL_SET): Remove macro. -+ -+ * nptl/Makefile (tests): Add tst-exec5. -+ * nptl/tst-exec5.c: New file. -+ * sysdeps/unix/sysv/linux/spawni.c (__spawni): Correctly enable and disable -+ asynchronous cancellation. -+ -+2016-09-19 Tulio Magno Quites Machado Filho -+ -+ [BZ #20615] -+ * sysdeps/powerpc/powerpc32/power9/multiarch/Implies: Replace -+ fpu directory by non-fpu. -+ * sysdeps/powerpc/powerpc64/power9/fpu/Implies: Remove dependency -+ on non-fpu directory from a fpu directory. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.24 A. -+ -+ * sysdeps/nacl/dup.c: Add libc_hidden_def. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/posix/wait3.c: Don't treat STAT_LOC as a union, since it's -+ not any more. -+ -+2016-09-02 Roland McGrath -+ -+ * sysdeps/nacl/clock.c (clock): nacl_abi_clock_t -> nacl_irt_clock_t -+ -+2016-08-17 Florian Weimer -+ -+ Reduce time to expected nptl/tst-once5 failure. -+ * nptl/tst-once5.cc (TIMEOUT): Define. -+ -+2016-08-18 Florian Weimer -+ -+ [BZ #16907] -+ * argp/argp.h: Switch to __BEGIN_DECLS and __END_DECLS. -+ (__THROW, __NTH, __attribute__, __restrict): Remove definitions. -+ * argp/argp-fmtstream.h: Add __BEGIN_DECLS and __END_DECLS. -+ (__attribute__): Remove definition. -+ -+2016-08-15 Andreas Schwab -+ -+ [BZ #20435] -+ * sysdeps/unix/sysv/linux/arm/setcontext.S (__startcontext): Mark -+ as .cantunwind. -+ -+2016-08-17 Florian Weimer -+ -+ [BZ #20452] -+ Avoid additional copies of objects in libc.a in static libraries. -+ * sysdeps/ia64/nptl/Makefile (libpthread-shared-only-routines): -+ Add ptw-sysdep, ptw-sigblock, ptw-sigprocmask. -+ * sysdeps/mips/Makefile (librt-shared-only-routines): Add -+ rt-sysdep. -+ * sysdeps/mips/nptl/Makefile (libpthread-shared-only-routines): -+ Add nptl-sysdep. -+ * sysdeps/s390/nptl/Makefile (libpthread-shared-only-routines): -+ Add ptw-sysdep. -+ * sysdeps/unix/alpha/Makefile (librt-shared-only-routines): Add -+ rt-sysdep. -+ * sysdeps/unix/sysv/linux/alpha/Makefile -+ (libpthread-shared-only-routines): Add ptw-sysdep, -+ ptw-sigprocmask, ptw-rt_sigaction. -+ * sysdeps/unix/sysv/linux/ia64/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ * sysdeps/unix/sysv/linux/i386/Makefile -+ (libpthread-shared-only-routines): Add libc-do-syscall. -+ * sysdeps/unix/sysv/linux/microblaze/Makefile -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/powerpc/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/s390/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ * sysdeps/unix/sysv/linux/sparc/Makefile -+ (librt-shared-only-routines): Add rt-sysdep. -+ (libpthread-shared-only-routines): Add sysdep. -+ * sysdeps/unix/sysv/linux/tile/Makefile -+ (libpthread-shared-only-routines): Likewise. -+ -+2016-08-05 Aurelien Jarno -+ -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -+ [$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines): -+ Remove s_fdimf-vis3, s_fdim-vis3. -+ * sysdeps/sparc/sparc32/fpu/s_fdim.S: Delete file. -+ * sysdeps/sparc/sparc32/fpu/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: Likewise. -+ * sysdeps/sparc/sparc64/fpu/s_fdim.S: Likewise. -+ * sysdeps/sparc/sparc64/fpu/s_fdimf.S: Likewise. -+ -+2016-08-02 David S. Miller -+ -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -+ (__nearbyint_vis3): Don't check for sNaN before float register is -+ loaded with the incoming argument. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -+ (__nearbyintf_vis3): Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint): -+ Likewise. -+ * sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf): -+ Likewise. -+ -+2016-08-03 Aurelien Jarno -+ -+ * sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Replace beqlr instructions -+ by beq instructions jumping to the end of the function. -+ * sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the -+ clobber list. Use "i" constraint instead of "X". -+ (ifunc_one): Add "12" to the clobber list. Use "i" constraint instead -+ of "X". -+ -+2016-08-04 Carlos O'Donell -+ -+ * po/de.po: Update from Translation Project. -+ * po/fi.po: Likewise. -+ * po/sv.po: Likewise. -+ -+2016-08-02 Florian Weimer -+ -+ [BZ #20370] -+ * malloc/arena.c (get_free_list): Update comment. Assert that -+ arenas on the free list have no attached threads. -+ (remove_from_free_list): New function. -+ (reused_arena): Call it. -+ -+2016-08-04 Florian Weimer -+ -+ Use sysdep.o from libc.a in static libraries. -+ * sysdeps/unix/sysv/linux/i386/Makefile -+ (libpthread-shared-only-routines): Add sysdep. -+ (librt-shared-only-routines): Likewise. -+ - 2016-08-01 Carlos O'Donell - - * version.h (RELEASE): Set to "stable" -diff --git a/Makeconfig b/Makeconfig -index 03fd89c13e..ee379f5852 100644 ---- a/Makeconfig -+++ b/Makeconfig -@@ -394,6 +394,9 @@ ifndef after-link - after-link = - endif - -+# Additional libraries to link into every test. -+link-extra-libs-tests = $(libsupport) -+ - # Command for linking PIE programs with the C library. - ifndef +link-pie - +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ -@@ -503,7 +506,7 @@ link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib) - link-libc-tests = $(link-libc-tests-rpath-link) \ - $(link-libc-before-gnulib) $(gnulib-tests) - # This is how to find at build-time things that will be installed there. --rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec -+rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support - rpath-link = \ - $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) - else -@@ -850,7 +853,7 @@ libio-include = -I$(..)libio - # List of non-library modules that we build. - built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ - libSegFault libpcprofile librpcsvc locale-programs \ -- memusagestat nonlib nscd extramodules libnldbl -+ memusagestat nonlib nscd extramodules libnldbl libsupport - - in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ - $(libof-$( - using `glibc' in the "product" field. - -+Version 2.24.1 -+ -+Security related changes: -+ -+* On ARM EABI (32-bit), generating a backtrace for execution contexts which -+ have been created with makecontext could fail to terminate due to a -+ missing .cantunwind annotation. This has been observed to lead to a hang -+ (denial of service) in some Go applications compiled with gccgo. Reported -+ by Andreas Schwab. (CVE-2016-6323) -+ -+* The DNS stub resolver functions would crash due to a NULL pointer -+ dereference when processing a query with a valid DNS question type which -+ was used internally in the implementation. The stub resolver now uses a -+ question type which is outside the range of valid question type values. -+ (CVE-2015-5180) -+ -+The following bugs are resolved with this release: -+ -+ [20790] Fix rpcgen buffer overrun -+ [20978] Fix strlen on null pointer in nss_nisplus -+ [21209] Ignore and remove LD_HWCAP_MASK for AT_SECURE programs -+ [21289] Fix symbol redirect for fts_set -+ [21386] Assertion in fork for distinct parent PID is incorrect -+ [21609] x86-64: Align the stack in __tls_get_addr -+ [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366) -+ [21654] nss: Fix invalid cast in group merging -+ - Version 2.24 - - * The minimum Linux kernel version that this version of the GNU C Library -diff --git a/Rules b/Rules -index 8306d36a07..a981965d2b 100644 ---- a/Rules -+++ b/Rules -@@ -149,6 +149,7 @@ endif - - ifneq "$(strip $(binaries-shared-tests))" "" - $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-tests) -@@ -156,6 +157,7 @@ endif - - ifneq "$(strip $(binaries-pie-tests))" "" - $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-pie-tests) -@@ -177,6 +179,7 @@ endif - - ifneq "$(strip $(binaries-static-tests))" "" - $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \ -+ $(link-extra-libs-tests) \ - $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ - $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) - $(+link-static-tests) -diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h -index bdeaa54dc2..e8c5797f38 100644 ---- a/argp/argp-fmtstream.h -+++ b/argp/argp-fmtstream.h -@@ -29,21 +29,6 @@ - #include - #include - --#ifndef __attribute__ --/* This feature is available in gcc versions 2.5 and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \ -- defined __STRICT_ANSI__ --# define __attribute__(Spec) /* empty */ --# endif --/* The __-protected variants of `format' and `printf' attributes -- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \ -- defined __STRICT_ANSI__ --# define __format__ format --# define __printf__ printf --# endif --#endif -- - #if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H) - /* line_wrap_stream is available, so use that. */ - #define ARGP_FMTSTREAM_USE_LINEWRAP -@@ -111,6 +96,8 @@ struct argp_fmtstream - - typedef struct argp_fmtstream *argp_fmtstream_t; - -+__BEGIN_DECLS -+ - /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines - written on it with LMARGIN spaces and limits them to RMARGIN columns - total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by -@@ -297,6 +284,8 @@ __argp_fmtstream_point (argp_fmtstream_t __fs) - - #endif /* __OPTIMIZE__ */ - -+__END_DECLS -+ - #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ - - #endif /* argp-fmtstream.h */ -diff --git a/argp/argp.h b/argp/argp.h -index e67bbef739..7cb5a69f08 100644 ---- a/argp/argp.h -+++ b/argp/argp.h -@@ -28,48 +28,12 @@ - #define __need_error_t - #include - --#ifndef __THROW --# define __THROW --#endif --#ifndef __NTH --# define __NTH(fct) fct __THROW --#endif -- --#ifndef __attribute__ --/* This feature is available in gcc versions 2.5 and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \ -- defined __STRICT_ANSI__ --# define __attribute__(Spec) /* empty */ --# endif --/* The __-protected variants of `format' and `printf' attributes -- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ --# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \ -- defined __STRICT_ANSI__ --# define __format__ format --# define __printf__ printf --# endif --#endif -- --/* GCC 2.95 and later have "__restrict"; C99 compilers have -- "restrict", and "configure" may have defined "restrict". */ --#ifndef __restrict --# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) --# if defined restrict || 199901L <= __STDC_VERSION__ --# define __restrict restrict --# else --# define __restrict --# endif --# endif --#endif -- - #ifndef __error_t_defined - typedef int error_t; - # define __error_t_defined - #endif - --#ifdef __cplusplus --extern "C" { --#endif -+__BEGIN_DECLS - - /* A description of a particular option. A pointer to an array of - these is passed in the OPTIONS field of an argp structure. Each option -@@ -590,8 +554,6 @@ __NTH (__option_is_end (const struct argp_option *__opt)) - # endif - #endif /* Use extern inlines. */ - --#ifdef __cplusplus --} --#endif -+__END_DECLS - - #endif /* argp.h */ -diff --git a/configure b/configure -index 17625e1041..9b5a486048 100755 ---- a/configure -+++ b/configure -@@ -6289,12 +6289,14 @@ echo >&5 "libc_undefs='$libc_undefs'" - # symbols (resolved by the linker), so filter out unknown symbols. - # This will fail to produce the correct result if the compiler - # defaults to -fstack-protector but this produces an undefined symbol --# other than __stack_chk_fail. However, compilers like that have not --# been encountered in practice. --libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'` -+# other than __stack_chk_fail or __stack_chk_fail_local. However, -+# compilers like that have not been encountered in practice. -+libc_undefs=`echo "$libc_undefs" | \ -+ egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'` - case "$libc_undefs" in - foobar) libc_cv_predef_stack_protector=no ;; - '__stack_chk_fail -+foobar'|'__stack_chk_fail_local - foobar') libc_cv_predef_stack_protector=yes ;; - *) as_fn_error $? "unexpected symbols in test: $libc_undefs" "$LINENO" 5 ;; - esac -diff --git a/configure.ac b/configure.ac -index 33bcd62180..8277d9f727 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1626,12 +1626,14 @@ echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'" - # symbols (resolved by the linker), so filter out unknown symbols. - # This will fail to produce the correct result if the compiler - # defaults to -fstack-protector but this produces an undefined symbol --# other than __stack_chk_fail. However, compilers like that have not --# been encountered in practice. --libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'` -+# other than __stack_chk_fail or __stack_chk_fail_local. However, -+# compilers like that have not been encountered in practice. -+libc_undefs=`echo "$libc_undefs" | \ -+ egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'` - case "$libc_undefs" in - foobar) libc_cv_predef_stack_protector=no ;; - '__stack_chk_fail -+foobar'|'__stack_chk_fail_local - foobar') libc_cv_predef_stack_protector=yes ;; - *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;; - esac], -diff --git a/conform/Makefile b/conform/Makefile -index 32a0937b06..7883624c81 100644 ---- a/conform/Makefile -+++ b/conform/Makefile -@@ -196,13 +196,13 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \ - conformtest.pl $(conformtest-headers-data) - (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ - mkdir -p $(@D)/scratch; \ -- $(PERL) conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ -+ $(PERL) -I. conformtest.pl --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --headers=$$hdr > $@); \ - $(evaluate-test) - - $(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl -- $(PERL) -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ -+ $(PERL) -I. -w $< --tmpdir=$(objpfx) --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$* \ - --headers="$(strip $(conformtest-headers-$*))" \ - > $@ 2> $@.err; \ -@@ -229,10 +229,11 @@ $(linknamespace-symlist-stdlibs-tests): $(objpfx)symlist-stdlibs-%: \ - - $(linknamespace-header-tests): $(objpfx)%/linknamespace.out: \ - linknamespace.pl \ -+ $(linknamespace-symlists-tests) \ - $(linknamespace-symlist-stdlibs-tests) - (set -e; std_hdr=$*; std=$${std_hdr%%/*}; hdr=$${std_hdr#*/}; \ - mkdir -p $(@D)/scratch; \ -- $(PERL) -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ -+ $(PERL) -I. -w $< --tmpdir=$(@D)/scratch --cc='$(CC)' \ - --flags='$(conformtest-cc-flags)' --standard=$$std \ - --stdsyms=$(objpfx)symlist-$$std --header=$$hdr \ - --libsyms=$(objpfx)symlist-stdlibs-$$std \ -diff --git a/elf/Makefile b/elf/Makefile -index 593403c640..847a012f84 100644 ---- a/elf/Makefile -+++ b/elf/Makefile -@@ -149,7 +149,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ - tst-nodelete) \ - tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ -- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error -+ tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error \ -+ tst-nodelete-dlclose - # reldep9 - ifeq ($(build-hardcoded-path-in-tests),yes) - tests += tst-dlopen-aout -@@ -223,7 +224,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ - tst-array5dep tst-null-argv-lib \ - tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \ - tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \ -- tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 -+ tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12 \ -+ tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin - ifeq (yes,$(have-mtls-dialect-gnu2)) - tests += tst-gnu2-tls1 - modules-names += tst-gnu2-tls1mod -@@ -1267,3 +1269,12 @@ $(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig - $(evaluate-test) - - $(objpfx)tst-dlsym-error: $(libdl) -+ -+# The application depends on the DSO, and the DSO loads the plugin. -+# The plugin also depends on the DSO. This creates the circular -+# dependency via dlopen that we're testing to make sure works. -+$(objpfx)tst-nodelete-dlclose-dso.so: $(libdl) -+$(objpfx)tst-nodelete-dlclose-plugin.so: $(objpfx)tst-nodelete-dlclose-dso.so -+$(objpfx)tst-nodelete-dlclose: $(objpfx)tst-nodelete-dlclose-dso.so -+$(objpfx)tst-nodelete-dlclose.out: $(objpfx)tst-nodelete-dlclose-dso.so \ -+ $(objpfx)tst-nodelete-dlclose-plugin.so -diff --git a/elf/dl-close.c b/elf/dl-close.c -index 687d7de874..9f93ab7628 100644 ---- a/elf/dl-close.c -+++ b/elf/dl-close.c -@@ -805,19 +805,37 @@ _dl_close (void *_map) - { - struct link_map *map = _map; - -- /* First see whether we can remove the object at all. */ -+ /* We must take the lock to examine the contents of map and avoid -+ concurrent dlopens. */ -+ __rtld_lock_lock_recursive (GL(dl_load_lock)); -+ -+ /* At this point we are guaranteed nobody else is touching the list of -+ loaded maps, but a concurrent dlclose might have freed our map -+ before we took the lock. There is no way to detect this (see below) -+ so we proceed assuming this isn't the case. First see whether we -+ can remove the object at all. */ - if (__glibc_unlikely (map->l_flags_1 & DF_1_NODELETE)) - { -- assert (map->l_init_called); - /* Nope. Do nothing. */ -+ __rtld_lock_unlock_recursive (GL(dl_load_lock)); - return; - } - -+ /* At present this is an unreliable check except in the case where the -+ caller has recursively called dlclose and we are sure the link map -+ has not been freed. In a non-recursive dlclose the map itself -+ might have been freed and this access is potentially a data race -+ with whatever other use this memory might have now, or worse we -+ might silently corrupt memory if it looks enough like a link map. -+ POSIX has language in dlclose that appears to guarantee that this -+ should be a detectable case and given that dlclose should be threadsafe -+ we need this to be a reliable detection. -+ This is bug 20990. */ - if (__builtin_expect (map->l_direct_opencount, 1) == 0) -- GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open")); -- -- /* Acquire the lock. */ -- __rtld_lock_lock_recursive (GL(dl_load_lock)); -+ { -+ __rtld_lock_unlock_recursive (GL(dl_load_lock)); -+ _dl_signal_error (0, map->l_name, NULL, N_("shared object not open")); -+ } - - _dl_close_worker (map, false); - -diff --git a/elf/rtld.c b/elf/rtld.c -index 647661ca45..8f56d6edd3 100644 ---- a/elf/rtld.c -+++ b/elf/rtld.c -@@ -99,14 +99,121 @@ uintptr_t __pointer_chk_guard_local - strong_alias (__pointer_chk_guard_local, __pointer_chk_guard) - #endif - -+/* Length limits for names and paths, to protect the dynamic linker, -+ particularly when __libc_enable_secure is active. */ -+#ifdef NAME_MAX -+# define SECURE_NAME_LIMIT NAME_MAX -+#else -+# define SECURE_NAME_LIMIT 255 -+#endif -+#ifdef PATH_MAX -+# define SECURE_PATH_LIMIT PATH_MAX -+#else -+# define SECURE_PATH_LIMIT 1024 -+#endif -+ -+/* Check that AT_SECURE=0, or that the passed name does not contain -+ directories and is not overly long. Reject empty names -+ unconditionally. */ -+static bool -+dso_name_valid_for_suid (const char *p) -+{ -+ if (__glibc_unlikely (__libc_enable_secure)) -+ { -+ /* Ignore pathnames with directories for AT_SECURE=1 -+ programs, and also skip overlong names. */ -+ size_t len = strlen (p); -+ if (len >= SECURE_NAME_LIMIT || memchr (p, '/', len) != NULL) -+ return false; -+ } -+ return *p != '\0'; -+} - --/* List of auditing DSOs. */ -+/* LD_AUDIT variable contents. Must be processed before the -+ audit_list below. */ -+const char *audit_list_string; -+ -+/* Cyclic list of auditing DSOs. audit_list->next is the first -+ element. */ - static struct audit_list - { - const char *name; - struct audit_list *next; - } *audit_list; - -+/* Iterator for audit_list_string followed by audit_list. */ -+struct audit_list_iter -+{ -+ /* Tail of audit_list_string still needing processing, or NULL. */ -+ const char *audit_list_tail; -+ -+ /* The list element returned in the previous iteration. NULL before -+ the first element. */ -+ struct audit_list *previous; -+ -+ /* Scratch buffer for returning a name which is part of -+ audit_list_string. */ -+ char fname[SECURE_NAME_LIMIT]; -+}; -+ -+/* Initialize an audit list iterator. */ -+static void -+audit_list_iter_init (struct audit_list_iter *iter) -+{ -+ iter->audit_list_tail = audit_list_string; -+ iter->previous = NULL; -+} -+ -+/* Iterate through both audit_list_string and audit_list. */ -+static const char * -+audit_list_iter_next (struct audit_list_iter *iter) -+{ -+ if (iter->audit_list_tail != NULL) -+ { -+ /* First iterate over audit_list_string. */ -+ while (*iter->audit_list_tail != '\0') -+ { -+ /* Split audit list at colon. */ -+ size_t len = strcspn (iter->audit_list_tail, ":"); -+ if (len > 0 && len < sizeof (iter->fname)) -+ { -+ memcpy (iter->fname, iter->audit_list_tail, len); -+ iter->fname[len] = '\0'; -+ } -+ else -+ /* Do not return this name to the caller. */ -+ iter->fname[0] = '\0'; -+ -+ /* Skip over the substring and the following delimiter. */ -+ iter->audit_list_tail += len; -+ if (*iter->audit_list_tail == ':') -+ ++iter->audit_list_tail; -+ -+ /* If the name is valid, return it. */ -+ if (dso_name_valid_for_suid (iter->fname)) -+ return iter->fname; -+ /* Otherwise, wrap around and try the next name. */ -+ } -+ /* Fall through to the procesing of audit_list. */ -+ } -+ -+ if (iter->previous == NULL) -+ { -+ if (audit_list == NULL) -+ /* No pre-parsed audit list. */ -+ return NULL; -+ /* Start of audit list. The first list element is at -+ audit_list->next (cyclic list). */ -+ iter->previous = audit_list->next; -+ return iter->previous->name; -+ } -+ if (iter->previous == audit_list) -+ /* Cyclic list wrap-around. */ -+ return NULL; -+ iter->previous = iter->previous->next; -+ return iter->previous->name; -+} -+ - #ifndef HAVE_INLINED_SYSCALLS - /* Set nonzero during loading and initialization of executable and - libraries, cleared before the executable's entry point runs. This -@@ -730,6 +837,42 @@ static const char *preloadlist attribute_relro; - /* Nonzero if information about versions has to be printed. */ - static int version_info attribute_relro; - -+/* The LD_PRELOAD environment variable gives list of libraries -+ separated by white space or colons that are loaded before the -+ executable's dependencies and prepended to the global scope list. -+ (If the binary is running setuid all elements containing a '/' are -+ ignored since it is insecure.) Return the number of preloads -+ performed. */ -+unsigned int -+handle_ld_preload (const char *preloadlist, struct link_map *main_map) -+{ -+ unsigned int npreloads = 0; -+ const char *p = preloadlist; -+ char fname[SECURE_PATH_LIMIT]; -+ -+ while (*p != '\0') -+ { -+ /* Split preload list at space/colon. */ -+ size_t len = strcspn (p, " :"); -+ if (len > 0 && len < sizeof (fname)) -+ { -+ memcpy (fname, p, len); -+ fname[len] = '\0'; -+ } -+ else -+ fname[0] = '\0'; -+ -+ /* Skip over the substring and the following delimiter. */ -+ p += len; -+ if (*p != '\0') -+ ++p; -+ -+ if (dso_name_valid_for_suid (fname)) -+ npreloads += do_preload (fname, main_map, "LD_PRELOAD"); -+ } -+ return npreloads; -+} -+ - static void - dl_main (const ElfW(Phdr) *phdr, - ElfW(Word) phnum, -@@ -1257,11 +1400,13 @@ of this helper program; chances are you did not intend to run this program.\n\ - GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid (); - - /* If we have auditing DSOs to load, do it now. */ -- if (__glibc_unlikely (audit_list != NULL)) -+ bool need_security_init = true; -+ if (__glibc_unlikely (audit_list != NULL) -+ || __glibc_unlikely (audit_list_string != NULL)) - { -- /* Iterate over all entries in the list. The order is important. */ - struct audit_ifaces *last_audit = NULL; -- struct audit_list *al = audit_list->next; -+ struct audit_list_iter al_iter; -+ audit_list_iter_init (&al_iter); - - /* Since we start using the auditing DSOs right away we need to - initialize the data structures now. */ -@@ -1272,9 +1417,14 @@ of this helper program; chances are you did not intend to run this program.\n\ - use different values (especially the pointer guard) and will - fail later on. */ - security_init (); -+ need_security_init = false; - -- do -+ while (true) - { -+ const char *name = audit_list_iter_next (&al_iter); -+ if (name == NULL) -+ break; -+ - int tls_idx = GL(dl_tls_max_dtv_idx); - - /* Now it is time to determine the layout of the static TLS -@@ -1283,7 +1433,7 @@ of this helper program; chances are you did not intend to run this program.\n\ - no DF_STATIC_TLS bit is set. The reason is that we know - glibc will use the static model. */ - struct dlmopen_args dlmargs; -- dlmargs.fname = al->name; -+ dlmargs.fname = name; - dlmargs.map = NULL; - - const char *objname; -@@ -1296,7 +1446,7 @@ of this helper program; chances are you did not intend to run this program.\n\ - not_loaded: - _dl_error_printf ("\ - ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", -- al->name, err_str); -+ name, err_str); - if (malloced) - free ((char *) err_str); - } -@@ -1400,10 +1550,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - goto not_loaded; - } - } -- -- al = al->next; - } -- while (al != audit_list->next); - - /* If we have any auditing modules, announce that we already - have two objects loaded. */ -@@ -1481,23 +1628,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - - if (__glibc_unlikely (preloadlist != NULL)) - { -- /* The LD_PRELOAD environment variable gives list of libraries -- separated by white space or colons that are loaded before the -- executable's dependencies and prepended to the global scope -- list. If the binary is running setuid all elements -- containing a '/' are ignored since it is insecure. */ -- char *list = strdupa (preloadlist); -- char *p; -- - HP_TIMING_NOW (start); -- -- /* Prevent optimizing strsep. Speed is not important here. */ -- while ((p = (strsep) (&list, " :")) != NULL) -- if (p[0] != '\0' -- && (__builtin_expect (! __libc_enable_secure, 1) -- || strchr (p, '/') == NULL)) -- npreloads += do_preload (p, main_map, "LD_PRELOAD"); -- -+ npreloads += handle_ld_preload (preloadlist, main_map); - HP_TIMING_NOW (stop); - HP_TIMING_DIFF (diff, start, stop); - HP_TIMING_ACCUM_NT (load_time, diff); -@@ -1682,7 +1814,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", - if (tcbp == NULL) - tcbp = init_tls (); - -- if (__glibc_likely (audit_list == NULL)) -+ if (__glibc_likely (need_security_init)) - /* Initialize security features. But only if we have not done it - earlier. */ - security_init (); -@@ -2313,9 +2445,7 @@ process_dl_audit (char *str) - char *p; - - while ((p = (strsep) (&str, ":")) != NULL) -- if (p[0] != '\0' -- && (__builtin_expect (! __libc_enable_secure, 1) -- || strchr (p, '/') == NULL)) -+ if (dso_name_valid_for_suid (p)) - { - /* This is using the local malloc, not the system malloc. The - memory can never be freed. */ -@@ -2379,7 +2509,7 @@ process_envvars (enum mode *modep) - break; - } - if (memcmp (envline, "AUDIT", 5) == 0) -- process_dl_audit (&envline[6]); -+ audit_list_string = &envline[6]; - break; - - case 7: -@@ -2423,7 +2553,8 @@ process_envvars (enum mode *modep) - - case 10: - /* Mask for the important hardware capabilities. */ -- if (memcmp (envline, "HWCAP_MASK", 10) == 0) -+ if (!__libc_enable_secure -+ && memcmp (envline, "HWCAP_MASK", 10) == 0) - GLRO(dl_hwcap_mask) = __strtoul_internal (&envline[11], NULL, - 0, 0); - break; -@@ -2437,7 +2568,8 @@ process_envvars (enum mode *modep) - - case 12: - /* The library search path. */ -- if (memcmp (envline, "LIBRARY_PATH", 12) == 0) -+ if (!__libc_enable_secure -+ && memcmp (envline, "LIBRARY_PATH", 12) == 0) - { - library_path = &envline[13]; - break; -diff --git a/elf/tst-nodelete-dlclose-dso.c b/elf/tst-nodelete-dlclose-dso.c -new file mode 100644 -index 0000000000..dd930f99cc ---- /dev/null -+++ b/elf/tst-nodelete-dlclose-dso.c -@@ -0,0 +1,90 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This is the primary DSO that is loaded by the appliation. This DSO -+ then loads a plugin with RTLD_NODELETE. This plugin depends on this -+ DSO. This dependency chain means that at application shutdown the -+ plugin will be destructed first. Thus by the time this DSO is -+ destructed we will be calling dlclose on an object that has already -+ been destructed. It is allowed to call dlclose in this way and -+ should not assert. */ -+#include -+#include -+#include -+ -+/* Plugin to load. */ -+static void *plugin_lib = NULL; -+/* Plugin function. */ -+static void (*plugin_func) (void); -+#define LIB_PLUGIN "tst-nodelete-dlclose-plugin.so" -+ -+/* This function is never called but the plugin references it. -+ We do this to avoid any future --as-needed from removing the -+ plugin's DT_NEEDED on this DSO (required for the test). */ -+void -+primary_reference (void) -+{ -+ printf ("INFO: Called primary_reference function.\n"); -+} -+ -+void -+primary (void) -+{ -+ char *error; -+ -+ plugin_lib = dlopen (LIB_PLUGIN, RTLD_NOW | RTLD_LOCAL | RTLD_NODELETE); -+ if (plugin_lib == NULL) -+ { -+ printf ("ERROR: Unable to load plugin library.\n"); -+ exit (EXIT_FAILURE); -+ } -+ dlerror (); -+ -+ plugin_func = (void (*) (void)) dlsym (plugin_lib, "plugin_func"); -+ error = dlerror (); -+ if (error != NULL) -+ { -+ printf ("ERROR: Unable to find symbol with error \"%s\".", -+ error); -+ exit (EXIT_FAILURE); -+ } -+ -+ return; -+} -+ -+__attribute__ ((destructor)) -+static void -+primary_dtor (void) -+{ -+ int ret; -+ -+ printf ("INFO: Calling primary destructor.\n"); -+ -+ /* The destructor runs in the test driver also, which -+ hasn't called primary, in that case do nothing. */ -+ if (plugin_lib == NULL) -+ return; -+ -+ ret = dlclose (plugin_lib); -+ if (ret != 0) -+ { -+ printf ("ERROR: Calling dlclose failed with \"%s\"\n", -+ dlerror ()); -+ exit (EXIT_FAILURE); -+ } -+} -diff --git a/elf/tst-nodelete-dlclose-plugin.c b/elf/tst-nodelete-dlclose-plugin.c -new file mode 100644 -index 0000000000..8b295c1718 ---- /dev/null -+++ b/elf/tst-nodelete-dlclose-plugin.c -@@ -0,0 +1,40 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This DSO simulates a plugin with a dependency on the -+ primary DSO loaded by the appliation. */ -+#include -+ -+extern void primary_reference (void); -+ -+void -+plugin_func (void) -+{ -+ printf ("INFO: Calling plugin function.\n"); -+ /* Need a reference to the DSO to ensure that a potential --as-needed -+ doesn't remove the DT_NEEDED entry which we rely upon to ensure -+ destruction ordering. */ -+ primary_reference (); -+} -+ -+__attribute__ ((destructor)) -+static void -+plugin_dtor (void) -+{ -+ printf ("INFO: Calling plugin destructor.\n"); -+} -diff --git a/elf/tst-nodelete-dlclose.c b/elf/tst-nodelete-dlclose.c -new file mode 100644 -index 0000000000..b3d07e1849 ---- /dev/null -+++ b/elf/tst-nodelete-dlclose.c -@@ -0,0 +1,36 @@ -+/* Bug 11941: Improper assert map->l_init_called in dlclose. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This simulates an application using the primary DSO which loads the -+ plugin DSO. */ -+#include -+#include -+ -+extern void primary (void); -+ -+static int -+do_test (void) -+{ -+ printf ("INFO: Starting application.\n"); -+ primary (); -+ printf ("INFO: Exiting application.\n"); -+ return 0; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/extra-lib.mk b/extra-lib.mk -index b10748d185..2552049135 100644 ---- a/extra-lib.mk -+++ b/extra-lib.mk -@@ -5,6 +5,9 @@ - # The variable $($(lib)-routines) defines the list of modules - # to be included in that library. A sysdep Makefile can add to - # $(lib)-sysdep_routines to include additional modules. -+# -+# Libraries listed in $(extra-libs-noinstall) are built, but not -+# installed. - - lib := $(firstword $(extra-libs-left)) - extra-libs-left := $(filter-out $(lib),$(extra-libs-left)) -@@ -28,7 +31,9 @@ extra-objs := $(extra-objs) - all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines) - - # Add each flavor of library to the lists of things to build and install. -+ifeq (,$(filter $(lib), $(extra-libs-noinstall))) - install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o))) -+endif - extra-objs += $(foreach o,$(filter-out .os .oS,$(object-suffixes-$(lib))),\ - $(patsubst %,%$o,$(filter-out \ - $($(lib)-shared-only-routines),\ -diff --git a/grp/grp-merge.c b/grp/grp-merge.c -index 0a1eb38d2c..5f79755798 100644 ---- a/grp/grp-merge.c -+++ b/grp/grp-merge.c -@@ -85,6 +85,14 @@ __copy_grp (const struct group srcgrp, const size_t buflen, - } - members[i] = NULL; - -+ /* Align for pointers. We can't simply align C because we need to -+ align destbuf[c]. */ -+ if ((((uintptr_t)destbuf + c) & (__alignof__(char **) - 1)) != 0) -+ { -+ uintptr_t mis_align = ((uintptr_t)destbuf + c) & (__alignof__(char **) - 1); -+ c += __alignof__(char **) - mis_align; -+ } -+ - /* Copy the pointers from the members array into the buffer and assign them - to the gr_mem member of destgrp. */ - destgrp->gr_mem = (char **) &destbuf[c]; -@@ -129,7 +137,7 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, - - /* Get the count of group members from the last sizeof (size_t) bytes in the - mergegrp buffer. */ -- savedmemcount = (size_t) *(savedend - sizeof (size_t)); -+ savedmemcount = *(size_t *) (savedend - sizeof (size_t)); - - /* Get the count of new members to add. */ - for (memcount = 0; mergegrp->gr_mem[memcount]; memcount++) -@@ -168,6 +176,14 @@ __merge_grp (struct group *savedgrp, char *savedbuf, char *savedend, - /* Add the NULL-terminator. */ - members[savedmemcount + memcount] = NULL; - -+ /* Align for pointers. We can't simply align C because we need to -+ align savedbuf[c]. */ -+ if ((((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1)) != 0) -+ { -+ uintptr_t mis_align = ((uintptr_t)savedbuf + c) & (__alignof__(char **) - 1); -+ c += __alignof__(char **) - mis_align; -+ } -+ - /* Copy the member array back into the buffer after the member list and free - the member array. */ - savedgrp->gr_mem = (char **) &savedbuf[c]; -diff --git a/iconv/gconv.h b/iconv/gconv.h -index 8d8ce5813b..a87028047b 100644 ---- a/iconv/gconv.h -+++ b/iconv/gconv.h -@@ -139,7 +139,7 @@ typedef struct __gconv_info - { - size_t __nsteps; - struct __gconv_step *__steps; -- __extension__ struct __gconv_step_data __data __flexarr; -+ __extension__ struct __gconv_step_data __data[0]; - } *__gconv_t; - - /* Transliteration using the locale's data. */ -diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h -index 2e735ede4c..7c0deed9ae 100644 ---- a/include/arpa/nameser_compat.h -+++ b/include/arpa/nameser_compat.h -@@ -1,8 +1,8 @@ - #ifndef _ARPA_NAMESER_COMPAT_ - #include - --/* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e., -- T_A and T_AAAA). */ --#define T_UNSPEC 62321 -+/* The number is outside the 16-bit RR type range and is used -+ internally by the implementation. */ -+#define T_QUERY_A_AND_AAAA 439963904 - - #endif -diff --git a/io/fts.h b/io/fts.h -index 127a0d2721..b6b45206c8 100644 ---- a/io/fts.h -+++ b/io/fts.h -@@ -193,7 +193,7 @@ FTS *__REDIRECT (fts_open, (char * const *, int, - int (*)(const FTSENT **, const FTSENT **)), - fts64_open); - FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); --int __REDIRECT (fts_set, (FTS *, FTSENT *, int), fts64_set) __THROW; -+int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set); - # else - # define fts_children fts64_children - # define fts_close fts64_close -diff --git a/localedata/ChangeLog b/localedata/ChangeLog -index 4be8afc110..a7688e3df6 100644 ---- a/localedata/ChangeLog -+++ b/localedata/ChangeLog -@@ -1,3 +1,17 @@ -+2017-06-11 Santhosh Thottingal -+ -+ [BZ #19922] -+ * locales/iso14651_t1_common: Add collation rules for U+07DA to U+07DF. -+ -+ [BZ #19919] -+ * locales/iso14651_t1_common: Correct collation of U+0D36 and U+0D37. -+ -+2016-12-30 Mike Frysinger -+ -+ [BZ #20974] -+ * localedata/bs_BA (LC_MESSAGES): Delete "*." from the end of -+ yesexpr and noexpr. -+ - 2016-07-07 Aurelien Jarno - - * locales/de_LI (postal_fmt): Fix indentation. -diff --git a/localedata/locales/bs_BA b/localedata/locales/bs_BA -index a47f87eb37..68c2f9471a 100644 ---- a/localedata/locales/bs_BA -+++ b/localedata/locales/bs_BA -@@ -148,8 +148,8 @@ copy "en_DK" - END LC_CTYPE - - LC_MESSAGES --yesexpr "" --noexpr "" -+yesexpr "" -+noexpr "" - yesstr "" - nostr "" - END LC_MESSAGES -diff --git a/localedata/locales/iso14651_t1_common b/localedata/locales/iso14651_t1_common -index eef75ba65e..0e64f26a12 100644 ---- a/localedata/locales/iso14651_t1_common -+++ b/localedata/locales/iso14651_t1_common -@@ -1042,9 +1042,9 @@ collating-element from "" - collating-element from "" - collating-element from "" - collating-element from "" --collating-element from "" - collating-element from "" - collating-element from "" -+collating-element from "" - collating-element from "" - collating-element from "" - collating-element from "" -@@ -1103,8 +1103,8 @@ collating-symbol - collating-symbol - collating-symbol - collating-symbol --collating-symbol - collating-symbol -+collating-symbol - collating-symbol - collating-symbol - collating-symbol -@@ -1126,6 +1126,12 @@ collating-symbol - collating-symbol - collating-symbol - collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol -+collating-symbol - # - # - # -@@ -4552,6 +4558,12 @@ collating-symbol - - - -+ -+ -+ -+ -+ -+ - # - # - # -@@ -7252,6 +7264,7 @@ order_start ;forward;forward;forward;forward,position - ;;;IGNORE - ;;;IGNORE - "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE -@@ -7280,6 +7293,7 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ണ്‍ = ണ + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ണ = ണ + ് + അ - "";;;IGNORE - "";;;IGNORE -@@ -7290,6 +7304,7 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ന്‍= ന + ് + zwj -+ "";;;IGNORE - "";;;IGNORE #ന = ന + ് + അ - "";;;IGNORE - "";;;IGNORE -@@ -7305,20 +7320,23 @@ order_start ;forward;forward;forward;forward,position - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ര = ര + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ര = ര + ് + അ - ;;;IGNORE # ല്‍ = ല + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ല = ല + ് + അ - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE -- "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE -- "";;;IGNORE -+ "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE - "";;;IGNORE # ള്‍ = ള + ് + zwj -+ "";;;IGNORE - "";;;IGNORE # ള = ള + ് + അ - "";;;IGNORE - "";;;IGNORE -diff --git a/malloc/arena.c b/malloc/arena.c -index 229783f3b7..4e16593d8b 100644 ---- a/malloc/arena.c -+++ b/malloc/arena.c -@@ -702,8 +702,7 @@ _int_new_arena (size_t size) - } - - --/* Remove an arena from free_list. The arena may be in use because it -- was attached concurrently to a thread by reused_arena below. */ -+/* Remove an arena from free_list. */ - static mstate - get_free_list (void) - { -@@ -718,7 +717,8 @@ get_free_list (void) - free_list = result->next_free; - - /* The arena will be attached to this thread. */ -- ++result->attached_threads; -+ assert (result->attached_threads == 0); -+ result->attached_threads = 1; - - detach_arena (replaced_arena); - } -@@ -735,6 +735,26 @@ get_free_list (void) - return result; - } - -+/* Remove the arena from the free list (if it is present). -+ free_list_lock must have been acquired by the caller. */ -+static void -+remove_from_free_list (mstate arena) -+{ -+ mstate *previous = &free_list; -+ for (mstate p = free_list; p != NULL; p = p->next_free) -+ { -+ assert (p->attached_threads == 0); -+ if (p == arena) -+ { -+ /* Remove the requested arena from the list. */ -+ *previous = p->next_free; -+ break; -+ } -+ else -+ previous = &p->next_free; -+ } -+} -+ - /* Lock and return an arena that can be reused for memory allocation. - Avoid AVOID_ARENA as we have already failed to allocate memory in - it and it is currently locked. */ -@@ -782,14 +802,25 @@ reused_arena (mstate avoid_arena) - (void) mutex_lock (&result->mutex); - - out: -- /* Attach the arena to the current thread. Note that we may have -- selected an arena which was on free_list. */ -+ /* Attach the arena to the current thread. */ - { - /* Update the arena thread attachment counters. */ - mstate replaced_arena = thread_arena; - (void) mutex_lock (&free_list_lock); - detach_arena (replaced_arena); -+ -+ /* We may have picked up an arena on the free list. We need to -+ preserve the invariant that no arena on the free list has a -+ positive attached_threads counter (otherwise, -+ arena_thread_freeres cannot use the counter to determine if the -+ arena needs to be put on the free list). We unconditionally -+ remove the selected arena from the free list. The caller of -+ reused_arena checked the free list and observed it to be empty, -+ so the list is very short. */ -+ remove_from_free_list (result); -+ - ++result->attached_threads; -+ - (void) mutex_unlock (&free_list_lock); - } - -diff --git a/misc/regexp.c b/misc/regexp.c -index 3b3668272f..b2a2c6e636 100644 ---- a/misc/regexp.c -+++ b/misc/regexp.c -@@ -29,14 +29,15 @@ - - #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) - --/* Define the variables used for the interface. */ --char *loc1; --char *loc2; -+/* Define the variables used for the interface. Avoid .symver on common -+ symbol, which just creates a new common symbol, not an alias. */ -+char *loc1 __attribute__ ((nocommon)); -+char *loc2 __attribute__ ((nocommon)); - compat_symbol (libc, loc1, loc1, GLIBC_2_0); - compat_symbol (libc, loc2, loc2, GLIBC_2_0); - - /* Although we do not support the use we define this variable as well. */ --char *locs; -+char *locs __attribute__ ((nocommon)); - compat_symbol (libc, locs, locs, GLIBC_2_0); - - -diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c -index 7f698b4e6d..cb5acce01d 100644 ---- a/nis/nss_nisplus/nisplus-alias.c -+++ b/nis/nss_nisplus/nisplus-alias.c -@@ -291,7 +291,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias, - return status; - } - -- if (name != NULL) -+ if (name == NULL) - { - *errnop = EINVAL; - return NSS_STATUS_UNAVAIL; -diff --git a/nptl/Makefile b/nptl/Makefile -index 0d8aadebed..fa925819ca 100644 ---- a/nptl/Makefile -+++ b/nptl/Makefile -@@ -268,7 +268,7 @@ tests = tst-typesizes \ - tst-flock1 tst-flock2 \ - tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \ - tst-signal6 tst-signal7 \ -- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \ -+ tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \ - tst-exit1 tst-exit2 tst-exit3 \ - tst-stdio1 tst-stdio2 \ - tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \ -diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c -index 6b42b11d5a..7365ca606b 100644 ---- a/nptl/allocatestack.c -+++ b/nptl/allocatestack.c -@@ -440,9 +440,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, - SETUP_THREAD_SYSINFO (pd); - #endif - -- /* The process ID is also the same as that of the caller. */ -- pd->pid = THREAD_GETMEM (THREAD_SELF, pid); -- - /* Don't allow setxid until cloned. */ - pd->setxid_futex = -1; - -@@ -579,9 +576,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, - /* Don't allow setxid until cloned. */ - pd->setxid_futex = -1; - -- /* The process ID is also the same as that of the caller. */ -- pd->pid = THREAD_GETMEM (THREAD_SELF, pid); -- - /* Allocate the DTV for this thread. */ - if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL) - { -@@ -875,9 +869,6 @@ __reclaim_stacks (void) - /* This marks the stack as free. */ - curp->tid = 0; - -- /* The PID field must be initialized for the new process. */ -- curp->pid = self->pid; -- - /* Account for the size of the stack. */ - stack_cache_actsize += curp->stackblock_size; - -@@ -903,13 +894,6 @@ __reclaim_stacks (void) - } - } - -- /* Reset the PIDs in any cached stacks. */ -- list_for_each (runp, &stack_cache) -- { -- struct pthread *curp = list_entry (runp, struct pthread, list); -- curp->pid = self->pid; -- } -- - /* Add the stack of all running threads to the cache. */ - list_splice (&stack_used, &stack_cache); - -@@ -1054,9 +1038,9 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t) - return 0; - - int val; -+ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err); -- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid), -- t->tid, SIGSETXID); -+ val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, t->tid, SIGSETXID); - - /* If this failed, it must have had not started yet or else exited. */ - if (!INTERNAL_SYSCALL_ERROR_P (val, err)) -diff --git a/nptl/descr.h b/nptl/descr.h -index 8e4938deb5..bc92abf010 100644 ---- a/nptl/descr.h -+++ b/nptl/descr.h -@@ -167,8 +167,8 @@ struct pthread - therefore stack) used' flag. */ - pid_t tid; - -- /* Process ID - thread group ID in kernel speak. */ -- pid_t pid; -+ /* Ununsed. */ -+ pid_t pid_ununsed; - - /* List of robust mutexes the thread is holding. */ - #ifdef __PTHREAD_MUTEX_HAVE_PREV -diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c -index bdbdfedcef..48fab50c4e 100644 ---- a/nptl/nptl-init.c -+++ b/nptl/nptl-init.c -@@ -184,18 +184,12 @@ __nptl_set_robust (struct pthread *self) - static void - sigcancel_handler (int sig, siginfo_t *si, void *ctx) - { -- /* Determine the process ID. It might be negative if the thread is -- in the middle of a fork() call. */ -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); -- if (__glibc_unlikely (pid < 0)) -- pid = -pid; -- - /* Safety check. It would be possible to call this function for - other signals and send a signal from another process. This is not - correct and might even be a security problem. Try to catch as - many incorrect invocations as possible. */ - if (sig != SIGCANCEL -- || si->si_pid != pid -+ || si->si_pid != __getpid() - || si->si_code != SI_TKILL) - return; - -@@ -243,19 +237,14 @@ struct xid_command *__xidcmd attribute_hidden; - static void - sighandler_setxid (int sig, siginfo_t *si, void *ctx) - { -- /* Determine the process ID. It might be negative if the thread is -- in the middle of a fork() call. */ -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); - int result; -- if (__glibc_unlikely (pid < 0)) -- pid = -pid; - - /* Safety check. It would be possible to call this function for - other signals and send a signal from another process. This is not - correct and might even be a security problem. Try to catch as - many incorrect invocations as possible. */ - if (sig != SIGSETXID -- || si->si_pid != pid -+ || si->si_pid != __getpid () - || si->si_code != SI_TKILL) - return; - -diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c -index 1419baf988..89d02e1741 100644 ---- a/nptl/pthread_cancel.c -+++ b/nptl/pthread_cancel.c -@@ -22,7 +22,7 @@ - #include "pthreadP.h" - #include - #include -- -+#include - - int - pthread_cancel (pthread_t th) -@@ -66,19 +66,11 @@ pthread_cancel (pthread_t th) - #ifdef SIGCANCEL - /* The cancellation handler will take care of marking the - thread as canceled. */ -- INTERNAL_SYSCALL_DECL (err); -- -- /* One comment: The PID field in the TCB can temporarily be -- changed (in fork). But this must not affect this code -- here. Since this function would have to be called while -- the thread is executing fork, it would have to happen in -- a signal handler. But this is no allowed, pthread_cancel -- is not guaranteed to be async-safe. */ -- int val; -- val = INTERNAL_SYSCALL (tgkill, err, 3, -- THREAD_GETMEM (THREAD_SELF, pid), pd->tid, -- SIGCANCEL); -+ pid_t pid = getpid (); - -+ INTERNAL_SYSCALL_DECL (err); -+ int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, pd->tid, -+ SIGCANCEL); - if (INTERNAL_SYSCALL_ERROR_P (val, err)) - result = INTERNAL_SYSCALL_ERRNO (val, err); - #else -diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c -index fb906f0484..32d7484bf8 100644 ---- a/nptl/pthread_getattr_np.c -+++ b/nptl/pthread_getattr_np.c -@@ -68,7 +68,6 @@ pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr) - { - /* No stack information available. This must be for the initial - thread. Get the info in some magical way. */ -- assert (abs (thread->pid) == thread->tid); - - /* Stack size limit. */ - struct rlimit rl; -diff --git a/nptl/tst-exec5.c b/nptl/tst-exec5.c -new file mode 100644 -index 0000000000..4327d8d41c ---- /dev/null -+++ b/nptl/tst-exec5.c -@@ -0,0 +1,196 @@ -+/* Check if posix_spawn does not act as a cancellation entrypoint. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int do_test (void); -+#define TEST_FUNCTION do_test () -+#include -+ -+static pthread_barrier_t b; -+ -+static pid_t pid; -+static int pipefd[2]; -+ -+static void * -+tf (void *arg) -+{ -+ int r = pthread_barrier_wait (&b); -+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) -+ { -+ puts ("error: pthread_barrier_wait failed"); -+ exit (1); -+ } -+ -+ posix_spawn_file_actions_t a; -+ if (posix_spawn_file_actions_init (&a) != 0) -+ { -+ puts ("error: spawn_file_actions_init failed"); -+ exit (1); -+ } -+ -+ if (posix_spawn_file_actions_adddup2 (&a, pipefd[1], STDOUT_FILENO) != 0) -+ { -+ puts ("error: spawn_file_actions_adddup2 failed"); -+ exit (1); -+ } -+ -+ if (posix_spawn_file_actions_addclose (&a, pipefd[0]) != 0) -+ { -+ puts ("error: spawn_file_actions_addclose"); -+ exit (1); -+ } -+ -+ char *argv[] = { (char *) _PATH_BSHELL, (char *) "-c", (char *) "echo $$", -+ NULL }; -+ if (posix_spawn (&pid, _PATH_BSHELL, &a, NULL, argv, NULL) != 0) -+ { -+ puts ("error: spawn failed"); -+ exit (1); -+ } -+ -+ return NULL; -+} -+ -+ -+static int -+do_test (void) -+{ -+ /* The test basically pipe a 'echo $$' created by a thread with a -+ cancellation pending. It then checks if the thread is not cancelled, -+ the process is created and if the output is the expected one. */ -+ -+ if (pipe (pipefd) != 0) -+ { -+ puts ("error: pipe failed"); -+ exit (1); -+ } -+ -+ /* Not interested in knowing when the pipe is closed. */ -+ if (sigignore (SIGPIPE) != 0) -+ { -+ puts ("error: sigignore failed"); -+ exit (1); -+ } -+ -+ /* To synchronize with the thread. */ -+ if (pthread_barrier_init (&b, NULL, 2) != 0) -+ { -+ puts ("error: pthread_barrier_init failed"); -+ exit (1); -+ } -+ -+ pthread_t th; -+ if (pthread_create (&th, NULL, &tf, NULL) != 0) -+ { -+ puts ("error: pthread_create failed"); -+ exit (1); -+ } -+ -+ if (pthread_cancel (th) != 0) -+ { -+ puts ("error: pthread_cancel failed"); -+ exit (1); -+ } -+ -+ int r = pthread_barrier_wait (&b); -+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) -+ { -+ puts ("error: pthread_barrier_wait"); -+ exit (1); -+ } -+ -+ void *retval; -+ if (pthread_join (th, &retval) != 0) -+ { -+ puts ("error: pthread_join failed\n"); -+ } -+ if (retval == PTHREAD_CANCELED) -+ { -+ puts ("error: thread cancelled"); -+ exit (1); -+ } -+ -+ close (pipefd[1]); -+ -+ /* The global 'pid' should be set by thread posix_spawn calling. Check -+ below if it was executed correctly and with expected output. */ -+ -+ char buf[64]; -+ ssize_t n; -+ bool seen_pid = false; -+ while (TEMP_FAILURE_RETRY ((n = read (pipefd[0], buf, sizeof (buf)))) > 0) -+ { -+ /* We only expect to read the PID. */ -+ char *endp; -+ long int rpid = strtol (buf, &endp, 10); -+ -+ if (*endp != '\n') -+ { -+ printf ("error: didn't parse whole line: \"%s\"\n", buf); -+ exit (1); -+ } -+ if (endp == buf) -+ { -+ puts ("error: read empty line"); -+ exit (1); -+ } -+ -+ if (rpid != pid) -+ { -+ printf ("error: found \"%s\", expected PID %ld\n", buf, -+ (long int) pid); -+ exit (1); -+ } -+ -+ if (seen_pid) -+ { -+ puts ("error: found more than one PID line"); -+ exit (1); -+ } -+ -+ seen_pid = true; -+ } -+ -+ close (pipefd[0]); -+ -+ int status; -+ int err = waitpid (pid, &status, 0); -+ if (err != pid) -+ { -+ puts ("errnor: waitpid failed"); -+ exit (1); -+ } -+ -+ if (!seen_pid) -+ { -+ puts ("error: didn't get PID"); -+ exit (1); -+ } -+ -+ return 0; -+} -diff --git a/nptl/tst-once5.cc b/nptl/tst-once5.cc -index 978d8271bd..513ac53f6f 100644 ---- a/nptl/tst-once5.cc -+++ b/nptl/tst-once5.cc -@@ -75,5 +75,7 @@ do_test (void) - return result; - } - -+// The test currently hangs and is XFAILed. Reduce the timeout. -+#define TIMEOUT 1 - #define TEST_FUNCTION do_test () - #include "../test-skeleton.c" -diff --git a/nptl_db/structs.def b/nptl_db/structs.def -index a9b621b126..1cb6a46391 100644 ---- a/nptl_db/structs.def -+++ b/nptl_db/structs.def -@@ -48,7 +48,6 @@ DB_STRUCT (pthread) - DB_STRUCT_FIELD (pthread, list) - DB_STRUCT_FIELD (pthread, report_events) - DB_STRUCT_FIELD (pthread, tid) --DB_STRUCT_FIELD (pthread, pid) - DB_STRUCT_FIELD (pthread, start_routine) - DB_STRUCT_FIELD (pthread, cancelhandling) - DB_STRUCT_FIELD (pthread, schedpolicy) -diff --git a/nptl_db/td_ta_thr_iter.c b/nptl_db/td_ta_thr_iter.c -index a990fed150..9e5059956b 100644 ---- a/nptl_db/td_ta_thr_iter.c -+++ b/nptl_db/td_ta_thr_iter.c -@@ -76,48 +76,28 @@ iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback, - if (ps_pdread (ta->ph, addr, copy, ta->ta_sizeof_pthread) != PS_OK) - return TD_ERR; - -- /* Verify that this thread's pid field matches the child PID. -- If its pid field is negative, it's about to do a fork or it -- is the sole thread in a fork child. */ -- psaddr_t pid; -- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, pid, 0); -- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0) -- { -- if (-(pid_t) (uintptr_t) pid == match_pid) -- /* It is about to do a fork, but is really still the parent PID. */ -- pid = (psaddr_t) (uintptr_t) match_pid; -- else -- /* It must be a fork child, whose new PID is in the tid field. */ -- err = DB_GET_FIELD_LOCAL (pid, ta, copy, pthread, tid, 0); -- } -+ err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread, -+ schedpolicy, 0); - if (err != TD_OK) - break; -+ err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread, -+ schedparam_sched_priority, 0); -+ if (err != TD_OK) -+ break; -+ -+ /* Now test whether this thread matches the specified conditions. */ - -- if ((pid_t) (uintptr_t) pid == match_pid) -+ /* Only if the priority level is as high or higher. */ -+ int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER -+ ? 0 : (uintptr_t) schedprio); -+ if (descr_pri >= ti_pri) - { -- err = DB_GET_FIELD_LOCAL (schedpolicy, ta, copy, pthread, -- schedpolicy, 0); -- if (err != TD_OK) -- break; -- err = DB_GET_FIELD_LOCAL (schedprio, ta, copy, pthread, -- schedparam_sched_priority, 0); -- if (err != TD_OK) -- break; -- -- /* Now test whether this thread matches the specified conditions. */ -- -- /* Only if the priority level is as high or higher. */ -- int descr_pri = ((uintptr_t) schedpolicy == SCHED_OTHER -- ? 0 : (uintptr_t) schedprio); -- if (descr_pri >= ti_pri) -- { -- /* Yep, it matches. Call the callback function. */ -- td_thrhandle_t th; -- th.th_ta_p = (td_thragent_t *) ta; -- th.th_unique = addr; -- if (callback (&th, cbdata_p) != 0) -- return TD_DBERR; -- } -+ /* Yep, it matches. Call the callback function. */ -+ td_thrhandle_t th; -+ th.th_ta_p = (td_thragent_t *) ta; -+ th.th_unique = addr; -+ if (callback (&th, cbdata_p) != 0) -+ return TD_DBERR; - } - - /* Get the pointer to the next element. */ -diff --git a/nptl_db/td_thr_validate.c b/nptl_db/td_thr_validate.c -index f3c8a7bed6..9b89fecad2 100644 ---- a/nptl_db/td_thr_validate.c -+++ b/nptl_db/td_thr_validate.c -@@ -80,28 +80,5 @@ td_thr_validate (const td_thrhandle_t *th) - err = TD_OK; - } - -- if (err == TD_OK) -- { -- /* Verify that this is not a stale element in a fork child. */ -- pid_t match_pid = ps_getpid (th->th_ta_p->ph); -- psaddr_t pid; -- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, pthread, pid, 0); -- if (err == TD_OK && (pid_t) (uintptr_t) pid < 0) -- { -- /* This was a thread that was about to fork, or it is the new sole -- thread in a fork child. In the latter case, its tid was stored -- via CLONE_CHILD_SETTID and so is already the proper child PID. */ -- if (-(pid_t) (uintptr_t) pid == match_pid) -- /* It is about to do a fork, but is really still the parent PID. */ -- pid = (psaddr_t) (uintptr_t) match_pid; -- else -- /* It must be a fork child, whose new PID is in the tid field. */ -- err = DB_GET_FIELD (pid, th->th_ta_p, th->th_unique, -- pthread, tid, 0); -- } -- if (err == TD_OK && (pid_t) (uintptr_t) pid != match_pid) -- err = TD_NOTHR; -- } -- - return err; - } -diff --git a/po/de.po b/po/de.po -index 1383e8c4a9..ca14c7e386 100644 ---- a/po/de.po -+++ b/po/de.po -@@ -8,7 +8,7 @@ msgid "" - msgstr "" - "Project-Id-Version: GNU libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-08-31 18:30+0200\n" -+"PO-Revision-Date: 2016-04-22 18:44+0200\n" - "Last-Translator: Jochen Hein \n" - "Language-Team: German \n" - "Language: de\n" -@@ -4479,13 +4479,13 @@ msgstr "" - "%15s Cache ist dauerhaft\n" - "%15s Cache wird gemeinsam verwendet\n" - "%15Zu vorgeschlagene Größe\n" --"%15Zu Gesamtröße des Data-Pools\n" -+"%15Zu Gesamtgröße des Data-Pools\n" - "%15Zu Benutzter Speicher im Data-Pool\n" - "%15lu Time to Live für positive Einträge in Sekunden\n" - "%15lu Time to Live für negative Einträge in Sekunden\n" - "%15 Cache-Hits bei positiven Einträgen\n" - "%15 Cache-Hits bei positiven Einträgen\n" --"%15 Cache-Misses bei positiven Einträgen\n" -+"%15 Cache-Misses bei positiven Einträgen\n" - "%15 Cache-Misses bei negativen Einträgen\n" - "%15lu%% Cache-Hit Verhältnis\n" - "%15zu aktuelle Anzahl der Werte im Cache\n" -diff --git a/po/fi.po b/po/fi.po -index 17cb3e3e1d..8a2ab8358c 100644 ---- a/po/fi.po -+++ b/po/fi.po -@@ -24,16 +24,16 @@ - # - msgid "" - msgstr "" --"Project-Id-Version: libc 2.21-pre1\n" -+"Project-Id-Version: libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-07-28 20:29+0300\n" -+"PO-Revision-Date: 2016-05-26 21:14+0300\n" - "Last-Translator: Lauri Nurmi \n" - "Language-Team: Finnish \n" - "Language: fi\n" - "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" - "Content-Transfer-Encoding: 8bit\n" --"X-Generator: Poedit 1.8.3\n" -+"X-Generator: Poedit 1.8.7\n" - "Plural-Forms: nplurals=2; plural=(n != 1);\n" - - #: argp/argp-help.c:227 -@@ -126,7 +126,7 @@ msgid "%s%s%s:%u: %s%sUnexpected error: %s.\n" - msgstr "%s%s%s:%u: %s%sOdottamaton virhe: %s.\n" - - #: assert/assert.c:101 --#, fuzzy, c-format -+#, c-format - msgid "" - "%s%s%s:%u: %s%sAssertion `%s' failed.\n" - "%n" -@@ -169,12 +169,12 @@ msgstr "" - #: malloc/memusagestat.c:563 nss/getent.c:973 nss/makedb.c:369 - #: posix/getconf.c:486 sunrpc/rpcinfo.c:691 - #: sysdeps/unix/sysv/linux/lddlibc4.c:61 --#, fuzzy, c-format -+#, c-format - msgid "" - "For bug reporting instructions, please see:\n" - "%s.\n" - msgstr "" --"Ohjeet ohjelmistovioista ilmoittamiseen ovat osoitteessa\n" -+"Katso ohjeet vikailmoitusten tekemiseen osoitteesta:\n" - "%s.\n" - - #: catgets/gencat.c:245 debug/pcprofiledump.c:225 debug/xtrace.sh:64 -@@ -321,9 +321,8 @@ msgstr "Käyttö: xtrace [VALITSIN]... OHJELMA [OHJELMANVALITSIN]...\\n" - - #: debug/xtrace.sh:32 elf/sotruss.sh:56 elf/sotruss.sh:67 elf/sotruss.sh:135 - #: malloc/memusage.sh:26 --#, fuzzy - msgid "Try \\`%s --help' or \\`%s --usage' for more information.\\n" --msgstr "Kokeile ”%s --help” tai ”%s --usage” saadaksesi lisää tietoa.\n" -+msgstr "Kokeile ”%s --help” tai ”%s --usage” saadaksesi lisää tietoa.\\n" - - #: debug/xtrace.sh:38 - #, fuzzy -@@ -594,9 +593,8 @@ msgid "cannot enable executable stack as shared object requires" - msgstr "jaettua objektikahvaa ei voi luoda" - - #: elf/dl-load.c:1339 --#, fuzzy - msgid "cannot close file descriptor" --msgstr "tiedostoa %s ei voi sulkea" -+msgstr "tiedostokahvaa ei voi sulkea" - - #: elf/dl-load.c:1568 - msgid "file too short" -@@ -796,9 +794,8 @@ msgid "Format to use: new, old or compat (default)" - msgstr "Käytettävä muoto: ”new”, ”old” tai ”compat” (oletus)" - - #: elf/ldconfig.c:151 --#, fuzzy - msgid "Ignore auxiliary cache file" --msgstr "Käytä CACHEa välimuistitiedostona" -+msgstr "Jätä huomiotta apuvälimuistitiedosto" - - #: elf/ldconfig.c:159 - msgid "Configure Dynamic Linker Run Time Bindings." -@@ -1087,9 +1084,9 @@ msgid "invalid process ID '%s'" - msgstr "virheellinen prosessi-ID ”%s”" - - #: elf/pldd.c:120 --#, fuzzy, c-format -+#, c-format - msgid "cannot open %s" --msgstr "laitetta %s ei voi avata" -+msgstr "tiedostoa %s ei voi avata" - - #: elf/pldd.c:152 - #, fuzzy, c-format -@@ -1102,24 +1099,24 @@ msgid "cannot prepare reading %s/task" - msgstr "ei voi avata laitetta %s lukutilaan" - - #: elf/pldd.c:168 --#, fuzzy, c-format -+#, c-format - msgid "invalid thread ID '%s'" --msgstr "virheellinen prosessi-ID ”%s”" -+msgstr "virheellinen säie-ID ”%s”" - - #: elf/pldd.c:179 --#, fuzzy, c-format -+#, c-format - msgid "cannot attach to process %lu" --msgstr "tiedostoa ”%s” ei voi avata" -+msgstr "ei voida kiinnittyä prosessiin %lu" - - #: elf/pldd.c:294 - #, c-format - msgid "cannot get information about process %lu" --msgstr "" -+msgstr "tietojen saaminen prosessista %lu ei onnistu" - - #: elf/pldd.c:307 --#, fuzzy, c-format -+#, c-format - msgid "process %lu is no ELF program" --msgstr "ohjelma %lu ei ole käytettävissä\n" -+msgstr "prosessi %lu ei ole ELF-ohjelma" - - #: elf/readelflib.c:34 - #, c-format -@@ -1203,7 +1200,7 @@ msgstr "%s kohde ei saa olla hakemisto\n" - #: elf/sln.c:184 - #, c-format - msgid "%s: failed to remove the old destination\n" --msgstr "" -+msgstr "%s: vanhan kohteen poistaminen epäonnistui\n" - - #: elf/sln.c:192 - #, c-format -@@ -1237,9 +1234,8 @@ msgid "Mandatory arguments to long options are also mandatory for any correspond - msgstr "Pakolliset argumentit pitkille valitsimille ovat pakollisia kaikille vastaaville lyhyille valitsimille.\\n" - - #: elf/sotruss.sh:55 --#, fuzzy - msgid "%s: option requires an argument -- '%s'\\n" --msgstr "%s: valitsin ”%s” vaatii argumentin\n" -+msgstr "%s: valitsin vaatii argumentin -- ”%c”\\n" - - #: elf/sotruss.sh:61 - msgid "%s: option is ambiguous; possibilities:" -@@ -1507,7 +1503,6 @@ msgid "unknown iconv() error %d" - msgstr "tuntematon iconv()-virhe %d" - - #: iconv/iconv_prog.c:791 --#, fuzzy - msgid "" - "The following list contains all the coded character sets known. This does\n" - "not necessarily mean that all combinations of these names can be used for\n" -@@ -1516,9 +1511,9 @@ msgid "" - "\n" - " " - msgstr "" --"Seuraavassa listassa ovat kaikki tunnetut koodatut merkistöt. Se ei\n" -+"Seuraavassa listassa ovat kaikki tunnetut koodatut merkistöt. Tämä ei\n" - "kuitenkaan välttämättä tarkoita sitä, että kaikkia näiden nimien\n" --"yhdistelmiä voidaan käyttää FROM- ja TO-komentoriviparametreina. Yksi\n" -+"yhdistelmiä voisi käyttää FROM- ja TO-komentoriviparametreina. Yksi\n" - "koodattu merkistö voi olla listalla useilla eri nimillä (aliaksilla).\n" - "\n" - " " -@@ -2733,14 +2728,12 @@ msgid "locale.alias file to consult when making archive" - msgstr "Arkistoa luotaessa käytettävä locale.alias-tiedosto" - - #: locale/programs/localedef.c:150 --#, fuzzy - msgid "Generate little-endian output" --msgstr "Tuota little-endian-koodia" -+msgstr "Tuota little-endian-muotoa" - - #: locale/programs/localedef.c:152 --#, fuzzy - msgid "Generate big-endian output" --msgstr "Tuota big-endian-koodia" -+msgstr "Tuota big-endian-muotoa" - - #: locale/programs/localedef.c:157 - msgid "Compile locale specification" -@@ -4275,10 +4268,9 @@ msgid "" - msgstr "" - - #: nscd/nscd.c:635 --#, fuzzy, c-format --#| msgid "lstat failed" -+#, c-format - msgid "'wait' failed\n" --msgstr "tiedoston tilan luku epäonnistui" -+msgstr "”wait” epäonnistui\n" - - #: nscd/nscd.c:642 - #, c-format -@@ -4670,9 +4662,9 @@ msgid "cannot create temporary file" - msgstr "tilapäistä tiedostoa ei voi luoda" - - #: nss/makedb.c:304 --#, fuzzy, c-format -+#, c-format - msgid "cannot stat newly created file" --msgstr "tiedoston ”%s” tilaa ei voi lukea: %s" -+msgstr "juuri luodun tiedoston tilaa ei voi lukea" - - #: nss/makedb.c:315 - #, c-format -@@ -4680,9 +4672,9 @@ msgid "cannot rename temporary file" - msgstr "tilapäistä tiedostoa ei voi nimetä uudelleen" - - #: nss/makedb.c:531 nss/makedb.c:554 --#, fuzzy, c-format -+#, c-format - msgid "cannot create search tree" --msgstr "hakupolulle ei voi luoda välimuistia" -+msgstr "hakupuuta ei voi luoda" - - #: nss/makedb.c:560 - msgid "duplicate key" -@@ -4699,9 +4691,9 @@ msgid "failed to write new database file" - msgstr "uuden tietokantatiedoston kirjoittaminen epäonnistui" - - #: nss/makedb.c:812 --#, fuzzy, c-format -+#, c-format - msgid "cannot stat database file" --msgstr "tiedoston ”%s” tilaa ei voi lukea: %s" -+msgstr "tietokantatiedoston tilaa ei voi lukea" - - #: nss/makedb.c:817 - #, fuzzy, c-format -@@ -4709,9 +4701,9 @@ msgid "cannot map database file" - msgstr "Karttatietokannassa ei ole enempää tietueita" - - #: nss/makedb.c:820 --#, fuzzy, c-format -+#, c-format - msgid "file not a database file" --msgstr "luettaessa profilointidatatiedoston tilaa" -+msgstr "tiedosto ei ole tietokantatiedosto" - - #: nss/makedb.c:871 - #, fuzzy, c-format -@@ -4726,7 +4718,7 @@ msgstr "Käyttö: %s [-v määrittely] muuttujanimi [polku]\n" - #: posix/getconf.c:403 - #, c-format - msgid " %s -a [pathname]\n" --msgstr "" -+msgstr " %s -a [polku]\n" - - #: posix/getconf.c:479 - #, c-format -@@ -5094,11 +5086,11 @@ msgstr "Laitetta irrotettu" - - #: stdio-common/psiginfo.c:139 - msgid "Signal sent by kill()" --msgstr "" -+msgstr "Signaalin lähetti kill()" - - #: stdio-common/psiginfo.c:142 - msgid "Signal sent by sigqueue()" --msgstr "" -+msgstr "Signaalin lähetti sigqueue()" - - #: stdio-common/psiginfo.c:145 - msgid "Signal generated by the expiration of a timer" -@@ -5114,7 +5106,7 @@ msgstr "" - - #: stdio-common/psiginfo.c:157 - msgid "Signal sent by tkill()" --msgstr "" -+msgstr "Signaalin lähetti tkill()" - - #: stdio-common/psiginfo.c:162 - msgid "Signal generated by the completion of an asynchronous name lookup request" -@@ -5296,9 +5288,8 @@ msgid "Failed (unspecified error)" - msgstr "Epäonnistui (määrittelemätön virhe)" - - #: sunrpc/clnt_raw.c:115 --#, fuzzy - msgid "clnt_raw.c: fatal header serialization error" --msgstr "clnt_raw.c: vakava otsikon serialisointivirhe" -+msgstr "clnt_raw.c: vakava otsikon sarjallistamisvirhe" - - #: sunrpc/pm_getmaps.c:77 - msgid "pmap_getmaps.c: rpc problem" -@@ -6825,9 +6816,8 @@ msgid "Interrupted by a signal" - msgstr "Signaalin keskeyttämä" - - #: sysdeps/posix/gai_strerror-strs.h:17 --#, fuzzy - msgid "Parameter string not correctly encoded" --msgstr "Parametrimerkkijono on väärin koodattu" -+msgstr "Parametrimerkkijono ei ole koodattu oikein" - - #: sysdeps/unix/sysv/linux/i386/readelflib.c:65 - #, c-format -diff --git a/po/sv.po b/po/sv.po -index 49d1f23904..e046577b08 100644 ---- a/po/sv.po -+++ b/po/sv.po -@@ -1,13 +1,17 @@ - # GNU libc message catalog for Swedish --# Copyright © 1996, 1998, 2001, 2002, 2003, 2006, 2008, 2009, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc. -+# Copyright © 1996, 1998, 2001, 2002, 2003, 2006, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc. - # This file is distributed under the same license as the glibc package. --# Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015 -+# -+# Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015. -+# Göran Uddeborg , 2016. -+# -+# $Revision: 1.3 $ - msgid "" - msgstr "" --"Project-Id-Version: libc 2.21-pre1\n" -+"Project-Id-Version: libc 2.22-pre1\n" - "POT-Creation-Date: 2015-07-31 00:10-0400\n" --"PO-Revision-Date: 2015-01-24 10:35+0100\n" --"Last-Translator: Jan Djärv \n" -+"PO-Revision-Date: 2016-08-02 17:17+0200\n" -+"Last-Translator: Göran Uddeborg \n" - "Language-Team: Swedish \n" - "Language: sv\n" - "MIME-Version: 1.0\n" -@@ -48,7 +52,7 @@ msgstr " [FLAGGA...]" - #: argp/argp-help.c:1643 - #, c-format - msgid "Try `%s --help' or `%s --usage' for more information.\n" --msgstr "Försök med \"%s --help\" eller \"%s --usage\" för mer information\n" -+msgstr "Försök med ”%s --help” eller ”%s --usage” för mer information.\n" - - #: argp/argp-help.c:1671 - #, c-format -@@ -304,11 +308,11 @@ msgstr "Användning: xtrace [FLAGGA]... PROGRAM [PROGRAMFLAGGA}...\\n" - #: debug/xtrace.sh:32 elf/sotruss.sh:56 elf/sotruss.sh:67 elf/sotruss.sh:135 - #: malloc/memusage.sh:26 - msgid "Try \\`%s --help' or \\`%s --usage' for more information.\\n" --msgstr "Försök med \\\"%s --help\\\" eller \\\"%s --usage\\\" för mer information\\n" -+msgstr "Försök med ”%s --help” eller ”%s --usage” för mer information\\n" - - #: debug/xtrace.sh:38 - msgid "%s: option '%s' requires an argument.\\n" --msgstr "%s: flaggan \\\"%s\\\" kräver ett argument\\n" -+msgstr "%s: flaggan ”%s” kräver ett argument.\\n" - - #: debug/xtrace.sh:45 - msgid "" -@@ -332,19 +336,17 @@ msgstr "" - " --usage Visa en kort hjälptext\n" - " -V,--version Visa versionsinformation och avsluta\n" - "\n" --"Obligatoriska argument för långa flaggor är obligatoriska även för\n" -+"Obligatoriska argument för långa flaggor är obligatoriska även för\n" - "motsvarande korta.\n" - - #: debug/xtrace.sh:57 elf/ldd.bash.in:55 elf/sotruss.sh:49 - #: malloc/memusage.sh:64 - msgid "For bug reporting instructions, please see:\\\\n%s.\\\\n" --msgstr "" --"För felrapporteringsinstruktioner, se:\\\\n%s.\\\\n\n" --"Rapportera fel eller synpunkter på översättningen till .\\\\n" -+msgstr "För felrapporteringsinstruktioner, se:\\\\n%s.\\\\nRapportera fel eller synpunkter på översättningen till:\\\\n.\\\\n" - - #: debug/xtrace.sh:125 - msgid "xtrace: unrecognized option \\`$1'\\n" --msgstr "xtrace: okänd flagga \"$1\"\\n" -+msgstr "xtrace: okänd flagga ”$1”\\n" - - #: debug/xtrace.sh:138 - msgid "No program name given\\n" -@@ -353,12 +355,12 @@ msgstr "Inget programnamn givet\\n" - #: debug/xtrace.sh:146 - #, sh-format - msgid "executable \\`$program' not found\\n" --msgstr "program \"$program\" hittades inte\\n" -+msgstr "program ”$program” hittades inte\\n" - - #: debug/xtrace.sh:150 - #, sh-format - msgid "\\`$program' is no executable\\n" --msgstr "\"$program\" är inte en körbar binär\\n" -+msgstr "”$program” är inte en körbar binär\\n" - - #: dlfcn/dlinfo.c:63 - msgid "RTLD_SELF used in code not dynamically loaded" -@@ -396,7 +398,7 @@ msgstr ", OS ABI: %s %d.%d.%d" - #: elf/cache.c:157 elf/ldconfig.c:1340 - #, c-format - msgid "Can't open cache file %s\n" --msgstr "Kan inte öppna cache-fil \"%s\"\n" -+msgstr "Kan inte öppna cache-filen %s\n" - - #: elf/cache.c:171 - #, c-format -@@ -416,7 +418,7 @@ msgstr "%d bibliotek hittades i cache \"%s\"\n" - #: elf/cache.c:426 - #, c-format - msgid "Can't create temporary cache file %s" --msgstr "Kan inte skapa temporär cache-fil \"%s\"" -+msgstr "Kan inte skapa en temporär cache-fil %s" - - #: elf/cache.c:434 elf/cache.c:444 elf/cache.c:448 elf/cache.c:453 - #, c-format -@@ -829,7 +831,7 @@ msgstr "Kan inte ta status (lstat) på %s" - #: elf/ldconfig.c:609 - #, c-format - msgid "Ignored file %s since it is not a regular file." --msgstr "Ignorerar fil %s eftersom den inte är en vanlig fil" -+msgstr "Ignorerar fil %s eftersom den inte är en vanlig fil." - - #: elf/ldconfig.c:618 - #, c-format -@@ -951,7 +953,7 @@ msgstr "" - - #: elf/ldd.bash.in:80 - msgid "ldd: option \\`$1' is ambiguous" --msgstr "ldd: flaggan \"$1\" är tvetydig" -+msgstr "ldd: flaggan ”$1” är tvetydig" - - #: elf/ldd.bash.in:87 - msgid "unrecognized option" -@@ -959,7 +961,7 @@ msgstr "okänd flagga" - - #: elf/ldd.bash.in:88 elf/ldd.bash.in:125 - msgid "Try \\`ldd --help' for more information." --msgstr "Försök med \"ldd --help\" för mer information" -+msgstr "Försök med \"ldd --help\" för mer information." - - #: elf/ldd.bash.in:124 - msgid "missing file arguments" -@@ -1028,10 +1030,9 @@ msgid "cannot read object name" - msgstr "kan inte läsa objektnamn" - - #: elf/pldd-xx.c:219 --#, fuzzy, c-format --#| msgid "cannot allocate memory for program header" -+#, c-format - msgid "cannot allocate buffer for object name" --msgstr "kan inte allokera minne för programhuvud" -+msgstr "kan inte allokera en buffert för objektnamn" - - #: elf/pldd.c:64 - msgid "List dynamic shared objects loaded into process." -@@ -1212,11 +1213,11 @@ msgstr "" - - #: elf/sotruss.sh:46 - msgid "Mandatory arguments to long options are also mandatory for any corresponding\\nshort options.\\n" --msgstr "Obligatoriska respektive valfria argument för långa flaggor är obligatoriska respektive\\nvalfria även för korta.\\n" -+msgstr "Obligatoriska respektive valfria argument för långa flaggor är obligatoriska\\nrespektive valfria även för korta.\\n" - - #: elf/sotruss.sh:55 - msgid "%s: option requires an argument -- '%s'\\n" --msgstr "%s: flaggan kräver ett argument -- \\\"%s\\\"\\n" -+msgstr "%s: flaggan kräver ett argument — ”%s”\\n" - - #: elf/sotruss.sh:61 - msgid "%s: option is ambiguous; possibilities:" -@@ -1240,7 +1241,7 @@ msgstr "" - - #: elf/sotruss.sh:134 - msgid "%s: unrecognized option '%c%s'\\n" --msgstr "%s: okänd flagga \\\"%c%s\\\"\\n" -+msgstr "%s: okänd flagga ”%c%s”\\n" - - #: elf/sprof.c:77 - msgid "Output selection:" -@@ -1260,7 +1261,7 @@ msgstr "generera anropsgraf" - - #: elf/sprof.c:89 - msgid "Read and display shared object profiling data." --msgstr "Läs och visa profildata för delat objekt" -+msgstr "Läs och visa profildata för delat objekt." - - #: elf/sprof.c:94 - msgid "SHOBJ [PROFDATA]" -@@ -1622,7 +1623,7 @@ msgstr "Fel: .netrc kan läsas av andra." - - #: inet/ruserpass.c:185 - msgid "Remove password or make file unreadable by others." --msgstr "Ta bort lösenord eller gör filen oläsbar för andra" -+msgstr "Ta bort lösenord eller gör filen oläsbar för andra." - - #: inet/ruserpass.c:277 - #, c-format -@@ -2182,12 +2183,12 @@ msgstr "Inget namn definierat i teckenuppsättning" - #: locale/programs/ld-ctype.c:479 - #, c-format - msgid "character L'\\u%0*x' in class `%s' must be in class `%s'" --msgstr "tecken L\"\\u%0*x\" i klass \"%s\" måste vara i klass \"%s\"" -+msgstr "tecken L'\\u%0*x' i klassen ”%s” måste vara i klassen ”%s”" - - #: locale/programs/ld-ctype.c:494 - #, c-format - msgid "character L'\\u%0*x' in class `%s' must not be in class `%s'" --msgstr "tecken L\"\\u%0*x\" i klass \"%s\" får inte vara i klass \"%s\"" -+msgstr "tecken L'\\u%0*x' i klassen ”%s” får inte vara i klassen ”%s”" - - #: locale/programs/ld-ctype.c:508 locale/programs/ld-ctype.c:566 - #, c-format -@@ -2611,7 +2612,7 @@ msgstr "Skriv mer information" - - #: locale/programs/locale.c:85 - msgid "Get locale-specific information." --msgstr "Hämta lokalspecifik information" -+msgstr "Hämta lokalspecifik information." - - #: locale/programs/locale.c:88 - msgid "" -@@ -3022,7 +3023,7 @@ msgstr "felaktig mcheck_status, biblioteket är felaktigt\n" - - #: malloc/memusage.sh:32 - msgid "%s: option '%s' requires an argument\\n" --msgstr "%s: flaggan \\\"%s\\\" kräver ett argument\\n" -+msgstr "%s: flaggan ”%s” kräver ett argument\\n" - - #: malloc/memusage.sh:38 - msgid "" -@@ -3091,11 +3092,11 @@ msgstr "" - - #: malloc/memusage.sh:191 - msgid "memusage: option \\`${1##*=}' is ambiguous" --msgstr "memusage: flaggan \"${1##*=}\" är tvetydig" -+msgstr "memusage: flaggan ”${1##*=}” är tvetydig" - - #: malloc/memusage.sh:200 - msgid "memusage: unrecognized option \\`$1'" --msgstr "memusage: okänd flagga \"$1\"" -+msgstr "memusage: okänd flagga ”$1”" - - #: malloc/memusage.sh:213 - msgid "No program name given" -@@ -3341,7 +3342,7 @@ msgstr "Kan inte skapa process hos server" - - #: nis/nis_error.h:48 - msgid "Master server busy, full dump rescheduled." --msgstr "Huvudserver är upptagen, full dump åter schemalagd" -+msgstr "Huvudserver är upptagen, full dump åter schemalagd." - - #: nis/nis_local_names.c:121 - #, c-format -@@ -3511,7 +3512,7 @@ msgstr "\t\tRättigheter : " - - #: nis/nis_print.c:290 - msgid "Linked Object Type : " --msgstr "Länkad objekttyp: " -+msgstr "Länkad objekttyp : " - - #: nis/nis_print.c:292 - #, c-format -@@ -3802,15 +3803,14 @@ msgid " (first)" - msgstr " (första)" - - #: nscd/cache.c:288 --#, fuzzy, c-format --#| msgid "cannot stat() file `%s': %s" -+#, c-format - msgid "checking for monitored file `%s': %s" --msgstr "kan inte ta status på fil \"%s\": %s" -+msgstr "kontrollerar den övervakade filen ”%s”: %s" - - #: nscd/cache.c:298 - #, c-format - msgid "monitored file `%s` changed (mtime)" --msgstr "" -+msgstr "den övervakade filen ”%s” ändrades (mtime)" - - #: nscd/cache.c:341 - #, c-format -@@ -3906,34 +3906,32 @@ msgstr "kan inte få uttag (socket) att acceptera förbindelser: %s" - #: nscd/connections.c:973 - #, c-format - msgid "disabled inotify-based monitoring for file `%s': %s" --msgstr "" -+msgstr "avaktiverade inotify-baserad övervakning för filen ”%s”: %s" - - #: nscd/connections.c:977 - #, c-format - msgid "monitoring file `%s` (%d)" --msgstr "" -+msgstr "övervakar filen ”%s” (%d)" - - #: nscd/connections.c:990 - #, c-format - msgid "disabled inotify-based monitoring for directory `%s': %s" --msgstr "" -+msgstr "avaktiverade inotify-baserad övervakning av katalogen ”%s”: %s" - - #: nscd/connections.c:994 --#, fuzzy, c-format --#| msgid "Can't open directory %s" -+#, c-format - msgid "monitoring directory `%s` (%d)" --msgstr "Kan inte öppna katalog %s" -+msgstr "övervakar katalogen ”%s” (%d)" - - #: nscd/connections.c:1022 --#, fuzzy, c-format --#| msgid "register trace file %s for database %s" -+#, c-format - msgid "monitoring file %s for database %s" --msgstr "registrera spårningsfil %s för databas %s" -+msgstr "övervakar filen %s för databas %s" - - #: nscd/connections.c:1032 - #, c-format - msgid "stat failed for file `%s'; will try again later: %s" --msgstr "" -+msgstr "stat misslyckades för filen ”%s”; kommer försöka igen senare: %s" - - #: nscd/connections.c:1151 - #, c-format -@@ -4032,44 +4030,42 @@ msgstr "handle_request: begäran mottagen (Version = %d)" - #: nscd/connections.c:1963 - #, c-format - msgid "ignored inotify event for `%s` (file exists)" --msgstr "" -+msgstr "ignorerade inotify-händelse för ”%s” (filen finns)" - - #: nscd/connections.c:1968 - #, c-format - msgid "monitored file `%s` was %s, removing watch" --msgstr "" -+msgstr "den övervakade filen ”%s” var %s, tar bort vakten" - - #: nscd/connections.c:1976 nscd/connections.c:2018 - #, c-format - msgid "failed to remove file watch `%s`: %s" --msgstr "" -+msgstr "misslyckades att ta bort filvakt ”%s”: %s" - - #: nscd/connections.c:1991 - #, c-format - msgid "monitored file `%s` was written to" --msgstr "" -+msgstr "den övervakade filen ”%s” skrevs till" - - #: nscd/connections.c:2015 - #, c-format - msgid "monitored parent directory `%s` was %s, removing watch on `%s`" --msgstr "" -+msgstr "den övervakade föräldrakatalogen ”%s” var %s, tar bort vakten av ”%s”" - - #: nscd/connections.c:2041 - #, c-format - msgid "monitored file `%s` was %s, adding watch" --msgstr "" -+msgstr "den övervakade filen ”%s” var %s, lägger till vakt" - - #: nscd/connections.c:2053 --#, fuzzy, c-format --#| msgid "failed to load shared object `%s'" -+#, c-format - msgid "failed to add file watch `%s`: %s" --msgstr "misslyckades med att ladda delat objekt \"%s\"" -+msgstr "misslyckades med att lägga till filvakt ”%s”: %s" - - #: nscd/connections.c:2247 nscd/connections.c:2428 --#, fuzzy, c-format --#| msgid "disabled inotify after read error %d" -+#, c-format - msgid "disabled inotify-based monitoring after read error %d" --msgstr "inaktiverade inotify efter läsfel %d" -+msgstr "avaktiverade inotify-baserad övervakning efter läsfel %d" - - #: nscd/connections.c:2543 - msgid "could not initialize conditional variable" -@@ -4199,7 +4195,7 @@ msgstr "Använd separat cache för varje användare" - - #: nscd/nscd.c:122 - msgid "Name Service Cache Daemon." --msgstr "Namntjänst cache-demon" -+msgstr "Cache-demon för namntjänsten." - - #: nscd/nscd.c:155 nss/getent.c:1007 nss/makedb.c:206 - #, c-format -@@ -4531,11 +4527,11 @@ msgstr "Access Vector Cache (AVC) startad" - - #: nscd/selinux.c:368 - msgid "Error querying policy for undefined object classes or permissions." --msgstr "Fel när policy för odefinierade objektklasser eller rättigheter hämtades" -+msgstr "Fel när policy för odefinierade objektklasser eller rättigheter hämtades." - - #: nscd/selinux.c:375 - msgid "Error getting security class for nscd." --msgstr "Fel när säkerhetsklass för nscd hämtades" -+msgstr "Fel när säkerhetsklass för nscd hämtades." - - #: nscd/selinux.c:380 - #, c-format -@@ -4609,7 +4605,7 @@ msgstr "inaktivera DIN-kodning" - - #: nss/getent.c:64 - msgid "Get entries from administrative database." --msgstr "Hämta poster från den administrativa databasen" -+msgstr "Hämta poster från den administrativa databasen." - - #: nss/getent.c:148 nss/getent.c:477 nss/getent.c:522 - #, c-format -@@ -4652,7 +4648,7 @@ msgstr "Genererad rad som inte ingår i iterationen" - - #: nss/makedb.c:131 - msgid "Create simple database from textual input." --msgstr "Skapa en enkel databas från textuell indata" -+msgstr "Skapa en enkel databas från textuell indata." - - #: nss/makedb.c:134 - msgid "" -@@ -5412,7 +5408,7 @@ msgstr "Kan inte ange netid-flaggan utan TIRPC!\n" - #: sunrpc/rpc_main.c:1374 - #, c-format - msgid "Cannot use table flags with newstyle!\n" --msgstr "Kan inte ange tabellflaggor med ny stil\n" -+msgstr "Kan inte ange tabellflaggor med ny stil!\n" - - #: sunrpc/rpc_main.c:1393 - #, c-format -@@ -7270,18 +7266,9 @@ msgstr "tidszonsförkortning skiljer sig från POSIX-standarden" - - #: timezone/zic.c:2789 - msgid "too many, or too long, time zone abbreviations" --msgstr "för många eller för långa tidszonförkortningar" -+msgstr "för många eller för långa tidszonsförkortningar" - - #: timezone/zic.c:2829 - #, c-format - msgid "%s: Can't create directory %s: %s\n" - msgstr "%s: Kan inte skapa katalog %s: %s\n" -- --#~ msgid "cannot load any more object with static TLS" --#~ msgstr "kan inte ladda fler objekt med statiskt TLS" -- --#~ msgid "%s: no PLTREL found in object %s\n" --#~ msgstr "%s: hittade inga PLTREL i objekt %s\n" -- --#~ msgid "cannot create internal descriptors" --#~ msgstr "kan inte skapa interna deskriptorer" -diff --git a/posix/execvpe.c b/posix/execvpe.c -index d933f9c92a..7cdb06a611 100644 ---- a/posix/execvpe.c -+++ b/posix/execvpe.c -@@ -48,12 +48,13 @@ maybe_script_execute (const char *file, char *const argv[], char *const envp[]) - } - } - -- /* Construct an argument list for the shell. */ -+ /* Construct an argument list for the shell. It will contain at minimum 3 -+ arguments (current shell, script, and an ending NULL. */ - char *new_argv[argc + 1]; - new_argv[0] = (char *) _PATH_BSHELL; - new_argv[1] = (char *) file; - if (argc > 1) -- memcpy (new_argv + 2, argv + 1, argc * sizeof(char *)); -+ memcpy (new_argv + 2, argv + 1, (argc - 1) * sizeof(char *)); - else - new_argv[2] = NULL; - -@@ -91,10 +92,11 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - /* Although GLIBC does not enforce NAME_MAX, we set it as the maximum - size to avoid unbounded stack allocation. Same applies for - PATH_MAX. */ -- size_t file_len = __strnlen (file, NAME_MAX + 1); -+ size_t file_len = __strnlen (file, NAME_MAX) + 1; - size_t path_len = __strnlen (path, PATH_MAX - 1) + 1; - -- if ((file_len > NAME_MAX) -+ /* NAME_MAX does not include the terminating null character. */ -+ if (((file_len-1) > NAME_MAX) - || !__libc_alloca_cutoff (path_len + file_len + 1)) - { - errno = ENAMETOOLONG; -@@ -103,6 +105,9 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - - const char *subp; - bool got_eacces = false; -+ /* The resulting string maximum size would be potentially a entry -+ in PATH plus '/' (path_len + 1) and then the the resulting file name -+ plus '\0' (file_len since it already accounts for the '\0'). */ - char buffer[path_len + file_len + 1]; - for (const char *p = path; ; p = subp) - { -@@ -123,7 +128,7 @@ __execvpe (const char *file, char *const argv[], char *const envp[]) - execute. */ - char *pend = mempcpy (buffer, p, subp - p); - *pend = '/'; -- memcpy (pend + (p < subp), file, file_len + 1); -+ memcpy (pend + (p < subp), file, file_len); - - __execve (buffer, argv, envp); - -diff --git a/resolv/Makefile b/resolv/Makefile -index 8be41d3ae1..a4c86b9762 100644 ---- a/resolv/Makefile -+++ b/resolv/Makefile -@@ -40,6 +40,9 @@ ifeq ($(have-thread-library),yes) - extra-libs += libanl - routines += gai_sigqueue - tests += tst-res_hconf_reorder -+ -+# This test sends millions of packets and is rather slow. -+xtests += tst-resolv-qtypes - endif - extra-libs-others = $(extra-libs) - libresolv-routines := gethnamaddr res_comp res_debug \ -@@ -117,3 +120,5 @@ tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace - $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out - $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@; \ - $(evaluate-test) -+ -+$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library) -diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c -index 5f9e35701b..d16fa4b8ed 100644 ---- a/resolv/nss_dns/dns-host.c -+++ b/resolv/nss_dns/dns-host.c -@@ -323,7 +323,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, - - int olderr = errno; - enum nss_status status; -- int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC, -+ int n = __libc_res_nsearch (&_res, name, C_IN, T_QUERY_A_AND_AAAA, - host_buffer.buf->buf, 2048, &host_buffer.ptr, - &ans2p, &nans2p, &resplen2, &ans2p_malloced); - if (n >= 0) -diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c -index 12f9730199..d80b5318e5 100644 ---- a/resolv/res_mkquery.c -+++ b/resolv/res_mkquery.c -@@ -103,6 +103,10 @@ res_nmkquery(res_state statp, - int n; - u_char *dnptrs[20], **dpp, **lastdnptr; - -+ if (class < 0 || class > 65535 -+ || type < 0 || type > 65535) -+ return -1; -+ - #ifdef DEBUG - if (statp->options & RES_DEBUG) - printf(";; res_nmkquery(%s, %s, %s, %s)\n", -diff --git a/resolv/res_query.c b/resolv/res_query.c -index 944d1a90f5..07dc6f6583 100644 ---- a/resolv/res_query.c -+++ b/resolv/res_query.c -@@ -122,7 +122,7 @@ __libc_res_nquery(res_state statp, - int n, use_malloc = 0; - u_int oflags = statp->_flags; - -- size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE; -+ size_t bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * QUERYSIZE; - u_char *buf = alloca (bufsize); - u_char *query1 = buf; - int nquery1 = -1; -@@ -137,7 +137,7 @@ __libc_res_nquery(res_state statp, - printf(";; res_query(%s, %d, %d)\n", name, class, type); - #endif - -- if (type == T_UNSPEC) -+ if (type == T_QUERY_A_AND_AAAA) - { - n = res_nmkquery(statp, QUERY, name, class, T_A, NULL, 0, NULL, - query1, bufsize); -@@ -190,7 +190,7 @@ __libc_res_nquery(res_state statp, - if (__builtin_expect (n <= 0, 0) && !use_malloc) { - /* Retry just in case res_nmkquery failed because of too - short buffer. Shouldn't happen. */ -- bufsize = (type == T_UNSPEC ? 2 : 1) * MAXPACKET; -+ bufsize = (type == T_QUERY_A_AND_AAAA ? 2 : 1) * MAXPACKET; - buf = malloc (bufsize); - if (buf != NULL) { - query1 = buf; -diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c -new file mode 100644 -index 0000000000..b3e60c693b ---- /dev/null -+++ b/resolv/tst-resolv-qtypes.c -@@ -0,0 +1,185 @@ -+/* Exercise low-level query functions with different QTYPEs. -+ Copyright (C) 2016 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* If ture, the response function will send the actual response packet -+ over TCP instead of UDP. */ -+static volatile bool force_tcp; -+ -+/* Send back a fake resource record matching the QTYPE. */ -+static void -+response (const struct resolv_response_context *ctx, -+ struct resolv_response_builder *b, -+ const char *qname, uint16_t qclass, uint16_t qtype) -+{ -+ if (force_tcp && ctx->tcp) -+ { -+ resolv_response_init (b, (struct resolv_response_flags) { .tc = 1 }); -+ resolv_response_add_question (b, qname, qclass, qtype); -+ return; -+ } -+ -+ resolv_response_init (b, (struct resolv_response_flags) { }); -+ resolv_response_add_question (b, qname, qclass, qtype); -+ resolv_response_section (b, ns_s_an); -+ resolv_response_open_record (b, qname, qclass, qtype, 0); -+ resolv_response_add_data (b, &qtype, sizeof (qtype)); -+ resolv_response_close_record (b); -+} -+ -+static const const char *domain = "www.example.com"; -+ -+static int -+wrap_res_query (int type, unsigned char *answer, int answer_length) -+{ -+ return res_query (domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_search (int type, unsigned char *answer, int answer_length) -+{ -+ return res_query (domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_querydomain (int type, unsigned char *answer, int answer_length) -+{ -+ return res_querydomain ("www", "example.com", C_IN, type, -+ answer, answer_length); -+} -+ -+static int -+wrap_res_send (int type, unsigned char *answer, int answer_length) -+{ -+ unsigned char buf[512]; -+ int ret = res_mkquery (QUERY, domain, C_IN, type, -+ (const unsigned char *) "", 0, NULL, -+ buf, sizeof (buf)); -+ if (type < 0 || type >= 65536) -+ { -+ /* res_mkquery fails for out-of-range record types. */ -+ TEST_VERIFY_EXIT (ret == -1); -+ return -1; -+ } -+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ -+ return res_send (buf, ret, answer, answer_length); -+} -+ -+static int -+wrap_res_nquery (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_nsearch (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquery (&_res, domain, C_IN, type, answer, answer_length); -+} -+ -+static int -+wrap_res_nquerydomain (int type, unsigned char *answer, int answer_length) -+{ -+ return res_nquerydomain (&_res, "www", "example.com", C_IN, type, -+ answer, answer_length); -+} -+ -+static int -+wrap_res_nsend (int type, unsigned char *answer, int answer_length) -+{ -+ unsigned char buf[512]; -+ int ret = res_nmkquery (&_res, QUERY, domain, C_IN, type, -+ (const unsigned char *) "", 0, NULL, -+ buf, sizeof (buf)); -+ if (type < 0 || type >= 65536) -+ { -+ /* res_mkquery fails for out-of-range record types. */ -+ TEST_VERIFY_EXIT (ret == -1); -+ return -1; -+ } -+ TEST_VERIFY_EXIT (ret > 12); /* DNS header length. */ -+ return res_nsend (&_res, buf, ret, answer, answer_length); -+} -+ -+static void -+test_function (const char *fname, -+ int (*func) (int type, -+ unsigned char *answer, int answer_length)) -+{ -+ unsigned char buf[512]; -+ for (int tcp = 0; tcp < 2; ++tcp) -+ { -+ force_tcp = tcp; -+ for (unsigned int type = 1; type <= 65535; ++type) -+ { -+ if (test_verbose) -+ printf ("info: sending QTYPE %d with %s (tcp=%d)\n", -+ type, fname, tcp); -+ int ret = func (type, buf, sizeof (buf)); -+ if (ret != 47) -+ FAIL_EXIT1 ("%s tcp=%d qtype=%d return value %d", -+ fname,tcp, type, ret); -+ /* One question, one answer record. */ -+ TEST_VERIFY (memcmp (buf + 4, "\0\1\0\1\0\0\0\0", 8) == 0); -+ /* Question section. */ -+ static const char qname[] = "\3www\7example\3com"; -+ size_t qname_length = sizeof (qname); -+ TEST_VERIFY (memcmp (buf + 12, qname, qname_length) == 0); -+ /* RDATA part of answer. */ -+ uint16_t type16 = type; -+ TEST_VERIFY (memcmp (buf + ret - 2, &type16, sizeof (type16)) == 0); -+ } -+ } -+ -+ TEST_VERIFY (func (-1, buf, sizeof (buf) == -1)); -+ TEST_VERIFY (func (65536, buf, sizeof (buf) == -1)); -+} -+ -+static int -+do_test (void) -+{ -+ struct resolv_redirect_config config = -+ { -+ .response_callback = response, -+ }; -+ struct resolv_test *obj = resolv_test_start (config); -+ -+ test_function ("res_query", &wrap_res_query); -+ test_function ("res_search", &wrap_res_search); -+ test_function ("res_querydomain", &wrap_res_querydomain); -+ test_function ("res_send", &wrap_res_send); -+ -+ test_function ("res_nquery", &wrap_res_nquery); -+ test_function ("res_nsearch", &wrap_res_nsearch); -+ test_function ("res_nquerydomain", &wrap_res_nquerydomain); -+ test_function ("res_nsend", &wrap_res_nsend); -+ -+ resolv_test_end (obj); -+ return 0; -+} -+ -+#define TIMEOUT 300 -+#include -diff --git a/scripts/backport-support.sh b/scripts/backport-support.sh -new file mode 100644 -index 0000000000..2ece7ce575 ---- /dev/null -+++ b/scripts/backport-support.sh -@@ -0,0 +1,110 @@ -+#!/bin/bash -+# Create a patch which backports the support/ subdirectory. -+# Copyright (C) 2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+ -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+ -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . -+ -+# This script does not backport the Makefile tweaks outside the -+# support/ directory (which need to be backported separately), or the -+# changes to test-skeleton.c (which should not be backported). -+ -+set -e -+ -+export LC_ALL=C -+export GIT_CONFIG=/dev/null -+export GTT_CONFIG_NOSYSTEM=0 -+export GIT_PAGER= -+ -+usage () { -+ cat >&2 <&2 -+ echo "# rm -rf $patch_targets" >&2 -+} -+ -+command_commit () { -+ git status --porcelain | while read line ; do -+ echo "error: working copy is not clean, cannot commit" >&2 -+ exit 1 -+ done -+ for path in $patch_targets; do -+ echo "# Processing $path" >&2 -+ case "$path" in -+ [a-zA-Z0-9]*/) -+ # Directory. -+ git rm --cached --ignore-unmatch -r "$path" -+ rm -rf "$path" -+ git read-tree --prefix="$path" "$latest_commit":"$path" -+ git checkout "$path" -+ ;; -+ *) -+ # File. -+ git show "$latest_commit":"$path" > "$path" -+ git add "$path" -+ esac -+ done -+ git commit -m "Synchronize support/ infrastructure with $branch_name -+ -+This commit updates the support/ subdirectory to -+commit $latest_commit -+on the $branch_name branch. -+" -+} -+ -+command_$command -diff --git a/sunrpc/Makefile b/sunrpc/Makefile -index 789ef423e5..1e91905011 100644 ---- a/sunrpc/Makefile -+++ b/sunrpc/Makefile -@@ -96,13 +96,18 @@ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \ - extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs)) - others += rpcgen - --tests = tst-xdrmem tst-xdrmem2 test-rpcent -+tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error - xtests := tst-getmyaddr - - ifeq ($(have-thread-library),yes) - xtests += thrsvc - endif - -+ifeq ($(run-built-tests),yes) -+rpcgen-tests := $(objpfx)bug20790.out -+tests-special += $(rpcgen-tests) -+endif -+ - headers += $(rpcsvc:%.x=rpcsvc/%.h) - extra-libs := librpcsvc - extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass. -@@ -153,6 +158,7 @@ BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS) - $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so - $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so - $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so -+$(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so - - $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) - -@@ -225,3 +231,9 @@ endif - endif - - $(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library) -+ -+ifeq ($(run-built-tests),yes) -+$(rpcgen-tests): $(objpfx)%.out: %.x $(objpfx)rpcgen -+ $(built-program-cmd) -c $< -o $@; \ -+ $(evaluate-test) -+endif -diff --git a/sunrpc/bug20790.x b/sunrpc/bug20790.x -new file mode 100644 -index 0000000000..a00c9b3830 ---- /dev/null -+++ b/sunrpc/bug20790.x -@@ -0,0 +1 @@ -+program TPROG { version TVERS { int FUNC(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) = 1; } = 1; } = 1; -diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c -index 4d9acb1e6a..1de25cb771 100644 ---- a/sunrpc/clnt_udp.c -+++ b/sunrpc/clnt_udp.c -@@ -421,9 +421,9 @@ send_again: - cmsg = CMSG_NXTHDR (&msg, cmsg)) - if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) - { -- free (cbuf); - e = (struct sock_extended_err *) CMSG_DATA(cmsg); - cu->cu_error.re_errno = e->ee_errno; -+ free (cbuf); - return (cu->cu_error.re_status = RPC_CANTRECV); - } - free (cbuf); -diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c -index 1a1df6d8c2..505a6554cf 100644 ---- a/sunrpc/rpc_parse.c -+++ b/sunrpc/rpc_parse.c -@@ -521,7 +521,7 @@ static void - get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ ) - { - token tok; -- char name[10]; /* argument name */ -+ char name[MAXLINESIZE]; /* argument name */ - - if (dkind == DEF_PROGRAM) - { -diff --git a/sunrpc/tst-udp-error.c b/sunrpc/tst-udp-error.c -new file mode 100644 -index 0000000000..1efc02f5c6 ---- /dev/null -+++ b/sunrpc/tst-udp-error.c -@@ -0,0 +1,62 @@ -+/* Check for use-after-free in clntudp_call (bug 21115). -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ support_become_root (); -+ support_enter_network_namespace (); -+ -+ /* Obtain a likely-unused port number. */ -+ struct sockaddr_in sin = -+ { -+ .sin_family = AF_INET, -+ .sin_addr.s_addr = htonl (INADDR_LOOPBACK), -+ }; -+ { -+ int fd = xsocket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); -+ xbind (fd, (struct sockaddr *) &sin, sizeof (sin)); -+ socklen_t sinlen = sizeof (sin); -+ xgetsockname (fd, (struct sockaddr *) &sin, &sinlen); -+ /* Close the socket, so that we will receive an error below. */ -+ close (fd); -+ } -+ -+ int sock = RPC_ANYSOCK; -+ CLIENT *clnt = clntudp_create -+ (&sin, 1, 2, (struct timeval) { 1, 0 }, &sock); -+ TEST_VERIFY_EXIT (clnt != NULL); -+ TEST_VERIFY (clnt_call (clnt, 3, -+ (xdrproc_t) xdr_void, NULL, -+ (xdrproc_t) xdr_void, NULL, -+ ((struct timeval) { 3, 0 })) -+ == RPC_CANTRECV); -+ clnt_destroy (clnt); -+ -+ return 0; -+} -+ -+#include -diff --git a/support/Makefile b/support/Makefile -new file mode 100644 -index 0000000000..20b0343ade ---- /dev/null -+++ b/support/Makefile -@@ -0,0 +1,146 @@ -+# Makefile for support library, used only at build and test time -+# Copyright (C) 2016-2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+ -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+ -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . -+ -+subdir := support -+ -+include ../Makeconfig -+ -+extra-libs := libsupport -+extra-libs-others = $(extra-libs) -+extra-libs-noinstall := $(extra-libs) -+ -+libsupport-routines = \ -+ check \ -+ check_addrinfo \ -+ check_dns_packet \ -+ check_hostent \ -+ check_netent \ -+ delayed_exit \ -+ ignore_stderr \ -+ oom_error \ -+ resolv_test \ -+ set_fortify_handler \ -+ support-xstat \ -+ support_become_root \ -+ support_can_chroot \ -+ support_capture_subprocess \ -+ support_capture_subprocess_check \ -+ support_enter_network_namespace \ -+ support_format_address_family \ -+ support_format_addrinfo \ -+ support_format_dns_packet \ -+ support_format_herrno \ -+ support_format_hostent \ -+ support_format_netent \ -+ support_isolate_in_subprocess \ -+ support_record_failure \ -+ support_run_diff \ -+ support_shared_allocate \ -+ support_write_file_string \ -+ support_test_main \ -+ support_test_verify_impl \ -+ temp_file \ -+ write_message \ -+ xaccept \ -+ xaccept4 \ -+ xasprintf \ -+ xbind \ -+ xcalloc \ -+ xchroot \ -+ xclose \ -+ xconnect \ -+ xdup2 \ -+ xfclose \ -+ xfopen \ -+ xfork \ -+ xgetsockname \ -+ xlisten \ -+ xmalloc \ -+ xmemstream \ -+ xmkdir \ -+ xmmap \ -+ xmunmap \ -+ xopen \ -+ xpipe \ -+ xpoll \ -+ xpthread_attr_destroy \ -+ xpthread_attr_init \ -+ xpthread_attr_setdetachstate \ -+ xpthread_attr_setstacksize \ -+ xpthread_barrier_destroy \ -+ xpthread_barrier_init \ -+ xpthread_barrier_wait \ -+ xpthread_cancel \ -+ xpthread_check_return \ -+ xpthread_cond_wait \ -+ xpthread_create \ -+ xpthread_detach \ -+ xpthread_join \ -+ xpthread_mutex_consistent \ -+ xpthread_mutex_destroy \ -+ xpthread_mutex_init \ -+ xpthread_mutex_lock \ -+ xpthread_mutex_unlock \ -+ xpthread_mutexattr_destroy \ -+ xpthread_mutexattr_init \ -+ xpthread_mutexattr_setprotocol \ -+ xpthread_mutexattr_setpshared \ -+ xpthread_mutexattr_setrobust \ -+ xpthread_mutexattr_settype \ -+ xpthread_once \ -+ xpthread_sigmask \ -+ xpthread_spin_lock \ -+ xpthread_spin_unlock \ -+ xrealloc \ -+ xrecvfrom \ -+ xsendto \ -+ xsetsockopt \ -+ xsocket \ -+ xstrdup \ -+ xwaitpid \ -+ xwrite \ -+ -+libsupport-static-only-routines := $(libsupport-routines) -+# Only build one variant of the library. -+libsupport-inhibit-o := .os -+ifeq ($(build-shared),yes) -+libsupport-inhibit-o += .o -+endif -+ -+tests = \ -+ README-testing \ -+ tst-support-namespace \ -+ tst-support_capture_subprocess \ -+ tst-support_format_dns_packet \ -+ tst-support_record_failure \ -+ -+ifeq ($(run-built-tests),yes) -+tests-special = \ -+ $(objpfx)tst-support_record_failure-2.out -+ -+$(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ -+ $(objpfx)tst-support_record_failure -+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ -+ '$(run-program-env)' '$(test-program-prefix-after-env)' \ -+ > $@; \ -+ $(evaluate-test) -+endif -+ -+$(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so -+ -+include ../Rules -diff --git a/support/README b/support/README -new file mode 100644 -index 0000000000..476cfcda59 ---- /dev/null -+++ b/support/README -@@ -0,0 +1,29 @@ -+This subdirectory contains infrastructure which is not put into -+installed libraries, but may be linked into programs (installed or -+not) and tests. -+ -+# Error-checking wrappers -+ -+These wrappers test for error return codes an terminate the process on -+error. They are declared in these header files: -+ -+* support.h -+* xsignal.h -+* xthread.h -+ -+In general, new wrappers should be added to support.h if possible. -+However, support.h must remain fully compatible with C90 and therefore -+cannot include headers which use identifers not reserved in C90. If -+the wrappers need additional types, additional headers such as -+signal.h need to be introduced. -+ -+# Test framework -+ -+The test framework provides a main program for tests, including a -+timeout for hanging tests. See README-testing.c for a minimal -+example, and test-driver.c for details how to use it. The following -+header files provide related declarations: -+ -+* check.h -+* temp_file.h -+* test-driver.h -diff --git a/support/README-testing.c b/support/README-testing.c -new file mode 100644 -index 0000000000..9d289c3020 ---- /dev/null -+++ b/support/README-testing.c -@@ -0,0 +1,19 @@ -+/* This file contains an example test case which shows minimal use of -+ the test framework. Additional testing hooks are described in -+ . */ -+ -+/* This function will be called from the test driver. */ -+static int -+do_test (void) -+{ -+ if (3 == 5) -+ /* Indicate failure. */ -+ return 1; -+ else -+ /* Indicate success. */ -+ return 0; -+} -+ -+/* This file references do_test above and contains the definition of -+ the main function. */ -+#include -diff --git a/support/capture_subprocess.h b/support/capture_subprocess.h -new file mode 100644 -index 0000000000..43caf9bce4 ---- /dev/null -+++ b/support/capture_subprocess.h -@@ -0,0 +1,61 @@ -+/* Capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CAPTURE_SUBPROCESS_H -+#define SUPPORT_CAPTURE_SUBPROCESS_H -+ -+#include -+ -+struct support_capture_subprocess -+{ -+ struct xmemstream out; -+ struct xmemstream err; -+ int status; -+}; -+ -+/* Invoke CALLBACK (CLOSURE) in a subprocess and capture standard -+ output, standard error, and the exit status. The out.buffer and -+ err.buffer members in the result are null-terminated strings which -+ can be examined by the caller (out.out and err.out are NULL). */ -+struct support_capture_subprocess support_capture_subprocess -+ (void (*callback) (void *), void *closure); -+ -+/* Deallocate the subprocess data captured by -+ support_capture_subprocess. */ -+void support_capture_subprocess_free (struct support_capture_subprocess *); -+ -+enum support_capture_allow -+{ -+ /* No output is allowed. */ -+ sc_allow_none = 0x01, -+ /* Output to stdout is permitted. */ -+ sc_allow_stdout = 0x02, -+ /* Output to standard error is permitted. */ -+ sc_allow_stderr = 0x04, -+}; -+ -+/* Check that the subprocess exited with STATUS and that only the -+ allowed outputs happened. ALLOWED is a combination of -+ support_capture_allow flags. Report errors under the CONTEXT -+ message. */ -+void support_capture_subprocess_check (struct support_capture_subprocess *, -+ const char *context, int status, -+ int allowed) -+ __attribute__ ((nonnull (1, 2))); -+ -+#endif /* SUPPORT_CAPTURE_SUBPROCESS_H */ -diff --git a/support/check.c b/support/check.c -new file mode 100644 -index 0000000000..592f2bc856 ---- /dev/null -+++ b/support/check.c -@@ -0,0 +1,57 @@ -+/* Support code for reporting test results. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+static void -+print_failure (const char *file, int line, const char *format, va_list ap) -+{ -+ printf ("error: %s:%d: ", file, line); -+ vprintf (format, ap); -+ puts (""); -+} -+ -+int -+support_print_failure_impl (const char *file, int line, -+ const char *format, ...) -+{ -+ support_record_failure (); -+ va_list ap; -+ va_start (ap, format); -+ print_failure (file, line, format, ap); -+ va_end (ap); -+ return 1; -+} -+ -+void -+support_exit_failure_impl (int status, const char *file, int line, -+ const char *format, ...) -+{ -+ if (status != EXIT_SUCCESS && status != EXIT_UNSUPPORTED) -+ support_record_failure (); -+ va_list ap; -+ va_start (ap, format); -+ print_failure (file, line, format, ap); -+ va_end (ap); -+ exit (status); -+} -diff --git a/support/check.h b/support/check.h -new file mode 100644 -index 0000000000..1d244a3557 ---- /dev/null -+++ b/support/check.h -@@ -0,0 +1,94 @@ -+/* Functionality for reporting test results. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CHECK_H -+#define SUPPORT_CHECK_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+/* Record a test failure, print the failure message to standard output -+ and return 1. */ -+#define FAIL_RET(...) \ -+ return support_print_failure_impl (__FILE__, __LINE__, __VA_ARGS__) -+ -+/* Print the failure message and terminate the process with STATUS. -+ Record a the process as failed if STATUS is neither EXIT_SUCCESS -+ nor EXIT_UNSUPPORTED. */ -+#define FAIL_EXIT(status, ...) \ -+ support_exit_failure_impl (status, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Record a test failure, print the failure message and terminate with -+ exit status 1. */ -+#define FAIL_EXIT1(...) \ -+ support_exit_failure_impl (1, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Print failure message and terminate with as unsupported test (exit -+ status of 77). */ -+#define FAIL_UNSUPPORTED(...) \ -+ support_exit_failure_impl (77, __FILE__, __LINE__, __VA_ARGS__) -+ -+/* Record a test failure (but continue executing) if EXPR evaluates to -+ false. */ -+#define TEST_VERIFY(expr) \ -+ ({ \ -+ if (expr) \ -+ ; \ -+ else \ -+ support_test_verify_impl (-1, __FILE__, __LINE__, #expr); \ -+ }) -+ -+/* Record a test failure and exit if EXPR evaluates to false. */ -+#define TEST_VERIFY_EXIT(expr) \ -+ ({ \ -+ if (expr) \ -+ ; \ -+ else \ -+ support_test_verify_impl (1, __FILE__, __LINE__, #expr); \ -+ }) -+ -+int support_print_failure_impl (const char *file, int line, -+ const char *format, ...) -+ __attribute__ ((nonnull (1), format (printf, 3, 4))); -+void support_exit_failure_impl (int exit_status, -+ const char *file, int line, -+ const char *format, ...) -+ __attribute__ ((noreturn, nonnull (2), format (printf, 4, 5))); -+void support_test_verify_impl (int status, const char *file, int line, -+ const char *expr); -+ -+/* Record a test failure. This function returns and does not -+ terminate the process. The failure counter is stored in a shared -+ memory mapping, so that failures reported in child processes are -+ visible to the parent process and test driver. This function -+ depends on initialization by an ELF constructor, so it can only be -+ invoked after the test driver has run. Note that this function -+ does not support reporting failures from a DSO. */ -+void support_record_failure (void); -+ -+/* Internal function called by the test driver. */ -+int support_report_failure (int status) -+ __attribute__ ((weak, warn_unused_result)); -+ -+/* Internal function used to test the failure recording framework. */ -+void support_record_failure_reset (void); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_CHECK_H */ -diff --git a/support/check_addrinfo.c b/support/check_addrinfo.c -new file mode 100644 -index 0000000000..55895ace3c ---- /dev/null -+++ b/support/check_addrinfo.c -@@ -0,0 +1,42 @@ -+/* Compare struct addrinfo values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_addrinfo (const char *query_description, struct addrinfo *ai, int ret, -+ const char *expected) -+{ -+ char *formatted = support_format_addrinfo (ai, ret); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: addrinfo comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_dns_packet.c b/support/check_dns_packet.c -new file mode 100644 -index 0000000000..d2a31bed7b ---- /dev/null -+++ b/support/check_dns_packet.c -@@ -0,0 +1,42 @@ -+/* Check that a DNS packet buffer has the expected contents. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_dns_packet (const char *query_description, -+ const unsigned char *buffer, size_t length, -+ const char *expected) -+{ -+ char *formatted = support_format_dns_packet (buffer, length); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: packet comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_hostent.c b/support/check_hostent.c -new file mode 100644 -index 0000000000..890d672d50 ---- /dev/null -+++ b/support/check_hostent.c -@@ -0,0 +1,42 @@ -+/* Compare struct hostent values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_hostent (const char *query_description, struct hostent *h, -+ const char *expected) -+{ -+ char *formatted = support_format_hostent (h); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: hostent comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_netent.c b/support/check_netent.c -new file mode 100644 -index 0000000000..daa3083fd1 ---- /dev/null -+++ b/support/check_netent.c -@@ -0,0 +1,42 @@ -+/* Compare struct netent values against a formatted string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+void -+check_netent (const char *query_description, struct netent *e, -+ const char *expected) -+{ -+ char *formatted = support_format_netent (e); -+ if (strcmp (formatted, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: netent comparison failure\n"); -+ if (query_description != NULL) -+ printf ("query: %s\n", query_description); -+ support_run_diff ("expected", expected, -+ "actual", formatted); -+ } -+ free (formatted); -+} -diff --git a/support/check_nss.h b/support/check_nss.h -new file mode 100644 -index 0000000000..2893f2c295 ---- /dev/null -+++ b/support/check_nss.h -@@ -0,0 +1,42 @@ -+/* Test verification functions for NSS- and DNS-related data. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_CHECK_NSS_H -+#define SUPPORT_CHECK_NSS_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Compare the data structures against the expected values (which have -+ to be formatted according to the support_format_* functions in -+ ). If there is a difference, a delayed test -+ failure is recorded, and a diff is written to standard output. */ -+void check_addrinfo (const char *query_description, -+ struct addrinfo *, int ret, const char *expected); -+void check_dns_packet (const char *query_description, -+ const unsigned char *, size_t, const char *expected); -+void check_hostent (const char *query_description, -+ struct hostent *, const char *expected); -+void check_netent (const char *query_description, -+ struct netent *, const char *expected); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_CHECK_NSS_H */ -diff --git a/support/delayed_exit.c b/support/delayed_exit.c -new file mode 100644 -index 0000000000..67442f95df ---- /dev/null -+++ b/support/delayed_exit.c -@@ -0,0 +1,55 @@ -+/* Time-triggered process termination. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static void * -+delayed_exit_thread (void *seconds_as_ptr) -+{ -+ int seconds = (uintptr_t) seconds_as_ptr; -+ struct timespec delay = { seconds, 0 }; -+ struct timespec remaining = { 0 }; -+ if (nanosleep (&delay, &remaining) != 0) -+ FAIL_EXIT1 ("nanosleep: %m"); -+ /* Exit the process sucessfully. */ -+ exit (0); -+ return NULL; -+} -+ -+void -+delayed_exit (int seconds) -+{ -+ /* Create the new thread with all signals blocked. */ -+ sigset_t all_blocked; -+ sigfillset (&all_blocked); -+ sigset_t old_set; -+ xpthread_sigmask (SIG_SETMASK, &all_blocked, &old_set); -+ /* Create a detached thread. */ -+ pthread_t thr = xpthread_create -+ (NULL, delayed_exit_thread, (void *) (uintptr_t) seconds); -+ xpthread_detach (thr); -+ /* Restore the original signal mask. */ -+ xpthread_sigmask (SIG_SETMASK, &old_set, NULL); -+} -diff --git a/support/format_nss.h b/support/format_nss.h -new file mode 100644 -index 0000000000..fb4597c238 ---- /dev/null -+++ b/support/format_nss.h -@@ -0,0 +1,41 @@ -+/* String formatting functions for NSS- and DNS-related data. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_FORMAT_NSS_H -+#define SUPPORT_FORMAT_NSS_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* The following functions format their arguments as human-readable -+ strings (which can span multiple lines). The caller must free the -+ returned buffer. For NULL pointers or failure status arguments, -+ error variables such as h_errno and errno are included in the -+ result. */ -+char *support_format_address_family (int); -+char *support_format_addrinfo (struct addrinfo *, int ret); -+char *support_format_dns_packet (const unsigned char *buffer, size_t length); -+char *support_format_herrno (int); -+char *support_format_hostent (struct hostent *); -+char *support_format_netent (struct netent *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_FORMAT_NSS_H */ -diff --git a/support/ignore_stderr.c b/support/ignore_stderr.c -new file mode 100644 -index 0000000000..7b77a2cd56 ---- /dev/null -+++ b/support/ignore_stderr.c -@@ -0,0 +1,38 @@ -+/* Avoid all the buffer overflow messages on stderr. -+ Copyright (C) 2015-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void -+ignore_stderr (void) -+{ -+ int fd = open (_PATH_DEVNULL, O_WRONLY); -+ if (fd == -1) -+ close (STDERR_FILENO); -+ else -+ { -+ dup2 (fd, STDERR_FILENO); -+ close (fd); -+ } -+ setenv ("LIBC_FATAL_STDERR_", "1", 1); -+} -diff --git a/support/namespace.h b/support/namespace.h -new file mode 100644 -index 0000000000..e1ccaa1ef0 ---- /dev/null -+++ b/support/namespace.h -@@ -0,0 +1,65 @@ -+/* Entering namespaces for test case isolation. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_NAMESPACE_H -+#define SUPPORT_NAMESPACE_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Attempts to become root (or acquire root-like privileges), possibly -+ with the help of user namespaces. Return true if (restricted) root -+ privileges could be attained in some way. Print diagnostics to -+ standard output. -+ -+ Note that this function generally has to be called before a process -+ becomes multi-threaded, otherwise it may fail with insufficient -+ privileges on systems which would support this operation for -+ single-threaded processes. */ -+bool support_become_root (void); -+ -+/* Return true if this process can perform a chroot operation. In -+ general, this is only possible if support_become_root has been -+ called. Note that the actual test is performed in a subprocess, -+ after fork, so that the file system root of the original process is -+ not changed. */ -+bool support_can_chroot (void); -+ -+/* Enter a network namespace (and a UTS namespace if possible) and -+ configure the loopback interface. Return true if a network -+ namespace could be created. Print diagnostics to standard output. -+ If a network namespace could be created, but networking in it could -+ not be configured, terminate the process. It is recommended to -+ call support_become_root before this function so that the process -+ has sufficient privileges. */ -+bool support_enter_network_namespace (void); -+ -+/* Return true if support_enter_network_namespace managed to enter a -+ UTS namespace. */ -+bool support_in_uts_namespace (void); -+ -+/* Invoke CALLBACK (CLOSURE) in a subprocess created using fork. -+ Terminate the calling process if the subprocess exits with a -+ non-zero exit status. */ -+void support_isolate_in_subprocess (void (*callback) (void *), void *closure); -+ -+__END_DECLS -+ -+#endif -diff --git a/sysdeps/sparc/sparc64/fpu/s_fdimf.S b/support/oom_error.c -similarity index 69% -rename from sysdeps/sparc/sparc64/fpu/s_fdimf.S -rename to support/oom_error.c -index 356c23c4e3..7816978273 100644 ---- a/sysdeps/sparc/sparc64/fpu/s_fdimf.S -+++ b/support/oom_error.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 64-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Reporting out-of-memory errors. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,15 +16,14 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- fcmps %f1, %f3 -- fbug 1f -- nop -- fzeros %f1 -- fnegs %f1, %f3 --1: retl -- fsubs %f1, %f3, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+#include -+ -+void -+oom_error (const char *function, size_t size) -+{ -+ printf ("%s: unable to allocate %zu bytes: %m\n", function, size); -+ exit (1); -+} -diff --git a/support/resolv_test.c b/support/resolv_test.c -new file mode 100644 -index 0000000000..050cd7154b ---- /dev/null -+++ b/support/resolv_test.c -@@ -0,0 +1,1202 @@ -+/* DNS test framework and libresolv redirection. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Response builder. */ -+ -+enum -+ { -+ max_response_length = 65536 -+ }; -+ -+/* List of pointers to be freed. The hash table implementation -+ (struct hsearch_data) does not provide a way to deallocate all -+ objects, so this approach is used to avoid memory leaks. */ -+struct to_be_freed -+{ -+ struct to_be_freed *next; -+ void *ptr; -+}; -+ -+struct resolv_response_builder -+{ -+ const unsigned char *query_buffer; -+ size_t query_length; -+ -+ size_t offset; /* Bytes written so far in buffer. */ -+ ns_sect section; /* Current section in the DNS packet. */ -+ unsigned int truncate_bytes; /* Bytes to remove at end of response. */ -+ bool drop; /* Discard generated response. */ -+ bool close; /* Close TCP client connection. */ -+ -+ /* Offset of the two-byte RDATA length field in the currently -+ written RDATA sub-structure. 0 if no RDATA is being written. */ -+ size_t current_rdata_offset; -+ -+ /* Hash table for locating targets for label compression. */ -+ struct hsearch_data compression_offsets; -+ /* List of pointers which need to be freed. Used for domain names -+ involved in label compression. */ -+ struct to_be_freed *to_be_freed; -+ -+ /* Must be last. Not zeroed for performance reasons. */ -+ unsigned char buffer[max_response_length]; -+}; -+ -+/* Response builder. */ -+ -+/* Add a pointer to the list of pointers to be freed when B is -+ deallocated. */ -+static void -+response_push_pointer_to_free (struct resolv_response_builder *b, void *ptr) -+{ -+ if (ptr == NULL) -+ return; -+ struct to_be_freed *e = xmalloc (sizeof (*e)); -+ *e = (struct to_be_freed) {b->to_be_freed, ptr}; -+ b->to_be_freed = e; -+} -+ -+void -+resolv_response_init (struct resolv_response_builder *b, -+ struct resolv_response_flags flags) -+{ -+ if (b->offset > 0) -+ FAIL_EXIT1 ("response_init: called at offset %zu", b->offset); -+ if (b->query_length < 12) -+ FAIL_EXIT1 ("response_init called for a query of size %zu", -+ b->query_length); -+ if (flags.rcode > 15) -+ FAIL_EXIT1 ("response_init: invalid RCODE %u", flags.rcode); -+ -+ /* Copy the transaction ID. */ -+ b->buffer[0] = b->query_buffer[0]; -+ b->buffer[1] = b->query_buffer[1]; -+ -+ /* Initialize the flags. */ -+ b->buffer[2] = 0x80; /* Mark as response. */ -+ b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */ -+ if (flags.tc) -+ b->buffer[2] |= 0x02; -+ b->buffer[3] = 0x80 | flags.rcode; /* Always set RA. */ -+ -+ /* Fill in the initial section count values. */ -+ b->buffer[4] = flags.qdcount >> 8; -+ b->buffer[5] = flags.qdcount; -+ b->buffer[6] = flags.ancount >> 8; -+ b->buffer[7] = flags.ancount; -+ b->buffer[8] = flags.nscount >> 8; -+ b->buffer[9] = flags.nscount; -+ b->buffer[10] = flags.adcount >> 8; -+ b->buffer[11] = flags.adcount; -+ -+ b->offset = 12; -+} -+ -+void -+resolv_response_section (struct resolv_response_builder *b, ns_sect section) -+{ -+ if (b->offset == 0) -+ FAIL_EXIT1 ("resolv_response_section: response_init not called before"); -+ if (section < b->section) -+ FAIL_EXIT1 ("resolv_response_section: cannot go back to previous section"); -+ b->section = section; -+} -+ -+/* Add a single byte to B. */ -+static inline void -+response_add_byte (struct resolv_response_builder *b, unsigned char ch) -+{ -+ if (b->offset == max_response_length) -+ FAIL_EXIT1 ("DNS response exceeds 64 KiB limit"); -+ b->buffer[b->offset] = ch; -+ ++b->offset; -+} -+ -+/* Add a 16-bit word VAL to B, in big-endian format. */ -+static void -+response_add_16 (struct resolv_response_builder *b, uint16_t val) -+{ -+ response_add_byte (b, val >> 8); -+ response_add_byte (b, val); -+} -+ -+/* Increment the pers-section record counter in the packet header. */ -+static void -+response_count_increment (struct resolv_response_builder *b) -+{ -+ unsigned int offset = b->section; -+ offset = 4 + 2 * offset; -+ ++b->buffer[offset + 1]; -+ if (b->buffer[offset + 1] == 0) -+ { -+ /* Carry. */ -+ ++b->buffer[offset]; -+ if (b->buffer[offset] == 0) -+ /* Overflow. */ -+ FAIL_EXIT1 ("too many records in section"); -+ } -+} -+ -+void -+resolv_response_add_question (struct resolv_response_builder *b, -+ const char *name, uint16_t class, uint16_t type) -+{ -+ if (b->offset == 0) -+ FAIL_EXIT1 ("resolv_response_add_question: " -+ "resolv_response_init not called"); -+ if (b->section != ns_s_qd) -+ FAIL_EXIT1 ("resolv_response_add_question: " -+ "must be called in the question section"); -+ -+ resolv_response_add_name (b, name); -+ response_add_16 (b, type); -+ response_add_16 (b, class); -+ -+ response_count_increment (b); -+} -+ -+void -+resolv_response_add_name (struct resolv_response_builder *b, -+ const char *const origname) -+{ -+ /* Normalized name. */ -+ char *name; -+ /* Normalized name with case preserved. */ -+ char *name_case; -+ { -+ size_t namelen = strlen (origname); -+ /* Remove trailing dots. FIXME: Handle trailing quoted dots. */ -+ while (namelen > 0 && origname[namelen - 1] == '.') -+ --namelen; -+ name = xmalloc (namelen + 1); -+ name_case = xmalloc (namelen + 1); -+ /* Copy and convert to lowercase. FIXME: This needs to normalize -+ escaping as well. */ -+ for (size_t i = 0; i < namelen; ++i) -+ { -+ char ch = origname[i]; -+ name_case[i] = ch; -+ if ('A' <= ch && ch <= 'Z') -+ ch = ch - 'A' + 'a'; -+ name[i] = ch; -+ } -+ name[namelen] = 0; -+ name_case[namelen] = 0; -+ } -+ char *name_start = name; -+ char *name_case_start = name_case; -+ -+ bool compression = false; -+ while (*name) -+ { -+ /* Search for a previous name we can reference. */ -+ ENTRY new_entry = -+ { -+ .key = name, -+ .data = (void *) (uintptr_t) b->offset, -+ }; -+ -+ /* If the label can be a compression target because it is at a -+ reachable offset, add it to the hash table. */ -+ ACTION action; -+ if (b->offset < (1 << 12)) -+ action = ENTER; -+ else -+ action = FIND; -+ -+ /* Search for known compression offsets in the hash table. */ -+ ENTRY *e; -+ if (hsearch_r (new_entry, action, &e, &b->compression_offsets) == 0) -+ { -+ if (action == FIND && errno == ESRCH) -+ /* Fall through. */ -+ e = NULL; -+ else -+ FAIL_EXIT1 ("hsearch_r failure in name compression: %m"); -+ } -+ -+ /* The name is known. Reference the previous location. */ -+ if (e != NULL && e->data != new_entry.data) -+ { -+ size_t old_offset = (uintptr_t) e->data; -+ response_add_byte (b, 0xC0 | (old_offset >> 8)); -+ response_add_byte (b, old_offset); -+ compression = true; -+ break; -+ } -+ -+ /* The name does not exist yet. Write one label. First, add -+ room for the label length. */ -+ size_t buffer_label_offset = b->offset; -+ response_add_byte (b, 0); -+ -+ /* Copy the label. */ -+ while (true) -+ { -+ char ch = *name_case; -+ if (ch == '\0') -+ break; -+ ++name; -+ ++name_case; -+ if (ch == '.') -+ break; -+ /* FIXME: Handle escaping. */ -+ response_add_byte (b, ch); -+ } -+ -+ /* Patch in the label length. */ -+ size_t label_length = b->offset - buffer_label_offset - 1; -+ if (label_length == 0) -+ FAIL_EXIT1 ("empty label in name compression: %s", origname); -+ if (label_length > 63) -+ FAIL_EXIT1 ("label too long in name compression: %s", origname); -+ b->buffer[buffer_label_offset] = label_length; -+ -+ /* Continue with the tail of the name and the next label. */ -+ } -+ -+ if (compression) -+ { -+ /* If we found an immediate match for the name, we have not put -+ it into the hash table, and can free it immediately. */ -+ if (name == name_start) -+ free (name_start); -+ else -+ response_push_pointer_to_free (b, name_start); -+ } -+ else -+ { -+ /* Terminate the sequence of labels. With compression, this is -+ implicit in the compression reference. */ -+ response_add_byte (b, 0); -+ response_push_pointer_to_free (b, name_start); -+ } -+ -+ free (name_case_start); -+} -+ -+void -+resolv_response_open_record (struct resolv_response_builder *b, -+ const char *name, -+ uint16_t class, uint16_t type, uint32_t ttl) -+{ -+ if (b->section == ns_s_qd) -+ FAIL_EXIT1 ("resolv_response_open_record called in question section"); -+ if (b->current_rdata_offset != 0) -+ FAIL_EXIT1 ("resolv_response_open_record called with open record"); -+ -+ resolv_response_add_name (b, name); -+ response_add_16 (b, type); -+ response_add_16 (b, class); -+ response_add_16 (b, ttl >> 16); -+ response_add_16 (b, ttl); -+ -+ b->current_rdata_offset = b->offset; -+ /* Add room for the RDATA length. */ -+ response_add_16 (b, 0); -+} -+ -+ -+void -+resolv_response_close_record (struct resolv_response_builder *b) -+{ -+ size_t rdata_offset = b->current_rdata_offset; -+ if (rdata_offset == 0) -+ FAIL_EXIT1 ("response_close_record called without open record"); -+ size_t rdata_length = b->offset - rdata_offset - 2; -+ if (rdata_length > 65535) -+ FAIL_EXIT1 ("RDATA length %zu exceeds limit", rdata_length); -+ b->buffer[rdata_offset] = rdata_length >> 8; -+ b->buffer[rdata_offset + 1] = rdata_length; -+ response_count_increment (b); -+ b->current_rdata_offset = 0; -+} -+ -+void -+resolv_response_add_data (struct resolv_response_builder *b, -+ const void *data, size_t length) -+{ -+ size_t remaining = max_response_length - b->offset; -+ if (remaining < length) -+ FAIL_EXIT1 ("resolv_response_add_data: not enough room for %zu bytes", -+ length); -+ memcpy (b->buffer + b->offset, data, length); -+ b->offset += length; -+} -+ -+void -+resolv_response_drop (struct resolv_response_builder *b) -+{ -+ b->drop = true; -+} -+ -+void -+resolv_response_close (struct resolv_response_builder *b) -+{ -+ b->close = true; -+} -+ -+void -+resolv_response_truncate_data (struct resolv_response_builder *b, size_t count) -+{ -+ if (count > 65535) -+ FAIL_EXIT1 ("resolv_response_truncate_data: argument too large: %zu", -+ count); -+ b->truncate_bytes = count; -+} -+ -+ -+size_t -+resolv_response_length (const struct resolv_response_builder *b) -+{ -+ return b->offset; -+} -+ -+unsigned char * -+resolv_response_buffer (const struct resolv_response_builder *b) -+{ -+ unsigned char *result = xmalloc (b->offset); -+ memcpy (result, b->buffer, b->offset); -+ return result; -+} -+ -+static struct resolv_response_builder * -+response_builder_allocate -+ (const unsigned char *query_buffer, size_t query_length) -+{ -+ struct resolv_response_builder *b = xmalloc (sizeof (*b)); -+ memset (b, 0, offsetof (struct resolv_response_builder, buffer)); -+ b->query_buffer = query_buffer; -+ b->query_length = query_length; -+ TEST_VERIFY_EXIT (hcreate_r (10000, &b->compression_offsets) != 0); -+ return b; -+} -+ -+static void -+response_builder_free (struct resolv_response_builder *b) -+{ -+ struct to_be_freed *current = b->to_be_freed; -+ while (current != NULL) -+ { -+ struct to_be_freed *next = current->next; -+ free (current->ptr); -+ free (current); -+ current = next; -+ } -+ hdestroy_r (&b->compression_offsets); -+ free (b); -+} -+ -+/* DNS query processing. */ -+ -+/* Data extracted from the question section of a DNS packet. */ -+struct query_info -+{ -+ char qname[MAXDNAME]; -+ uint16_t qclass; -+ uint16_t qtype; -+ struct resolv_edns_info edns; -+}; -+ -+/* Update *INFO from the specified DNS packet. */ -+static void -+parse_query (struct query_info *info, -+ const unsigned char *buffer, size_t length) -+{ -+ HEADER hd; -+ _Static_assert (sizeof (hd) == 12, "DNS header size"); -+ if (length < sizeof (hd)) -+ FAIL_EXIT1 ("malformed DNS query: too short: %zu bytes", length); -+ memcpy (&hd, buffer, sizeof (hd)); -+ -+ if (ntohs (hd.qdcount) != 1) -+ FAIL_EXIT1 ("malformed DNS query: wrong question count: %d", -+ (int) ntohs (hd.qdcount)); -+ if (ntohs (hd.ancount) != 0) -+ FAIL_EXIT1 ("malformed DNS query: wrong answer count: %d", -+ (int) ntohs (hd.ancount)); -+ if (ntohs (hd.nscount) != 0) -+ FAIL_EXIT1 ("malformed DNS query: wrong authority count: %d", -+ (int) ntohs (hd.nscount)); -+ if (ntohs (hd.arcount) > 1) -+ FAIL_EXIT1 ("malformed DNS query: wrong additional count: %d", -+ (int) ntohs (hd.arcount)); -+ -+ int ret = dn_expand (buffer, buffer + length, buffer + sizeof (hd), -+ info->qname, sizeof (info->qname)); -+ if (ret < 0) -+ FAIL_EXIT1 ("malformed DNS query: cannot uncompress QNAME"); -+ -+ /* Obtain QTYPE and QCLASS. */ -+ size_t remaining = length - (12 + ret); -+ struct -+ { -+ uint16_t qtype; -+ uint16_t qclass; -+ } qtype_qclass; -+ if (remaining < sizeof (qtype_qclass)) -+ FAIL_EXIT1 ("malformed DNS query: " -+ "query lacks QCLASS/QTYPE, QNAME: %s", info->qname); -+ memcpy (&qtype_qclass, buffer + 12 + ret, sizeof (qtype_qclass)); -+ info->qclass = ntohs (qtype_qclass.qclass); -+ info->qtype = ntohs (qtype_qclass.qtype); -+ -+ memset (&info->edns, 0, sizeof (info->edns)); -+ if (ntohs (hd.arcount) > 0) -+ { -+ /* Parse EDNS record. */ -+ struct __attribute__ ((packed, aligned (1))) -+ { -+ uint8_t root; -+ uint16_t rtype; -+ uint16_t payload; -+ uint8_t edns_extended_rcode; -+ uint8_t edns_version; -+ uint16_t flags; -+ uint16_t rdatalen; -+ } rr; -+ _Static_assert (sizeof (rr) == 11, "EDNS record size"); -+ -+ if (remaining < 4 + sizeof (rr)) -+ FAIL_EXIT1 ("mailformed DNS query: no room for EDNS record"); -+ memcpy (&rr, buffer + 12 + ret + 4, sizeof (rr)); -+ if (rr.root != 0) -+ FAIL_EXIT1 ("malformed DNS query: invalid OPT RNAME: %d\n", rr.root); -+ if (rr.rtype != htons (41)) -+ FAIL_EXIT1 ("malformed DNS query: invalid OPT type: %d\n", -+ ntohs (rr.rtype)); -+ info->edns.active = true; -+ info->edns.extended_rcode = rr.edns_extended_rcode; -+ info->edns.version = rr.edns_version; -+ info->edns.flags = ntohs (rr.flags); -+ info->edns.payload_size = ntohs (rr.payload); -+ } -+} -+ -+ -+/* Main testing framework. */ -+ -+/* Per-server information. One struct is allocated for each test -+ server. */ -+struct resolv_test_server -+{ -+ /* Local address of the server. UDP and TCP use the same port. */ -+ struct sockaddr_in address; -+ -+ /* File descriptor of the UDP server, or -1 if this server is -+ disabled. */ -+ int socket_udp; -+ -+ /* File descriptor of the TCP server, or -1 if this server is -+ disabled. */ -+ int socket_tcp; -+ -+ /* Counter of the number of responses processed so far. */ -+ size_t response_number; -+ -+ /* Thread handles for the server threads (if not disabled in the -+ configuration). */ -+ pthread_t thread_udp; -+ pthread_t thread_tcp; -+}; -+ -+/* Main struct for keeping track of libresolv redirection and -+ testing. */ -+struct resolv_test -+{ -+ /* After initialization, any access to the struct must be performed -+ while this lock is acquired. */ -+ pthread_mutex_t lock; -+ -+ /* Data for each test server. */ -+ struct resolv_test_server servers[resolv_max_test_servers]; -+ -+ /* Used if config.single_thread_udp is true. */ -+ pthread_t thread_udp_single; -+ -+ struct resolv_redirect_config config; -+ bool termination_requested; -+}; -+ -+/* Function implementing a server thread. */ -+typedef void (*thread_callback) (struct resolv_test *, int server_index); -+ -+/* Storage for thread-specific data, for passing to the -+ thread_callback function. */ -+struct thread_closure -+{ -+ struct resolv_test *obj; /* Current test object. */ -+ thread_callback callback; /* Function to call. */ -+ int server_index; /* Index of the implemented server. */ -+}; -+ -+/* Wrap response_callback as a function which can be passed to -+ pthread_create. */ -+static void * -+thread_callback_wrapper (void *arg) -+{ -+ struct thread_closure *closure = arg; -+ closure->callback (closure->obj, closure->server_index); -+ free (closure); -+ return NULL; -+} -+ -+/* Start a server thread for the specified SERVER_INDEX, implemented -+ by CALLBACK. */ -+static pthread_t -+start_server_thread (struct resolv_test *obj, int server_index, -+ thread_callback callback) -+{ -+ struct thread_closure *closure = xmalloc (sizeof (*closure)); -+ *closure = (struct thread_closure) -+ { -+ .obj = obj, -+ .callback = callback, -+ .server_index = server_index, -+ }; -+ return xpthread_create (NULL, thread_callback_wrapper, closure); -+} -+ -+/* Process one UDP query. Return false if a termination requested has -+ been detected. */ -+static bool -+server_thread_udp_process_one (struct resolv_test *obj, int server_index) -+{ -+ unsigned char query[512]; -+ struct sockaddr_storage peer; -+ socklen_t peerlen = sizeof (peer); -+ size_t length = xrecvfrom (obj->servers[server_index].socket_udp, -+ query, sizeof (query), 0, -+ (struct sockaddr *) &peer, &peerlen); -+ /* Check for termination. */ -+ { -+ bool termination_requested; -+ xpthread_mutex_lock (&obj->lock); -+ termination_requested = obj->termination_requested; -+ xpthread_mutex_unlock (&obj->lock); -+ if (termination_requested) -+ return false; -+ } -+ -+ -+ struct query_info qinfo; -+ parse_query (&qinfo, query, length); -+ if (test_verbose > 0) -+ { -+ if (test_verbose > 1) -+ printf ("info: UDP server %d: incoming query:" -+ " %zd bytes, %s/%u/%u, tnxid=0x%02x%02x\n", -+ server_index, length, qinfo.qname, qinfo.qclass, qinfo.qtype, -+ query[0], query[1]); -+ else -+ printf ("info: UDP server %d: incoming query:" -+ " %zd bytes, %s/%u/%u\n", -+ server_index, length, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ -+ struct resolv_response_context ctx = -+ { -+ .query_buffer = query, -+ .query_length = length, -+ .server_index = server_index, -+ .tcp = false, -+ .edns = qinfo.edns, -+ }; -+ struct resolv_response_builder *b = response_builder_allocate (query, length); -+ obj->config.response_callback -+ (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ -+ if (b->drop) -+ { -+ if (test_verbose) -+ printf ("info: UDP server %d: dropping response to %s/%u/%u\n", -+ server_index, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ else -+ { -+ if (test_verbose) -+ { -+ if (b->offset >= 12) -+ printf ("info: UDP server %d: sending response:" -+ " %zu bytes, RCODE %d (for %s/%u/%u)\n", -+ server_index, b->offset, b->buffer[3] & 0x0f, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ else -+ printf ("info: UDP server %d: sending response: %zu bytes" -+ " (for %s/%u/%u)\n", -+ server_index, b->offset, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ if (b->truncate_bytes > 0) -+ printf ("info: truncated by %u bytes\n", b->truncate_bytes); -+ } -+ size_t to_send = b->offset; -+ if (to_send < b->truncate_bytes) -+ to_send = 0; -+ else -+ to_send -= b->truncate_bytes; -+ -+ /* Ignore most errors here because the other end may have closed -+ the socket. */ -+ if (sendto (obj->servers[server_index].socket_udp, -+ b->buffer, to_send, 0, -+ (struct sockaddr *) &peer, peerlen) < 0) -+ TEST_VERIFY_EXIT (errno != EBADF); -+ } -+ response_builder_free (b); -+ return true; -+} -+ -+/* UDP thread_callback function. Variant for one thread per -+ server. */ -+static void -+server_thread_udp (struct resolv_test *obj, int server_index) -+{ -+ while (server_thread_udp_process_one (obj, server_index)) -+ ; -+} -+ -+/* Single-threaded UDP processing function, for the single_thread_udp -+ case. */ -+static void * -+server_thread_udp_single (void *closure) -+{ -+ struct resolv_test *obj = closure; -+ -+ struct pollfd fds[resolv_max_test_servers]; -+ for (int server_index = 0; server_index < resolv_max_test_servers; -+ ++server_index) -+ if (obj->config.servers[server_index].disable_udp) -+ fds[server_index] = (struct pollfd) {.fd = -1}; -+ else -+ { -+ fds[server_index] = (struct pollfd) -+ { -+ .fd = obj->servers[server_index].socket_udp, -+ .events = POLLIN -+ }; -+ -+ /* Make the socket non-blocking. */ -+ int flags = fcntl (obj->servers[server_index].socket_udp, F_GETFL, 0); -+ if (flags < 0) -+ FAIL_EXIT1 ("fcntl (F_GETFL): %m"); -+ flags |= O_NONBLOCK; -+ if (fcntl (obj->servers[server_index].socket_udp, F_SETFL, flags) < 0) -+ FAIL_EXIT1 ("fcntl (F_SETFL): %m"); -+ } -+ -+ while (true) -+ { -+ xpoll (fds, resolv_max_test_servers, -1); -+ for (int server_index = 0; server_index < resolv_max_test_servers; -+ ++server_index) -+ if (fds[server_index].revents != 0) -+ { -+ if (!server_thread_udp_process_one (obj, server_index)) -+ goto out; -+ fds[server_index].revents = 0; -+ } -+ } -+ -+ out: -+ return NULL; -+} -+ -+/* Start the single UDP handler thread (for the single_thread_udp -+ case). */ -+static void -+start_server_thread_udp_single (struct resolv_test *obj) -+{ -+ obj->thread_udp_single -+ = xpthread_create (NULL, server_thread_udp_single, obj); -+} -+ -+/* Data describing a TCP client connect. */ -+struct tcp_thread_closure -+{ -+ struct resolv_test *obj; -+ int server_index; -+ int client_socket; -+}; -+ -+/* Read a complete DNS query packet. If EOF_OK, an immediate -+ end-of-file condition is acceptable. */ -+static bool -+read_fully (int fd, void *buf, size_t len, bool eof_ok) -+{ -+ const void *const end = buf + len; -+ while (buf < end) -+ { -+ ssize_t ret = read (fd, buf, end - buf); -+ if (ret == 0) -+ { -+ if (!eof_ok) -+ { -+ support_record_failure (); -+ printf ("error: unexpected EOF on TCP connection\n"); -+ } -+ return false; -+ } -+ else if (ret < 0) -+ { -+ if (!eof_ok || errno != ECONNRESET) -+ { -+ support_record_failure (); -+ printf ("error: TCP read: %m\n"); -+ } -+ return false; -+ } -+ buf += ret; -+ eof_ok = false; -+ } -+ return true; -+} -+ -+/* Write an array of iovecs. Terminate the process on failure. */ -+static void -+writev_fully (int fd, struct iovec *buffers, size_t count) -+{ -+ while (count > 0) -+ { -+ /* Skip zero-length write requests. */ -+ if (buffers->iov_len == 0) -+ { -+ ++buffers; -+ --count; -+ continue; -+ } -+ /* Try to rewrite the remaing buffers. */ -+ ssize_t ret = writev (fd, buffers, count); -+ if (ret < 0) -+ FAIL_EXIT1 ("writev: %m"); -+ if (ret == 0) -+ FAIL_EXIT1 ("writev: invalid return value zero"); -+ /* Find the buffers that were successfully written. */ -+ while (ret > 0) -+ { -+ if (count == 0) -+ FAIL_EXIT1 ("internal writev consistency failure"); -+ /* Current buffer was partially written. */ -+ if (buffers->iov_len > (size_t) ret) -+ { -+ buffers->iov_base += ret; -+ buffers->iov_len -= ret; -+ ret = 0; -+ } -+ else -+ { -+ ret -= buffers->iov_len; -+ buffers->iov_len = 0; -+ ++buffers; -+ --count; -+ } -+ } -+ } -+} -+ -+/* Thread callback for handling a single established TCP connection to -+ a client. */ -+static void * -+server_thread_tcp_client (void *arg) -+{ -+ struct tcp_thread_closure *closure = arg; -+ -+ while (true) -+ { -+ /* Read packet length. */ -+ uint16_t query_length; -+ if (!read_fully (closure->client_socket, -+ &query_length, sizeof (query_length), true)) -+ break; -+ query_length = ntohs (query_length); -+ -+ /* Read the packet. */ -+ unsigned char *query_buffer = xmalloc (query_length); -+ read_fully (closure->client_socket, query_buffer, query_length, false); -+ -+ struct query_info qinfo; -+ parse_query (&qinfo, query_buffer, query_length); -+ if (test_verbose > 0) -+ { -+ if (test_verbose > 1) -+ printf ("info: UDP server %d: incoming query:" -+ " %d bytes, %s/%u/%u, tnxid=0x%02x%02x\n", -+ closure->server_index, query_length, -+ qinfo.qname, qinfo.qclass, qinfo.qtype, -+ query_buffer[0], query_buffer[1]); -+ else -+ printf ("info: TCP server %d: incoming query:" -+ " %u bytes, %s/%u/%u\n", -+ closure->server_index, query_length, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ -+ struct resolv_response_context ctx = -+ { -+ .query_buffer = query_buffer, -+ .query_length = query_length, -+ .server_index = closure->server_index, -+ .tcp = true, -+ .edns = qinfo.edns, -+ }; -+ struct resolv_response_builder *b = response_builder_allocate -+ (query_buffer, query_length); -+ closure->obj->config.response_callback -+ (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype); -+ -+ if (b->drop) -+ { -+ if (test_verbose) -+ printf ("info: TCP server %d: dropping response to %s/%u/%u\n", -+ closure->server_index, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ } -+ else -+ { -+ if (test_verbose) -+ printf ("info: TCP server %d: sending response: %zu bytes" -+ " (for %s/%u/%u)\n", -+ closure->server_index, b->offset, -+ qinfo.qname, qinfo.qclass, qinfo.qtype); -+ uint16_t length = htons (b->offset); -+ size_t to_send = b->offset; -+ if (to_send < b->truncate_bytes) -+ to_send = 0; -+ else -+ to_send -= b->truncate_bytes; -+ struct iovec buffers[2] = -+ { -+ {&length, sizeof (length)}, -+ {b->buffer, to_send} -+ }; -+ writev_fully (closure->client_socket, buffers, 2); -+ } -+ bool close_flag = b->close; -+ response_builder_free (b); -+ free (query_buffer); -+ if (close_flag) -+ break; -+ } -+ -+ xclose (closure->client_socket); -+ free (closure); -+ return NULL; -+} -+ -+/* thread_callback for the TCP case. Accept connections and create a -+ new thread for each client. */ -+static void -+server_thread_tcp (struct resolv_test *obj, int server_index) -+{ -+ while (true) -+ { -+ /* Get the client conenction. */ -+ int client_socket = xaccept -+ (obj->servers[server_index].socket_tcp, NULL, NULL); -+ -+ /* Check for termination. */ -+ xpthread_mutex_lock (&obj->lock); -+ if (obj->termination_requested) -+ { -+ xpthread_mutex_unlock (&obj->lock); -+ xclose (client_socket); -+ break; -+ } -+ xpthread_mutex_unlock (&obj->lock); -+ -+ /* Spawn a new thread for handling this connection. */ -+ struct tcp_thread_closure *closure = xmalloc (sizeof (*closure)); -+ *closure = (struct tcp_thread_closure) -+ { -+ .obj = obj, -+ .server_index = server_index, -+ .client_socket = client_socket, -+ }; -+ -+ pthread_t thr -+ = xpthread_create (NULL, server_thread_tcp_client, closure); -+ /* TODO: We should keep track of this thread so that we can -+ block in resolv_test_end until it has exited. */ -+ xpthread_detach (thr); -+ } -+} -+ -+/* Create UDP and TCP server sockets. */ -+static void -+make_server_sockets (struct resolv_test_server *server) -+{ -+ while (true) -+ { -+ server->socket_udp = xsocket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); -+ server->socket_tcp = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ -+ /* Pick the address for the UDP socket. */ -+ server->address = (struct sockaddr_in) -+ { -+ .sin_family = AF_INET, -+ .sin_addr = {.s_addr = htonl (INADDR_LOOPBACK)} -+ }; -+ xbind (server->socket_udp, -+ (struct sockaddr *)&server->address, sizeof (server->address)); -+ -+ /* Retrieve the address. */ -+ socklen_t addrlen = sizeof (server->address); -+ xgetsockname (server->socket_udp, -+ (struct sockaddr *)&server->address, &addrlen); -+ -+ /* Bind the TCP socket to the same address. */ -+ { -+ int on = 1; -+ xsetsockopt (server->socket_tcp, SOL_SOCKET, SO_REUSEADDR, -+ &on, sizeof (on)); -+ } -+ if (bind (server->socket_tcp, -+ (struct sockaddr *)&server->address, -+ sizeof (server->address)) != 0) -+ { -+ /* Port collision. The UDP bind succeeded, but the TCP BIND -+ failed. We assume here that the kernel will pick the -+ next local UDP address randomly. */ -+ if (errno == EADDRINUSE) -+ { -+ xclose (server->socket_udp); -+ xclose (server->socket_tcp); -+ continue; -+ } -+ FAIL_EXIT1 ("TCP bind: %m"); -+ } -+ xlisten (server->socket_tcp, 5); -+ break; -+ } -+} -+ -+/* One-time initialization of NSS. */ -+static void -+resolv_redirect_once (void) -+{ -+ /* Only use nss_dns. */ -+ __nss_configure_lookup ("hosts", "dns"); -+ __nss_configure_lookup ("networks", "dns"); -+ /* Enter a network namespace for isolation and firewall state -+ cleanup. The tests will still work if these steps fail, but they -+ may be less reliable. */ -+ support_become_root (); -+ support_enter_network_namespace (); -+} -+pthread_once_t resolv_redirect_once_var = PTHREAD_ONCE_INIT; -+ -+void -+resolv_test_init (void) -+{ -+ /* Perform one-time initialization of NSS. */ -+ xpthread_once (&resolv_redirect_once_var, resolv_redirect_once); -+} -+ -+/* Copy the search path from CONFIG.search to the _res object. */ -+static void -+set_search_path (struct resolv_redirect_config config) -+{ -+ memset (_res.defdname, 0, sizeof (_res.defdname)); -+ memset (_res.dnsrch, 0, sizeof (_res.dnsrch)); -+ -+ char *current = _res.defdname; -+ char *end = current + sizeof (_res.defdname); -+ -+ for (unsigned int i = 0; -+ i < sizeof (config.search) / sizeof (config.search[0]); ++i) -+ { -+ if (config.search[i] == NULL) -+ continue; -+ -+ size_t length = strlen (config.search[i]) + 1; -+ size_t remaining = end - current; -+ TEST_VERIFY_EXIT (length <= remaining); -+ memcpy (current, config.search[i], length); -+ _res.dnsrch[i] = current; -+ current += length; -+ } -+} -+ -+struct resolv_test * -+resolv_test_start (struct resolv_redirect_config config) -+{ -+ /* Apply configuration defaults. */ -+ if (config.nscount == 0) -+ config.nscount = resolv_max_test_servers; -+ -+ struct resolv_test *obj = xmalloc (sizeof (*obj)); -+ *obj = (struct resolv_test) { -+ .config = config, -+ .lock = PTHREAD_MUTEX_INITIALIZER, -+ }; -+ -+ resolv_test_init (); -+ -+ /* Create all the servers, to reserve the necessary ports. */ -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ make_server_sockets (obj->servers + server_index); -+ -+ /* Start server threads. Disable the server ports, as -+ requested. */ -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ { -+ struct resolv_test_server *server = obj->servers + server_index; -+ if (config.servers[server_index].disable_udp) -+ { -+ xclose (server->socket_udp); -+ server->socket_udp = -1; -+ } -+ else if (!config.single_thread_udp) -+ server->thread_udp = start_server_thread (obj, server_index, -+ server_thread_udp); -+ if (config.servers[server_index].disable_tcp) -+ { -+ xclose (server->socket_tcp); -+ server->socket_tcp = -1; -+ } -+ else -+ server->thread_tcp = start_server_thread (obj, server_index, -+ server_thread_tcp); -+ } -+ if (config.single_thread_udp) -+ start_server_thread_udp_single (obj); -+ -+ int timeout = 1; -+ -+ /* Initialize libresolv. */ -+ TEST_VERIFY_EXIT (res_init () == 0); -+ -+ /* Disable IPv6 name server addresses. The code below only -+ overrides the IPv4 addresses. */ -+ __res_iclose (&_res, true); -+ _res._u._ext.nscount = 0; -+ -+ /* Redirect queries to the server socket. */ -+ if (test_verbose) -+ { -+ printf ("info: old timeout value: %d\n", _res.retrans); -+ printf ("info: old retry attempt value: %d\n", _res.retry); -+ printf ("info: old _res.options: 0x%lx\n", _res.options); -+ printf ("info: old _res.nscount value: %d\n", _res.nscount); -+ printf ("info: old _res.ndots value: %d\n", _res.ndots); -+ } -+ _res.retrans = timeout; -+ _res.retry = 4; -+ _res.nscount = config.nscount; -+ _res.options = RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH; -+ _res.ndots = 1; -+ if (test_verbose) -+ { -+ printf ("info: new timeout value: %d\n", _res.retrans); -+ printf ("info: new retry attempt value: %d\n", _res.retry); -+ printf ("info: new _res.options: 0x%lx\n", _res.options); -+ printf ("info: new _res.nscount value: %d\n", _res.nscount); -+ printf ("info: new _res.ndots value: %d\n", _res.ndots); -+ } -+ for (int server_index = 0; server_index < config.nscount; ++server_index) -+ { -+ _res.nsaddr_list[server_index] = obj->servers[server_index].address; -+ if (test_verbose) -+ { -+ char buf[256]; -+ TEST_VERIFY_EXIT -+ (inet_ntop (AF_INET, &obj->servers[server_index].address.sin_addr, -+ buf, sizeof (buf)) != NULL); -+ printf ("info: server %d: %s/%u\n", -+ server_index, buf, -+ htons (obj->servers[server_index].address.sin_port)); -+ } -+ } -+ -+ set_search_path (config); -+ -+ return obj; -+} -+ -+void -+resolv_test_end (struct resolv_test *obj) -+{ -+ res_close (); -+ -+ xpthread_mutex_lock (&obj->lock); -+ obj->termination_requested = true; -+ xpthread_mutex_unlock (&obj->lock); -+ -+ /* Send trigger packets to unblock the server threads. */ -+ for (int server_index = 0; server_index < obj->config.nscount; -+ ++server_index) -+ { -+ if (!obj->config.servers[server_index].disable_udp) -+ { -+ int sock = xsocket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); -+ xsendto (sock, "", 1, 0, -+ (struct sockaddr *) &obj->servers[server_index].address, -+ sizeof (obj->servers[server_index].address)); -+ xclose (sock); -+ } -+ if (!obj->config.servers[server_index].disable_tcp) -+ { -+ int sock = xsocket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ xconnect (sock, -+ (struct sockaddr *) &obj->servers[server_index].address, -+ sizeof (obj->servers[server_index].address)); -+ xclose (sock); -+ } -+ } -+ -+ if (obj->config.single_thread_udp) -+ xpthread_join (obj->thread_udp_single); -+ -+ /* Wait for the server threads to terminate. */ -+ for (int server_index = 0; server_index < obj->config.nscount; -+ ++server_index) -+ { -+ if (!obj->config.servers[server_index].disable_udp) -+ { -+ if (!obj->config.single_thread_udp) -+ xpthread_join (obj->servers[server_index].thread_udp); -+ xclose (obj->servers[server_index].socket_udp); -+ } -+ if (!obj->config.servers[server_index].disable_tcp) -+ { -+ xpthread_join (obj->servers[server_index].thread_tcp); -+ xclose (obj->servers[server_index].socket_tcp); -+ } -+ } -+ -+ free (obj); -+} -diff --git a/support/resolv_test.h b/support/resolv_test.h -new file mode 100644 -index 0000000000..6498751569 ---- /dev/null -+++ b/support/resolv_test.h -@@ -0,0 +1,180 @@ -+/* DNS test framework and libresolv redirection. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_RESOLV_TEST_H -+#define SUPPORT_RESOLV_TEST_H -+ -+#include -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Information about EDNS properties of a DNS query. */ -+struct resolv_edns_info -+{ -+ bool active; -+ uint8_t extended_rcode; -+ uint8_t version; -+ uint16_t flags; -+ uint16_t payload_size; -+}; -+ -+/* This struct provides context information when the response callback -+ specified in struct resolv_redirect_config is invoked. */ -+struct resolv_response_context -+{ -+ const unsigned char *query_buffer; -+ size_t query_length; -+ int server_index; -+ bool tcp; -+ struct resolv_edns_info edns; -+}; -+ -+/* This opaque struct is used to construct responses from within the -+ response callback function. */ -+struct resolv_response_builder; -+ -+/* This opaque struct collects information about the resolver testing -+ currently in progress. */ -+struct resolv_test; -+ -+enum -+ { -+ /* Maximum number of test servers supported by the framework. */ -+ resolv_max_test_servers = 3, -+ }; -+ -+/* Configuration settings specific to individual test servers. */ -+struct resolv_redirect_server_config -+{ -+ bool disable_tcp; /* If true, no TCP server is listening. */ -+ bool disable_udp; /* If true, no UDP server is listening. */ -+}; -+ -+/* Instructions for setting up the libresolv redirection. */ -+struct resolv_redirect_config -+{ -+ /* The response_callback function is called for every incoming DNS -+ packet, over UDP or TCP. It must be specified, the other -+ configuration settings are optional. */ -+ void (*response_callback) (const struct resolv_response_context *, -+ struct resolv_response_builder *, -+ const char *qname, -+ uint16_t qclass, uint16_t qtype); -+ -+ /* Per-server configuration. */ -+ struct resolv_redirect_server_config servers[resolv_max_test_servers]; -+ -+ /* Search path entries. The first entry serves as the default -+ domain name as well. */ -+ const char *search[7]; -+ -+ /* Number of servers to activate in resolv. 0 means the default, -+ resolv_max_test_servers. */ -+ int nscount; -+ -+ /* If true, use a single thread to process all UDP queries. This -+ may results in more predictable ordering of queries and -+ responses. */ -+ bool single_thread_udp; -+}; -+ -+/* Configure NSS to use, nss_dns only for aplicable databases, and try -+ to put the process into a network namespace for better isolation. -+ This may have to be called before resolv_test_start, before the -+ process creates any threads. Otherwise, initialization is -+ performed by resolv_test_start implicitly. */ -+void resolv_test_init (void); -+ -+/* Initiate resolver testing. This updates the _res variable as -+ needed. As a side effect, NSS is reconfigured to use nss_dns only -+ for aplicable databases, and the process may enter a network -+ namespace for better isolation. */ -+struct resolv_test *resolv_test_start (struct resolv_redirect_config); -+ -+/* Call this function at the end of resolver testing, to free -+ resources and report pending errors (if any). */ -+void resolv_test_end (struct resolv_test *); -+ -+/* The remaining facilities in this file are used for constructing -+ response packets from the response_callback function. */ -+ -+/* Special settings for constructing responses from the callback. */ -+struct resolv_response_flags -+{ -+ /* 4-bit response code to incorporate into the response. */ -+ unsigned char rcode; -+ -+ /* If true, the TC (truncation) flag will be set. */ -+ bool tc; -+ -+ /* Initial section count values. Can be used to artificially -+ increase the counts, for malformed packet testing.*/ -+ unsigned short qdcount; -+ unsigned short ancount; -+ unsigned short nscount; -+ unsigned short adcount; -+}; -+ -+/* Begin a new response with the requested flags. Must be called -+ first. */ -+void resolv_response_init (struct resolv_response_builder *, -+ struct resolv_response_flags); -+ -+/* Switches to the section in the response packet. Only forward -+ movement is supported. */ -+void resolv_response_section (struct resolv_response_builder *, ns_sect); -+ -+/* Add a question record to the question section. */ -+void resolv_response_add_question (struct resolv_response_builder *, -+ const char *name, uint16_t class, -+ uint16_t type); -+/* Starts a new resource record with the specified owner name, class, -+ type, and TTL. Data is supplied with resolv_response_add_data or -+ resolv_response_add_name. */ -+void resolv_response_open_record (struct resolv_response_builder *, -+ const char *name, uint16_t class, -+ uint16_t type, uint32_t ttl); -+ -+/* Add unstructed bytes to the RDATA part of a resource record. */ -+void resolv_response_add_data (struct resolv_response_builder *, -+ const void *, size_t); -+ -+/* Add a compressed domain name to the RDATA part of a resource -+ record. */ -+void resolv_response_add_name (struct resolv_response_builder *, -+ const char *name); -+ -+/* Mark the end of the constructed record. Must be called last. */ -+void resolv_response_close_record (struct resolv_response_builder *); -+ -+/* Drop this query packet (that is, do not send a response, not even -+ an empty packet). */ -+void resolv_response_drop (struct resolv_response_builder *); -+ -+/* In TCP mode, close the connection after this packet (if a response -+ is sent). */ -+void resolv_response_close (struct resolv_response_builder *); -+ -+/* The size of the response packet built so far. */ -+size_t resolv_response_length (const struct resolv_response_builder *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_RESOLV_TEST_H */ -diff --git a/support/run_diff.h b/support/run_diff.h -new file mode 100644 -index 0000000000..f65b5dd22c ---- /dev/null -+++ b/support/run_diff.h -@@ -0,0 +1,31 @@ -+/* Invoke the system diff tool to compare two strings. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_RUN_DIFF_H -+#define SUPPORT_RUN_DIFF_H -+ -+/* Compare the two NUL-terminated strings LEFT and RIGHT using the -+ diff tool. Label the sides of the diff with LEFT_LABEL and -+ RIGHT_LABEL, respectively. -+ -+ This function assumes that LEFT and RIGHT are different -+ strings. */ -+void support_run_diff (const char *left_label, const char *left, -+ const char *right_label, const char *right); -+ -+#endif /* SUPPORT_RUN_DIFF_H */ -diff --git a/support/set_fortify_handler.c b/support/set_fortify_handler.c -new file mode 100644 -index 0000000000..f434a8082a ---- /dev/null -+++ b/support/set_fortify_handler.c -@@ -0,0 +1,34 @@ -+/* Set signal handler for use in fortify tests. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+set_fortify_handler (void (*handler) (int sig)) -+{ -+ struct sigaction sa; -+ -+ sa.sa_handler = handler; -+ sa.sa_flags = 0; -+ sigemptyset (&sa.sa_mask); -+ -+ sigaction (SIGABRT, &sa, NULL); -+ ignore_stderr (); -+} -diff --git a/support/support-xstat.c b/support/support-xstat.c -new file mode 100644 -index 0000000000..86a81ec601 ---- /dev/null -+++ b/support/support-xstat.c -@@ -0,0 +1,30 @@ -+/* stat64 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* NB: Non-standard file name to avoid sysdeps override for xstat. */ -+ -+#include -+#include -+#include -+ -+void -+xstat (const char *path, struct stat64 *result) -+{ -+ if (stat64 (path, result) != 0) -+ FAIL_EXIT1 ("stat64 (\"%s\"): %m", path); -+} -diff --git a/support/support.h b/support/support.h -new file mode 100644 -index 0000000000..4b5f04c2cc ---- /dev/null -+++ b/support/support.h -@@ -0,0 +1,74 @@ -+/* Common extra functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This header file should only contain definitions compatible with -+ C90. (Using __attribute__ is fine because provides a -+ fallback.) */ -+ -+#ifndef SUPPORT_H -+#define SUPPORT_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Write a message to standard output. Can be used in signal -+ handlers. */ -+void write_message (const char *message) __attribute__ ((nonnull (1))); -+ -+/* Avoid all the buffer overflow messages on stderr. */ -+void ignore_stderr (void); -+ -+/* Set fortification error handler. Used when tests want to verify that bad -+ code is caught by the library. */ -+void set_fortify_handler (void (*handler) (int sig)); -+ -+/* Report an out-of-memory error for the allocation of SIZE bytes in -+ FUNCTION, terminating the process. */ -+void oom_error (const char *function, size_t size) -+ __attribute__ ((nonnull (1))); -+ -+/* Return a pointer to a memory region of SIZE bytes. The memory is -+ initialized to zero and will be shared with subprocesses (across -+ fork). The returned pointer must be freed using -+ support_shared_free; it is not compatible with the malloc -+ functions. */ -+void *support_shared_allocate (size_t size); -+ -+/* Deallocate a pointer returned by support_shared_allocate. */ -+void support_shared_free (void *); -+ -+/* Write CONTENTS to the file PATH. Create or truncate the file as -+ needed. The file mode is 0666 masked by the umask. Terminate the -+ process on error. */ -+void support_write_file_string (const char *path, const char *contents); -+ -+/* Error-checking wrapper functions which terminate the process on -+ error. */ -+ -+void *xmalloc (size_t) __attribute__ ((malloc)); -+void *xcalloc (size_t n, size_t s) __attribute__ ((malloc)); -+void *xrealloc (void *p, size_t n); -+char *xasprintf (const char *format, ...) -+ __attribute__ ((format (printf, 1, 2), malloc)); -+char *xstrdup (const char *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_H */ -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S b/support/support_become_root.c -similarity index 57% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S -rename to support/support_become_root.c -index 37f7f44dfa..3fa0bd4ac0 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S -+++ b/support/support_become_root.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Acquire root privileges. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,24 +16,25 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- std %o0, [%sp + 72] -- std %o2, [%sp + 80] -- ldd [%sp + 72], %f0 -- ldd [%sp + 80], %f2 -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+#include -+#include -+#include - --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); -+bool -+support_become_root (void) -+{ -+#ifdef CLONE_NEWUSER -+ if (unshare (CLONE_NEWUSER | CLONE_NEWNS) == 0) -+ /* Even if we do not have UID zero, we have extended privileges at -+ this point. */ -+ return true; - #endif -+ if (setuid (0) != 0) -+ { -+ printf ("warning: could not become root outside namespace (%m)\n"); -+ return false; -+ } -+ return true; -+} -diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c -new file mode 100644 -index 0000000000..0dfd2deb54 ---- /dev/null -+++ b/support/support_can_chroot.c -@@ -0,0 +1,65 @@ -+/* Return true if the process can perform a chroot operation. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static void -+callback (void *closure) -+{ -+ int *result = closure; -+ struct stat64 before; -+ xstat ("/dev", &before); -+ if (chroot ("/dev") != 0) -+ { -+ *result = errno; -+ return; -+ } -+ struct stat64 after; -+ xstat ("/", &after); -+ TEST_VERIFY (before.st_dev == after.st_dev); -+ TEST_VERIFY (before.st_ino == after.st_ino); -+ *result = 0; -+} -+ -+bool -+support_can_chroot (void) -+{ -+ int *result = support_shared_allocate (sizeof (*result)); -+ *result = 0; -+ support_isolate_in_subprocess (callback, result); -+ bool ok = *result == 0; -+ if (!ok) -+ { -+ static bool already_warned; -+ if (!already_warned) -+ { -+ already_warned = true; -+ errno = *result; -+ printf ("warning: this process does not support chroot: %m\n"); -+ } -+ } -+ support_shared_free (result); -+ return ok; -+} -diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c -new file mode 100644 -index 0000000000..030f124252 ---- /dev/null -+++ b/support/support_capture_subprocess.c -@@ -0,0 +1,108 @@ -+/* Capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static void -+transfer (const char *what, struct pollfd *pfd, struct xmemstream *stream) -+{ -+ if (pfd->revents != 0) -+ { -+ char buf[1024]; -+ ssize_t ret = TEMP_FAILURE_RETRY (read (pfd->fd, buf, sizeof (buf))); -+ if (ret < 0) -+ { -+ support_record_failure (); -+ printf ("error: reading from subprocess %s: %m", what); -+ pfd->events = 0; -+ pfd->revents = 0; -+ } -+ else if (ret == 0) -+ { -+ /* EOF reached. Stop listening. */ -+ pfd->events = 0; -+ pfd->revents = 0; -+ } -+ else -+ /* Store the data just read. */ -+ TEST_VERIFY (fwrite (buf, ret, 1, stream->out) == 1); -+ } -+} -+ -+struct support_capture_subprocess -+support_capture_subprocess (void (*callback) (void *), void *closure) -+{ -+ struct support_capture_subprocess result; -+ xopen_memstream (&result.out); -+ xopen_memstream (&result.err); -+ -+ int stdout_pipe[2]; -+ xpipe (stdout_pipe); -+ int stderr_pipe[2]; -+ xpipe (stderr_pipe); -+ -+ TEST_VERIFY (fflush (stdout) == 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ xclose (stdout_pipe[0]); -+ xclose (stderr_pipe[0]); -+ xdup2 (stdout_pipe[1], STDOUT_FILENO); -+ xdup2 (stderr_pipe[1], STDERR_FILENO); -+ callback (closure); -+ _exit (0); -+ } -+ xclose (stdout_pipe[1]); -+ xclose (stderr_pipe[1]); -+ -+ struct pollfd fds[2] = -+ { -+ { .fd = stdout_pipe[0], .events = POLLIN }, -+ { .fd = stderr_pipe[0], .events = POLLIN }, -+ }; -+ -+ do -+ { -+ xpoll (fds, 2, -1); -+ transfer ("stdout", &fds[0], &result.out); -+ transfer ("stderr", &fds[1], &result.err); -+ } -+ while (fds[0].events != 0 || fds[1].events != 0); -+ xclose (stdout_pipe[0]); -+ xclose (stderr_pipe[0]); -+ -+ xfclose_memstream (&result.out); -+ xfclose_memstream (&result.err); -+ xwaitpid (pid, &result.status, 0); -+ return result; -+} -+ -+void -+support_capture_subprocess_free (struct support_capture_subprocess *p) -+{ -+ free (p->out.buffer); -+ free (p->err.buffer); -+} -diff --git a/support/support_capture_subprocess_check.c b/support/support_capture_subprocess_check.c -new file mode 100644 -index 0000000000..708c89f331 ---- /dev/null -+++ b/support/support_capture_subprocess_check.c -@@ -0,0 +1,67 @@ -+/* Verify capture output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+static void -+print_context (const char *context, bool *failed) -+{ -+ if (*failed) -+ /* Do not duplicate message. */ -+ return; -+ support_record_failure (); -+ printf ("error: subprocess failed: %s\n", context); -+} -+ -+void -+support_capture_subprocess_check (struct support_capture_subprocess *proc, -+ const char *context, int status, -+ int allowed) -+{ -+ TEST_VERIFY ((allowed & sc_allow_none) -+ || (allowed & sc_allow_stdout) -+ || (allowed & sc_allow_stderr)); -+ TEST_VERIFY (!((allowed & sc_allow_none) -+ && ((allowed & sc_allow_stdout) -+ || (allowed & sc_allow_stderr)))); -+ -+ bool failed = false; -+ if (proc->status != status) -+ { -+ print_context (context, &failed); -+ printf ("error: expected exit status: %d\n", status); -+ printf ("error: actual exit status: %d\n", status); -+ } -+ if (!(allowed & sc_allow_stdout) && proc->out.length != 0) -+ { -+ print_context (context, &failed); -+ printf ("error: unexpected output from subprocess\n"); -+ fwrite (proc->out.buffer, proc->out.length, 1, stdout); -+ puts ("\n"); -+ } -+ if (!(allowed & sc_allow_stderr) && proc->err.length != 0) -+ { -+ print_context (context, &failed); -+ printf ("error: unexpected error output from subprocess\n"); -+ fwrite (proc->err.buffer, proc->err.length, 1, stdout); -+ puts ("\n"); -+ } -+} -diff --git a/support/support_enter_network_namespace.c b/support/support_enter_network_namespace.c -new file mode 100644 -index 0000000000..28b0ee29cf ---- /dev/null -+++ b/support/support_enter_network_namespace.c -@@ -0,0 +1,75 @@ -+/* Enter a network namespace. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static bool in_uts_namespace; -+ -+bool -+support_enter_network_namespace (void) -+{ -+#ifdef CLONE_NEWUTS -+ if (unshare (CLONE_NEWUTS) == 0) -+ in_uts_namespace = true; -+ else -+ printf ("warning: unshare (CLONE_NEWUTS) failed: %m\n"); -+#endif -+ -+#ifdef CLONE_NEWNET -+ if (unshare (CLONE_NEWNET) == 0) -+ { -+ /* Bring up the loopback interface. */ -+ int fd = xsocket (AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); -+ struct ifreq req; -+ strcpy (req.ifr_name, "lo"); -+ TEST_VERIFY_EXIT (ioctl (fd, SIOCGIFFLAGS, &req) == 0); -+ bool already_up = req.ifr_flags & IFF_UP; -+ if (already_up) -+ /* This means that we likely have not achieved isolation from -+ the parent namespace. */ -+ printf ("warning: loopback interface already exists" -+ " in new network namespace\n"); -+ else -+ { -+ req.ifr_flags |= IFF_UP | IFF_RUNNING; -+ TEST_VERIFY_EXIT (ioctl (fd, SIOCSIFFLAGS, &req) == 0); -+ } -+ xclose (fd); -+ -+ return !already_up; -+ } -+#endif -+ printf ("warning: could not enter network namespace\n"); -+ return false; -+} -+ -+bool -+support_in_uts_namespace (void) -+{ -+ return in_uts_namespace; -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S b/support/support_format_address_family.c -similarity index 63% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S -rename to support/support_format_address_family.c -index 9e0e3f21be..5d42c42a45 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S -+++ b/support/support_format_address_family.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Convert an address family to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,19 +16,20 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- st %o0, [%sp + 72] -- st %o1, [%sp + 76] -- ld [%sp + 72], %f0 -- ld [%sp + 76], %f1 -- fcmps %f0, %f1 -- fbug 1f -- nop -- fzeros %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+ -+char * -+support_format_address_family (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return xstrdup ("INET"); -+ case AF_INET6: -+ return xstrdup ("INET6"); -+ default: -+ return xasprintf ("", family); -+ } -+} -diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c -new file mode 100644 -index 0000000000..eedb030591 ---- /dev/null -+++ b/support/support_format_addrinfo.c -@@ -0,0 +1,239 @@ -+/* Convert struct addrinfo values to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static size_t -+socket_address_length (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return sizeof (struct sockaddr_in); -+ case AF_INET6: -+ return sizeof (struct sockaddr_in6); -+ default: -+ return -1; -+ } -+} -+ -+static void -+format_ai_flags_1 (FILE *out, struct addrinfo *ai, int flag, const char *name, -+ int * flags_printed) -+{ -+ if ((ai->ai_flags & flag) != 0) -+ fprintf (out, " %s", name); -+ *flags_printed |= flag; -+} -+ -+static void -+format_ai_flags (FILE *out, struct addrinfo *ai) -+{ -+ if (ai == NULL) -+ return; -+ -+ if (ai->ai_flags != 0) -+ { -+ fprintf (out, "flags:"); -+ int flags_printed = 0; -+#define FLAG(flag) format_ai_flags_1 (out, ai, flag, #flag, &flags_printed) -+ FLAG (AI_PASSIVE); -+ FLAG (AI_CANONNAME); -+ FLAG (AI_NUMERICHOST); -+ FLAG (AI_V4MAPPED); -+ FLAG (AI_ALL); -+ FLAG (AI_ADDRCONFIG); -+ FLAG (AI_IDN); -+ FLAG (AI_CANONIDN); -+ FLAG (AI_IDN_ALLOW_UNASSIGNED); -+ FLAG (AI_IDN_USE_STD3_ASCII_RULES); -+ FLAG (AI_NUMERICSERV); -+#undef FLAG -+ int remaining = ai->ai_flags & ~flags_printed; -+ if (remaining != 0) -+ fprintf (out, " %08x", remaining); -+ fprintf (out, "\n"); -+ } -+ -+ /* Report flag mismatches within the list. */ -+ int flags = ai->ai_flags; -+ int index = 1; -+ ai = ai->ai_next; -+ while (ai != NULL) -+ { -+ if (ai->ai_flags != flags) -+ fprintf (out, "error: flags at %d: 0x%x expected, 0x%x actual\n", -+ index, flags, ai->ai_flags); -+ ai = ai->ai_next; -+ ++index; -+ } -+} -+ -+static void -+format_ai_canonname (FILE *out, struct addrinfo *ai) -+{ -+ if (ai == NULL) -+ return; -+ if (ai->ai_canonname != NULL) -+ fprintf (out, "canonname: %s\n", ai->ai_canonname); -+ -+ /* Report incorrectly set ai_canonname fields on subsequent list -+ entries. */ -+ int index = 1; -+ ai = ai->ai_next; -+ while (ai != NULL) -+ { -+ if (ai->ai_canonname != NULL) -+ fprintf (out, "error: canonname set at %d: %s\n", -+ index, ai->ai_canonname); -+ ai = ai->ai_next; -+ ++index; -+ } -+} -+ -+static void -+format_ai_one (FILE *out, struct addrinfo *ai) -+{ -+ { -+ char type_buf[32]; -+ const char *type_str; -+ char proto_buf[32]; -+ const char *proto_str; -+ -+ /* ai_socktype */ -+ switch (ai->ai_socktype) -+ { -+ case SOCK_RAW: -+ type_str = "RAW"; -+ break; -+ case SOCK_DGRAM: -+ type_str = "DGRAM"; -+ break; -+ case SOCK_STREAM: -+ type_str = "STREAM"; -+ break; -+ default: -+ snprintf (type_buf, sizeof (type_buf), "%d", ai->ai_socktype); -+ type_str = type_buf; -+ } -+ -+ /* ai_protocol */ -+ switch (ai->ai_protocol) -+ { -+ case IPPROTO_IP: -+ proto_str = "IP"; -+ break; -+ case IPPROTO_UDP: -+ proto_str = "UDP"; -+ break; -+ case IPPROTO_TCP: -+ proto_str = "TCP"; -+ break; -+ default: -+ snprintf (proto_buf, sizeof (proto_buf), "%d", ai->ai_protocol); -+ proto_str = proto_buf; -+ } -+ fprintf (out, "address: %s/%s", type_str, proto_str); -+ } -+ -+ /* ai_addrlen */ -+ if (ai->ai_addrlen != socket_address_length (ai->ai_family)) -+ { -+ char *family = support_format_address_family (ai->ai_family); -+ fprintf (out, "error: invalid address length %d for %s\n", -+ ai->ai_addrlen, family); -+ free (family); -+ } -+ -+ /* ai_addr */ -+ { -+ char buf[128]; -+ uint16_t port; -+ const char *ret; -+ switch (ai->ai_family) -+ { -+ case AF_INET: -+ { -+ struct sockaddr_in *sin = (struct sockaddr_in *) ai->ai_addr; -+ ret = inet_ntop (AF_INET, &sin->sin_addr, buf, sizeof (buf)); -+ port = sin->sin_port; -+ } -+ break; -+ case AF_INET6: -+ { -+ struct sockaddr_in6 *sin = (struct sockaddr_in6 *) ai->ai_addr; -+ ret = inet_ntop (AF_INET6, &sin->sin6_addr, buf, sizeof (buf)); -+ port = sin->sin6_port; -+ } -+ break; -+ default: -+ errno = EAFNOSUPPORT; -+ ret = NULL; -+ } -+ if (ret == NULL) -+ fprintf (out, "error: inet_top failed: %m\n"); -+ else -+ fprintf (out, " %s %u\n", buf, ntohs (port)); -+ } -+} -+ -+/* Format all the addresses in one address family. */ -+static void -+format_ai_family (FILE *out, struct addrinfo *ai, int family) -+{ -+ while (ai) -+ { -+ if (ai->ai_family == family) -+ format_ai_one (out, ai); -+ ai = ai->ai_next; -+ } -+} -+ -+char * -+support_format_addrinfo (struct addrinfo *ai, int ret) -+{ -+ int errno_copy = errno; -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ if (ret != 0) -+ { -+ fprintf (mem.out, "error: %s\n", gai_strerror (ret)); -+ if (ret == EAI_SYSTEM) -+ { -+ errno = errno_copy; -+ fprintf (mem.out, "error: %m\n"); -+ } -+ } -+ else -+ { -+ format_ai_flags (mem.out, ai); -+ format_ai_canonname (mem.out, ai); -+ format_ai_family (mem.out, ai, AF_INET); -+ format_ai_family (mem.out, ai, AF_INET6); -+ } -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_dns_packet.c b/support/support_format_dns_packet.c -new file mode 100644 -index 0000000000..2992c57971 ---- /dev/null -+++ b/support/support_format_dns_packet.c -@@ -0,0 +1,222 @@ -+/* Convert a DNS packet to a human-readable representation. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+struct in_buffer -+{ -+ const unsigned char *data; -+ size_t size; -+}; -+ -+static inline bool -+extract_8 (struct in_buffer *in, unsigned char *value) -+{ -+ if (in->size == 0) -+ return false; -+ *value = in->data[0]; -+ ++in->data; -+ --in->size; -+ return true; -+} -+ -+static inline bool -+extract_16 (struct in_buffer *in, unsigned short *value) -+{ -+ if (in->size < 2) -+ return false; -+ *value = (in->data[0] << 8) | in->data[1]; -+ in->data += 2; -+ in->size -= 2; -+ return true; -+} -+ -+static inline bool -+extract_32 (struct in_buffer *in, unsigned *value) -+{ -+ if (in->size < 4) -+ return false; -+ unsigned a = in->data[0]; -+ unsigned b = in->data[1]; -+ unsigned c = in->data[2]; -+ unsigned d = in->data[3]; -+ *value = (a << 24) | (b << 16) | (c << 8) | d; -+ in->data += 4; -+ in->size -= 4; -+ return true; -+} -+ -+static inline bool -+extract_bytes (struct in_buffer *in, size_t length, struct in_buffer *value) -+{ -+ if (in->size < length) -+ return false; -+ *value = (struct in_buffer) {in->data, length}; -+ in->data += length; -+ in->size -= length; -+ return true; -+} -+ -+struct dname -+{ -+ char name[MAXDNAME + 1]; -+}; -+ -+static bool -+extract_name (struct in_buffer full, struct in_buffer *in, struct dname *value) -+{ -+ const unsigned char *full_end = full.data + full.size; -+ /* Sanity checks; these indicate buffer misuse. */ -+ TEST_VERIFY_EXIT -+ (!(in->data < full.data || in->data > full_end -+ || in->size > (size_t) (full_end - in->data))); -+ int ret = dn_expand (full.data, full_end, in->data, -+ value->name, sizeof (value->name)); -+ if (ret < 0) -+ return false; -+ in->data += ret; -+ in->size -= ret; -+ return true; -+} -+ -+char * -+support_format_dns_packet (const unsigned char *buffer, size_t length) -+{ -+ struct in_buffer full = { buffer, length }; -+ struct in_buffer in = full; -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ unsigned short txnid; -+ unsigned short flags; -+ unsigned short qdcount; -+ unsigned short ancount; -+ unsigned short nscount; -+ unsigned short adcount; -+ if (!(extract_16 (&in, &txnid) -+ && extract_16 (&in, &flags) -+ && extract_16 (&in, &qdcount) -+ && extract_16 (&in, &ancount) -+ && extract_16 (&in, &nscount) -+ && extract_16 (&in, &adcount))) -+ { -+ fprintf (mem.out, "error: could not parse DNS header\n"); -+ goto out; -+ } -+ if (qdcount != 1) -+ { -+ fprintf (mem.out, "error: question count is %d, not 1\n", qdcount); -+ goto out; -+ } -+ struct dname qname; -+ if (!extract_name (full, &in, &qname)) -+ { -+ fprintf (mem.out, "error: malformed QNAME\n"); -+ goto out; -+ } -+ unsigned short qtype; -+ unsigned short qclass; -+ if (!(extract_16 (&in, &qtype) -+ && extract_16 (&in, &qclass))) -+ { -+ fprintf (mem.out, "error: malformed question\n"); -+ goto out; -+ } -+ if (qtype != T_A && qtype != T_AAAA && qtype != T_PTR) -+ { -+ fprintf (mem.out, "error: unsupported QTYPE %d\n", qtype); -+ goto out; -+ } -+ -+ fprintf (mem.out, "name: %s\n", qname.name); -+ -+ for (int i = 0; i < ancount; ++i) -+ { -+ struct dname rname; -+ if (!extract_name (full, &in, &rname)) -+ { -+ fprintf (mem.out, "error: malformed record name\n"); -+ goto out; -+ } -+ unsigned short rtype; -+ unsigned short rclass; -+ unsigned ttl; -+ unsigned short rdlen; -+ struct in_buffer rdata; -+ if (!(extract_16 (&in, &rtype) -+ && extract_16 (&in, &rclass) -+ && extract_32 (&in, &ttl) -+ && extract_16 (&in, &rdlen) -+ && extract_bytes (&in, rdlen, &rdata))) -+ { -+ fprintf (mem.out, "error: malformed record header\n"); -+ goto out; -+ } -+ /* Skip non-matching record types. */ -+ if ((rtype != qtype && rtype != T_CNAME) || rclass != qclass) -+ continue; -+ switch (rtype) -+ { -+ case T_A: -+ if (rdlen == 4) -+ fprintf (mem.out, "address: %d.%d.%d.%d\n", -+ rdata.data[0], -+ rdata.data[1], -+ rdata.data[2], -+ rdata.data[3]); -+ else -+ fprintf (mem.out, "error: A record of size %d: %s\n", -+ rdlen, rname.name); -+ break; -+ case T_AAAA: -+ { -+ if (rdlen == 16) -+ { -+ char buf[100]; -+ if (inet_ntop (AF_INET6, rdata.data, buf, sizeof (buf)) == NULL) -+ fprintf (mem.out, "error: AAAA record decoding failed: %m\n"); -+ else -+ fprintf (mem.out, "address: %s\n", buf); -+ } -+ else -+ fprintf (mem.out, "error: AAAA record of size %d: %s\n", -+ rdlen, rname.name); -+ } -+ break; -+ case T_CNAME: -+ case T_PTR: -+ { -+ struct dname name; -+ if (extract_name (full, &rdata, &name)) -+ fprintf (mem.out, "name: %s\n", name.name); -+ else -+ fprintf (mem.out, "error: malformed CNAME/PTR record\n"); -+ } -+ } -+ } -+ -+ out: -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_herrno.c b/support/support_format_herrno.c -new file mode 100644 -index 0000000000..493d6ae962 ---- /dev/null -+++ b/support/support_format_herrno.c -@@ -0,0 +1,45 @@ -+/* Convert a h_errno error code to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+char * -+support_format_herrno (int code) -+{ -+ const char *errstr; -+ switch (code) -+ { -+ case HOST_NOT_FOUND: -+ errstr = "HOST_NOT_FOUND"; -+ break; -+ case NO_ADDRESS: -+ errstr = "NO_ADDRESS"; -+ break; -+ case NO_RECOVERY: -+ errstr = "NO_RECOVERY"; -+ break; -+ case TRY_AGAIN: -+ errstr = "TRY_AGAIN"; -+ break; -+ default: -+ return xasprintf ("\n", code); -+ } -+ return xstrdup (errstr); -+} -diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c -new file mode 100644 -index 0000000000..5b5f26082e ---- /dev/null -+++ b/support/support_format_hostent.c -@@ -0,0 +1,75 @@ -+/* Convert a struct hostent object to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+static int -+address_length (int family) -+{ -+ switch (family) -+ { -+ case AF_INET: -+ return 4; -+ case AF_INET6: -+ return 16; -+ } -+ return -1; -+} -+ -+char * -+support_format_hostent (struct hostent *h) -+{ -+ if (h == NULL) -+ { -+ char *value = support_format_herrno (h_errno); -+ char *result = xasprintf ("error: %s\n", value); -+ free (value); -+ return result; -+ } -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ fprintf (mem.out, "name: %s\n", h->h_name); -+ for (char **alias = h->h_aliases; *alias != NULL; ++alias) -+ fprintf (mem.out, "alias: %s\n", *alias); -+ for (unsigned i = 0; h->h_addr_list[i] != NULL; ++i) -+ { -+ char buf[128]; -+ if (inet_ntop (h->h_addrtype, h->h_addr_list[i], -+ buf, sizeof (buf)) == NULL) -+ fprintf (mem.out, "error: inet_ntop failed: %m\n"); -+ else -+ fprintf (mem.out, "address: %s\n", buf); -+ } -+ if (h->h_length != address_length (h->h_addrtype)) -+ { -+ char *family = support_format_address_family (h->h_addrtype); -+ fprintf (mem.out, "error: invalid address length %d for %s\n", -+ h->h_length, family); -+ free (family); -+ } -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_format_netent.c b/support/support_format_netent.c -new file mode 100644 -index 0000000000..020f5720d9 ---- /dev/null -+++ b/support/support_format_netent.c -@@ -0,0 +1,52 @@ -+/* Convert a struct netent object to a string. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+char * -+support_format_netent (struct netent *e) -+{ -+ if (e == NULL) -+ { -+ char *value = support_format_herrno (h_errno); -+ char *result = xasprintf ("error: %s\n", value); -+ free (value); -+ return result; -+ } -+ -+ struct xmemstream mem; -+ xopen_memstream (&mem); -+ -+ if (e->n_name != NULL) -+ fprintf (mem.out, "name: %s\n", e->n_name); -+ for (char **ap = e->n_aliases; *ap != NULL; ++ap) -+ fprintf (mem.out, "alias: %s\n", *ap); -+ if (e->n_addrtype != AF_INET) -+ fprintf (mem.out, "addrtype: %d\n", e->n_addrtype); -+ /* On alpha, e->n_net is an unsigned long. */ -+ unsigned int n_net = e->n_net; -+ fprintf (mem.out, "net: 0x%08x\n", n_net); -+ -+ xfclose_memstream (&mem); -+ return mem.buffer; -+} -diff --git a/support/support_isolate_in_subprocess.c b/support/support_isolate_in_subprocess.c -new file mode 100644 -index 0000000000..cf48614383 ---- /dev/null -+++ b/support/support_isolate_in_subprocess.c -@@ -0,0 +1,38 @@ -+/* Run a function in a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+void -+support_isolate_in_subprocess (void (*callback) (void *), void *closure) -+{ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ /* Child process. */ -+ callback (closure); -+ _exit (0); -+ } -+ -+ /* Parent process. */ -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (status != 0) -+ FAIL_EXIT1 ("child process exited with status %d", status); -+} -diff --git a/support/support_record_failure.c b/support/support_record_failure.c -new file mode 100644 -index 0000000000..684055c746 ---- /dev/null -+++ b/support/support_record_failure.c -@@ -0,0 +1,106 @@ -+/* Global test failure counter. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* This structure keeps track of test failures. The counter is -+ incremented on each failure. The failed member is set to true if a -+ failure is detected, so that even if the counter wraps around to -+ zero, the failure of a test can be detected. -+ -+ The init constructor function below puts *state on a shared -+ annonymous mapping, so that failure reports from subprocesses -+ propagate to the parent process. */ -+struct test_failures -+{ -+ unsigned int counter; -+ unsigned int failed; -+}; -+static struct test_failures *state; -+ -+static __attribute__ ((constructor)) void -+init (void) -+{ -+ void *ptr = mmap (NULL, sizeof (*state), PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_SHARED, -1, 0); -+ if (ptr == MAP_FAILED) -+ { -+ printf ("error: could not map %zu bytes: %m\n", sizeof (*state)); -+ exit (1); -+ } -+ /* Zero-initialization of the struct is sufficient. */ -+ state = ptr; -+} -+ -+void -+support_record_failure (void) -+{ -+ if (state == NULL) -+ { -+ write_message -+ ("error: support_record_failure called without initialization\n"); -+ _exit (1); -+ } -+ /* Relaxed MO is sufficient because we are only interested in the -+ values themselves, in isolation. */ -+ __atomic_store_n (&state->failed, 1, __ATOMIC_RELEASE); -+ __atomic_add_fetch (&state->counter, 1, __ATOMIC_RELEASE); -+} -+ -+int -+support_report_failure (int status) -+{ -+ if (state == NULL) -+ { -+ write_message -+ ("error: support_report_failure called without initialization\n"); -+ return 1; -+ } -+ -+ /* Relaxed MO is sufficient because acquire test result reporting -+ assumes that exiting from the main thread happens before the -+ error reporting via support_record_failure, which requires some -+ form of external synchronization. */ -+ bool failed = __atomic_load_n (&state->failed, __ATOMIC_RELAXED); -+ if (failed) -+ printf ("error: %u test failures\n", -+ __atomic_load_n (&state->counter, __ATOMIC_RELAXED)); -+ -+ if ((status == 0 || status == EXIT_UNSUPPORTED) && failed) -+ /* If we have a recorded failure, it overrides a non-failure -+ report from the test function. */ -+ status = 1; -+ return status; -+} -+ -+void -+support_record_failure_reset (void) -+{ -+ /* Only used for testing the test framework, with external -+ synchronization, but use release MO for consistency. */ -+ __atomic_store_n (&state->failed, 0, __ATOMIC_RELAXED); -+ __atomic_add_fetch (&state->counter, 0, __ATOMIC_RELAXED); -+} -diff --git a/support/support_run_diff.c b/support/support_run_diff.c -new file mode 100644 -index 0000000000..f5155de727 ---- /dev/null -+++ b/support/support_run_diff.c -@@ -0,0 +1,76 @@ -+/* Invoke the system diff tool to compare two strings. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static char * -+write_to_temp_file (const char *prefix, const char *str) -+{ -+ char *template = xasprintf ("run_diff-%s", prefix); -+ char *name = NULL; -+ int fd = create_temp_file (template, &name); -+ TEST_VERIFY_EXIT (fd >= 0); -+ free (template); -+ xwrite (fd, str, strlen (str)); -+ xclose (fd); -+ return name; -+} -+ -+void -+support_run_diff (const char *left_label, const char *left, -+ const char *right_label, const char *right) -+{ -+ /* Ensure that the diff command output is ordered properly with -+ standard output. */ -+ TEST_VERIFY_EXIT (fflush (stdout) == 0); -+ -+ char *left_path = write_to_temp_file ("left-diff", left); -+ char *right_path = write_to_temp_file ("right-diff", right); -+ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ execlp ("diff", "diff", "-u", -+ "--label", left_label, "--label", right_label, -+ "--", left_path, right_path, -+ NULL); -+ _exit (17); -+ } -+ else -+ { -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (!WIFEXITED (status) || WEXITSTATUS (status) != 1) -+ printf ("warning: could not run diff, exit status: %d\n" -+ "*** %s ***\n%s\n" -+ "*** %s ***\n%s\n", -+ status, left_label, left, right_label, right); -+ } -+ -+ free (right_path); -+ free (left_path); -+} -diff --git a/support/support_shared_allocate.c b/support/support_shared_allocate.c -new file mode 100644 -index 0000000000..61d088e8cf ---- /dev/null -+++ b/support/support_shared_allocate.c -@@ -0,0 +1,57 @@ -+/* Allocate a memory region shared across processes. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* Header for the allocation. It contains the size of the allocation -+ for subsequent unmapping. */ -+struct header -+{ -+ size_t total_size; -+ char data[] __attribute__ ((aligned (__alignof__ (max_align_t)))); -+}; -+ -+void * -+support_shared_allocate (size_t size) -+{ -+ size_t total_size = size + offsetof (struct header, data); -+ if (total_size < size) -+ { -+ errno = ENOMEM; -+ oom_error (__func__, size); -+ return NULL; -+ } -+ else -+ { -+ struct header *result = xmmap (NULL, total_size, PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_SHARED, -1); -+ result->total_size = total_size; -+ return &result->data; -+ } -+} -+ -+void -+support_shared_free (void *data) -+{ -+ struct header *header = data - offsetof (struct header, data); -+ xmunmap (header, header->total_size); -+} -diff --git a/support/support_test_main.c b/support/support_test_main.c -new file mode 100644 -index 0000000000..914d64f603 ---- /dev/null -+++ b/support/support_test_main.c -@@ -0,0 +1,423 @@ -+/* Main worker function for the test driver. -+ Copyright (C) 1998-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static const struct option default_options[] = -+{ -+ TEST_DEFAULT_OPTIONS -+ { NULL, 0, NULL, 0 } -+}; -+ -+/* Show people how to run the program. */ -+static void -+usage (const struct option *options) -+{ -+ size_t i; -+ -+ printf ("Usage: %s [options]\n" -+ "\n" -+ "Environment Variables:\n" -+ " TIMEOUTFACTOR An integer used to scale the timeout\n" -+ " TMPDIR Where to place temporary files\n" -+ " TEST_COREDUMPS Do not disable coredumps if set\n" -+ "\n", -+ program_invocation_short_name); -+ printf ("Options:\n"); -+ for (i = 0; options[i].name; ++i) -+ { -+ int indent; -+ -+ indent = printf (" --%s", options[i].name); -+ if (options[i].has_arg == required_argument) -+ indent += printf (" "); -+ printf ("%*s", 25 - indent, ""); -+ switch (options[i].val) -+ { -+ case 'v': -+ printf ("Increase the output verbosity"); -+ break; -+ case OPT_DIRECT: -+ printf ("Run the test directly (instead of forking & monitoring)"); -+ break; -+ case OPT_TESTDIR: -+ printf ("Override the TMPDIR env var"); -+ break; -+ } -+ printf ("\n"); -+ } -+} -+ -+/* The PID of the test process. */ -+static pid_t test_pid; -+ -+/* The cleanup handler passed to test_main. */ -+static void (*cleanup_function) (void); -+ -+/* Timeout handler. We kill the child and exit with an error. */ -+static void -+__attribute__ ((noreturn)) -+signal_handler (int sig) -+{ -+ int killed; -+ int status; -+ -+ assert (test_pid > 1); -+ /* Kill the whole process group. */ -+ kill (-test_pid, SIGKILL); -+ /* In case setpgid failed in the child, kill it individually too. */ -+ kill (test_pid, SIGKILL); -+ -+ /* Wait for it to terminate. */ -+ int i; -+ for (i = 0; i < 5; ++i) -+ { -+ killed = waitpid (test_pid, &status, WNOHANG|WUNTRACED); -+ if (killed != 0) -+ break; -+ -+ /* Delay, give the system time to process the kill. If the -+ nanosleep() call return prematurely, all the better. We -+ won't restart it since this probably means the child process -+ finally died. */ -+ struct timespec ts; -+ ts.tv_sec = 0; -+ ts.tv_nsec = 100000000; -+ nanosleep (&ts, NULL); -+ } -+ if (killed != 0 && killed != test_pid) -+ { -+ printf ("Failed to kill test process: %m\n"); -+ exit (1); -+ } -+ -+ if (cleanup_function != NULL) -+ cleanup_function (); -+ -+ if (sig == SIGINT) -+ { -+ signal (sig, SIG_DFL); -+ raise (sig); -+ } -+ -+ if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)) -+ puts ("Timed out: killed the child process"); -+ else if (WIFSTOPPED (status)) -+ printf ("Timed out: the child process was %s\n", -+ strsignal (WSTOPSIG (status))); -+ else if (WIFSIGNALED (status)) -+ printf ("Timed out: the child process got signal %s\n", -+ strsignal (WTERMSIG (status))); -+ else -+ printf ("Timed out: killed the child process but it exited %d\n", -+ WEXITSTATUS (status)); -+ -+ /* Exit with an error. */ -+ exit (1); -+} -+ -+/* Run test_function or test_function_argv. */ -+static int -+run_test_function (int argc, char **argv, const struct test_config *config) -+{ -+ if (config->test_function != NULL) -+ return config->test_function (); -+ else if (config->test_function_argv != NULL) -+ return config->test_function_argv (argc, argv); -+ else -+ { -+ printf ("error: no test function defined\n"); -+ exit (1); -+ } -+} -+ -+static bool test_main_called; -+ -+const char *test_dir = NULL; -+unsigned int test_verbose = 0; -+ -+/* If test failure reporting has been linked in, it may contribute -+ additional test failures. */ -+static int -+adjust_exit_status (int status) -+{ -+ if (support_report_failure != NULL) -+ return support_report_failure (status); -+ return status; -+} -+ -+int -+support_test_main (int argc, char **argv, const struct test_config *config) -+{ -+ if (test_main_called) -+ { -+ printf ("error: test_main called for a second time\n"); -+ exit (1); -+ } -+ test_main_called = true; -+ const struct option *options; -+ if (config->options != NULL) -+ options = config->options; -+ else -+ options = default_options; -+ -+ cleanup_function = config->cleanup_function; -+ -+ int direct = 0; /* Directly call the test function? */ -+ int status; -+ int opt; -+ unsigned int timeoutfactor = 1; -+ pid_t termpid; -+ -+ if (!config->no_mallopt) -+ { -+ /* Make uses of freed and uninitialized memory known. Do not -+ pull in a definition for mallopt if it has not been defined -+ already. */ -+ extern __typeof__ (mallopt) mallopt __attribute__ ((weak)); -+ if (mallopt != NULL) -+ mallopt (M_PERTURB, 42); -+ } -+ -+ while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1) -+ switch (opt) -+ { -+ case '?': -+ usage (options); -+ exit (1); -+ case 'v': -+ ++test_verbose; -+ break; -+ case OPT_DIRECT: -+ direct = 1; -+ break; -+ case OPT_TESTDIR: -+ test_dir = optarg; -+ break; -+ default: -+ if (config->cmdline_function != NULL) -+ config->cmdline_function (opt); -+ } -+ -+ /* If set, read the test TIMEOUTFACTOR value from the environment. -+ This value is used to scale the default test timeout values. */ -+ char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR"); -+ if (envstr_timeoutfactor != NULL) -+ { -+ char *envstr_conv = envstr_timeoutfactor; -+ unsigned long int env_fact; -+ -+ env_fact = strtoul (envstr_timeoutfactor, &envstr_conv, 0); -+ if (*envstr_conv == '\0' && envstr_conv != envstr_timeoutfactor) -+ timeoutfactor = MAX (env_fact, 1); -+ } -+ -+ /* Set TMPDIR to specified test directory. */ -+ if (test_dir != NULL) -+ { -+ setenv ("TMPDIR", test_dir, 1); -+ -+ if (chdir (test_dir) < 0) -+ { -+ printf ("chdir: %m\n"); -+ exit (1); -+ } -+ } -+ else -+ { -+ test_dir = getenv ("TMPDIR"); -+ if (test_dir == NULL || test_dir[0] == '\0') -+ test_dir = "/tmp"; -+ } -+ if (support_set_test_dir != NULL) -+ support_set_test_dir (test_dir); -+ -+ int timeout = config->timeout; -+ if (timeout == 0) -+ timeout = DEFAULT_TIMEOUT; -+ -+ /* Make sure we see all message, even those on stdout. */ -+ setvbuf (stdout, NULL, _IONBF, 0); -+ -+ /* Make sure temporary files are deleted. */ -+ if (support_delete_temp_files != NULL) -+ atexit (support_delete_temp_files); -+ -+ /* Correct for the possible parameters. */ -+ argv[optind - 1] = argv[0]; -+ argv += optind - 1; -+ argc -= optind - 1; -+ -+ /* Call the initializing function, if one is available. */ -+ if (config->prepare_function != NULL) -+ config->prepare_function (argc, argv); -+ -+ const char *envstr_direct = getenv ("TEST_DIRECT"); -+ if (envstr_direct != NULL) -+ { -+ FILE *f = fopen (envstr_direct, "w"); -+ if (f == NULL) -+ { -+ printf ("cannot open TEST_DIRECT output file '%s': %m\n", -+ envstr_direct); -+ exit (1); -+ } -+ -+ fprintf (f, "timeout=%u\ntimeoutfactor=%u\n", -+ config->timeout, timeoutfactor); -+ if (config->expected_status != 0) -+ fprintf (f, "exit=%u\n", config->expected_status); -+ if (config->expected_signal != 0) -+ fprintf (f, "signal=%s\n", strsignal (config->expected_signal)); -+ -+ if (support_print_temp_files != NULL) -+ support_print_temp_files (f); -+ -+ fclose (f); -+ direct = 1; -+ } -+ -+ bool disable_coredumps; -+ { -+ const char *coredumps = getenv ("TEST_COREDUMPS"); -+ disable_coredumps = coredumps == NULL || coredumps[0] == '\0'; -+ } -+ -+ /* If we are not expected to fork run the function immediately. */ -+ if (direct) -+ return adjust_exit_status (run_test_function (argc, argv, config)); -+ -+ /* Set up the test environment: -+ - prevent core dumps -+ - set up the timer -+ - fork and execute the function. */ -+ -+ test_pid = fork (); -+ if (test_pid == 0) -+ { -+ /* This is the child. */ -+ if (disable_coredumps) -+ { -+ /* Try to avoid dumping core. This is necessary because we -+ run the test from the source tree, and the coredumps -+ would end up there (and not in the build tree). */ -+ struct rlimit core_limit; -+ core_limit.rlim_cur = 0; -+ core_limit.rlim_max = 0; -+ setrlimit (RLIMIT_CORE, &core_limit); -+ } -+ -+ /* We put the test process in its own pgrp so that if it bogusly -+ generates any job control signals, they won't hit the whole build. */ -+ if (setpgid (0, 0) != 0) -+ printf ("Failed to set the process group ID: %m\n"); -+ -+ /* Execute the test function and exit with the return value. */ -+ exit (run_test_function (argc, argv, config)); -+ } -+ else if (test_pid < 0) -+ { -+ printf ("Cannot fork test program: %m\n"); -+ exit (1); -+ } -+ -+ /* Set timeout. */ -+ signal (SIGALRM, signal_handler); -+ alarm (timeout * timeoutfactor); -+ -+ /* Make sure we clean up if the wrapper gets interrupted. */ -+ signal (SIGINT, signal_handler); -+ -+ /* Wait for the regular termination. */ -+ termpid = TEMP_FAILURE_RETRY (waitpid (test_pid, &status, 0)); -+ if (termpid == -1) -+ { -+ printf ("Waiting for test program failed: %m\n"); -+ exit (1); -+ } -+ if (termpid != test_pid) -+ { -+ printf ("Oops, wrong test program terminated: expected %ld, got %ld\n", -+ (long int) test_pid, (long int) termpid); -+ exit (1); -+ } -+ -+ /* Process terminated normaly without timeout etc. */ -+ if (WIFEXITED (status)) -+ { -+ if (config->expected_status == 0) -+ { -+ if (config->expected_signal == 0) -+ /* Exit with the return value of the test. */ -+ return adjust_exit_status (WEXITSTATUS (status)); -+ else -+ { -+ printf ("Expected signal '%s' from child, got none\n", -+ strsignal (config->expected_signal)); -+ exit (1); -+ } -+ } -+ else -+ { -+ /* Non-zero exit status is expected */ -+ if (WEXITSTATUS (status) != config->expected_status) -+ { -+ printf ("Expected status %d, got %d\n", -+ config->expected_status, WEXITSTATUS (status)); -+ exit (1); -+ } -+ } -+ return adjust_exit_status (0); -+ } -+ /* Process was killed by timer or other signal. */ -+ else -+ { -+ if (config->expected_signal == 0) -+ { -+ printf ("Didn't expect signal from child: got `%s'\n", -+ strsignal (WTERMSIG (status))); -+ exit (1); -+ } -+ else if (WTERMSIG (status) != config->expected_signal) -+ { -+ printf ("Incorrect signal from child: got `%s', need `%s'\n", -+ strsignal (WTERMSIG (status)), -+ strsignal (config->expected_signal)); -+ exit (1); -+ } -+ -+ return adjust_exit_status (0); -+ } -+} -diff --git a/support/support_test_verify_impl.c b/support/support_test_verify_impl.c -new file mode 100644 -index 0000000000..5bae38f8b1 ---- /dev/null -+++ b/support/support_test_verify_impl.c -@@ -0,0 +1,33 @@ -+/* Implementation of the TEST_VERIFY and TEST_VERIFY_EXIT macros. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+ -+void -+support_test_verify_impl (int status, const char *file, int line, -+ const char *expr) -+{ -+ support_record_failure (); -+ printf ("error: %s:%d: not true: %s\n", file, line, expr); -+ if (status >= 0) -+ exit (status); -+ -+} -diff --git a/support/support_write_file_string.c b/support/support_write_file_string.c -new file mode 100644 -index 0000000000..48e89597f3 ---- /dev/null -+++ b/support/support_write_file_string.c -@@ -0,0 +1,39 @@ -+/* Write a string to a file. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+void -+support_write_file_string (const char *path, const char *contents) -+{ -+ int fd = xopen (path, O_CREAT | O_TRUNC | O_WRONLY, 0666); -+ const char *end = contents + strlen (contents); -+ for (const char *p = contents; p < end; ) -+ { -+ ssize_t ret = write (fd, p, end - p); -+ if (ret < 0) -+ FAIL_EXIT1 ("cannot write to \"%s\": %m", path); -+ if (ret == 0) -+ FAIL_EXIT1 ("zero-length write to \"%s\"", path); -+ p += ret; -+ } -+ xclose (fd); -+} -diff --git a/support/temp_file-internal.h b/support/temp_file-internal.h -new file mode 100644 -index 0000000000..fb6cceb065 ---- /dev/null -+++ b/support/temp_file-internal.h -@@ -0,0 +1,31 @@ -+/* Internal weak declarations for temporary file handling. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEMP_FILE_INTERNAL_H -+#define SUPPORT_TEMP_FILE_INTERNAL_H -+ -+/* These functions are called by the test driver if they are -+ defined. Tests should not call them directly. */ -+ -+#include -+ -+void support_set_test_dir (const char *name) __attribute__ ((weak)); -+void support_delete_temp_files (void) __attribute__ ((weak)); -+void support_print_temp_files (FILE *) __attribute__ ((weak)); -+ -+#endif /* SUPPORT_TEMP_FILE_INTERNAL_H */ -diff --git a/support/temp_file.c b/support/temp_file.c -new file mode 100644 -index 0000000000..fdb2477ab9 ---- /dev/null -+++ b/support/temp_file.c -@@ -0,0 +1,132 @@ -+/* Temporary file handling for tests. -+ Copyright (C) 1998-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This is required to get an mkstemp which can create large files on -+ some 32-bit platforms. */ -+#define _FILE_OFFSET_BITS 64 -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+/* List of temporary files. */ -+static struct temp_name_list -+{ -+ struct temp_name_list *next; -+ char *name; -+ pid_t owner; -+} *temp_name_list; -+ -+/* Location of the temporary files. Set by the test skeleton via -+ support_set_test_dir. The string is not be freed. */ -+static const char *test_dir = _PATH_TMP; -+ -+void -+add_temp_file (const char *name) -+{ -+ struct temp_name_list *newp -+ = (struct temp_name_list *) xcalloc (sizeof (*newp), 1); -+ char *newname = strdup (name); -+ if (newname != NULL) -+ { -+ newp->name = newname; -+ newp->next = temp_name_list; -+ newp->owner = getpid (); -+ temp_name_list = newp; -+ } -+ else -+ free (newp); -+} -+ -+int -+create_temp_file (const char *base, char **filename) -+{ -+ char *fname; -+ int fd; -+ -+ fname = (char *) xmalloc (strlen (test_dir) + 1 + strlen (base) -+ + sizeof ("XXXXXX")); -+ strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX"); -+ -+ fd = mkstemp (fname); -+ if (fd == -1) -+ { -+ printf ("cannot open temporary file '%s': %m\n", fname); -+ free (fname); -+ return -1; -+ } -+ -+ add_temp_file (fname); -+ if (filename != NULL) -+ *filename = fname; -+ else -+ free (fname); -+ -+ return fd; -+} -+ -+/* Helper functions called by the test skeleton follow. */ -+ -+void -+support_set_test_dir (const char *path) -+{ -+ test_dir = path; -+} -+ -+void -+support_delete_temp_files (void) -+{ -+ pid_t pid = getpid (); -+ while (temp_name_list != NULL) -+ { -+ /* Only perform the removal if the path was registed in the same -+ process, as identified by the PID. (This assumes that the -+ parent process which registered the temporary file sticks -+ around, to prevent PID reuse.) */ -+ if (temp_name_list->owner == pid) -+ { -+ if (remove (temp_name_list->name) != 0) -+ printf ("warning: could not remove temporary file: %s: %m\n", -+ temp_name_list->name); -+ } -+ free (temp_name_list->name); -+ -+ struct temp_name_list *next = temp_name_list->next; -+ free (temp_name_list); -+ temp_name_list = next; -+ } -+} -+ -+void -+support_print_temp_files (FILE *f) -+{ -+ if (temp_name_list != NULL) -+ { -+ struct temp_name_list *n; -+ fprintf (f, "temp_files=(\n"); -+ for (n = temp_name_list; n != NULL; n = n->next) -+ fprintf (f, " '%s'\n", n->name); -+ fprintf (f, ")\n"); -+ } -+} -diff --git a/support/temp_file.h b/support/temp_file.h -new file mode 100644 -index 0000000000..6fed8df1ea ---- /dev/null -+++ b/support/temp_file.h -@@ -0,0 +1,37 @@ -+/* Declarations for temporary file handling. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEMP_FILE_H -+#define SUPPORT_TEMP_FILE_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+/* Schedule a temporary file for deletion on exit. */ -+void add_temp_file (const char *name); -+ -+/* Create a temporary file. Return the opened file descriptor on -+ success, or -1 on failure. Write the file name to *FILENAME if -+ FILENAME is not NULL. In this case, the caller is expected to free -+ *FILENAME. */ -+int create_temp_file (const char *base, char **filename); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_TEMP_FILE_H */ -diff --git a/support/test-driver.c b/support/test-driver.c -new file mode 100644 -index 0000000000..482066dbeb ---- /dev/null -+++ b/support/test-driver.c -@@ -0,0 +1,156 @@ -+/* Main function for test programs. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* This file should be included from test cases. It will define a -+ main function which provides the test wrapper. -+ -+ It assumes that the test case defines a function -+ -+ int do_test (void); -+ -+ and arranges for that function being called under the test wrapper. -+ The do_test function should return 0 to indicate a passing test, 1 -+ to indicate a failing test, or 77 to indicate an unsupported test. -+ Other result values could be used to indicate a failing test, but -+ the result of the expression is passed to exit and exit only -+ returns the lower 8 bits of its input. A non-zero return with some -+ values could cause a test to incorrectly be considered passing when -+ it really failed. For this reason, the function should always -+ return 0 (EXIT_SUCCESS), 1 (EXIT_FAILURE), or 77 -+ (EXIT_UNSUPPORTED). -+ -+ The test function may print out diagnostic or warning messages as well -+ as messages about failures. These messages should be printed to stdout -+ and not stderr so that the output is properly ordered with respect to -+ the rest of the glibc testsuite run output. -+ -+ Several preprocessors macros can be defined before including this -+ file. -+ -+ The name of the do_test function can be changed with the -+ TEST_FUNCTION macro. It must expand to the desired function name. -+ -+ If the test case needs access to command line parameters, it must -+ define the TEST_FUNCTION_ARGV macro with the name of the test -+ function. It must have the following type: -+ -+ int TEST_FUNCTION_ARGV (int argc, char **argv); -+ -+ This overrides the do_test default function and is incompatible -+ with the TEST_FUNCTION macro. -+ -+ If PREPARE is defined, it must expand to the name of a function of -+ the type -+ -+ void PREPARE (int argc, char **); -+ -+ This function will be called early, after parsing the command line, -+ but before running the test, in the parent process which acts as -+ the test supervisor. -+ -+ If CLEANUP_HANDLER is defined, it must expand to the name of a -+ function of the type -+ -+ void CLEANUP_HANDLER (void); -+ -+ This function will be called from the timeout (SIGALRM) signal -+ handler. -+ -+ If EXPECTED_SIGNAL is defined, it must expanded to a constant which -+ denotes the expected signal number. -+ -+ If EXPECTED_STATUS is defined, it must expand to the expected exit -+ status. -+ -+ If TIMEOUT is defined, it must be positive constant. It overrides -+ the default test timeout and is measured in seconds. -+ -+ If TEST_NO_MALLOPT is defined, the test wrapper will not call -+ mallopt. -+ -+ Custom command line handling can be implemented by defining the -+ CMDLINE_OPTION macro (after including the header; this -+ requires _GNU_SOURCE to be defined). This macro must expand to a -+ to a comma-separated list of braced initializers for struct option -+ from , with a trailing comma. CMDLINE_PROCESS can be -+ defined as the name of a function which is called to process these -+ options. The function is passed the option character/number and -+ has this type: -+ -+ void CMDLINE_PROCESS (int); -+*/ -+ -+#include -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ struct test_config test_config; -+ memset (&test_config, 0, sizeof (test_config)); -+ -+#ifdef PREPARE -+ test_config.prepare_function = (PREPARE); -+#endif -+ -+#if defined (TEST_FUNCTION) && defined (TEST_FUNCTON_ARGV) -+# error TEST_FUNCTION and TEST_FUNCTION_ARGV cannot be defined at the same time -+#endif -+#if defined (TEST_FUNCTION) -+ test_config.test_function = TEST_FUNCTION; -+#elif defined (TEST_FUNCTION_ARGV) -+ test_config.test_function_argv = TEST_FUNCTION_ARGV; -+#else -+ test_config.test_function = do_test; -+#endif -+ -+#ifdef CLEANUP_HANDLER -+ test_config.cleanup_function = CLEANUP_HANDLER; -+#endif -+ -+#ifdef EXPECTED_SIGNAL -+ test_config.expected_signal = (EXPECTED_SIGNAL); -+#endif -+ -+#ifdef EXPECTED_STATUS -+ test_config.expected_status = (EXPECTED_STATUS); -+#endif -+ -+#ifdef TEST_NO_MALLOPT -+ test_config.no_mallopt = 1; -+#endif -+ -+#ifdef TIMEOUT -+ test_config.timeout = TIMEOUT; -+#endif -+ -+#ifdef CMDLINE_OPTIONS -+ struct option options[] = -+ { -+ CMDLINE_OPTIONS -+ TEST_DEFAULT_OPTIONS -+ }; -+ test_config.options = &options; -+#endif -+#ifdef CMDLINE_PROCESS -+ test_config.cmdline_function = CMDLINE_PROCESS; -+#endif -+ -+ return support_test_main (argc, argv, &test_config); -+} -diff --git a/support/test-driver.h b/support/test-driver.h -new file mode 100644 -index 0000000000..af1971a9ca ---- /dev/null -+++ b/support/test-driver.h -@@ -0,0 +1,74 @@ -+/* Interfaces for the test driver. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_TEST_DRIVER_H -+#define SUPPORT_TEST_DRIVER_H -+ -+#include -+ -+__BEGIN_DECLS -+ -+struct test_config -+{ -+ void (*prepare_function) (int argc, char **argv); -+ int (*test_function) (void); -+ int (*test_function_argv) (int argc, char **argv); -+ void (*cleanup_function) (void); -+ void (*cmdline_function) (int); -+ const void *options; /* Custom options if not NULL. */ -+ int timeout; /* Test timeout in seconds. */ -+ int expected_status; /* Expected exit status. */ -+ int expected_signal; /* If non-zero, expect termination by signal. */ -+ char no_mallopt; /* Boolean flag to disable mallopt. */ -+}; -+ -+enum -+ { -+ /* Test exit status which indicates that the feature is -+ unsupported. */ -+ EXIT_UNSUPPORTED = 77, -+ -+ /* Default timeout is twenty seconds. Tests should normally -+ complete faster than this, but if they don't, that's abnormal -+ (a bug) anyways. */ -+ DEFAULT_TIMEOUT = 20, -+ -+ /* Used for command line argument parsing. */ -+ OPT_DIRECT = 1000, -+ OPT_TESTDIR, -+ }; -+ -+/* Options provided by the test driver. */ -+#define TEST_DEFAULT_OPTIONS \ -+ { "verbose", no_argument, NULL, 'v' }, \ -+ { "direct", no_argument, NULL, OPT_DIRECT }, \ -+ { "test-dir", required_argument, NULL, OPT_TESTDIR }, \ -+ -+/* The directory the test should use for temporary files. */ -+extern const char *test_dir; -+ -+/* The number of --verbose arguments specified during program -+ invocation. This variable can be used to control the verbosity of -+ tests. */ -+extern unsigned int test_verbose; -+ -+int support_test_main (int argc, char **argv, const struct test_config *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_TEST_DRIVER_H */ -diff --git a/support/tst-support-namespace.c b/support/tst-support-namespace.c -new file mode 100644 -index 0000000000..a50b074f5e ---- /dev/null -+++ b/support/tst-support-namespace.c -@@ -0,0 +1,34 @@ -+/* Test entering namespaces. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ if (support_become_root ()) -+ printf ("info: acquired root-like privileges\n"); -+ if (support_enter_network_namespace ()) -+ printf ("info: entered network namespace\n"); -+ if (support_in_uts_namespace ()) -+ printf ("info: also entered UTS namespace\n"); -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_capture_subprocess.c b/support/tst-support_capture_subprocess.c -new file mode 100644 -index 0000000000..5672fba0f7 ---- /dev/null -+++ b/support/tst-support_capture_subprocess.c -@@ -0,0 +1,188 @@ -+/* Test capturing output from a subprocess. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Write one byte at *P to FD and advance *P. Do nothing if *P is -+ '\0'. */ -+static void -+transfer (const unsigned char **p, int fd) -+{ -+ if (**p != '\0') -+ { -+ TEST_VERIFY (write (fd, *p, 1) == 1); -+ ++*p; -+ } -+} -+ -+/* Determine the order in which stdout and stderr are written. */ -+enum write_mode { out_first, err_first, interleave, -+ write_mode_last = interleave }; -+ -+/* Describe what to write in the subprocess. */ -+struct test -+{ -+ char *out; -+ char *err; -+ enum write_mode write_mode; -+ int signal; -+ int status; -+}; -+ -+/* For use with support_capture_subprocess. */ -+static void -+callback (void *closure) -+{ -+ const struct test *test = closure; -+ bool mode_ok = false; -+ switch (test->write_mode) -+ { -+ case out_first: -+ TEST_VERIFY (fputs (test->out, stdout) >= 0); -+ TEST_VERIFY (fflush (stdout) == 0); -+ TEST_VERIFY (fputs (test->err, stderr) >= 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ mode_ok = true; -+ break; -+ case err_first: -+ TEST_VERIFY (fputs (test->err, stderr) >= 0); -+ TEST_VERIFY (fflush (stderr) == 0); -+ TEST_VERIFY (fputs (test->out, stdout) >= 0); -+ TEST_VERIFY (fflush (stdout) == 0); -+ mode_ok = true; -+ break; -+ case interleave: -+ { -+ const unsigned char *pout = (const unsigned char *) test->out; -+ const unsigned char *perr = (const unsigned char *) test->err; -+ do -+ { -+ transfer (&pout, STDOUT_FILENO); -+ transfer (&perr, STDERR_FILENO); -+ } -+ while (*pout != '\0' || *perr != '\0'); -+ } -+ mode_ok = true; -+ break; -+ } -+ TEST_VERIFY (mode_ok); -+ -+ if (test->signal != 0) -+ raise (test->signal); -+ exit (test->status); -+} -+ -+/* Create a heap-allocated random string of letters. */ -+static char * -+random_string (size_t length) -+{ -+ char *result = xmalloc (length + 1); -+ for (size_t i = 0; i < length; ++i) -+ result[i] = 'a' + (rand () % 26); -+ result[length] = '\0'; -+ return result; -+} -+ -+/* Check that the specific stream from the captured subprocess matches -+ expectations. */ -+static void -+check_stream (const char *what, const struct xmemstream *stream, -+ const char *expected) -+{ -+ if (strcmp (stream->buffer, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: captured %s data incorrect\n" -+ " expected: %s\n" -+ " actual: %s\n", -+ what, expected, stream->buffer); -+ } -+ if (stream->length != strlen (expected)) -+ { -+ support_record_failure (); -+ printf ("error: captured %s data length incorrect\n" -+ " expected: %zu\n" -+ " actual: %zu\n", -+ what, strlen (expected), stream->length); -+ } -+} -+ -+static int -+do_test (void) -+{ -+ const int lengths[] = {0, 1, 17, 512, 20000, -1}; -+ -+ /* Test multiple combinations of support_capture_subprocess. -+ -+ length_idx_stdout: Index into the lengths array above, -+ controls how many bytes are written by the subprocess to -+ standard output. -+ length_idx_stderr: Same for standard error. -+ write_mode: How standard output and standard error writes are -+ ordered. -+ signal: Exit with no signal if zero, with SIGTERM if one. -+ status: Process exit status: 0 if zero, 3 if one. */ -+ for (int length_idx_stdout = 0; lengths[length_idx_stdout] >= 0; -+ ++length_idx_stdout) -+ for (int length_idx_stderr = 0; lengths[length_idx_stderr] >= 0; -+ ++length_idx_stderr) -+ for (int write_mode = 0; write_mode < write_mode_last; ++write_mode) -+ for (int signal = 0; signal < 2; ++signal) -+ for (int status = 0; status < 2; ++status) -+ { -+ struct test test = -+ { -+ .out = random_string (lengths[length_idx_stdout]), -+ .err = random_string (lengths[length_idx_stderr]), -+ .write_mode = write_mode, -+ .signal = signal * SIGTERM, /* 0 or SIGTERM. */ -+ .status = status * 3, /* 0 or 3. */ -+ }; -+ TEST_VERIFY (strlen (test.out) == lengths[length_idx_stdout]); -+ TEST_VERIFY (strlen (test.err) == lengths[length_idx_stderr]); -+ -+ struct support_capture_subprocess result -+ = support_capture_subprocess (callback, &test); -+ check_stream ("stdout", &result.out, test.out); -+ check_stream ("stderr", &result.err, test.err); -+ if (test.signal != 0) -+ { -+ TEST_VERIFY (WIFSIGNALED (result.status)); -+ TEST_VERIFY (WTERMSIG (result.status) == test.signal); -+ } -+ else -+ { -+ TEST_VERIFY (WIFEXITED (result.status)); -+ TEST_VERIFY (WEXITSTATUS (result.status) == test.status); -+ } -+ support_capture_subprocess_free (&result); -+ free (test.out); -+ free (test.err); -+ } -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_format_dns_packet.c b/support/tst-support_format_dns_packet.c -new file mode 100644 -index 0000000000..9c8589c09c ---- /dev/null -+++ b/support/tst-support_format_dns_packet.c -@@ -0,0 +1,101 @@ -+/* Tests for the support_format_dns_packet function. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+static void -+check_packet (const void *buffer, size_t length, -+ const char *name, const char *expected) -+{ -+ char *actual = support_format_dns_packet (buffer, length); -+ if (strcmp (actual, expected) != 0) -+ { -+ support_record_failure (); -+ printf ("error: formatted packet does not match: %s\n", name); -+ support_run_diff ("expected", expected, -+ "actual", actual); -+ } -+ free (actual); -+} -+ -+static void -+test_aaaa_length (void) -+{ -+ static const char packet[] = -+ /* Header: Response with two records. */ -+ "\x12\x34\x80\x00\x00\x01\x00\x02\x00\x00\x00\x00" -+ /* Question section. www.example/IN/AAAA. */ -+ "\x03www\x07""example\x00\x00\x1c\x00\x01" -+ /* Answer section. www.example AAAA [corrupted]. */ -+ "\xc0\x0c" -+ "\x00\x1c\x00\x01\x00\x00\x00\x00\x00\x10" -+ "\x20\x01\x0d\xb8\x05\x06\x07\x08" -+ "\x11\x12\x13\x14\x15\x16\x17\x18" -+ /* www.example AAAA [corrupted]. */ -+ "\xc0\x0c" -+ "\x00\x1c\x00\x01\x00\x00\x00\x00\x00\x11" -+ "\x01\x02\x03\x04\x05\x06\x07\x08" -+ "\x11\x12\x13\x14\x15\x16\x17\x18" "\xff"; -+ check_packet (packet, sizeof (packet) - 1, __func__, -+ "name: www.example\n" -+ "address: 2001:db8:506:708:1112:1314:1516:1718\n" -+ "error: AAAA record of size 17: www.example\n"); -+} -+ -+static void -+test_multiple_cnames (void) -+{ -+ static const char packet[] = -+ /* Header: Response with three records. */ -+ "\x12\x34\x80\x00\x00\x01\x00\x03\x00\x00\x00\x00" -+ /* Question section. www.example/IN/A. */ -+ "\x03www\x07""example\x00\x00\x01\x00\x01" -+ /* Answer section. www.example CNAME www1.example. */ -+ "\xc0\x0c" -+ "\x00\x05\x00\x01\x00\x00\x00\x00\x00\x07" -+ "\x04www1\xc0\x10" -+ /* www1 CNAME www2. */ -+ "\x04www1\xc0\x10" -+ "\x00\x05\x00\x01\x00\x00\x00\x00\x00\x07" -+ "\x04www2\xc0\x10" -+ /* www2 A 192.0.2.1. */ -+ "\x04www2\xc0\x10" -+ "\x00\x01\x00\x01\x00\x00\x00\x00\x00\x04" -+ "\xc0\x00\x02\x01"; -+ check_packet (packet, sizeof (packet) - 1, __func__, -+ "name: www.example\n" -+ "name: www1.example\n" -+ "name: www2.example\n" -+ "address: 192.0.2.1\n"); -+} -+ -+static int -+do_test (void) -+{ -+ test_aaaa_length (); -+ test_multiple_cnames (); -+ return 0; -+} -+ -+#include -diff --git a/support/tst-support_record_failure-2.sh b/support/tst-support_record_failure-2.sh -new file mode 100644 -index 0000000000..2c9372cc29 ---- /dev/null -+++ b/support/tst-support_record_failure-2.sh -@@ -0,0 +1,69 @@ -+#!/bin/sh -+# Test failure recording (with and without --direct). -+# Copyright (C) 2016-2017 Free Software Foundation, Inc. -+# This file is part of the GNU C Library. -+ -+# The GNU C Library is free software; you can redistribute it and/or -+# modify it under the terms of the GNU Lesser General Public -+# License as published by the Free Software Foundation; either -+# version 2.1 of the License, or (at your option) any later version. -+# -+# The GNU C Library is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# Lesser General Public License for more details. -+# -+# You should have received a copy of the GNU Lesser General Public -+# License along with the GNU C Library; if not, see -+# . */ -+ -+set -e -+ -+common_objpfx=$1; shift -+test_program_prefix_before_env=$1; shift -+run_program_env=$1; shift -+test_program_prefix_after_env=$1; shift -+ -+run_test () { -+ expected_status="$1" -+ expected_output="$2" -+ shift 2 -+ args="${common_objpfx}support/tst-support_record_failure $*" -+ echo "running: $args" -+ set +e -+ output="$(${test_program_prefix_before_env} \ -+ ${run_program} ${test_program_prefix_after_env} $args)" -+ status=$? -+ set -e -+ echo " exit status: $status" -+ if test "$output" != "$expected_output" ; then -+ echo "error: unexpected output: $output" -+ exit 1 -+ fi -+ if test "$status" -ne "$expected_status" ; then -+ echo "error: exit status $expected_status expected" -+ exit 1 -+ fi -+} -+ -+different_status () { -+ direct="$1" -+ run_test 1 "error: 1 test failures" $direct --status=0 -+ run_test 1 "error: 1 test failures" $direct --status=1 -+ run_test 2 "error: 1 test failures" $direct --status=2 -+ run_test 1 "error: 1 test failures" $direct --status=77 -+ run_test 2 "error: tst-support_record_failure.c:109: not true: false -+error: 1 test failures" $direct --test-verify -+ run_test 2 "error: tst-support_record_failure.c:109: not true: false -+info: execution passed failed TEST_VERIFY -+error: 1 test failures" $direct --test-verify --verbose -+} -+ -+different_status -+different_status --direct -+ -+run_test 1 "error: tst-support_record_failure.c:116: not true: false -+error: 1 test failures" --test-verify-exit -+# --direct does not print the summary error message if exit is called. -+run_test 1 "error: tst-support_record_failure.c:116: not true: false" \ -+ --direct --test-verify-exit -diff --git a/support/tst-support_record_failure.c b/support/tst-support_record_failure.c -new file mode 100644 -index 0000000000..e739e739c3 ---- /dev/null -+++ b/support/tst-support_record_failure.c -@@ -0,0 +1,153 @@ -+/* Test support_record_failure state sharing. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int exit_status_with_failure = -1; -+static bool test_verify; -+static bool test_verify_exit; -+enum -+ { -+ OPT_STATUS = 10001, -+ OPT_TEST_VERIFY, -+ OPT_TEST_VERIFY_EXIT, -+ }; -+#define CMDLINE_OPTIONS \ -+ { "status", required_argument, NULL, OPT_STATUS }, \ -+ { "test-verify", no_argument, NULL, OPT_TEST_VERIFY }, \ -+ { "test-verify-exit", no_argument, NULL, OPT_TEST_VERIFY_EXIT }, -+static void -+cmdline_process (int c) -+{ -+ switch (c) -+ { -+ case OPT_STATUS: -+ exit_status_with_failure = atoi (optarg); -+ break; -+ case OPT_TEST_VERIFY: -+ test_verify = true; -+ break; -+ case OPT_TEST_VERIFY_EXIT: -+ test_verify_exit = true; -+ break; -+ } -+} -+#define CMDLINE_PROCESS cmdline_process -+ -+static void -+check_failure_reporting (int phase, int zero, int unsupported) -+{ -+ int status = support_report_failure (0); -+ if (status != zero) -+ { -+ printf ("real-error (phase %d): support_report_failure (0) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (1); -+ if (status != 1) -+ { -+ printf ("real-error (phase %d): support_report_failure (1) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (2); -+ if (status != 2) -+ { -+ printf ("real-error (phase %d): support_report_failure (2) == %d\n", -+ phase, status); -+ exit (1); -+ } -+ status = support_report_failure (EXIT_UNSUPPORTED); -+ if (status != unsupported) -+ { -+ printf ("real-error (phase %d): " -+ "support_report_failure (EXIT_UNSUPPORTED) == %d\n", -+ phase, status); -+ exit (1); -+ } -+} -+ -+static int -+do_test (void) -+{ -+ if (exit_status_with_failure >= 0) -+ { -+ /* External invocation with requested error status. Used by -+ tst-support_report_failure-2.sh. */ -+ support_record_failure (); -+ return exit_status_with_failure; -+ } -+ TEST_VERIFY (true); -+ TEST_VERIFY_EXIT (true); -+ if (test_verify) -+ { -+ TEST_VERIFY (false); -+ if (test_verbose) -+ printf ("info: execution passed failed TEST_VERIFY\n"); -+ return 2; /* Expected exit status. */ -+ } -+ if (test_verify_exit) -+ { -+ TEST_VERIFY_EXIT (false); -+ return 3; /* Not reached. Expected exit status is 1. */ -+ } -+ -+ printf ("info: This test tests the test framework.\n" -+ "info: It reports some expected errors on stdout.\n"); -+ -+ /* Check that the status is passed through unchanged. */ -+ check_failure_reporting (1, 0, EXIT_UNSUPPORTED); -+ -+ /* Check state propagation from a subprocess. */ -+ pid_t pid = xfork (); -+ if (pid == 0) -+ { -+ support_record_failure (); -+ _exit (0); -+ } -+ int status; -+ xwaitpid (pid, &status, 0); -+ if (status != 0) -+ { -+ printf ("real-error: incorrect status from subprocess: %d\n", status); -+ return 1; -+ } -+ check_failure_reporting (2, 1, 1); -+ -+ /* Also test directly in the parent process. */ -+ support_record_failure_reset (); -+ check_failure_reporting (3, 0, EXIT_UNSUPPORTED); -+ support_record_failure (); -+ check_failure_reporting (4, 1, 1); -+ -+ /* We need to mask the failure above. */ -+ support_record_failure_reset (); -+ return 0; -+} -+ -+#include -diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/support/write_message.c -similarity index 68% -rename from sysdeps/unix/sysv/linux/sh/pwrite64.c -rename to support/write_message.c -index 683a5d9886..f03ed931d6 100644 ---- a/sysdeps/unix/sysv/linux/sh/pwrite64.c -+++ b/support/write_message.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* Write a message to standard output. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ralf Baechle , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,14 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+ -+#include -+#include -+ -+void -+write_message (const char *message) -+{ -+ ssize_t unused __attribute__ ((unused)); -+ unused = write (STDOUT_FILENO, message, strlen (message)); -+} -diff --git a/support/xaccept.c b/support/xaccept.c -new file mode 100644 -index 0000000000..7b25af3b05 ---- /dev/null -+++ b/support/xaccept.c -@@ -0,0 +1,32 @@ -+/* accept with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xaccept (int fd, struct sockaddr *sa, socklen_t *salen) -+{ -+ int clientfd = accept (fd, sa, salen); -+ if (clientfd < 0) -+ FAIL_EXIT1 ("accept (%d): %m", fd); -+ return clientfd; -+} -diff --git a/support/xaccept4.c b/support/xaccept4.c -new file mode 100644 -index 0000000000..67dd95e9fb ---- /dev/null -+++ b/support/xaccept4.c -@@ -0,0 +1,32 @@ -+/* accept4 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xaccept4 (int fd, struct sockaddr *sa, socklen_t *salen, int flags) -+{ -+ int clientfd = accept4 (fd, sa, salen, flags); -+ if (clientfd < 0) -+ FAIL_EXIT1 ("accept4 (%d, 0x%x): %m", fd, flags); -+ return clientfd; -+} -diff --git a/support/xasprintf.c b/support/xasprintf.c -new file mode 100644 -index 0000000000..5157680fa2 ---- /dev/null -+++ b/support/xasprintf.c -@@ -0,0 +1,36 @@ -+/* Error-checking wrapper for asprintf. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+char * -+xasprintf (const char *format, ...) -+{ -+ va_list ap; -+ va_start (ap, format); -+ char *result; -+ if (vasprintf (&result, format, ap) < 0) -+ FAIL_EXIT1 ("asprintf: %m"); -+ va_end (ap); -+ return result; -+} -diff --git a/support/xbind.c b/support/xbind.c -new file mode 100644 -index 0000000000..cfc6dd8fa8 ---- /dev/null -+++ b/support/xbind.c -@@ -0,0 +1,30 @@ -+/* bind with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xbind (int fd, const struct sockaddr *sa, socklen_t sa_len) -+{ -+ if (bind (fd, sa, sa_len) != 0) -+ FAIL_EXIT1 ("bind (%d), family %d: %m", fd, sa->sa_family); -+} -diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/support/xcalloc.c -similarity index 68% -rename from sysdeps/unix/sysv/linux/sh/pread.c -rename to support/xcalloc.c -index d3f99f35db..135f42dab2 100644 ---- a/sysdeps/unix/sysv/linux/sh/pread.c -+++ b/support/xcalloc.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* Error-checking wrapper for calloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,19 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+ -+#include -+#include -+#include -+ -+void * -+xcalloc (size_t n, size_t s) -+{ -+ void *p; -+ -+ p = calloc (n, s); -+ if (p == NULL) -+ oom_error ("calloc", n * s); -+ return p; -+} -diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/support/xchroot.c -similarity index 67% -rename from sysdeps/unix/sysv/linux/sh/pread64.c -rename to support/xchroot.c -index b2e8a25788..abcc299e00 100644 ---- a/sysdeps/unix/sysv/linux/sh/pread64.c -+++ b/support/xchroot.c -@@ -1,6 +1,6 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -+/* chroot with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -16,8 +16,13 @@ - License along with the GNU C Library; if not, see - . */ - --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pread adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -+#include -+#include -+#include -+ -+void -+xchroot (const char *path) -+{ -+ if (chroot (path) != 0) -+ FAIL_EXIT1 ("chroot (\"%s\"): %m", path); -+} -diff --git a/support/xclose.c b/support/xclose.c -new file mode 100644 -index 0000000000..c931e08421 ---- /dev/null -+++ b/support/xclose.c -@@ -0,0 +1,28 @@ -+/* close with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xclose (int fd) -+{ -+ if (close (fd) < 0 && errno != EINTR) -+ FAIL_EXIT1 ("close of descriptor %d failed: %m", fd); -+} -diff --git a/support/xconnect.c b/support/xconnect.c -new file mode 100644 -index 0000000000..0266dbc643 ---- /dev/null -+++ b/support/xconnect.c -@@ -0,0 +1,30 @@ -+/* connect with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xconnect (int fd, const struct sockaddr *sa, socklen_t sa_len) -+{ -+ if (connect (fd, sa, sa_len) != 0) -+ FAIL_EXIT1 ("connect (%d), family %d: %m", fd, sa->sa_family); -+} -diff --git a/support/xdup2.c b/support/xdup2.c -new file mode 100644 -index 0000000000..dc08c94518 ---- /dev/null -+++ b/support/xdup2.c -@@ -0,0 +1,28 @@ -+/* dup2 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xdup2 (int from, int to) -+{ -+ if (dup2 (from, to) < 0) -+ FAIL_EXIT1 ("dup2 (%d, %d): %m", from, to); -+} -diff --git a/support/xfclose.c b/support/xfclose.c -new file mode 100644 -index 0000000000..2737f05044 ---- /dev/null -+++ b/support/xfclose.c -@@ -0,0 +1,33 @@ -+/* fclose with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+ -+void -+xfclose (FILE *fp) -+{ -+ if (ferror (fp)) -+ FAIL_EXIT1 ("stdio stream closed with pending errors"); -+ if (fflush (fp) != 0) -+ FAIL_EXIT1 ("fflush: %m"); -+ if (fclose (fp) != 0) -+ FAIL_EXIT1 ("fclose: %m"); -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S b/support/xfopen.c -similarity index 67% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S -rename to support/xfopen.c -index 081fc15b62..14532a09f3 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S -+++ b/support/xfopen.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9+vis3. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* fopen with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,16 +16,16 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf_vis3) -- movwtos %o0, %f0 -- movwtos %o1, %f1 -- fcmps %f0, %f1 -- fbug 1f -- nop -- fzeros %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf_vis3) -+#include -+#include -+ -+FILE * -+xfopen (const char *path, const char *mode) -+{ -+ FILE *fp = fopen (path, mode); -+ if (fp == NULL) -+ FAIL_EXIT1 ("could not open %s (mode \"%s\"): %m", path, mode); -+ return fp; -+} -diff --git a/support/xfork.c b/support/xfork.c -new file mode 100644 -index 0000000000..aa52ba62c5 ---- /dev/null -+++ b/support/xfork.c -@@ -0,0 +1,32 @@ -+/* fork with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+pid_t -+xfork (void) -+{ -+ pid_t result = fork (); -+ if (result < 0) -+ FAIL_EXIT1 ("fork: %m"); -+ return result; -+} -diff --git a/support/xgetsockname.c b/support/xgetsockname.c -new file mode 100644 -index 0000000000..c3bd884f8d ---- /dev/null -+++ b/support/xgetsockname.c -@@ -0,0 +1,30 @@ -+/* getsockname with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xgetsockname (int fd, struct sockaddr *sa, socklen_t *plen) -+{ -+ if (getsockname (fd, sa, plen) != 0) -+ FAIL_EXIT1 ("setsockopt (%d): %m", fd); -+} -diff --git a/support/xlisten.c b/support/xlisten.c -new file mode 100644 -index 0000000000..1953e5900a ---- /dev/null -+++ b/support/xlisten.c -@@ -0,0 +1,30 @@ -+/* listen with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xlisten (int fd, int backlog) -+{ -+ if (listen (fd, backlog) != 0) -+ FAIL_EXIT1 ("listen (%d, %d): %m", fd, backlog); -+} -diff --git a/support/xmalloc.c b/support/xmalloc.c -new file mode 100644 -index 0000000000..450f699789 ---- /dev/null -+++ b/support/xmalloc.c -@@ -0,0 +1,34 @@ -+/* Error-checking wrapper for malloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void * -+xmalloc (size_t n) -+{ -+ void *p; -+ -+ p = malloc (n); -+ if (p == NULL) -+ oom_error ("malloc", n); -+ return p; -+} -diff --git a/sysdeps/sparc/sparc32/fpu/s_fdim.S b/support/xmemstream.c -similarity index 54% -rename from sysdeps/sparc/sparc32/fpu/s_fdim.S -rename to support/xmemstream.c -index e93970faae..bce6dc9170 100644 ---- a/sysdeps/sparc/sparc32/fpu/s_fdim.S -+++ b/support/xmemstream.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* Error-checking wrappers for memstream functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,26 +16,27 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- std %o0, [%sp + 72] -- std %o2, [%sp + 80] -- ldd [%sp + 72], %f0 -- ldd [%sp + 80], %f2 -- fcmpd %f0, %f2 -- st %g0, [%sp + 72] -- fbug 1f -- st %g0, [%sp + 76] -- ldd [%sp + 72], %f0 -- fnegs %f0, %f2 -- fmovs %f1, %f3 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+#include -+#include -+#include -+#include - --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); --#endif -+void -+xopen_memstream (struct xmemstream *stream) -+{ -+ int old_errno = errno; -+ *stream = (struct xmemstream) {}; -+ stream->out = open_memstream (&stream->buffer, &stream->length); -+ if (stream->out == NULL) -+ FAIL_EXIT1 ("open_memstream: %m"); -+ errno = old_errno; -+} -+ -+void -+xfclose_memstream (struct xmemstream *stream) -+{ -+ xfclose (stream->out); -+ stream->out = NULL; -+} -diff --git a/support/xmemstream.h b/support/xmemstream.h -new file mode 100644 -index 0000000000..e5ba231e4d ---- /dev/null -+++ b/support/xmemstream.h -@@ -0,0 +1,49 @@ -+/* Error-checking wrappers for memstream functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XMEMSTREAM_H -+#define SUPPORT_XMEMSTREAM_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Wrappers for other libc functions. */ -+struct xmemstream -+{ -+ FILE *out; -+ char *buffer; -+ size_t length; -+}; -+ -+/* Create a new in-memory stream. Initializes *STREAM. After this -+ function returns, STREAM->out is a file descriptor open for -+ writing. errno is preserved, so that the %m format specifier can -+ be used for writing to STREAM->out. */ -+void xopen_memstream (struct xmemstream *stream); -+ -+/* Closes STREAM->OUT. After this function returns, STREAM->buffer -+ and STREAM->length denote a memory range which contains the bytes -+ written to the output stream. The caller should free -+ STREAM->buffer. */ -+void xfclose_memstream (struct xmemstream *stream); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XMEMSTREAM_H */ -diff --git a/support/xmkdir.c b/support/xmkdir.c -new file mode 100644 -index 0000000000..ea17d49391 ---- /dev/null -+++ b/support/xmkdir.c -@@ -0,0 +1,28 @@ -+/* mkdir with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xmkdir (const char *path, mode_t mode) -+{ -+ if (mkdir (path, mode) != 0) -+ FAIL_EXIT1 ("mkdir (\"%s\", 0%o): %m", path, mode); -+} -diff --git a/support/xmmap.c b/support/xmmap.c -new file mode 100644 -index 0000000000..435b1eb733 ---- /dev/null -+++ b/support/xmmap.c -@@ -0,0 +1,31 @@ -+/* mmap with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void * -+xmmap (void *addr, size_t length, int prot, int flags, int fd) -+{ -+ void *result = mmap (addr, length, prot, flags, fd, 0); -+ if (result == MAP_FAILED) -+ FAIL_EXIT1 ("mmap of %zu bytes, prot=0x%x, flags=0x%x: %m", -+ length, prot, flags); -+ return result; -+} -diff --git a/support/xmunmap.c b/support/xmunmap.c -new file mode 100644 -index 0000000000..6ef5a4a468 ---- /dev/null -+++ b/support/xmunmap.c -@@ -0,0 +1,28 @@ -+/* munmap with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+void -+xmunmap (void *addr, size_t length) -+{ -+ if (munmap (addr, length) != 0) -+ FAIL_EXIT1 ("munmap of %zu bytes: %m", length); -+} -diff --git a/support/xopen.c b/support/xopen.c -new file mode 100644 -index 0000000000..7f033a03a7 ---- /dev/null -+++ b/support/xopen.c -@@ -0,0 +1,30 @@ -+/* open64 with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+xopen (const char *path, int flags, mode_t mode) -+{ -+ int ret = open64 (path, flags, mode); -+ if (ret < 0) -+ FAIL_EXIT1 ("open64 (\"%s\", 0x%x, 0%o): %m", path, flags, mode); -+ return ret; -+} -diff --git a/support/xpipe.c b/support/xpipe.c -new file mode 100644 -index 0000000000..89a64a55c1 ---- /dev/null -+++ b/support/xpipe.c -@@ -0,0 +1,28 @@ -+/* pipe with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xpipe (int fds[2]) -+{ -+ if (pipe (fds) < 0) -+ FAIL_EXIT1 ("pipe: %m"); -+} -diff --git a/support/xpoll.c b/support/xpoll.c -new file mode 100644 -index 0000000000..bec2521ffc ---- /dev/null -+++ b/support/xpoll.c -@@ -0,0 +1,32 @@ -+/* poll with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xpoll (struct pollfd *fds, nfds_t nfds, int timeout) -+{ -+ int ret = poll (fds, nfds, timeout); -+ if (ret < 0) -+ FAIL_EXIT1 ("poll: %m"); -+ return ret; -+} -diff --git a/support/xpthread_attr_destroy.c b/support/xpthread_attr_destroy.c -new file mode 100644 -index 0000000000..664c809e9f ---- /dev/null -+++ b/support/xpthread_attr_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_attr_destroy with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_destroy (pthread_attr_t *attr) -+{ -+ xpthread_check_return ("pthread_attr_destroy", -+ pthread_attr_destroy (attr)); -+} -diff --git a/support/xpthread_attr_init.c b/support/xpthread_attr_init.c -new file mode 100644 -index 0000000000..2e30ade9ab ---- /dev/null -+++ b/support/xpthread_attr_init.c -@@ -0,0 +1,25 @@ -+/* pthread_attr_init with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_init (pthread_attr_t *attr) -+{ -+ xpthread_check_return ("pthread_attr_init", pthread_attr_init (attr)); -+} -diff --git a/support/xpthread_attr_setdetachstate.c b/support/xpthread_attr_setdetachstate.c -new file mode 100644 -index 0000000000..b544dbaa42 ---- /dev/null -+++ b/support/xpthread_attr_setdetachstate.c -@@ -0,0 +1,27 @@ -+/* pthread_attr_setdetachstate with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) -+{ -+ xpthread_check_return ("pthread_attr_setdetachstate", -+ pthread_attr_setdetachstate (attr, -+ detachstate)); -+} -diff --git a/support/xpthread_attr_setstacksize.c b/support/xpthread_attr_setstacksize.c -new file mode 100644 -index 0000000000..02d06310a9 ---- /dev/null -+++ b/support/xpthread_attr_setstacksize.c -@@ -0,0 +1,26 @@ -+/* pthread_attr_setstacksize with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) -+{ -+ xpthread_check_return ("pthread_attr_setstacksize", -+ pthread_attr_setstacksize (attr, stacksize)); -+} -diff --git a/support/xpthread_barrier_destroy.c b/support/xpthread_barrier_destroy.c -new file mode 100644 -index 0000000000..efc0719a63 ---- /dev/null -+++ b/support/xpthread_barrier_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_barrier_destroy with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_barrier_destroy (pthread_barrier_t *barrier) -+{ -+ xpthread_check_return ("pthread_barrier_destroy", -+ pthread_barrier_destroy (barrier)); -+} -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S b/support/xpthread_barrier_init.c -similarity index 65% -rename from sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S -rename to support/xpthread_barrier_init.c -index 4a479b1a59..b32dad1315 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S -+++ b/support/xpthread_barrier_init.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit+v9+vis3. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* pthread_barrier_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,18 +16,12 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdim_vis3) -- movwtos %o0, %f0 -- movwtos %o1, %f1 -- movwtos %o2, %f2 -- movwtos %o3, %f3 -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim_vis3) -+void -+xpthread_barrier_init (pthread_barrier_t *barrier, -+ pthread_barrierattr_t *attr, unsigned int count) -+{ -+ xpthread_check_return ("pthread_barrier_init", -+ pthread_barrier_init (barrier, attr, count)); -+} -diff --git a/support/xpthread_barrier_wait.c b/support/xpthread_barrier_wait.c -new file mode 100644 -index 0000000000..7cee44d0a3 ---- /dev/null -+++ b/support/xpthread_barrier_wait.c -@@ -0,0 +1,28 @@ -+/* pthread_barrier_wait with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int -+xpthread_barrier_wait (pthread_barrier_t *barrier) -+{ -+ int ret = pthread_barrier_wait (barrier); -+ if (ret != 0 && ret != PTHREAD_BARRIER_SERIAL_THREAD) -+ xpthread_check_return ("pthread_barrier_wait", ret); -+ return ret == PTHREAD_BARRIER_SERIAL_THREAD; -+} -diff --git a/support/xpthread_cancel.c b/support/xpthread_cancel.c -new file mode 100644 -index 0000000000..3af16f9b54 ---- /dev/null -+++ b/support/xpthread_cancel.c -@@ -0,0 +1,25 @@ -+/* pthread_cancel with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_cancel (pthread_t thr) -+{ -+ xpthread_check_return ("pthread_cancel", pthread_cancel (thr)); -+} -diff --git a/support/xpthread_check_return.c b/support/xpthread_check_return.c -new file mode 100644 -index 0000000000..3094d82e9c ---- /dev/null -+++ b/support/xpthread_check_return.c -@@ -0,0 +1,34 @@ -+/* Return value checking for pthread functions, exit variant. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void -+xpthread_check_return (const char *function, int value) -+{ -+ if (value != 0) -+ { -+ errno = value; -+ FAIL_EXIT1 ("%s: %m", function); -+ } -+} -diff --git a/support/xpthread_cond_wait.c b/support/xpthread_cond_wait.c -new file mode 100644 -index 0000000000..b0e9b2a232 ---- /dev/null -+++ b/support/xpthread_cond_wait.c -@@ -0,0 +1,26 @@ -+/* pthread_cond_wait with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) -+{ -+ xpthread_check_return -+ ("pthread_cond_wait", pthread_cond_wait (cond, mutex)); -+} -diff --git a/support/xpthread_create.c b/support/xpthread_create.c -new file mode 100644 -index 0000000000..98c63e54c3 ---- /dev/null -+++ b/support/xpthread_create.c -@@ -0,0 +1,29 @@ -+/* pthread_create with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+pthread_t -+xpthread_create (pthread_attr_t *attr, -+ void *(*thread_func) (void *), void *closure) -+{ -+ pthread_t thr; -+ xpthread_check_return -+ ("pthread_create", pthread_create (&thr, attr, thread_func, closure)); -+ return thr; -+} -diff --git a/support/xpthread_detach.c b/support/xpthread_detach.c -new file mode 100644 -index 0000000000..2088af2f57 ---- /dev/null -+++ b/support/xpthread_detach.c -@@ -0,0 +1,25 @@ -+/* pthread_detach with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_detach (pthread_t thr) -+{ -+ xpthread_check_return ("pthread_detach", pthread_detach (thr)); -+} -diff --git a/support/xpthread_join.c b/support/xpthread_join.c -new file mode 100644 -index 0000000000..f23bb9a5ae ---- /dev/null -+++ b/support/xpthread_join.c -@@ -0,0 +1,27 @@ -+/* pthread_join with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void * -+xpthread_join (pthread_t thr) -+{ -+ void *result; -+ xpthread_check_return ("pthread_join", pthread_join (thr, &result)); -+ return result; -+} -diff --git a/support/xpthread_mutex_consistent.c b/support/xpthread_mutex_consistent.c -new file mode 100644 -index 0000000000..52364be365 ---- /dev/null -+++ b/support/xpthread_mutex_consistent.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_consistent with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_consistent (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_consistent", -+ pthread_mutex_consistent (mutex)); -+} -diff --git a/support/xpthread_mutex_destroy.c b/support/xpthread_mutex_destroy.c -new file mode 100644 -index 0000000000..f11f8f0acd ---- /dev/null -+++ b/support/xpthread_mutex_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_destroy with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_destroy (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_destroy", -+ pthread_mutex_destroy (mutex)); -+} -diff --git a/support/xpthread_mutex_init.c b/support/xpthread_mutex_init.c -new file mode 100644 -index 0000000000..2d16d1b9d9 ---- /dev/null -+++ b/support/xpthread_mutex_init.c -@@ -0,0 +1,26 @@ -+/* pthread_mutex_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutex_init", -+ pthread_mutex_init (mutex, attr)); -+} -diff --git a/support/xpthread_mutex_lock.c b/support/xpthread_mutex_lock.c -new file mode 100644 -index 0000000000..af727b45f3 ---- /dev/null -+++ b/support/xpthread_mutex_lock.c -@@ -0,0 +1,25 @@ -+/* pthread_mutex_lock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_lock (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_lock", pthread_mutex_lock (mutex)); -+} -diff --git a/support/xpthread_mutex_unlock.c b/support/xpthread_mutex_unlock.c -new file mode 100644 -index 0000000000..161b41edf6 ---- /dev/null -+++ b/support/xpthread_mutex_unlock.c -@@ -0,0 +1,25 @@ -+/* pthread_mutex_unlock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutex_unlock (pthread_mutex_t *mutex) -+{ -+ xpthread_check_return ("pthread_mutex_unlock", pthread_mutex_unlock (mutex)); -+} -diff --git a/support/xpthread_mutexattr_destroy.c b/support/xpthread_mutexattr_destroy.c -new file mode 100644 -index 0000000000..c699e32b41 ---- /dev/null -+++ b/support/xpthread_mutexattr_destroy.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_destroy with error checking. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_destroy (pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutexattr_destroy", -+ pthread_mutexattr_destroy (attr)); -+} -diff --git a/support/xpthread_mutexattr_init.c b/support/xpthread_mutexattr_init.c -new file mode 100644 -index 0000000000..fa93fab178 ---- /dev/null -+++ b/support/xpthread_mutexattr_init.c -@@ -0,0 +1,25 @@ -+/* pthread_mutexattr_init with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_init (pthread_mutexattr_t *attr) -+{ -+ xpthread_check_return ("pthread_mutexattr_init", pthread_mutexattr_init (attr)); -+} -diff --git a/sysdeps/sparc/sparc64/fpu/s_fdim.S b/support/xpthread_mutexattr_setprotocol.c -similarity index 67% -rename from sysdeps/sparc/sparc64/fpu/s_fdim.S -rename to support/xpthread_mutexattr_setprotocol.c -index 7fae72a251..353f75e3d7 100644 ---- a/sysdeps/sparc/sparc64/fpu/s_fdim.S -+++ b/support/xpthread_mutexattr_setprotocol.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 64-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* pthread_mutexattr_setprotocol with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,16 +16,11 @@ - License along with the GNU C Library; if not, see - . */ - --#include --#include -+#include - --ENTRY(__fdim) -- fcmpd %f0, %f2 -- fbug 1f -- nop -- fzero %f0 -- fnegd %f0, %f2 --1: retl -- fsubd %f0, %f2, %f0 --END(__fdim) --weak_alias (__fdim, fdim) -+void -+xpthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setprotocol", -+ pthread_mutexattr_setprotocol (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_setpshared.c b/support/xpthread_mutexattr_setpshared.c -new file mode 100644 -index 0000000000..242da1aeca ---- /dev/null -+++ b/support/xpthread_mutexattr_setpshared.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_setpshared with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setpshared", -+ pthread_mutexattr_setpshared (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_setrobust.c b/support/xpthread_mutexattr_setrobust.c -new file mode 100644 -index 0000000000..d7d6fa8630 ---- /dev/null -+++ b/support/xpthread_mutexattr_setrobust.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_setrobust with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_setrobust", -+ pthread_mutexattr_setrobust (attr, flag)); -+} -diff --git a/support/xpthread_mutexattr_settype.c b/support/xpthread_mutexattr_settype.c -new file mode 100644 -index 0000000000..cf22170b56 ---- /dev/null -+++ b/support/xpthread_mutexattr_settype.c -@@ -0,0 +1,26 @@ -+/* pthread_mutexattr_settype with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_mutexattr_settype (pthread_mutexattr_t *attr, int flag) -+{ -+ xpthread_check_return ("pthread_mutexattr_settype", -+ pthread_mutexattr_settype (attr, flag)); -+} -diff --git a/support/xpthread_once.c b/support/xpthread_once.c -new file mode 100644 -index 0000000000..70d58dbab2 ---- /dev/null -+++ b/support/xpthread_once.c -@@ -0,0 +1,25 @@ -+/* pthread_once with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_once (pthread_once_t *guard, void (*func) (void)) -+{ -+ xpthread_check_return ("pthread_once", pthread_once (guard, func)); -+} -diff --git a/support/xpthread_sigmask.c b/support/xpthread_sigmask.c -new file mode 100644 -index 0000000000..0ba9ca02dc ---- /dev/null -+++ b/support/xpthread_sigmask.c -@@ -0,0 +1,34 @@ -+/* pthread_sigmask with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+#include -+ -+void -+xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset) -+{ -+ if (pthread_sigmask (how, set, oldset) != 0) -+ { -+ write_message ("error: pthread_setmask failed\n"); -+ /* Do not use exit because pthread_sigmask can be called from a -+ signal handler. */ -+ _exit (1); -+ } -+} -diff --git a/support/xpthread_spin_lock.c b/support/xpthread_spin_lock.c -new file mode 100644 -index 0000000000..6975215b17 ---- /dev/null -+++ b/support/xpthread_spin_lock.c -@@ -0,0 +1,25 @@ -+/* pthread_spin_lock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_spin_lock (pthread_spinlock_t *lock) -+{ -+ xpthread_check_return ("pthread_spin_lock", pthread_spin_lock (lock)); -+} -diff --git a/support/xpthread_spin_unlock.c b/support/xpthread_spin_unlock.c -new file mode 100644 -index 0000000000..4f19a44c48 ---- /dev/null -+++ b/support/xpthread_spin_unlock.c -@@ -0,0 +1,25 @@ -+/* pthread_spin_unlock with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+void -+xpthread_spin_unlock (pthread_spinlock_t *lock) -+{ -+ xpthread_check_return ("pthread_spin_unlock", pthread_spin_unlock (lock)); -+} -diff --git a/support/xrealloc.c b/support/xrealloc.c -new file mode 100644 -index 0000000000..00c313880c ---- /dev/null -+++ b/support/xrealloc.c -@@ -0,0 +1,32 @@ -+/* Error-checking wrapper for realloc. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void * -+xrealloc (void *p, size_t n) -+{ -+ void *result = realloc (p, n); -+ if (result == NULL && (n > 0 || p == NULL)) -+ oom_error ("realloc", n); -+ return result; -+} -diff --git a/support/xrecvfrom.c b/support/xrecvfrom.c -new file mode 100644 -index 0000000000..17809c4dd2 ---- /dev/null -+++ b/support/xrecvfrom.c -@@ -0,0 +1,33 @@ -+/* recvfrom with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+size_t -+xrecvfrom (int fd, void *buf, size_t buflen, int flags, -+ struct sockaddr *sa, socklen_t *salen) -+{ -+ ssize_t ret = recvfrom (fd, buf, buflen, flags, sa, salen); -+ if (ret < 0) -+ FAIL_EXIT1 ("error: recvfrom (%d), %zu bytes buffer: %m", fd, buflen); -+ return ret; -+} -diff --git a/support/xsendto.c b/support/xsendto.c -new file mode 100644 -index 0000000000..20bddf6965 ---- /dev/null -+++ b/support/xsendto.c -@@ -0,0 +1,35 @@ -+/* sendto with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+void -+xsendto (int fd, const void *buf, size_t buflen, int flags, -+ const struct sockaddr *sa, socklen_t salen) -+{ -+ ssize_t ret = sendto (fd, buf, buflen, flags, sa, salen); -+ if (ret < 0) -+ FAIL_EXIT1 ("sendto (%d), %zu bytes, family %d: %m", -+ fd, buflen, sa->sa_family); -+ if (ret != buflen) -+ FAIL_EXIT1 ("sendto (%d) sent %zd bytes instead of %zu", fd, ret, buflen); -+} -diff --git a/sysdeps/sparc/sparc32/fpu/s_fdimf.S b/support/xsetsockopt.c -similarity index 62% -rename from sysdeps/sparc/sparc32/fpu/s_fdimf.S -rename to support/xsetsockopt.c -index c3fe8afa98..9931882e75 100644 ---- a/sysdeps/sparc/sparc32/fpu/s_fdimf.S -+++ b/support/xsetsockopt.c -@@ -1,7 +1,6 @@ --/* Compute positive difference, sparc 32-bit. -- Copyright (C) 2013-2016 Free Software Foundation, Inc. -+/* setsockopt with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. -- Contributed by David S. Miller . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -17,19 +16,16 @@ - License along with the GNU C Library; if not, see - . */ - --#include -+#include - --ENTRY(__fdimf) -- st %o0, [%sp + 72] -- st %o1, [%sp + 76] -- ld [%sp + 72], %f0 -- ld [%sp + 76], %f1 -- fcmps %f0, %f1 -- fbug 1f -- st %g0, [%sp + 72] -- ld [%sp + 72], %f0 -- fnegs %f0, %f1 --1: retl -- fsubs %f0, %f1, %f0 --END(__fdimf) --weak_alias (__fdimf, fdimf) -+#include -+#include -+#include -+ -+void -+xsetsockopt (int fd, int level, int name, const void *val, socklen_t vallen) -+{ -+ if (setsockopt (fd, level, name, val, vallen) != 0) -+ FAIL_EXIT1 ("setsockopt (%d, %d, %d), %zu bytes: %m", -+ fd, level, name, (size_t) vallen); -+} -diff --git a/support/xsignal.h b/support/xsignal.h -new file mode 100644 -index 0000000000..3dc0d9d5ce ---- /dev/null -+++ b/support/xsignal.h -@@ -0,0 +1,34 @@ -+/* Support functionality for using signals. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_SIGNAL_H -+#define SUPPORT_SIGNAL_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* The following functions call the corresponding libpthread functions -+ and terminate the process on error. */ -+ -+void xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_SIGNAL_H */ -diff --git a/support/xsocket.c b/support/xsocket.c -new file mode 100644 -index 0000000000..c1deaee924 ---- /dev/null -+++ b/support/xsocket.c -@@ -0,0 +1,32 @@ -+/* socket with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+ -+int -+xsocket (int domain, int type, int protocol) -+{ -+ int fd = socket (domain, type, protocol); -+ if (fd < 0) -+ FAIL_EXIT1 ("socket (%d, %d, %d): %m\n", domain, type, protocol); -+ return fd; -+} -diff --git a/support/xsocket.h b/support/xsocket.h -new file mode 100644 -index 0000000000..d6724948d8 ---- /dev/null -+++ b/support/xsocket.h -@@ -0,0 +1,39 @@ -+/* Error-checking wrappers for socket functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XSOCKET_H -+#define SUPPORT_XSOCKET_H -+ -+#include -+#include -+#include -+ -+int xsocket (int, int, int); -+void xsetsockopt (int, int, int, const void *, socklen_t); -+void xgetsockname (int, struct sockaddr *, socklen_t *); -+void xconnect (int, const struct sockaddr *, socklen_t); -+void xbind (int, const struct sockaddr *, socklen_t); -+void xlisten (int, int); -+int xaccept (int, struct sockaddr *, socklen_t *); -+int xaccept4 (int, struct sockaddr *, socklen_t *, int); -+void xsendto (int, const void *, size_t, int, -+ const struct sockaddr *, socklen_t); -+size_t xrecvfrom (int, void *, size_t, int, struct sockaddr *, socklen_t *); -+int xpoll (struct pollfd *, nfds_t, int); -+ -+#endif /* SUPPORT_XSOCKET_H */ -diff --git a/support/xstdio.h b/support/xstdio.h -new file mode 100644 -index 0000000000..bcc2e863bf ---- /dev/null -+++ b/support/xstdio.h -@@ -0,0 +1,32 @@ -+/* Error-checking wrappers for stdio functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_XSTDIO_H -+#define SUPPORT_XSTDIO_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+FILE *xfopen (const char *path, const char *mode); -+void xfclose (FILE *); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XSTDIO_H */ -diff --git a/support/xstrdup.c b/support/xstrdup.c -new file mode 100644 -index 0000000000..d6a8c04baf ---- /dev/null -+++ b/support/xstrdup.c -@@ -0,0 +1,30 @@ -+/* strdup with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+char * -+xstrdup (const char *s) -+{ -+ char *p = strdup (s); -+ if (p == NULL) -+ oom_error ("strdup", strlen (s)); -+ return p; -+} -diff --git a/support/xthread.h b/support/xthread.h -new file mode 100644 -index 0000000000..6dd7e709be ---- /dev/null -+++ b/support/xthread.h -@@ -0,0 +1,77 @@ -+/* Support functionality for using threads. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef SUPPORT_THREAD_H -+#define SUPPORT_THREAD_H -+ -+#include -+#include -+ -+__BEGIN_DECLS -+ -+/* Terminate the process (with exit status 0) after SECONDS have -+ elapsed, from a helper thread. The process is terminated with the -+ exit function, so atexit handlers are executed. */ -+void delayed_exit (int seconds); -+ -+/* Terminate the process (with exit status 1) if VALUE is not zero. -+ In that case, print a failure message to standard output mentioning -+ FUNCTION. The process is terminated with the exit function, so -+ atexit handlers are executed. */ -+void xpthread_check_return (const char *function, int value); -+ -+/* The following functions call the corresponding libpthread functions -+ and terminate the process on error. */ -+ -+void xpthread_barrier_init (pthread_barrier_t *barrier, -+ pthread_barrierattr_t *attr, unsigned int count); -+void xpthread_barrier_destroy (pthread_barrier_t *barrier); -+void xpthread_mutexattr_destroy (pthread_mutexattr_t *); -+void xpthread_mutexattr_init (pthread_mutexattr_t *); -+void xpthread_mutexattr_setprotocol (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_setpshared (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_setrobust (pthread_mutexattr_t *, int); -+void xpthread_mutexattr_settype (pthread_mutexattr_t *, int); -+void xpthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); -+void xpthread_mutex_destroy (pthread_mutex_t *); -+void xpthread_mutex_lock (pthread_mutex_t *mutex); -+void xpthread_mutex_unlock (pthread_mutex_t *mutex); -+void xpthread_mutex_consistent (pthread_mutex_t *); -+void xpthread_spin_lock (pthread_spinlock_t *lock); -+void xpthread_spin_unlock (pthread_spinlock_t *lock); -+void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex); -+pthread_t xpthread_create (pthread_attr_t *attr, -+ void *(*thread_func) (void *), void *closure); -+void xpthread_detach (pthread_t thr); -+void xpthread_cancel (pthread_t thr); -+void *xpthread_join (pthread_t thr); -+void xpthread_once (pthread_once_t *guard, void (*func) (void)); -+void xpthread_attr_destroy (pthread_attr_t *attr); -+void xpthread_attr_init (pthread_attr_t *attr); -+void xpthread_attr_setdetachstate (pthread_attr_t *attr, -+ int detachstate); -+void xpthread_attr_setstacksize (pthread_attr_t *attr, -+ size_t stacksize); -+ -+/* This function returns non-zero if pthread_barrier_wait returned -+ PTHREAD_BARRIER_SERIAL_THREAD. */ -+int xpthread_barrier_wait (pthread_barrier_t *barrier); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_THREAD_H */ -diff --git a/support/xunistd.h b/support/xunistd.h -new file mode 100644 -index 0000000000..151d743e1f ---- /dev/null -+++ b/support/xunistd.h -@@ -0,0 +1,56 @@ -+/* POSIX-specific extra functions. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+/* These wrapper functions use POSIX types and therefore cannot be -+ declared in . */ -+ -+#ifndef SUPPORT_XUNISTD_H -+#define SUPPORT_XUNISTD_H -+ -+#include -+#include -+#include -+ -+__BEGIN_DECLS -+ -+struct stat64; -+ -+pid_t xfork (void); -+pid_t xwaitpid (pid_t, int *status, int flags); -+void xpipe (int[2]); -+void xdup2 (int, int); -+int xopen (const char *path, int flags, mode_t); -+void xstat (const char *path, struct stat64 *); -+void xmkdir (const char *path, mode_t); -+void xchroot (const char *path); -+ -+/* Close the file descriptor. Ignore EINTR errors, but terminate the -+ process on other errors. */ -+void xclose (int); -+ -+/* Write the buffer. Retry on short writes. */ -+void xwrite (int, const void *, size_t); -+ -+/* Invoke mmap with a zero file offset. */ -+void *xmmap (void *addr, size_t length, int prot, int flags, int fd); -+ -+void xmunmap (void *addr, size_t length); -+ -+__END_DECLS -+ -+#endif /* SUPPORT_XUNISTD_H */ -diff --git a/support/xwaitpid.c b/support/xwaitpid.c -new file mode 100644 -index 0000000000..204795e4c0 ---- /dev/null -+++ b/support/xwaitpid.c -@@ -0,0 +1,33 @@ -+/* waitpid with error checking. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+int -+xwaitpid (int pid, int *status, int flags) -+{ -+ pid_t result = waitpid (pid, status, flags); -+ if (result < 0) -+ FAIL_EXIT1 ("waitpid: %m\n"); -+ return result; -+} -diff --git a/support/xwrite.c b/support/xwrite.c -new file mode 100644 -index 0000000000..134e8ee4c1 ---- /dev/null -+++ b/support/xwrite.c -@@ -0,0 +1,39 @@ -+/* write with error checking and retries. -+ Copyright (C) 2016-2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+#include -+ -+void -+xwrite (int fd, const void *buffer, size_t length) -+{ -+ const char *p = buffer; -+ const char *end = p + length; -+ while (p < end) -+ { -+ ssize_t ret = write (fd, p, end - p); -+ if (ret < 0) -+ FAIL_EXIT1 ("write of %zu bytes failed after %td: %m", -+ length, p - (const char *) buffer); -+ if (ret == 0) -+ FAIL_EXIT1 ("write return 0 after writing %td bytes of %zu", -+ p - (const char *) buffer, length); -+ p += ret; -+ } -+} -diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h -index 282805e396..e86d8b5b63 100644 ---- a/sysdeps/aarch64/dl-machine.h -+++ b/sysdeps/aarch64/dl-machine.h -@@ -172,8 +172,8 @@ _dl_start_user: \n\ - cmp x0, #0 \n\ - bne 1b \n\ - // Update _dl_argv \n\ -- adrp x3, _dl_argv \n\ -- str x2, [x3, #:lo12:_dl_argv] \n\ -+ adrp x3, __GI__dl_argv \n\ -+ str x2, [x3, #:lo12:__GI__dl_argv] \n\ - .L_done_stack_adjust: \n\ - // compute envp \n\ - add x3, x2, x1, lsl #3 \n\ -diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym b/sysdeps/aarch64/nptl/tcb-offsets.sym -index 0677aeabff..238647dd47 100644 ---- a/sysdeps/aarch64/nptl/tcb-offsets.sym -+++ b/sysdeps/aarch64/nptl/tcb-offsets.sym -@@ -2,6 +2,5 @@ - #include - - PTHREAD_MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) --PTHREAD_PID_OFFSET offsetof (struct pthread, pid) - PTHREAD_TID_OFFSET offsetof (struct pthread, tid) - PTHREAD_SIZEOF sizeof (struct pthread) -diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c -index c1ff864d4b..e9c350af1c 100644 ---- a/sysdeps/alpha/fpu/s_ceil.c -+++ b/sysdeps/alpha/fpu/s_ceil.c -@@ -26,17 +26,16 @@ - double - __ceil (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - new_x = -x; - __asm ( --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(new_x)); -diff --git a/sysdeps/alpha/fpu/s_ceilf.c b/sysdeps/alpha/fpu/s_ceilf.c -index 7e63a6fe94..77e01a99f7 100644 ---- a/sysdeps/alpha/fpu/s_ceilf.c -+++ b/sysdeps/alpha/fpu/s_ceilf.c -@@ -25,6 +25,9 @@ - float - __ceilf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -@@ -36,11 +39,7 @@ __ceilf (float x) - - new_x = -x; - __asm ("cvtst/s %3,%2\n\t" --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(new_x)); -diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c -index 1a6f8c4617..9930f6be42 100644 ---- a/sysdeps/alpha/fpu/s_floor.c -+++ b/sysdeps/alpha/fpu/s_floor.c -@@ -27,16 +27,15 @@ - double - __floor (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; - - __asm ( --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1) - : "f"(x)); -diff --git a/sysdeps/alpha/fpu/s_floorf.c b/sysdeps/alpha/fpu/s_floorf.c -index 8cd80e2b42..015c04f40d 100644 ---- a/sysdeps/alpha/fpu/s_floorf.c -+++ b/sysdeps/alpha/fpu/s_floorf.c -@@ -26,6 +26,9 @@ - float - __floorf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -@@ -36,11 +39,7 @@ __floorf (float x) - float tmp1, tmp2, new_x; - - __asm ("cvtst/s %3,%2\n\t" --#ifdef _IEEE_FP_INEXACT -- "cvttq/svim %2,%1\n\t" --#else - "cvttq/svm %2,%1\n\t" --#endif - "cvtqt/m %1,%0\n\t" - : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2) - : "f"(x)); -diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c -index f33fe72c11..259348afc0 100644 ---- a/sysdeps/alpha/fpu/s_rint.c -+++ b/sysdeps/alpha/fpu/s_rint.c -@@ -23,6 +23,9 @@ - double - __rint (double x) - { -+ if (isnan (x)) -+ return x + x; -+ - if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */ - { - double tmp1, new_x; -diff --git a/sysdeps/alpha/fpu/s_rintf.c b/sysdeps/alpha/fpu/s_rintf.c -index 1400dfe8d7..645728ad5b 100644 ---- a/sysdeps/alpha/fpu/s_rintf.c -+++ b/sysdeps/alpha/fpu/s_rintf.c -@@ -22,6 +22,9 @@ - float - __rintf (float x) - { -+ if (isnanf (x)) -+ return x + x; -+ - if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */ - { - /* Note that Alpha S_Floating is stored in registers in a -diff --git a/sysdeps/alpha/fpu/s_trunc.c b/sysdeps/alpha/fpu/s_trunc.c -index 16cb114a72..4b986a6926 100644 ---- a/sysdeps/alpha/fpu/s_trunc.c -+++ b/sysdeps/alpha/fpu/s_trunc.c -@@ -28,12 +28,11 @@ __trunc (double x) - double two52 = copysign (0x1.0p52, x); - double r, tmp; - -+ if (isgreaterequal (fabs (x), 0x1.0p52)) -+ return x; -+ - __asm ( --#ifdef _IEEE_FP_INEXACT -- "addt/suic %2, %3, %1\n\tsubt/suic %1, %3, %0" --#else - "addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0" --#endif - : "=&f"(r), "=&f"(tmp) - : "f"(x), "f"(two52)); - -diff --git a/sysdeps/alpha/fpu/s_truncf.c b/sysdeps/alpha/fpu/s_truncf.c -index 2290f28295..3e93356166 100644 ---- a/sysdeps/alpha/fpu/s_truncf.c -+++ b/sysdeps/alpha/fpu/s_truncf.c -@@ -27,12 +27,11 @@ __truncf (float x) - float two23 = copysignf (0x1.0p23, x); - float r, tmp; - -+ if (isgreaterequal (fabsf (x), 0x1.0p23)) -+ return x; -+ - __asm ( --#ifdef _IEEE_FP_INEXACT -- "adds/suic %2, %3, %1\n\tsubs/suic %1, %3, %0" --#else - "adds/suc %2, %3, %1\n\tsubs/suc %1, %3, %0" --#endif - : "=&f"(r), "=&f"(tmp) - : "f"(x), "f"(two23)); - -diff --git a/sysdeps/alpha/nptl/tcb-offsets.sym b/sysdeps/alpha/nptl/tcb-offsets.sym -index c21a791040..1005621b37 100644 ---- a/sysdeps/alpha/nptl/tcb-offsets.sym -+++ b/sysdeps/alpha/nptl/tcb-offsets.sym -@@ -10,5 +10,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/arm/nacl/libc.abilist b/sysdeps/arm/nacl/libc.abilist -index 2f7751d167..dfa7198306 100644 ---- a/sysdeps/arm/nacl/libc.abilist -+++ b/sysdeps/arm/nacl/libc.abilist -@@ -1840,4 +1840,5 @@ GLIBC_2.23 fts64_close F - GLIBC_2.23 fts64_open F - GLIBC_2.23 fts64_read F - GLIBC_2.23 fts64_set F -+GLIBC_2.24 GLIBC_2.24 A - GLIBC_2.24 quick_exit F -diff --git a/sysdeps/arm/nptl/tcb-offsets.sym b/sysdeps/arm/nptl/tcb-offsets.sym -index 92cc441d3d..bf9c0a1c17 100644 ---- a/sysdeps/arm/nptl/tcb-offsets.sym -+++ b/sysdeps/arm/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h -index d5b8119c9c..ac57bd5db0 100644 ---- a/sysdeps/generic/unsecvars.h -+++ b/sysdeps/generic/unsecvars.h -@@ -4,11 +4,13 @@ - #define UNSECURE_ENVVARS \ - "GCONV_PATH\0" \ - "GETCONF_DIR\0" \ -+ "GLIBC_TUNABLES\0" \ - "HOSTALIASES\0" \ - "LD_AUDIT\0" \ - "LD_DEBUG\0" \ - "LD_DEBUG_OUTPUT\0" \ - "LD_DYNAMIC_WEAK\0" \ -+ "LD_HWCAP_MASK\0" \ - "LD_LIBRARY_PATH\0" \ - "LD_ORIGIN_PATH\0" \ - "LD_PRELOAD\0" \ -diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h -index 9404211819..01bd5bf197 100644 ---- a/sysdeps/hppa/dl-machine.h -+++ b/sysdeps/hppa/dl-machine.h -@@ -302,6 +302,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - #define ARCH_LA_PLTENTER hppa_gnu_pltenter - #define ARCH_LA_PLTEXIT hppa_gnu_pltexit - -+/* Adjust DL_STACK_END to get value we want in __libc_stack_end. */ -+#define DL_STACK_END(cookie) \ -+ ((void *) (((long) (cookie)) + 0x160)) -+ - /* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ -@@ -401,11 +405,6 @@ asm ( \ - /* Save the entry point in %r3. */ \ - " copy %ret0,%r3\n" \ - \ -- /* Remember the lowest stack address. */ \ --" addil LT'__libc_stack_end,%r19\n" \ --" ldw RT'__libc_stack_end(%r1),%r20\n" \ --" stw %sp,0(%r20)\n" \ -- \ - /* See if we were called as a command with the executable file \ - name as an extra leading argument. */ \ - " addil LT'_dl_skip_args,%r19\n" \ -diff --git a/sysdeps/hppa/nptl/tcb-offsets.sym b/sysdeps/hppa/nptl/tcb-offsets.sym -index c2f326ee3d..6e852f35b1 100644 ---- a/sysdeps/hppa/nptl/tcb-offsets.sym -+++ b/sysdeps/hppa/nptl/tcb-offsets.sym -@@ -3,7 +3,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) -@@ -14,6 +13,5 @@ MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) - -- This way we get the offset of a member in the struct pthread that - -- preceeds the thread pointer (which points to the dtv). - #define thread_offsetof(mem) (unsigned int)(offsetof(struct pthread, mem) - sizeof(struct pthread)) --PID_THREAD_OFFSET thread_offsetof (pid) - TID_THREAD_OFFSET thread_offsetof (tid) - MULTIPLE_THREADS_THREAD_OFFSET thread_offsetof (header.multiple_threads) -diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/i686/multiarch/strcspn-c.c -index 6d61e190a8..ec230fb383 100644 ---- a/sysdeps/i386/i686/multiarch/strcspn-c.c -+++ b/sysdeps/i386/i686/multiarch/strcspn-c.c -@@ -1,2 +1,4 @@ --#define __strcspn_sse2 __strcspn_ia32 --#include -+#if IS_IN (libc) -+# define __strcspn_sse2 __strcspn_ia32 -+# include -+#endif -diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/i686/multiarch/varshift.c -index 7760b966e2..6742a35d41 100644 ---- a/sysdeps/i386/i686/multiarch/varshift.c -+++ b/sysdeps/i386/i686/multiarch/varshift.c -@@ -1 +1,3 @@ --#include -+#if IS_IN (libc) -+# include -+#endif -diff --git a/sysdeps/i386/nptl/tcb-offsets.sym b/sysdeps/i386/nptl/tcb-offsets.sym -index 7bdf161b29..695a810386 100644 ---- a/sysdeps/i386/nptl/tcb-offsets.sym -+++ b/sysdeps/i386/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) -diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile -index 48f1327446..1e6be8eea8 100644 ---- a/sysdeps/ia64/nptl/Makefile -+++ b/sysdeps/ia64/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask -+libpthread-shared-only-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask - endif -diff --git a/sysdeps/ia64/nptl/tcb-offsets.sym b/sysdeps/ia64/nptl/tcb-offsets.sym -index e1707ab1c8..b01f712be2 100644 ---- a/sysdeps/ia64/nptl/tcb-offsets.sym -+++ b/sysdeps/ia64/nptl/tcb-offsets.sym -@@ -1,7 +1,6 @@ - #include - #include - --PID offsetof (struct pthread, pid) - TLS_PRE_TCB_SIZE - TID offsetof (struct pthread, tid) - TLS_PRE_TCB_SIZE - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - TLS_PRE_TCB_SIZE - SYSINFO_OFFSET offsetof (tcbhead_t, __private) -diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c -index 663fa392c2..bd758b5979 100644 ---- a/sysdeps/ieee754/dbl-64/e_pow.c -+++ b/sysdeps/ieee754/dbl-64/e_pow.c -@@ -466,15 +466,15 @@ checkint (double x) - return (n & 1) ? -1 : 1; /* odd or even */ - if (k > 20) - { -- if (n << (k - 20)) -+ if (n << (k - 20) != 0) - return 0; /* if not integer */ -- return (n << (k - 21)) ? -1 : 1; -+ return (n << (k - 21) != 0) ? -1 : 1; - } - if (n) - return 0; /*if not integer */ - if (k == 20) - return (m & 1) ? -1 : 1; -- if (m << (k + 12)) -+ if (m << (k + 12) != 0) - return 0; -- return (m << (k + 11)) ? -1 : 1; -+ return (m << (k + 11) != 0) ? -1 : 1; - } -diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m680x0/m68020/atomic-machine.h -index 24bc5c5ef7..65965cca9e 100644 ---- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h -+++ b/sysdeps/m68k/m680x0/m68020/atomic-machine.h -@@ -73,7 +73,7 @@ typedef uintmax_t uatomic_max_t; - __typeof (mem) __memp = (mem); \ - __asm __volatile ("cas2%.l %0:%R0,%1:%R1,(%2):(%3)" \ - : "=d" (__ret) \ -- : "d" (newval), "r" (__memp), \ -+ : "d" ((__typeof (*(mem))) (newval)), "r" (__memp), \ - "r" ((char *) __memp + 4), "0" (oldval) \ - : "memory"); \ - __ret; }) -@@ -101,8 +101,9 @@ typedef uintmax_t uatomic_max_t; - __asm __volatile ("1: cas2%.l %0:%R0,%1:%R1,(%2):(%3);" \ - " jbne 1b" \ - : "=d" (__result) \ -- : "d" (newvalue), "r" (__memp), \ -- "r" ((char *) __memp + 4), "0" (__result) \ -+ : "d" ((__typeof (*(mem))) (newvalue)), \ -+ "r" (__memp), "r" ((char *) __memp + 4), \ -+ "0" (__result) \ - : "memory"); \ - } \ - __result; }) -@@ -144,7 +145,7 @@ typedef uintmax_t uatomic_max_t; - " cas2%.l %0:%R0,%1:%R1,(%3):(%4);" \ - " jbne 1b" \ - : "=d" (__result), "=&d" (__temp) \ -- : "d" (value), "r" (__memp), \ -+ : "d" ((__typeof (*(mem))) (value)), "r" (__memp), \ - "r" ((char *) __memp + 4), "0" (__result) \ - : "memory"); \ - } \ -@@ -175,8 +176,9 @@ typedef uintmax_t uatomic_max_t; - " cas2%.l %0:%R0,%1:%R1,(%3):(%4);" \ - " jbne 1b" \ - : "=d" (__oldval), "=&d" (__temp) \ -- : "d" (value), "r" (__memp), \ -- "r" ((char *) __memp + 4), "0" (__oldval) \ -+ : "d" ((__typeof (*(mem))) (value)), \ -+ "r" (__memp), "r" ((char *) __memp + 4), \ -+ "0" (__oldval) \ - : "memory"); \ - } \ - }) -diff --git a/sysdeps/m68k/nptl/tcb-offsets.sym b/sysdeps/m68k/nptl/tcb-offsets.sym -index b1bba65868..241fb8b47c 100644 ---- a/sysdeps/m68k/nptl/tcb-offsets.sym -+++ b/sysdeps/m68k/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/microblaze/nptl/tcb-offsets.sym b/sysdeps/microblaze/nptl/tcb-offsets.sym -index 18afbee291..614f0dfed6 100644 ---- a/sysdeps/microblaze/nptl/tcb-offsets.sym -+++ b/sysdeps/microblaze/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - sizeof (struct pthread)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile -index 3d3552322b..7c1d77941e 100644 ---- a/sysdeps/mips/Makefile -+++ b/sysdeps/mips/Makefile -@@ -9,6 +9,7 @@ endif - - ifeq ($(subdir),rt) - librt-sysdep_routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),debug) -diff --git a/sysdeps/mips/mips32/crti.S b/sysdeps/mips/mips32/crti.S -index 5c0ad7328a..dfbbdc4f8f 100644 ---- a/sysdeps/mips/mips32/crti.S -+++ b/sysdeps/mips/mips32/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - lw $25,%got(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/mips64/n32/crti.S b/sysdeps/mips/mips64/n32/crti.S -index 00b89f3894..afe6d8edaa 100644 ---- a/sysdeps/mips/mips64/n32/crti.S -+++ b/sysdeps/mips/mips64/n32/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - lw $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/mips64/n64/crti.S b/sysdeps/mips/mips64/n64/crti.S -index f59b20c631..4049d29290 100644 ---- a/sysdeps/mips/mips64/n64/crti.S -+++ b/sysdeps/mips/mips64/n64/crti.S -@@ -74,6 +74,7 @@ _init: - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION - 1: jalr $25 - .Lno_weak_fn: -+ .insn - #else - ld $25,%got_disp(PREINIT_FUNCTION)($28) - .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION -diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile -index 117744ffe2..dda154d842 100644 ---- a/sysdeps/mips/nptl/Makefile -+++ b/sysdeps/mips/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-sysdep_routines += nptl-sysdep -+libpthread-shared-only-routines += nptl-sysdep - endif -diff --git a/sysdeps/mips/nptl/tcb-offsets.sym b/sysdeps/mips/nptl/tcb-offsets.sym -index e0e71dc430..9ea25b94a8 100644 ---- a/sysdeps/mips/nptl/tcb-offsets.sym -+++ b/sysdeps/mips/nptl/tcb-offsets.sym -@@ -7,5 +7,4 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) -diff --git a/sysdeps/nacl/clock.c b/sysdeps/nacl/clock.c -index 664ad650c3..b6fbcfd2dd 100644 ---- a/sysdeps/nacl/clock.c -+++ b/sysdeps/nacl/clock.c -@@ -24,6 +24,6 @@ - clock_t - clock (void) - { -- nacl_abi_clock_t result; -+ nacl_irt_clock_t result; - return NACL_CALL (__nacl_irt_basic.clock (&result), result); - } -diff --git a/sysdeps/nacl/dup.c b/sysdeps/nacl/dup.c -index 34a7cd46d4..cbce3f5a5a 100644 ---- a/sysdeps/nacl/dup.c -+++ b/sysdeps/nacl/dup.c -@@ -27,4 +27,5 @@ __dup (int fd) - int result; - return NACL_CALL (__nacl_irt_fdio.dup (fd, &result), result); - } -+libc_hidden_def (__dup) - weak_alias (__dup, dup) -diff --git a/sysdeps/nios2/nptl/tcb-offsets.sym b/sysdeps/nios2/nptl/tcb-offsets.sym -index d9ae952585..3cd8d984ac 100644 ---- a/sysdeps/nios2/nptl/tcb-offsets.sym -+++ b/sysdeps/nios2/nptl/tcb-offsets.sym -@@ -9,6 +9,5 @@ - # define thread_offsetof(mem) ((ptrdiff_t) THREAD_SELF + offsetof (struct pthread, mem)) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c -index 616d897a36..a5d1e86d71 100644 ---- a/sysdeps/nptl/fork.c -+++ b/sysdeps/nptl/fork.c -@@ -131,16 +131,6 @@ __libc_fork (void) - __malloc_fork_lock_parent (); - } - --#ifndef NDEBUG -- pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid); --#endif -- -- /* We need to prevent the getpid() code to update the PID field so -- that, if a signal arrives in the child very early and the signal -- handler uses getpid(), the value returned is correct. */ -- pid_t parentpid = THREAD_GETMEM (THREAD_SELF, pid); -- THREAD_SETMEM (THREAD_SELF, pid, -parentpid); -- - #ifdef ARCH_FORK - pid = ARCH_FORK (); - #else -@@ -153,15 +143,10 @@ __libc_fork (void) - { - struct pthread *self = THREAD_SELF; - -- assert (THREAD_GETMEM (self, tid) != ppid); -- - /* See __pthread_once. */ - if (__fork_generation_pointer != NULL) - *__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR; - -- /* Adjust the PID field for the new process. */ -- THREAD_SETMEM (self, pid, THREAD_GETMEM (self, tid)); -- - #if HP_TIMING_AVAIL - /* The CPU clock of the thread and process have to be set to zero. */ - hp_timing_t now; -@@ -231,11 +216,6 @@ __libc_fork (void) - } - else - { -- assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid); -- -- /* Restore the PID value. */ -- THREAD_SETMEM (THREAD_SELF, pid, parentpid); -- - /* Release acquired locks in the multi-threaded case. */ - if (multiple_threads) - { -diff --git a/sysdeps/posix/wait3.c b/sysdeps/posix/wait3.c -index cf43d973a7..73722d2be6 100644 ---- a/sysdeps/posix/wait3.c -+++ b/sysdeps/posix/wait3.c -@@ -33,7 +33,7 @@ __wait3 (int *stat_loc, int options, struct rusage *usage) - __set_errno (ENOSYS); - return (pid_t) -1; - } -- return __waitpid (WAIT_ANY, stat_loc.__iptr, options); -+ return __waitpid (WAIT_ANY, stat_loc, options); - } - - weak_alias (__wait3, wait3) -diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps -index 7f37c813d0..36b700c520 100644 ---- a/sysdeps/powerpc/fpu/libm-test-ulps -+++ b/sysdeps/powerpc/fpu/libm-test-ulps -@@ -36,8 +36,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "acosh_downward": - double: 1 -@@ -52,8 +52,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "acosh_upward": - double: 2 -@@ -122,8 +122,8 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 4 --ldouble: 4 -+ildouble: 7 -+ldouble: 7 - - Function: "atan": - double: 1 -@@ -216,8 +216,8 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "cabs": - double: 1 -@@ -272,8 +272,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "cacos_towardzero": - double: 2 -@@ -288,8 +288,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "cacos_upward": - double: 2 -@@ -328,8 +328,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "cacosh_downward": - double: 2 -@@ -344,8 +344,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "cacosh_towardzero": - double: 2 -@@ -432,8 +432,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "casin_towardzero": - double: 3 -@@ -448,8 +448,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Real part of "casin_upward": - double: 2 -@@ -488,8 +488,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "casinh_downward": - double: 3 -@@ -504,8 +504,8 @@ double: 5 - float: 3 - idouble: 5 - ifloat: 3 --ildouble: 5 --ldouble: 5 -+ildouble: 8 -+ldouble: 8 - - Function: Imaginary part of "casinh_towardzero": - double: 3 -@@ -696,8 +696,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Real part of "ccos_downward": - double: 1 -@@ -1132,8 +1132,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Imaginary part of "csin": - ildouble: 1 -@@ -1198,8 +1198,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: Real part of "csinh_downward": - double: 2 -@@ -1318,8 +1318,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: Imaginary part of "ctan": - double: 2 -@@ -1390,8 +1390,8 @@ double: 2 - float: 1 - idouble: 2 - ifloat: 1 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: Real part of "ctanh_downward": - double: 4 -@@ -1478,8 +1478,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: "erfc_downward": - double: 3 -@@ -1564,8 +1564,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "exp2_upward": - double: 1 -@@ -1588,8 +1588,8 @@ ildouble: 2 - ldouble: 2 - - Function: "exp_upward": --float: 1 - double: 1 -+float: 1 - idouble: 1 - ifloat: 1 - ildouble: 1 -@@ -1624,8 +1624,8 @@ double: 1 - float: 1 - idouble: 1 - ifloat: 1 --ildouble: 4 --ldouble: 4 -+ildouble: 6 -+ldouble: 6 - - Function: "fma": - ildouble: 1 -@@ -1688,8 +1688,8 @@ double: 4 - float: 5 - idouble: 4 - ifloat: 5 --ildouble: 10 --ldouble: 10 -+ildouble: 11 -+ldouble: 11 - - Function: "hypot": - double: 1 -@@ -1752,8 +1752,8 @@ double: 1 - float: 2 - idouble: 1 - ifloat: 2 --ildouble: 1 --ldouble: 1 -+ildouble: 2 -+ldouble: 2 - - Function: "j1_downward": - double: 3 -@@ -1840,8 +1840,8 @@ double: 4 - float: 5 - idouble: 4 - ifloat: 5 --ildouble: 10 --ldouble: 10 -+ildouble: 11 -+ldouble: 11 - - Function: "log": - float: 1 -@@ -1910,8 +1910,8 @@ double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 2 --ldouble: 2 -+ildouble: 3 -+ldouble: 3 - - Function: "log2": - double: 1 -@@ -2184,16 +2184,16 @@ double: 3 - float: 3 - idouble: 3 - ifloat: 3 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "tanh_towardzero": - double: 2 - float: 2 - idouble: 2 - ifloat: 2 --ildouble: 3 --ldouble: 3 -+ildouble: 4 -+ldouble: 4 - - Function: "tanh_upward": - double: 3 -diff --git a/sysdeps/powerpc/ifunc-sel.h b/sysdeps/powerpc/ifunc-sel.h -index 526d8ed88b..ac589bd3c0 100644 ---- a/sysdeps/powerpc/ifunc-sel.h -+++ b/sysdeps/powerpc/ifunc-sel.h -@@ -17,15 +17,17 @@ ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void)) - "addis %0,11,%2-1b@ha\n\t" - "addi %0,%0,%2-1b@l\n\t" - "cmpwi 12,1\n\t" -- "beqlr\n\t" -+ "beq 2f\n\t" - "addis %0,11,%3-1b@ha\n\t" - "addi %0,%0,%3-1b@l\n\t" - "cmpwi 12,-1\n\t" -- "beqlr\n\t" -+ "beq 2f\n\t" - "addis %0,11,%4-1b@ha\n\t" -- "addi %0,%0,%4-1b@l" -+ "addi %0,%0,%4-1b@l\n\t" -+ "2:" - : "=r" (ret) -- : "X" (&global), "X" (f1), "X" (f2), "X" (f3)); -+ : "i" (&global), "i" (f1), "i" (f2), "i" (f3) -+ : "11", "12", "cr0"); - return ret; - } - -@@ -40,7 +42,8 @@ ifunc_one (int (*f1) (void)) - "addis %0,%0,%1-1b@ha\n\t" - "addi %0,%0,%1-1b@l" - : "=r" (ret) -- : "X" (f1)); -+ : "i" (f1) -+ : "12"); - return ret; - } - #endif -diff --git a/sysdeps/powerpc/nptl/tcb-offsets.sym b/sysdeps/powerpc/nptl/tcb-offsets.sym -index f580e69555..7c9fd33562 100644 ---- a/sysdeps/powerpc/nptl/tcb-offsets.sym -+++ b/sysdeps/powerpc/nptl/tcb-offsets.sym -@@ -13,7 +13,6 @@ - #if TLS_MULTIPLE_THREADS_IN_TCB - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) - #endif --PID thread_offsetof (pid) - TID thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) - TAR_SAVE (offsetof (tcbhead_t, tar_save) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S -index b2a222edd2..d5dbe83af2 100644 ---- a/sysdeps/powerpc/powerpc32/power6/memset.S -+++ b/sysdeps/powerpc/powerpc32/power6/memset.S -@@ -394,7 +394,7 @@ L(cacheAlignedx): - /* A simple loop for the longer (>640 bytes) lengths. This form limits - the branch miss-predicted to exactly 1 at loop exit.*/ - L(cacheAligned512): -- cmpli cr1,rLEN,128 -+ cmplwi cr1,rLEN,128 - blt cr1,L(cacheAligned1) - dcbz 0,rMEMP - addi rLEN,rLEN,-128 -diff --git a/sysdeps/powerpc/powerpc32/power9/multiarch/Implies b/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -index 4393b56872..1a46ef0035 100644 ---- a/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -+++ b/sysdeps/powerpc/powerpc32/power9/multiarch/Implies -@@ -1 +1 @@ --powerpc/powerpc32/power8/fpu/multiarch -+powerpc/powerpc32/power8/multiarch -diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S -index c2d1c4e600..d445b1e1ef 100644 ---- a/sysdeps/powerpc/powerpc64/power6/memset.S -+++ b/sysdeps/powerpc/powerpc64/power6/memset.S -@@ -251,7 +251,7 @@ L(cacheAlignedx): - /* A simple loop for the longer (>640 bytes) lengths. This form limits - the branch miss-predicted to exactly 1 at loop exit.*/ - L(cacheAligned512): -- cmpli cr1,rLEN,128 -+ cmpldi cr1,rLEN,128 - blt cr1,L(cacheAligned1) - dcbz 0,rMEMP - addi rLEN,rLEN,-128 -diff --git a/sysdeps/powerpc/powerpc64/power9/fpu/Implies b/sysdeps/powerpc/powerpc64/power9/fpu/Implies -index fad2505ab9..ae0dbaf857 100644 ---- a/sysdeps/powerpc/powerpc64/power9/fpu/Implies -+++ b/sysdeps/powerpc/powerpc64/power9/fpu/Implies -@@ -1,2 +1 @@ - powerpc/powerpc64/power8/fpu --powerpc/powerpc64/power8 -diff --git a/sysdeps/s390/nptl/Makefile b/sysdeps/s390/nptl/Makefile -index 5734b983b0..3a391c8217 100644 ---- a/sysdeps/s390/nptl/Makefile -+++ b/sysdeps/s390/nptl/Makefile -@@ -21,4 +21,5 @@ endif - - ifeq ($(subdir),nptl) - libpthread-routines += ptw-sysdep -+libpthread-shared-only-routines += ptw-sysdep - endif -diff --git a/sysdeps/s390/nptl/tcb-offsets.sym b/sysdeps/s390/nptl/tcb-offsets.sym -index 9cfae211e0..9c1c01f353 100644 ---- a/sysdeps/s390/nptl/tcb-offsets.sym -+++ b/sysdeps/s390/nptl/tcb-offsets.sym -@@ -3,5 +3,4 @@ - - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) - STACK_GUARD offsetof (tcbhead_t, stack_guard) --PID offsetof (struct pthread, pid) - TID offsetof (struct pthread, tid) -diff --git a/sysdeps/sh/nptl/tcb-offsets.sym b/sysdeps/sh/nptl/tcb-offsets.sym -index ac63b5b93b..4963e1506f 100644 ---- a/sysdeps/sh/nptl/tcb-offsets.sym -+++ b/sysdeps/sh/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) -diff --git a/sysdeps/sparc/nptl/tcb-offsets.sym b/sysdeps/sparc/nptl/tcb-offsets.sym -index 923af8a5b7..f75d02065e 100644 ---- a/sysdeps/sparc/nptl/tcb-offsets.sym -+++ b/sysdeps/sparc/nptl/tcb-offsets.sym -@@ -3,5 +3,4 @@ - - MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) - POINTER_GUARD offsetof (tcbhead_t, pointer_guard) --PID offsetof (struct pthread, pid) - TID offsetof (struct pthread, tid) -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -index ebbe28b07f..13d3c6db51 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile -@@ -4,8 +4,8 @@ libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \ - s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \ - s_rintf-vis3 s_rint-vis3 w_sqrt-vis3 w_sqrtf-vis3 \ - s_fminf-vis3 s_fmin-vis3 s_fmaxf-vis3 s_fmax-vis3 \ -- s_fmaf-vis3 s_fma-vis3 s_fdimf-vis3 s_fdim-vis3 \ -- s_nearbyint-vis3 s_nearbyintf-vis3 -+ s_fmaf-vis3 s_fma-vis3 s_nearbyint-vis3 \ -+ s_nearbyintf-vis3 - sysdep_routines += s_copysignf-vis3 s_copysign-vis3 - endif - endif -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S -deleted file mode 100644 -index 4b13408244..0000000000 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S -+++ /dev/null -@@ -1,19 +0,0 @@ --#include --#include -- --SPARC_ASM_VIS3_IFUNC(fdim) -- --weak_alias (__fdim, fdim) -- --#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) --compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); --#endif -- --# undef weak_alias --# define weak_alias(a, b) --# undef compat_symbol --# define compat_symbol(a, b, c, d) -- --#define __fdim __fdim_generic -- --#include "../s_fdim.S" -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S -deleted file mode 100644 -index 30381d6a59..0000000000 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S -+++ /dev/null -@@ -1,12 +0,0 @@ --#include -- --SPARC_ASM_VIS3_IFUNC(fdimf) -- --weak_alias (__fdimf, fdimf) -- --# undef weak_alias --# define weak_alias(a, b) -- --#define __fdimf __fdimf_generic -- --#include "../s_fdimf.S" -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -index d9ff0cc288..ff81b0da83 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S -@@ -36,15 +36,15 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyint_vis3) -+ sllx %o0, 32, %o0 -+ or %o0, %o1, %o0 -+ movxtod %o0, %f0 - fcmpd %fcc3, %f0, %f0 /* Check for sNaN */ - st %fsr, [%sp + 88] - sethi %hi(TWO_FIFTYTWO), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -- sllx %o0, 32, %o0 - or %o5, %lo(0xf8003e0), %o5 -- or %o0, %o1, %o0 -- movxtod %o0, %f0 - andn %o4, %o5, %o4 - fzero ZERO - st %o4, [%sp + 80] -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -index 5cd1eb02db..833a0dfc24 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S -@@ -35,9 +35,9 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyintf_vis3) -+ movwtos %o0, %f1 - fcmps %fcc3, %f1, %f1 /* Check for sNaN */ - st %fsr, [%sp + 88] -- movwtos %o0, %f1 - sethi %hi(TWO_TWENTYTHREE), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -index 84a10971a4..198440a5bc 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S -@@ -36,21 +36,21 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyint) -+ sllx %o0, 32, %o0 -+ or %o0, %o1, %o0 -+ stx %o0, [%sp + 72] -+ ldd [%sp + 72], %f0 - fcmpd %fcc3, %f0, %f0 /* Check for sNaN */ - st %fsr, [%sp + 88] - sethi %hi(TWO_FIFTYTWO), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -- sllx %o0, 32, %o0 - or %o5, %lo(0xf8003e0), %o5 -- or %o0, %o1, %o0 - andn %o4, %o5, %o4 - fzero ZERO - st %o4, [%sp + 80] -- stx %o0, [%sp + 72] - sllx %o2, 32, %o2 - fnegd ZERO, SIGN_BIT -- ldd [%sp + 72], %f0 - ld [%sp + 80], %fsr - stx %o2, [%sp + 72] - fabsd %f0, %f14 -diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -index d5cf5ce815..9be41f6c22 100644 ---- a/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S -@@ -35,9 +35,10 @@ - #define SIGN_BIT %f12 /* -0.0 */ - - ENTRY (__nearbyintf) -+ st %o0, [%sp + 68] -+ ld [%sp + 68], %f1 - fcmps %fcc3, %f1, %f1 /* Check for sNaN */ - st %fsr, [%sp + 88] -- st %o0, [%sp + 68] - sethi %hi(TWO_TWENTYTHREE), %o2 - sethi %hi(0xf8003e0), %o5 - ld [%sp + 88], %o4 -@@ -46,7 +47,6 @@ ENTRY (__nearbyintf) - fnegs ZERO, SIGN_BIT - andn %o4, %o5, %o4 - st %o4, [%sp + 80] -- ld [%sp + 68], %f1 - ld [%sp + 80], %fsr - st %o2, [%sp + 68] - fabss %f1, %f14 -diff --git a/sysdeps/tile/nptl/tcb-offsets.sym b/sysdeps/tile/nptl/tcb-offsets.sym -index 6740bc976f..0147ffafb7 100644 ---- a/sysdeps/tile/nptl/tcb-offsets.sym -+++ b/sysdeps/tile/nptl/tcb-offsets.sym -@@ -9,7 +9,6 @@ - #define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - - MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) --PID_OFFSET thread_offsetof (pid) - TID_OFFSET thread_offsetof (tid) - POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) - FEEDBACK_DATA_OFFSET (offsetof (tcbhead_t, feedback_data) - TLS_TCB_OFFSET - sizeof (tcbhead_t)) -diff --git a/sysdeps/unix/alpha/Makefile b/sysdeps/unix/alpha/Makefile -index 441aa02a83..0660847f15 100644 ---- a/sysdeps/unix/alpha/Makefile -+++ b/sysdeps/unix/alpha/Makefile -@@ -1,3 +1,4 @@ - ifeq ($(subdir),rt) - librt-sysdep_routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif -diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h -index 94a2ce0e37..38c2432002 100644 ---- a/sysdeps/unix/sysdep.h -+++ b/sysdeps/unix/sysdep.h -@@ -24,42 +24,79 @@ - #define SYSCALL__(name, args) PSEUDO (__##name, name, args) - #define SYSCALL(name, args) PSEUDO (name, name, args) - --#define __SYSCALL0(name) \ -+#define __SYSCALL_CONCAT_X(a,b) a##b -+#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) -+ -+ -+#define __INTERNAL_SYSCALL0(name, err) \ -+ INTERNAL_SYSCALL (name, err, 0) -+#define __INTERNAL_SYSCALL1(name, err, a1) \ -+ INTERNAL_SYSCALL (name, err, 1, a1) -+#define __INTERNAL_SYSCALL2(name, err, a1, a2) \ -+ INTERNAL_SYSCALL (name, err, 2, a1, a2) -+#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ -+ INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) -+#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ -+ INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) -+#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ -+ INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) -+#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ -+ INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) -+#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ -+ INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) -+ -+#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o -+#define __INTERNAL_SYSCALL_NARGS(...) \ -+ __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) -+#define __INTERNAL_SYSCALL_DISP(b,...) \ -+ __SYSCALL_CONCAT (b,__INTERNAL_SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) -+ -+/* Issue a syscall defined by syscall number plus any other argument required. -+ It is similar to INTERNAL_SYSCALL macro, but without the need to pass the -+ expected argument number as second parameter. */ -+#define INTERNAL_SYSCALL_CALL(...) \ -+ __INTERNAL_SYSCALL_DISP (__INTERNAL_SYSCALL, __VA_ARGS__) -+ -+#define __INLINE_SYSCALL0(name) \ - INLINE_SYSCALL (name, 0) --#define __SYSCALL1(name, a1) \ -+#define __INLINE_SYSCALL1(name, a1) \ - INLINE_SYSCALL (name, 1, a1) --#define __SYSCALL2(name, a1, a2) \ -+#define __INLINE_SYSCALL2(name, a1, a2) \ - INLINE_SYSCALL (name, 2, a1, a2) --#define __SYSCALL3(name, a1, a2, a3) \ -+#define __INLINE_SYSCALL3(name, a1, a2, a3) \ - INLINE_SYSCALL (name, 3, a1, a2, a3) --#define __SYSCALL4(name, a1, a2, a3, a4) \ -+#define __INLINE_SYSCALL4(name, a1, a2, a3, a4) \ - INLINE_SYSCALL (name, 4, a1, a2, a3, a4) --#define __SYSCALL5(name, a1, a2, a3, a4, a5) \ -+#define __INLINE_SYSCALL5(name, a1, a2, a3, a4, a5) \ - INLINE_SYSCALL (name, 5, a1, a2, a3, a4, a5) --#define __SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ -+#define __INLINE_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ - INLINE_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6) --#define __SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ -+#define __INLINE_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ - INLINE_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7) - --#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n --#define __SYSCALL_NARGS(...) \ -- __SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) --#define __SYSCALL_CONCAT_X(a,b) a##b --#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) --#define __SYSCALL_DISP(b,...) \ -- __SYSCALL_CONCAT (b,__SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) -+#define __INLINE_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n -+#define __INLINE_SYSCALL_NARGS(...) \ -+ __INLINE_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) -+#define __INLINE_SYSCALL_DISP(b,...) \ -+ __SYSCALL_CONCAT (b,__INLINE_SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__) - --#define __SYSCALL_CALL(...) __SYSCALL_DISP (__SYSCALL, __VA_ARGS__) -+/* Issue a syscall defined by syscall number plus any other argument -+ required. Any error will be handled using arch defined macros and errno -+ will be set accordingly. -+ It is similar to INLINE_SYSCALL macro, but without the need to pass the -+ expected argument number as second parameter. */ -+#define INLINE_SYSCALL_CALL(...) \ -+ __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) - - #define SYSCALL_CANCEL(...) \ - ({ \ - long int sc_ret; \ - if (SINGLE_THREAD_P) \ -- sc_ret = __SYSCALL_CALL (__VA_ARGS__); \ -+ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ - else \ - { \ - int sc_cancel_oldtype = LIBC_CANCEL_ASYNC (); \ -- sc_ret = __SYSCALL_CALL (__VA_ARGS__); \ -+ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ - LIBC_CANCEL_RESET (sc_cancel_oldtype); \ - } \ - sc_ret; \ -diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S -index 76baa7a698..96482e53c0 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/clone.S -+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S -@@ -72,16 +72,6 @@ thread_start: - cfi_undefined (x30) - mov x29, 0 - -- tbnz x11, #CLONE_VM_BIT, 1f -- -- mov x8, #SYS_ify(getpid) -- svc 0x0 -- mrs x1, tpidr_el0 -- sub x1, x1, #PTHREAD_SIZEOF -- str w0, [x1, #PTHREAD_PID_OFFSET] -- str w0, [x1, #PTHREAD_TID_OFFSET] --1: -- - /* Pick the function arg and execute. */ - mov x0, x12 - blr x10 -diff --git a/sysdeps/unix/sysv/linux/aarch64/vfork.S b/sysdeps/unix/sysv/linux/aarch64/vfork.S -index 577895eeb2..aeed0b29ce 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/vfork.S -+++ b/sysdeps/unix/sysv/linux/aarch64/vfork.S -@@ -27,27 +27,10 @@ - - ENTRY (__vfork) - -- /* Save the TCB-cached PID away in w3, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- mrs x2, tpidr_el0 -- sub x2, x2, #PTHREAD_SIZEOF -- ldr w3, [x2, #PTHREAD_PID_OFFSET] -- mov w1, #0x80000000 -- negs w0, w3 -- csel w0, w1, w0, eq -- str w0, [x2, #PTHREAD_PID_OFFSET] -- - mov x0, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */ - mov x1, sp - DO_CALL (clone, 2) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- cbz x0, 1f -- str w3, [x2, #PTHREAD_PID_OFFSET] --1: - cmn x0, #4095 - b.cs .Lsyscall_error - RET -diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile -index c089545e9b..3b523b70cf 100644 ---- a/sysdeps/unix/sysv/linux/alpha/Makefile -+++ b/sysdeps/unix/sysv/linux/alpha/Makefile -@@ -40,4 +40,5 @@ endif # math - ifeq ($(subdir),nptl) - # pull in __syscall_error routine, __sigprocmask, __syscall_rt_sigaction - libpthread-routines += ptw-sysdep ptw-sigprocmask ptw-rt_sigaction -+libpthread-shared-only-routines += ptw-sysdep ptw-sigprocmask ptw-rt_sigaction - endif -diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S -index 6a3154f9a7..2757bf20c3 100644 ---- a/sysdeps/unix/sysv/linux/alpha/clone.S -+++ b/sysdeps/unix/sysv/linux/alpha/clone.S -@@ -91,13 +91,6 @@ thread_start: - cfi_def_cfa_register(fp) - cfi_undefined(ra) - -- /* Check and see if we need to reset the PID. */ -- ldq t0, 16(sp) -- lda t1, CLONE_VM -- and t0, t1, t2 -- beq t2, 2f --1: -- - /* Load up the arguments. */ - ldq pv, 0(sp) - ldq a0, 8(sp) -@@ -120,15 +113,6 @@ thread_start: - halt - - .align 4 --2: -- rduniq -- mov v0, s0 -- lda v0, __NR_getxpid -- callsys --3: -- stl v0, PID_OFFSET(s0) -- stl v0, TID_OFFSET(s0) -- br 1b - cfi_endproc - .end thread_start - -diff --git a/sysdeps/unix/sysv/linux/alpha/vfork.S b/sysdeps/unix/sysv/linux/alpha/vfork.S -index 9fc199ac41..e5f7ed0661 100644 ---- a/sysdeps/unix/sysv/linux/alpha/vfork.S -+++ b/sysdeps/unix/sysv/linux/alpha/vfork.S -@@ -25,24 +25,9 @@ ENTRY(__libc_vfork) - rduniq - mov v0, a1 - -- /* Save the TCB-cached PID away in A2, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- ldl a2, PID_OFFSET(v0) -- ldah t0, -0x8000 -- negl a2, t1 -- cmovne a2, t1, t0 -- stl t0, PID_OFFSET(v0); -- - lda v0, SYS_ify(vfork) - call_pal PAL_callsys - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- beq v0, 1f -- stl a2, PID_OFFSET(a1) --1: - /* Normal error check and return. */ - bne a3, SYSCALL_ERROR_LABEL - ret -diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S -index 7ff681804b..4c6325d088 100644 ---- a/sysdeps/unix/sysv/linux/arm/clone.S -+++ b/sysdeps/unix/sysv/linux/arm/clone.S -@@ -70,16 +70,6 @@ PSEUDO_END (__clone) - 1: - .fnstart - .cantunwind -- tst ip, #CLONE_VM -- bne 2f -- GET_TLS (lr) -- mov r1, r0 -- ldr r7, =SYS_ify(getpid) -- swi 0x0 -- NEGOFF_ADJ_BASE (r1, TID_OFFSET) -- str r0, NEGOFF_OFF1 (r1, TID_OFFSET) -- str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET) --2: - @ pick the function arg and call address off the stack and execute - ldr r0, [sp, #4] - ldr ip, [sp], #8 -diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S -index 603e508858..d1f168fece 100644 ---- a/sysdeps/unix/sysv/linux/arm/setcontext.S -+++ b/sysdeps/unix/sysv/linux/arm/setcontext.S -@@ -86,12 +86,19 @@ weak_alias(__setcontext, setcontext) - - /* Called when a makecontext() context returns. Start the - context in R4 or fall through to exit(). */ -+ /* Unwind descriptors are looked up based on PC - 2, so we have to -+ make sure to mark the instruction preceding the __startcontext -+ label as .cantunwind. */ -+ .fnstart -+ .cantunwind -+ nop - ENTRY(__startcontext) - movs r0, r4 - bne PLTJMP(__setcontext) - - @ New context was 0 - exit - b PLTJMP(HIDDEN_JUMPTARGET(exit)) -+ .fnend - END(__startcontext) - - #ifdef PIC -diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S -index 500f5ca4be..794372ee12 100644 ---- a/sysdeps/unix/sysv/linux/arm/vfork.S -+++ b/sysdeps/unix/sysv/linux/arm/vfork.S -@@ -28,16 +28,6 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__vfork) -- /* Save the PID value. */ -- GET_TLS (r2) -- NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET) /* Save the TLS addr in r2. */ -- ldr r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* Load the saved PID. */ -- rsbs r0, r3, #0 /* Negate it, and test for zero. */ -- /* Use 0x80000000 if it was 0. See raise.c for how this is used. */ -- it eq -- moveq r0, #0x80000000 -- str r0, NEGOFF_OFF1 (r2, PID_OFFSET) /* Store the temp PID. */ -- - /* The DO_CALL macro saves r7 on the stack, to enable generation - of ARM unwind info. Since the stack is initially shared between - parent and child of vfork, that saved value could be corrupted. -@@ -57,11 +47,6 @@ ENTRY (__vfork) - mov r7, ip - cfi_restore (r7) - -- /* Restore the old PID value in the parent. */ -- cmp r0, #0 /* If we are the parent... */ -- it ne -- strne r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* restore the saved PID. */ -- - cmn a1, #4096 - it cc - RETINSTR(cc, lr) -diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c -index 6d32cece48..ec86f50814 100644 ---- a/sysdeps/unix/sysv/linux/createthread.c -+++ b/sysdeps/unix/sysv/linux/createthread.c -@@ -128,10 +128,10 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, - /* The operation failed. We have to kill the thread. - We let the normal cancellation mechanism do the work. */ - -+ pid_t pid = __getpid (); - INTERNAL_SYSCALL_DECL (err2); -- (void) INTERNAL_SYSCALL (tgkill, err2, 3, -- THREAD_GETMEM (THREAD_SELF, pid), -- pd->tid, SIGCANCEL); -+ (void) INTERNAL_SYSCALL_CALL (tgkill, err2, pid, pd->tid, -+ SIGCANCEL); - - return INTERNAL_SYSCALL_ERRNO (res, err); - } -diff --git a/sysdeps/unix/sysv/linux/getpid.c b/sysdeps/unix/sysv/linux/getpid.c -deleted file mode 100644 -index 1124549326..0000000000 ---- a/sysdeps/unix/sysv/linux/getpid.c -+++ /dev/null -@@ -1,64 +0,0 @@ --/* Copyright (C) 2003-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 2003. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- . */ -- --#include --#include --#include -- -- --#if IS_IN (libc) --static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval); -- --static inline __attribute__((always_inline)) pid_t --really_getpid (pid_t oldval) --{ -- if (__glibc_likely (oldval == 0)) -- { -- pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid); -- if (__glibc_likely (selftid != 0)) -- return selftid; -- } -- -- INTERNAL_SYSCALL_DECL (err); -- pid_t result = INTERNAL_SYSCALL (getpid, err, 0); -- -- /* We do not set the PID field in the TID here since we might be -- called from a signal handler while the thread executes fork. */ -- if (oldval == 0) -- THREAD_SETMEM (THREAD_SELF, tid, result); -- return result; --} --#endif -- --pid_t --__getpid (void) --{ --#if !IS_IN (libc) -- INTERNAL_SYSCALL_DECL (err); -- pid_t result = INTERNAL_SYSCALL (getpid, err, 0); --#else -- pid_t result = THREAD_GETMEM (THREAD_SELF, pid); -- if (__glibc_unlikely (result <= 0)) -- result = really_getpid (result); --#endif -- return result; --} -- --libc_hidden_def (__getpid) --weak_alias (__getpid, getpid) --libc_hidden_def (getpid) -diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S -index 3d037f1430..25fcd497f7 100644 ---- a/sysdeps/unix/sysv/linux/hppa/clone.S -+++ b/sysdeps/unix/sysv/linux/hppa/clone.S -@@ -132,18 +132,6 @@ ENTRY(__clone) - ldwm -64(%sp), %r4 - - .LthreadStart: --# define CLONE_VM_BIT 23 /* 0x00000100 */ -- /* Load original clone flags. -- If CLONE_VM was passed, don't modify PID/TID. -- Otherwise store the result of getpid to PID/TID. */ -- ldw -56(%sp), %r26 -- bb,<,n %r26, CLONE_VM_BIT, 1f -- ble 0x100(%sr2, %r0) -- ldi __NR_getpid, %r20 -- mfctl %cr27, %r26 -- stw %ret0, PID_THREAD_OFFSET(%r26) -- stw %ret0, TID_THREAD_OFFSET(%r26) --1: - /* Load up the arguments. */ - ldw -60(%sp), %arg0 - ldw -64(%sp), %r22 -diff --git a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S b/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -index df532362d2..4684048502 100644 ---- a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -+++ b/sysdeps/unix/sysv/linux/hppa/pt-vfork.S -@@ -25,26 +25,6 @@ - replaced by a call to `execve'. Return -1 for errors, 0 to the new process, - and the process ID of the new process to the old process. */ - --/* Load the thread register. -- Load the saved PID value. -- Negate the value. -- Store the temporary PID. */ --#define SAVE_PID \ -- mfctl %cr27, %r26 ASM_LINE_SEP \ -- ldw PID_THREAD_OFFSET(%r26),%r1 ASM_LINE_SEP \ -- sub %r0,%r1,%r1 ASM_LINE_SEP \ -- stw %r1,PID_THREAD_OFFSET(%r26) ASM_LINE_SEP --/* If we are the parent... -- Get the thread pointer. -- Load the saved PID. -- Negate the value (got back original) -- Restore the PID. */ --#define RESTORE_PID \ -- cmpb,=,n %r0,%ret0,.Lthread_start ASM_LINE_SEP \ -- mfctl %cr27, %r26 ASM_LINE_SEP \ -- ldw PID_THREAD_OFFSET(%r26),%r1 ASM_LINE_SEP \ -- sub %r0,%r1,%r1 ASM_LINE_SEP \ -- stw %r1,PID_THREAD_OFFSET(%r26) ASM_LINE_SEP \ - .Lthread_start: ASM_LINE_SEP - - /* r26, r25, r24, r23 are free since vfork has no arguments */ -@@ -58,16 +38,10 @@ ENTRY(__vfork) - copy %r19, %r25 /* parent */ - #endif - -- /* Save the process PID */ -- SAVE_PID -- - /* Syscall saves and restores all register states */ - ble 0x100(%sr2,%r0) - ldi __NR_vfork,%r20 - -- /* Conditionally restore the PID */ -- RESTORE_PID -- - /* Check for error */ - ldi -4096,%r1 - comclr,>>= %r1,%ret0,%r0 /* Note: unsigned compare. */ -diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile -index 71ba61e9d7..6073a9fe04 100644 ---- a/sysdeps/unix/sysv/linux/i386/Makefile -+++ b/sysdeps/unix/sysv/linux/i386/Makefile -@@ -31,6 +31,7 @@ endif - # libpthread uses six-argument inline syscalls. - ifeq ($(subdir),nptl) - libpthread-sysdep_routines += libc-do-syscall -+libpthread-shared-only-routines += libc-do-syscall - endif - - ifeq ($(subdir),resource) -@@ -48,9 +49,11 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif - - ifeq ($(subdir),rt) - # pull in __syscall_error routine - librt-routines += sysdep -+librt-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S -index 25f2a9c340..feae504ce6 100644 ---- a/sysdeps/unix/sysv/linux/i386/clone.S -+++ b/sysdeps/unix/sysv/linux/i386/clone.S -@@ -107,9 +107,6 @@ L(thread_start): - cfi_undefined (eip); - /* Note: %esi is zero. */ - movl %esi,%ebp /* terminate the stack frame */ -- testl $CLONE_VM, %edi -- je L(newpid) --L(haspid): - call *%ebx - #ifdef PIC - call L(here) -@@ -121,18 +118,6 @@ L(here): - movl $SYS_ify(exit), %eax - ENTER_KERNEL - -- .subsection 2 --L(newpid): -- movl $SYS_ify(getpid), %eax -- ENTER_KERNEL --L(nomoregetpid): -- movl %eax, %gs:PID -- movl %eax, %gs:TID -- jmp L(haspid) -- .previous -- cfi_endproc; -- -- cfi_startproc - PSEUDO_END (__clone) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S -index 7a1d3373bb..a865de2201 100644 ---- a/sysdeps/unix/sysv/linux/i386/vfork.S -+++ b/sysdeps/unix/sysv/linux/i386/vfork.S -@@ -34,17 +34,6 @@ ENTRY (__vfork) - cfi_adjust_cfa_offset (-4) - cfi_register (%eip, %ecx) - -- /* Save the TCB-cached PID away in %edx, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- movl %gs:PID, %edx -- movl %edx, %eax -- negl %eax -- jne 1f -- movl $0x80000000, %eax --1: movl %eax, %gs:PID -- -- - /* Stuff the syscall number in EAX and enter into the kernel. */ - movl $SYS_ify (vfork), %eax - int $0x80 -@@ -55,14 +44,6 @@ ENTRY (__vfork) - pushl %ecx - cfi_adjust_cfa_offset (4) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- testl %eax, %eax -- je 1f -- movl %edx, %gs:PID --1: -- - cmpl $-4095, %eax - /* Branch forward if it failed. */ - jae SYSCALL_ERROR_LABEL -diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile -index 1de62c528a..4d6766db5e 100644 ---- a/sysdeps/unix/sysv/linux/ia64/Makefile -+++ b/sysdeps/unix/sysv/linux/ia64/Makefile -@@ -19,6 +19,7 @@ endif - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),nptl) -diff --git a/sysdeps/unix/sysv/linux/ia64/clone2.S b/sysdeps/unix/sysv/linux/ia64/clone2.S -index b4cfdfc959..e637b6d4a5 100644 ---- a/sysdeps/unix/sysv/linux/ia64/clone2.S -+++ b/sysdeps/unix/sysv/linux/ia64/clone2.S -@@ -67,19 +67,7 @@ ENTRY(__clone2) - (CHILD) mov loc0=gp - (PARENT) ret - ;; -- tbit.nz p6,p0=in3,8 /* CLONE_VM */ --(p6) br.cond.dptk 1f -- ;; -- mov r15=SYS_ify (getpid) --(p7) break __BREAK_SYSCALL -- ;; -- add r9=PID,r13 -- add r10=TID,r13 -- ;; -- st4 [r9]=r8 -- st4 [r10]=r8 -- ;; --1: ld8 out1=[in0],8 /* Retrieve code pointer. */ -+ ld8 out1=[in0],8 /* Retrieve code pointer. */ - mov out0=in4 /* Pass proper argument to fn */ - ;; - ld8 gp=[in0] /* Load function gp. */ -diff --git a/sysdeps/unix/sysv/linux/ia64/vfork.S b/sysdeps/unix/sysv/linux/ia64/vfork.S -index 9154d7c0fd..84bfdd5d8a 100644 ---- a/sysdeps/unix/sysv/linux/ia64/vfork.S -+++ b/sysdeps/unix/sysv/linux/ia64/vfork.S -@@ -33,32 +33,12 @@ ENTRY (__libc_vfork) - .prologue // work around a GAS bug which triggers if - .body // first .prologue is not at the beginning of proc. - alloc r2=ar.pfs,0,0,2,0 -- adds r14=PID,r13 -- ;; -- ld4 r16=[r14] -- ;; -- sub r15=0,r16 -- cmp.eq p6,p0=0,r16 -- ;; --(p6) movl r15=0x80000000 - mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD - mov out1=0 /* Standard sp value. */ - ;; -- st4 [r14]=r15 - DO_CALL (SYS_ify (clone)) - cmp.eq p6,p0=0,r8 -- adds r14=PID,r13 - (p6) br.cond.dptk 1f -- ;; -- ld4 r15=[r14] -- ;; -- extr.u r16=r15,0,31 -- ;; -- cmp.eq p0,p6=0,r16 -- ;; --(p6) sub r16=0,r15 -- ;; -- st4 [r14]=r16 - 1: - cmp.eq p6,p0=-1,r10 - (p6) br.cond.spnt.few __syscall_error -diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S -index 3a828443dc..630a29209d 100644 ---- a/sysdeps/unix/sysv/linux/m68k/clone.S -+++ b/sysdeps/unix/sysv/linux/m68k/clone.S -@@ -98,19 +98,6 @@ ENTRY (__clone) - cfi_startproc - cfi_undefined (pc) /* Mark end of stack */ - subl %fp, %fp /* terminate the stack frame */ -- /* Check and see if we need to reset the PID. */ -- andl #CLONE_VM, %d1 -- jne 1f -- movel #SYS_ify (getpid), %d0 -- trap #0 -- movel %a0, -(%sp) -- movel %d0, -(%sp) -- bsrl __m68k_read_tp@PLTPC -- movel (%sp)+, %d0 -- movel %d0, PID_OFFSET(%a0) -- movel %d0, TID_OFFSET(%a0) -- movel (%sp)+, %a0 --1: - jsr (%a0) - movel %d0, %d1 - movel #SYS_ify (exit), %d0 -diff --git a/sysdeps/unix/sysv/linux/m68k/vfork.S b/sysdeps/unix/sysv/linux/m68k/vfork.S -index 1625a7b7a0..e27479361b 100644 ---- a/sysdeps/unix/sysv/linux/m68k/vfork.S -+++ b/sysdeps/unix/sysv/linux/m68k/vfork.S -@@ -28,18 +28,6 @@ - - ENTRY (__vfork) - -- /* Save the TCB-cached PID away in %d1, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- jbsr __m68k_read_tp@PLTPC -- movel %a0, %a1 -- movel PID_OFFSET(%a1), %d0 -- movel %d0, %d1 -- negl %d0 -- jne 1f -- movel #0x80000000, %d0 --1: movel %d0, PID_OFFSET(%a1) -- - /* Pop the return PC value into A0. */ - movel %sp@+, %a0 - cfi_adjust_cfa_offset (-4) -@@ -49,14 +37,6 @@ ENTRY (__vfork) - movel #SYS_ify (vfork), %d0 - trap #0 - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- tstl %d0 -- jeq 1f -- movel %d1, PID_OFFSET(%a1) --1: -- - tstl %d0 - jmi .Lerror /* Branch forward if it failed. */ - -diff --git a/sysdeps/unix/sysv/linux/microblaze/Makefile b/sysdeps/unix/sysv/linux/microblaze/Makefile -index 44a838fa11..d178bc6f34 100644 ---- a/sysdeps/unix/sysv/linux/microblaze/Makefile -+++ b/sysdeps/unix/sysv/linux/microblaze/Makefile -@@ -5,4 +5,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep --endif -\ No newline at end of file -+libpthread-shared-only-routines += sysdep -+endif -diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S -index 39634c5cf0..7ae65ef723 100644 ---- a/sysdeps/unix/sysv/linux/mips/clone.S -+++ b/sysdeps/unix/sysv/linux/mips/clone.S -@@ -130,11 +130,6 @@ L(thread_start): - SAVE_GP (GPOFF) - /* The stackframe has been created on entry of clone(). */ - -- /* Check and see if we need to reset the PID. */ -- and a1,a0,CLONE_VM -- beqz a1,L(restore_pid) --L(donepid): -- - /* Restore the arg for user's function. */ - PTR_L t9,0(sp) /* Function pointer. */ - PTR_L a0,PTRSIZE(sp) /* Argument pointer. */ -@@ -151,14 +146,6 @@ L(donepid): - jal _exit - #endif - --L(restore_pid): -- li v0,__NR_getpid -- syscall -- READ_THREAD_POINTER(v1) -- INT_S v0,PID_OFFSET(v1) -- INT_S v0,TID_OFFSET(v1) -- b L(donepid) -- - END(__thread_start) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -index 890a74494a..26ab6d0b75 100644 ---- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list -@@ -4,6 +4,8 @@ mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64 - - sync_file_range - sync_file_range Ci:iiii sync_file_range - -+readahead - readahead i:iii __readahead readahead -+ - prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 - - fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark -diff --git a/sysdeps/unix/sysv/linux/mips/vfork.S b/sysdeps/unix/sysv/linux/mips/vfork.S -index 1867c8626e..0b9244b7f8 100644 ---- a/sysdeps/unix/sysv/linux/mips/vfork.S -+++ b/sysdeps/unix/sysv/linux/mips/vfork.S -@@ -60,14 +60,6 @@ NESTED(__libc_vfork,FRAMESZ,sp) - PTR_ADDU sp, FRAMESZ - cfi_adjust_cfa_offset (-FRAMESZ) - -- /* Save the PID value. */ -- READ_THREAD_POINTER(v1) /* Get the thread pointer. */ -- lw a2, PID_OFFSET(v1) /* Load the saved PID. */ -- subu a2, $0, a2 /* Negate it. */ -- bnez a2, 1f /* If it was zero... */ -- lui a2, 0x8000 /* use 0x80000000 instead. */ --1: sw a2, PID_OFFSET(v1) /* Store the temporary PID. */ -- - li a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */ - move a1, sp - -@@ -75,17 +67,6 @@ NESTED(__libc_vfork,FRAMESZ,sp) - li v0,__NR_clone - syscall - -- /* Restore the old PID value in the parent. */ -- beqz v0, 1f /* If we are the parent... */ -- READ_THREAD_POINTER(v1) /* Get the thread pointer. */ -- lw a2, PID_OFFSET(v1) /* Load the saved PID. */ -- subu a2, $0, a2 /* Re-negate it. */ -- lui a0, 0x8000 /* Load 0x80000000... */ -- bne a2, a0, 2f /* ... compare against it... */ -- li a2, 0 /* ... use 0 instead. */ --2: sw a2, PID_OFFSET(v1) /* Restore the PID. */ --1: -- - cfi_remember_state - bnez a3,L(error) - -diff --git a/sysdeps/unix/sysv/linux/nios2/clone.S b/sysdeps/unix/sysv/linux/nios2/clone.S -index 30b6e4a6c8..c9fa00f94c 100644 ---- a/sysdeps/unix/sysv/linux/nios2/clone.S -+++ b/sysdeps/unix/sysv/linux/nios2/clone.S -@@ -68,14 +68,6 @@ thread_start: - cfi_startproc - cfi_undefined (ra) - -- /* We expect the argument registers to be preserved across system -- calls and across task cloning, so flags should be in r4 here. */ -- andi r2, r4, CLONE_VM -- bne r2, zero, 2f -- DO_CALL (getpid, 0) -- stw r2, PID_OFFSET(r23) -- stw r2, TID_OFFSET(r23) --2: - ldw r5, 4(sp) /* Function pointer. */ - ldw r4, 0(sp) /* Argument pointer. */ - addi sp, sp, 8 -diff --git a/sysdeps/unix/sysv/linux/nios2/vfork.S b/sysdeps/unix/sysv/linux/nios2/vfork.S -index c1bb9c7134..8997269199 100644 ---- a/sysdeps/unix/sysv/linux/nios2/vfork.S -+++ b/sysdeps/unix/sysv/linux/nios2/vfork.S -@@ -21,20 +21,10 @@ - - ENTRY(__vfork) - -- ldw r6, PID_OFFSET(r23) -- sub r7, zero, r6 -- bne r7, zero, 2f -- movhi r7, %hi(0x80000000) --2: -- stw r7, PID_OFFSET(r23) -- - movi r4, 0x4111 /* (CLONE_VM | CLONE_VFORK | SIGCHLD) */ - mov r5, zero - DO_CALL (clone, 2) - -- beq r2, zero, 1f -- stw r6, PID_OFFSET(r23) --1: - bne r7, zero, SYSCALL_ERROR_LABEL - ret - -diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile -index c89ed9ec7d..2cfb46eca3 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/Makefile -+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile -@@ -8,6 +8,7 @@ abi-64-v2-condition := __WORDSIZE == 64 && _CALL_ELF == 2 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),stdlib) -@@ -34,4 +35,5 @@ ifeq ($(subdir),nptl) - libpthread-routines += sysdep - libpthread-sysdep_routines += elision-lock elision-unlock elision-timed \ - elision-trylock -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -index dd1e4c3b17..7dd3d835b6 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c -@@ -45,7 +45,9 @@ - int - __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - { -- if (*adapt_count > 0) -+ /* adapt_count is accessed concurrently but is just a hint. Thus, -+ use atomic accesses but relaxed MO is sufficient. */ -+ if (atomic_load_relaxed (adapt_count) > 0) - { - goto use_lock; - } -@@ -67,7 +69,8 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) - { - if (aconf.skip_lock_internal_abort > 0) -- *adapt_count = aconf.skip_lock_internal_abort; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_lock_internal_abort); - goto use_lock; - } - } -@@ -75,7 +78,8 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared) - - /* Fall back to locks for a bit if retries have been exhausted */ - if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0) -- *adapt_count = aconf.skip_lock_out_of_tbegin_retries; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_lock_out_of_tbegin_retries); - - use_lock: - return LLL_LOCK ((*lock), pshared); -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -index 0807a6a432..606185670d 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c -@@ -34,7 +34,7 @@ __lll_trylock_elision (int *futex, short *adapt_count) - __libc_tabort (_ABORT_NESTED_TRYLOCK); - - /* Only try a transaction if it's worth it. */ -- if (*adapt_count > 0) -+ if (atomic_load_relaxed (adapt_count) > 0) - { - goto use_lock; - } -@@ -49,7 +49,7 @@ __lll_trylock_elision (int *futex, short *adapt_count) - __libc_tend (0); - - if (aconf.skip_lock_busy > 0) -- *adapt_count = aconf.skip_lock_busy; -+ atomic_store_relaxed (adapt_count, aconf.skip_lock_busy); - } - else - { -@@ -59,7 +59,8 @@ __lll_trylock_elision (int *futex, short *adapt_count) - result in another failure. Use normal locking now and - for the next couple of calls. */ - if (aconf.skip_trylock_internal_abort > 0) -- *adapt_count = aconf.skip_trylock_internal_abort; -+ atomic_store_relaxed (adapt_count, -+ aconf.skip_trylock_internal_abort); - } - } - -diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -index 43c5a67df2..51d7018e4c 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -+++ b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c -@@ -28,13 +28,16 @@ __lll_unlock_elision (int *lock, short *adapt_count, int pshared) - __libc_tend (0); - else - { -- lll_unlock ((*lock), pshared); -+ /* Update adapt_count in the critical section to prevent a -+ write-after-destroy error as mentioned in BZ 20822. The -+ following update of adapt_count has to be contained within -+ the critical region of the fall-back lock in order to not violate -+ the mutex destruction requirements. */ -+ short __tmp = atomic_load_relaxed (adapt_count); -+ if (__tmp > 0) -+ atomic_store_relaxed (adapt_count, __tmp - 1); - -- /* Update the adapt count AFTER completing the critical section. -- Doing this here prevents unneeded stalling when entering -- a critical section. Saving about 8% runtime on P8. */ -- if (*adapt_count > 0) -- (*adapt_count)--; -+ lll_unlock ((*lock), pshared); - } - return 0; - } -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -index bebadbfbb9..49fe01ecde 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S -@@ -76,15 +76,6 @@ ENTRY (__clone) - crandc cr1*4+eq,cr1*4+eq,cr0*4+so - bne- cr1,L(parent) /* The '-' is to minimise the race. */ - -- /* If CLONE_VM is set do not update the pid/tid field. */ -- andi. r0,r28,CLONE_VM -- bne+ cr0,L(oldpid) -- -- DO_CALL(SYS_ify(getpid)) -- stw r3,TID(r2) -- stw r3,PID(r2) --L(oldpid): -- - /* Call procedure. */ - mtctr r30 - mr r3,r31 -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -index edbc7de1e6..0a724953a4 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S -@@ -27,34 +27,8 @@ - - ENTRY (__vfork) - -- /* Load the TCB-cached PID value and negates it. If It it is zero -- sets it to 0x800000. And then sets its value again on TCB field. -- See raise.c for the logic that relies on this value. */ -- -- lwz r0,PID(r2) -- cmpwi cr0,r0,0 -- neg r0,r0 -- bne- cr0,1f -- lis r0,0x8000 --1: stw r0,PID(r2) -- - DO_CALL (SYS_ify (vfork)) - -- cmpwi cr1,r3,0 -- beqlr- 1 -- -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- lwz r0,PID(r2) -- /* Cannot use clrlwi. here, because cr0 needs to be preserved -- until PSEUDO_RET. */ -- clrlwi r4,r0,1 -- cmpwi cr1,r4,0 -- beq- cr1,1f -- neg r4,r0 --1: stw r4,PID(r2) -- - PSEUDO_RET - - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -index 7c59b9b4e9..d8604f6731 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S -@@ -78,15 +78,6 @@ ENTRY (__clone) - crandc cr1*4+eq,cr1*4+eq,cr0*4+so - bne- cr1,L(parent) /* The '-' is to minimise the race. */ - -- /* If CLONE_VM is set do not update the pid/tid field. */ -- rldicl. r0,r29,56,63 /* flags & CLONE_VM. */ -- bne+ cr0,L(oldpid) -- -- DO_CALL(SYS_ify(getpid)) -- stw r3,TID(r13) -- stw r3,PID(r13) --L(oldpid): -- - std r2,FRAME_TOC_SAVE(r1) - /* Call procedure. */ - PPC64_LOAD_FUNCPTR r30 -diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -index 3083ab7b3c..6b4cf432c1 100644 ---- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S -@@ -28,31 +28,8 @@ - ENTRY (__vfork) - CALL_MCOUNT 0 - -- /* Load the TCB-cached PID value and negates it. If It it is zero -- sets it to 0x800000. And then sets its value again on TCB field. -- See raise.c for the logic that relies on this value. */ -- lwz r0,PID(r13) -- cmpwi cr0,r0,0 -- neg r0,r0 -- bne- cr0,1f -- lis r0,0x8000 --1: stw r0,PID(r13) -- - DO_CALL (SYS_ify (vfork)) - -- cmpwi cr1,r3,0 -- beqlr- 1 -- -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- lwz r0,PID(r13) -- clrlwi r4,r0,1 -- cmpwi cr1,r4,0 -- beq- cr1,1f -- neg r4,r0 --1: stw r4,PID(r13) -- - PSEUDO_RET - - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c -index 1bcff64781..46d974d952 100644 ---- a/sysdeps/unix/sysv/linux/pread.c -+++ b/sysdeps/unix/sysv/linux/pread.c -@@ -28,8 +28,7 @@ - ssize_t - __libc_pread (int fd, void *buf, size_t count, off_t offset) - { -- return SYSCALL_CANCEL (pread, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL (offset)); -+ return SYSCALL_CANCEL (pread, fd, buf, count, SYSCALL_LL_PRW (offset)); - } - - strong_alias (__libc_pread, __pread) -diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c -index 58c6aeb541..f51beae77a 100644 ---- a/sysdeps/unix/sysv/linux/pread64.c -+++ b/sysdeps/unix/sysv/linux/pread64.c -@@ -26,8 +26,7 @@ - ssize_t - __libc_pread64 (int fd, void *buf, size_t count, off64_t offset) - { -- return SYSCALL_CANCEL (pread64, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL64 (offset)); -+ return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset)); - } - - weak_alias (__libc_pread64, __pread64) -diff --git a/sysdeps/unix/sysv/linux/pthread-pids.h b/sysdeps/unix/sysv/linux/pthread-pids.h -index d42bba03cf..618a5b1b9f 100644 ---- a/sysdeps/unix/sysv/linux/pthread-pids.h -+++ b/sysdeps/unix/sysv/linux/pthread-pids.h -@@ -26,5 +26,5 @@ static inline void - __pthread_initialize_pids (struct pthread *pd) - { - INTERNAL_SYSCALL_DECL (err); -- pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); -+ pd->tid = INTERNAL_SYSCALL_CALL (set_tid_address, err, &pd->tid); - } -diff --git a/sysdeps/unix/sysv/linux/pthread_kill.c b/sysdeps/unix/sysv/linux/pthread_kill.c -index bcb3009675..cc109973cc 100644 ---- a/sysdeps/unix/sysv/linux/pthread_kill.c -+++ b/sysdeps/unix/sysv/linux/pthread_kill.c -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - - int -@@ -49,15 +50,9 @@ __pthread_kill (pthread_t threadid, int signo) - /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - -- /* One comment: The PID field in the TCB can temporarily be changed -- (in fork). But this must not affect this code here. Since this -- function would have to be called while the thread is executing -- fork, it would have to happen in a signal handler. But this is -- no allowed, pthread_kill is not guaranteed to be async-safe. */ -- int val; -- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid), -- tid, signo); -+ pid_t pid = __getpid (); - -+ int val = INTERNAL_SYSCALL_CALL (tgkill, err, pid, tid, signo); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); - } -diff --git a/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/sysdeps/unix/sysv/linux/pthread_sigqueue.c -index 7694d5467c..e393e0bd73 100644 ---- a/sysdeps/unix/sysv/linux/pthread_sigqueue.c -+++ b/sysdeps/unix/sysv/linux/pthread_sigqueue.c -@@ -49,27 +49,22 @@ pthread_sigqueue (pthread_t threadid, int signo, const union sigval value) - if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID) - return EINVAL; - -+ pid_t pid = getpid (); -+ - /* Set up the siginfo_t structure. */ - siginfo_t info; - memset (&info, '\0', sizeof (siginfo_t)); - info.si_signo = signo; - info.si_code = SI_QUEUE; -- info.si_pid = THREAD_GETMEM (THREAD_SELF, pid); -+ info.si_pid = pid; - info.si_uid = getuid (); - info.si_value = value; - - /* We have a special syscall to do the work. */ - INTERNAL_SYSCALL_DECL (err); - -- /* One comment: The PID field in the TCB can temporarily be changed -- (in fork). But this must not affect this code here. Since this -- function would have to be called while the thread is executing -- fork, it would have to happen in a signal handler. But this is -- no allowed, pthread_sigqueue is not guaranteed to be async-safe. */ -- int val = INTERNAL_SYSCALL (rt_tgsigqueueinfo, err, 4, -- THREAD_GETMEM (THREAD_SELF, pid), -- tid, signo, &info); -- -+ int val = INTERNAL_SYSCALL_CALL (rt_tgsigqueueinfo, err, pid, tid, signo, -+ &info); - return (INTERNAL_SYSCALL_ERROR_P (val, err) - ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); - #else -diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c -index 9c502beac1..1371df8a60 100644 ---- a/sysdeps/unix/sysv/linux/pwrite.c -+++ b/sysdeps/unix/sysv/linux/pwrite.c -@@ -28,8 +28,7 @@ - ssize_t - __libc_pwrite (int fd, const void *buf, size_t count, off_t offset) - { -- return SYSCALL_CANCEL (pwrite, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL (offset)); -+ return SYSCALL_CANCEL (pwrite, fd, buf, count, SYSCALL_LL_PRW (offset)); - } - - strong_alias (__libc_pwrite, __pwrite) -diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c -index b49e6bc286..22f1f05a44 100644 ---- a/sysdeps/unix/sysv/linux/pwrite64.c -+++ b/sysdeps/unix/sysv/linux/pwrite64.c -@@ -26,8 +26,7 @@ - ssize_t - __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset) - { -- return SYSCALL_CANCEL (pwrite64, fd, buf, count, -- __ALIGNMENT_ARG SYSCALL_LL64 (offset)); -+ return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset)); - } - weak_alias (__libc_pwrite64, __pwrite64) - libc_hidden_weak (__pwrite64) -diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c -index 470033e83d..49bb7cb0d4 100644 ---- a/sysdeps/unix/sysv/linux/raise.c -+++ b/sysdeps/unix/sysv/linux/raise.c -@@ -26,13 +26,6 @@ - int - raise (int sig) - { -- /* raise is an async-safe function so it could be called while the -- fork/vfork function temporarily invalidated the PID field. To avoid -- relying on cached value we block all user-defined signal handler -- (which might call fork/vfork) and issue the getpid and gettid -- syscalls directly. */ -- -- - /* rt_sigprocmask may fail if: - - 1. sigsetsize != sizeof (sigset_t) (EINVAL) -diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile -index 497ffd566c..f8ed013e9e 100644 ---- a/sysdeps/unix/sysv/linux/s390/Makefile -+++ b/sysdeps/unix/sysv/linux/s390/Makefile -@@ -6,6 +6,7 @@ abi-64-condition := __WORDSIZE == 64 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),stdlib) -diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -index 2f8fa0b840..b1de1480d1 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S -@@ -54,13 +54,6 @@ error: - PSEUDO_END (__clone) - - thread_start: -- tml %r3,256 /* CLONE_VM == 0x00000100 */ -- jne 1f -- svc SYS_ify(getpid) -- ear %r3,%a0 -- st %r2,PID(%r3) -- st %r2,TID(%r3) --1: - /* fn is in gpr 1, arg in gpr 0 */ - lr %r2,%r0 /* set first parameter to void *arg */ - ahi %r15,-96 /* make room on the stack for the save area */ -diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S b/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -index b7588ebd7c..cc60e139ba 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S -@@ -28,21 +28,9 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- ear %r4,%a0 -- lhi %r1,1 -- icm %r3,15,PID(%r4) -- sll %r1,31 -- je 1f -- lcr %r1,%r3 --1: st %r1,PID(%r4) -- - /* Do vfork system call. */ - svc SYS_ify (vfork) - -- ltr %r2,%r2 -- je 1f -- st %r3,PID(%r4) --1: - /* Check for error. */ - lhi %r4,-4095 - clr %r2,%r4 -diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -index fb816922ca..29606acf03 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S -@@ -55,15 +55,6 @@ error: - PSEUDO_END (__clone) - - thread_start: -- tmll %r3,256 /* CLONE_VM == 0x00000100 */ -- jne 1f -- svc SYS_ify(getpid) -- ear %r3,%a0 -- sllg %r3,%r3,32 -- ear %r3,%a1 -- st %r2,PID(%r3) -- st %r2,TID(%r3) --1: - /* fn is in gpr 1, arg in gpr 0 */ - lgr %r2,%r0 /* set first parameter to void *arg */ - aghi %r15,-160 /* make room on the stack for the save area */ -diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S b/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -index 0bd2161381..b9a813f2cc 100644 ---- a/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -+++ b/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S -@@ -28,22 +28,9 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- ear %r4,%a0 -- sllg %r4,%r4,32 -- ear %r4,%a1 -- icm %r3,15,PID(%r4) -- llilh %r1,32768 -- je 1f -- lcr %r1,%r3 --1: st %r1,PID(%r4) -- - /* Do vfork system call. */ - svc SYS_ify (vfork) - -- ltgr %r2,%r2 -- je 1f -- st %r3,PID(%r4) --1: - /* Check for error. */ - lghi %r4,-4095 - clgr %r2,%r4 -diff --git a/sysdeps/unix/sysv/linux/sh/clone.S b/sysdeps/unix/sysv/linux/sh/clone.S -index 4cd7df117c..ce7cddcb19 100644 ---- a/sysdeps/unix/sysv/linux/sh/clone.S -+++ b/sysdeps/unix/sysv/linux/sh/clone.S -@@ -66,23 +66,7 @@ ENTRY(__clone) - 2: - /* terminate the stack frame */ - mov #0, r14 -- mov r4, r0 -- shlr8 r0 -- tst #1, r0 // CLONE_VM = (1 << 8) -- bf/s 4f -- mov r4, r0 -- /* new pid */ -- mov #+SYS_ify(getpid), r3 -- trapa #0x15 --3: -- stc gbr, r1 -- mov.w .Lpidoff, r2 -- add r1, r2 -- mov.l r0, @r2 -- mov.w .Ltidoff, r2 -- add r1, r2 -- mov.l r0, @r2 --4: -+ - /* thread starts */ - mov.l @r15, r1 - jsr @r1 -@@ -113,10 +97,6 @@ ENTRY(__clone) - .long _GLOBAL_OFFSET_TABLE_ - .L3: - .long PLTJMP(C_SYMBOL_NAME(_exit)) --.Lpidoff: -- .word PID - TLS_PRE_TCB_SIZE --.Ltidoff: -- .word TID - TLS_PRE_TCB_SIZE - PSEUDO_END (__clone) - - libc_hidden_def (__clone) -diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h -index ad05fc39e1..c5240fafbd 100644 ---- a/sysdeps/unix/sysv/linux/sh/kernel-features.h -+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h -@@ -44,3 +44,8 @@ - - /* SH does not have a 64-bit inode field. */ - #undef __ASSUME_ST_INO_64_BIT -+ -+/* SH4 ABI does not really require argument alignment for 64-bits, but -+ the kernel interface for p{read,write}64 adds a dummy long argument -+ before the offset. */ -+#define __ASSUME_PRW_DUMMY_ARG 1 -diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c -deleted file mode 100644 -index 391ed5e17b..0000000000 ---- a/sysdeps/unix/sysv/linux/sh/pwrite.c -+++ /dev/null -@@ -1,23 +0,0 @@ --/* Copyright (C) 1997-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- Contributed by Ulrich Drepper , 1997. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- . */ -- --/* SH4 ABI does not really require argument alignment for 64-bits, but -- the kernel interface for pwrite adds a dummy long argument before the -- offset. */ --#define __ALIGNMENT_ARG --#include -diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -index 17397c5511..25f914a93b 100644 ---- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym -@@ -13,22 +13,22 @@ SIG_SETMASK - oLINK ucontext (uc_link) - oSS_SP ucontext (uc_stack.ss_sp) - oSS_SIZE ucontext (uc_stack.ss_size) --oR0 mcontext (gregs[R0]) --oR1 mcontext (gregs[R1]) --oR2 mcontext (gregs[R2]) --oR3 mcontext (gregs[R3]) --oR4 mcontext (gregs[R4]) --oR5 mcontext (gregs[R5]) --oR6 mcontext (gregs[R6]) --oR7 mcontext (gregs[R7]) --oR8 mcontext (gregs[R8]) --oR9 mcontext (gregs[R9]) --oR10 mcontext (gregs[R10]) --oR11 mcontext (gregs[R11]) --oR12 mcontext (gregs[R12]) --oR13 mcontext (gregs[R13]) --oR14 mcontext (gregs[R14]) --oR15 mcontext (gregs[R15]) -+oR0 mcontext (gregs[REG_R0]) -+oR1 mcontext (gregs[REG_R1]) -+oR2 mcontext (gregs[REG_R2]) -+oR3 mcontext (gregs[REG_R3]) -+oR4 mcontext (gregs[REG_R4]) -+oR5 mcontext (gregs[REG_R5]) -+oR6 mcontext (gregs[REG_R6]) -+oR7 mcontext (gregs[REG_R7]) -+oR8 mcontext (gregs[REG_R8]) -+oR9 mcontext (gregs[REG_R9]) -+oR10 mcontext (gregs[REG_R10]) -+oR11 mcontext (gregs[REG_R11]) -+oR12 mcontext (gregs[REG_R12]) -+oR13 mcontext (gregs[REG_R13]) -+oR14 mcontext (gregs[REG_R14]) -+oR15 mcontext (gregs[REG_R15]) - oPC mcontext (pc) - oPR mcontext (pr) - oSR mcontext (sr) -diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -index 65633fbcf4..130f60cd96 100644 ---- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym -@@ -13,22 +13,22 @@ SIG_SETMASK - oLINK ucontext (uc_link) - oSS_SP ucontext (uc_stack.ss_sp) - oSS_SIZE ucontext (uc_stack.ss_size) --oR0 mcontext (gregs[R0]) --oR1 mcontext (gregs[R1]) --oR2 mcontext (gregs[R2]) --oR3 mcontext (gregs[R3]) --oR4 mcontext (gregs[R4]) --oR5 mcontext (gregs[R5]) --oR6 mcontext (gregs[R6]) --oR7 mcontext (gregs[R7]) --oR8 mcontext (gregs[R8]) --oR9 mcontext (gregs[R9]) --oR10 mcontext (gregs[R10]) --oR11 mcontext (gregs[R11]) --oR12 mcontext (gregs[R12]) --oR13 mcontext (gregs[R13]) --oR14 mcontext (gregs[R14]) --oR15 mcontext (gregs[R15]) -+oR0 mcontext (gregs[REG_R0]) -+oR1 mcontext (gregs[REG_R1]) -+oR2 mcontext (gregs[REG_R2]) -+oR3 mcontext (gregs[REG_R3]) -+oR4 mcontext (gregs[REG_R4]) -+oR5 mcontext (gregs[REG_R5]) -+oR6 mcontext (gregs[REG_R6]) -+oR7 mcontext (gregs[REG_R7]) -+oR8 mcontext (gregs[REG_R8]) -+oR9 mcontext (gregs[REG_R9]) -+oR10 mcontext (gregs[REG_R10]) -+oR11 mcontext (gregs[REG_R11]) -+oR12 mcontext (gregs[REG_R12]) -+oR13 mcontext (gregs[REG_R13]) -+oR14 mcontext (gregs[REG_R14]) -+oR15 mcontext (gregs[REG_R15]) - oPC mcontext (pc) - oPR mcontext (pr) - oSR mcontext (sr) -diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -index ab9a7e66bf..037fbb73e8 100644 ---- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -+++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h -@@ -31,49 +31,47 @@ - typedef int greg_t; - - /* Number of general registers. */ --#define NGPREG 16 -+#define NGREG 16 - - /* Container for all general registers. */ --typedef greg_t gregset_t[NGPREG]; -+typedef greg_t gregset_t[NGREG]; - --#ifdef __USE_GNU - /* Number of each register is the `gregset_t' array. */ - enum - { -- R0 = 0, --#define R0 R0 -- R1 = 1, --#define R1 R1 -- R2 = 2, --#define R2 R2 -- R3 = 3, --#define R3 R3 -- R4 = 4, --#define R4 R4 -- R5 = 5, --#define R5 R5 -- R6 = 6, --#define R6 R6 -- R7 = 7, --#define R7 R7 -- R8 = 8, --#define R8 R8 -- R9 = 9, --#define R9 R9 -- R10 = 10, --#define R10 R10 -- R11 = 11, --#define R11 R11 -- R12 = 12, --#define R12 R12 -- R13 = 13, --#define R13 R13 -- R14 = 14, --#define R14 R14 -- R15 = 15, --#define R15 R15 -+ REG_R0 = 0, -+#define REG_R0 REG_R0 -+ REG_R1 = 1, -+#define REG_R1 REG_R1 -+ REG_R2 = 2, -+#define REG_R2 REG_R2 -+ REG_R3 = 3, -+#define REG_R3 REG_R3 -+ REG_R4 = 4, -+#define REG_R4 REG_R4 -+ REG_R5 = 5, -+#define REG_R5 REG_R5 -+ REG_R6 = 6, -+#define REG_R6 REG_R6 -+ REG_R7 = 7, -+#define REG_R7 REG_R7 -+ REG_R8 = 8, -+#define REG_R8 REG_R8 -+ REG_R9 = 9, -+#define REG_R9 REG_R9 -+ REG_R10 = 10, -+#define REG_R10 REG_R10 -+ REG_R11 = 11, -+#define REG_R11 REG_R11 -+ REG_R12 = 12, -+#define REG_R12 REG_R12 -+ REG_R13 = 13, -+#define REG_R13 REG_R13 -+ REG_R14 = 14, -+#define REG_R14 REG_R14 -+ REG_R15 = 15, -+#define REG_R15 REG_R15 - }; --#endif - - #if (defined(__SH4__) || defined(__SH4A__)) - typedef int freg_t; -diff --git a/sysdeps/unix/sysv/linux/sh/vfork.S b/sysdeps/unix/sysv/linux/sh/vfork.S -index 6895bc5491..df559cb439 100644 ---- a/sysdeps/unix/sysv/linux/sh/vfork.S -+++ b/sysdeps/unix/sysv/linux/sh/vfork.S -@@ -26,30 +26,11 @@ - and the process ID of the new process to the old process. */ - - ENTRY (__libc_vfork) -- /* Save the PID value. */ -- stc gbr, r2 -- mov.w .L2, r0 -- mov.l @(r0,r2), r4 -- neg r4, r1 -- tst r1, r1 -- bf 1f -- mov #1, r1 -- rotr r1 --1: -- mov.l r1, @(r0,r2) - - mov.w .L1, r3 - trapa #0x10 - mov r0, r1 - -- /* Restore the old PID value in the parent. */ -- tst r0, r0 -- bt.s 2f -- stc gbr, r2 -- mov.w .L2, r0 -- mov.l r4, @(r0,r2) -- mov r1, r0 --2: - mov #-12, r2 - shad r2, r1 - not r1, r1 // r1=0 means r0 = -1 to -4095 -@@ -61,8 +42,6 @@ ENTRY (__libc_vfork) - nop - .L1: - .word __NR_vfork --.L2: -- .word PID - TLS_PRE_TCB_SIZE - .align 2 - PSEUDO_END (__libc_vfork) - -diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile -index e67aecf8f0..a67d199eb5 100644 ---- a/sysdeps/unix/sysv/linux/sparc/Makefile -+++ b/sysdeps/unix/sysv/linux/sparc/Makefile -@@ -6,6 +6,7 @@ abi-64-condition := __WORDSIZE == 64 - - ifeq ($(subdir),rt) - librt-routines += rt-sysdep -+librt-shared-only-routines += rt-sysdep - endif - - ifeq ($(subdir),sysvipc) -@@ -15,4 +16,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -index d6c92f6133..0456a0d16e 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S -@@ -79,13 +79,6 @@ END(__clone) - - .type __thread_start,@function - __thread_start: -- andcc %g4, CLONE_VM, %g0 -- bne 1f -- set __NR_getpid,%g1 -- ta 0x10 -- st %o0,[%g7 + PID] -- st %o0,[%g7 + TID] --1: - mov %g0, %fp /* terminate backtrace */ - call %g2 - mov %g3,%o0 -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -index 0d0a3b5298..6d985034f0 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S -@@ -22,24 +22,14 @@ - .text - .globl __syscall_error - ENTRY(__libc_vfork) -- ld [%g7 + PID], %o5 -- cmp %o5, 0 -- bne 1f -- sub %g0, %o5, %o4 -- sethi %hi(0x80000000), %o4 --1: st %o4, [%g7 + PID] -- - LOADSYSCALL(vfork) - ta 0x10 - bcc 2f - mov %o7, %g1 -- st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 - 2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 -- bne,a 1f -- st %o5, [%g7 + PID] - 1: retl - nop - END(__libc_vfork) -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -index b0f62660a7..6ffead88e2 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S -@@ -76,13 +76,6 @@ END(__clone) - - .type __thread_start,@function - __thread_start: -- andcc %g4, CLONE_VM, %g0 -- bne,pt %icc, 1f -- set __NR_getpid,%g1 -- ta 0x6d -- st %o0,[%g7 + PID] -- st %o0,[%g7 + TID] --1: - mov %g0, %fp /* terminate backtrace */ - call %g2 - mov %g3,%o0 -diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -index 0818eba02e..298dd197a9 100644 ---- a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S -@@ -22,24 +22,14 @@ - .text - .globl __syscall_error - ENTRY(__libc_vfork) -- ld [%g7 + PID], %o5 -- sethi %hi(0x80000000), %o3 -- cmp %o5, 0 -- sub %g0, %o5, %o4 -- move %icc, %o3, %o4 -- st %o4, [%g7 + PID] -- - LOADSYSCALL(vfork) - ta 0x6d - bcc,pt %xcc, 2f - mov %o7, %g1 -- st %o5, [%g7 + PID] - call __syscall_error - mov %g1, %o7 - 2: sub %o1, 1, %o1 - andcc %o0, %o1, %o0 -- bne,a,pt %icc, 1f -- st %o5, [%g7 + PID] - 1: retl - nop - END(__libc_vfork) -diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c -index bb3eecfde1..b5f20a710b 100644 ---- a/sysdeps/unix/sysv/linux/spawni.c -+++ b/sysdeps/unix/sysv/linux/spawni.c -@@ -58,22 +58,19 @@ - normal program exit with the exit code 127. */ - #define SPAWN_ERROR 127 - --/* We need to block both SIGCANCEL and SIGSETXID. */ --#define SIGALL_SET \ -- ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } }) -- - #ifdef __ia64__ --# define CLONE(__fn, __stack, __stacksize, __flags, __args) \ -- __clone2 (__fn, __stack, __stacksize, __flags, __args, 0, 0, 0) -+# define CLONE(__fn, __stackbase, __stacksize, __flags, __args) \ -+ __clone2 (__fn, __stackbase, __stacksize, __flags, __args, 0, 0, 0) - #else - # define CLONE(__fn, __stack, __stacksize, __flags, __args) \ - __clone (__fn, __stack, __flags, __args) - #endif - --#if _STACK_GROWS_DOWN --# define STACK(__stack, __stack_size) (__stack + __stack_size) --#elif _STACK_GROWS_UP -+/* Since ia64 wants the stackbase w/clone2, re-use the grows-up macro. */ -+#if _STACK_GROWS_UP || defined (__ia64__) - # define STACK(__stack, __stack_size) (__stack) -+#elif _STACK_GROWS_DOWN -+# define STACK(__stack, __stack_size) (__stack + __stack_size) - #endif - - -@@ -329,6 +326,11 @@ __spawnix (pid_t * pid, const char *file, - - /* Add a slack area for child's stack. */ - size_t argv_size = (argc * sizeof (void *)) + 512; -+ /* We need at least a few pages in case the compiler's stack checking is -+ enabled. In some configs, it is known to use at least 24KiB. We use -+ 32KiB to be "safe" from anything the compiler might do. Besides, the -+ extra pages won't actually be allocated unless they get used. */ -+ argv_size += (32 * 1024); - size_t stack_size = ALIGN_UP (argv_size, GLRO(dl_pagesize)); - void *stack = __mmap (NULL, stack_size, prot, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); -@@ -340,7 +342,9 @@ __spawnix (pid_t * pid, const char *file, - } - - /* Disable asynchronous cancellation. */ -- int cs = LIBC_CANCEL_ASYNC (); -+ int state; -+ __libc_ptf_call (__pthread_setcancelstate, -+ (PTHREAD_CANCEL_DISABLE, &state), 0); - - args.file = file; - args.exec = exec; -@@ -351,7 +355,7 @@ __spawnix (pid_t * pid, const char *file, - args.envp = envp; - args.xflags = xflags; - -- __sigprocmask (SIG_BLOCK, &SIGALL_SET, &args.oldmask); -+ __libc_signal_block_all (&args.oldmask); - - /* The clone flags used will create a new child that will run in the same - memory space (CLONE_VM) and the execution of calling thread will be -@@ -384,9 +388,9 @@ __spawnix (pid_t * pid, const char *file, - if ((ec == 0) && (pid != NULL)) - *pid = new_pid; - -- __sigprocmask (SIG_SETMASK, &args.oldmask, 0); -+ __libc_signal_restore_set (&args.oldmask); - -- LIBC_CANCEL_RESET (cs); -+ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0); - - return ec; - } -diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list -index 7ae2541f8f..248641b830 100644 ---- a/sysdeps/unix/sysv/linux/syscalls.list -+++ b/sysdeps/unix/sysv/linux/syscalls.list -@@ -18,6 +18,7 @@ execve - execve i:spp __execve execve - fdatasync - fdatasync Ci:i fdatasync - flock - flock i:ii __flock flock - get_kernel_syms EXTRA get_kernel_syms i:p __compat_get_kernel_syms get_kernel_syms@GLIBC_2.0:GLIBC_2.23 -+getpid - getpid Ei: __getpid getpid - getegid - getegid Ei: __getegid getegid - geteuid - geteuid Ei: __geteuid geteuid - getpgid - getpgid i:i __getpgid getpgid -diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h -index a469f57121..e3ecd5638e 100644 ---- a/sysdeps/unix/sysv/linux/sysdep.h -+++ b/sysdeps/unix/sysv/linux/sysdep.h -@@ -48,6 +48,16 @@ - __LONG_LONG_PAIR ((long) ((val) >> 32), (long) ((val) & 0xffffffff)) - #endif - -+/* Provide a common macro to pass 64-bit value on pread and pwrite -+ syscalls. */ -+#ifdef __ASSUME_PRW_DUMMY_ARG -+# define SYSCALL_LL_PRW(val) 0, SYSCALL_LL (val) -+# define SYSCALL_LL64_PRW(val) 0, SYSCALL_LL64 (val) -+#else -+# define SYSCALL_LL_PRW(val) __ALIGNMENT_ARG SYSCALL_LL (val) -+# define SYSCALL_LL64_PRW(val) __ALIGNMENT_ARG SYSCALL_LL64 (val) -+#endif -+ - /* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}. */ - #define LO_HI_LONG(val) \ - (long) (val), \ -diff --git a/sysdeps/unix/sysv/linux/tile/Makefile b/sysdeps/unix/sysv/linux/tile/Makefile -index 1c1cfff280..43acea3633 100644 ---- a/sysdeps/unix/sysv/linux/tile/Makefile -+++ b/sysdeps/unix/sysv/linux/tile/Makefile -@@ -25,4 +25,5 @@ endif - ifeq ($(subdir),nptl) - # pull in __syscall_error routine - libpthread-routines += sysdep -+libpthread-shared-only-routines += sysdep - endif -diff --git a/sysdeps/unix/sysv/linux/tile/clone.S b/sysdeps/unix/sysv/linux/tile/clone.S -index d1d36462e7..3f9e3d56c4 100644 ---- a/sysdeps/unix/sysv/linux/tile/clone.S -+++ b/sysdeps/unix/sysv/linux/tile/clone.S -@@ -163,22 +163,6 @@ ENTRY (__clone) - .Lthread_start: - cfi_def_cfa_offset (FRAME_SIZE) - cfi_undefined (lr) -- /* Check and see if we need to reset the PID, which we do if -- CLONE_VM isn't set, i.e. it's a fork-like clone with a new -- address space. In that case we update the cached values -- from the true system pid (retrieved via __NR_getpid syscall). */ -- moveli r0, CLONE_VM -- and r0, r30, r0 -- BNEZ r0, .Lno_reset_pid /* CLONE_VM is set */ -- moveli TREG_SYSCALL_NR_NAME, __NR_getpid -- swint1 -- ADDLI_PTR r2, tp, PID_OFFSET -- { -- ST4 r2, r0 -- ADDLI_PTR r2, tp, TID_OFFSET -- } -- ST4 r2, r0 --.Lno_reset_pid: - { - /* Invoke user function with specified argument. */ - move r0, r31 -diff --git a/sysdeps/unix/sysv/linux/tile/vfork.S b/sysdeps/unix/sysv/linux/tile/vfork.S -index d8c5ce3e24..2272777187 100644 ---- a/sysdeps/unix/sysv/linux/tile/vfork.S -+++ b/sysdeps/unix/sysv/linux/tile/vfork.S -@@ -29,18 +29,6 @@ - - .text - ENTRY (__vfork) -- { -- addli r11, tp, PID_OFFSET /* Point at PID. */ -- movei r13, 1 -- } -- { -- LD4U r12, r11 /* Load the saved PID. */ -- shli r13, r13, 31 /* Build 0x80000000. */ -- } -- sub r12, zero, r12 /* Negate it. */ -- CMOVEQZ r12, r12, r13 /* Replace zero pids. */ -- ST4 r11, r12 /* Store the temporary PID. */ -- - { - moveli r0, CLONE_VFORK | CLONE_VM | SIGCHLD - move r1, zero -@@ -52,22 +40,6 @@ ENTRY (__vfork) - moveli TREG_SYSCALL_NR_NAME, __NR_clone - swint1 - -- BEQZ r0, 1f /* If we are the parent... */ -- { -- addli r11, tp, PID_OFFSET /* Point at PID. */ -- movei r13, 1 -- } -- { -- LD4U r12, r11 /* Load the saved PID. */ -- shli r13, r13, 31 /* Build 0x80000000. */ -- } -- { -- CMPEQ r13, r12, r12 /* Test for that value. */ -- sub r12, zero, r12 /* Re-negate it. */ -- } -- CMOVNEZ r12, r13, zero /* Replace zero pids. */ -- ST4 r11, r12 /* Restore the PID. */ --1: - BNEZ r1, 0f - jrp lr - PSEUDO_END (__vfork) -diff --git a/sysdeps/unix/sysv/linux/tst-clone2.c b/sysdeps/unix/sysv/linux/tst-clone2.c -index 68a7e6d6e2..1472311947 100644 ---- a/sysdeps/unix/sysv/linux/tst-clone2.c -+++ b/sysdeps/unix/sysv/linux/tst-clone2.c -@@ -28,8 +28,11 @@ - #include - #include - #include -+#include - --#include /* for THREAD_* macros. */ -+#include /* For _STACK_GROWS_{UP,DOWN}. */ -+ -+#include - - static int sig; - static int pipefd[2]; -@@ -39,39 +42,35 @@ f (void *a) - { - close (pipefd[0]); - -- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid); -- pid_t tid = THREAD_GETMEM (THREAD_SELF, tid); -+ pid_t ppid = getppid (); -+ pid_t pid = getpid (); -+ pid_t tid = syscall (__NR_gettid); - -- while (write (pipefd[1], &pid, sizeof pid) < 0) -- continue; -- while (write (pipefd[1], &tid, sizeof tid) < 0) -- continue; -+ if (write (pipefd[1], &ppid, sizeof ppid) != sizeof (ppid)) -+ FAIL_EXIT1 ("write ppid failed\n"); -+ if (write (pipefd[1], &pid, sizeof pid) != sizeof (pid)) -+ FAIL_EXIT1 ("write pid failed\n"); -+ if (write (pipefd[1], &tid, sizeof tid) != sizeof (tid)) -+ FAIL_EXIT1 ("write tid failed\n"); - - return 0; - } - - - static int --clone_test (int clone_flags) -+do_test (void) - { - sig = SIGRTMIN; - sigset_t ss; - sigemptyset (&ss); - sigaddset (&ss, sig); - if (sigprocmask (SIG_BLOCK, &ss, NULL) != 0) -- { -- printf ("sigprocmask failed: %m\n"); -- return 1; -- } -+ FAIL_EXIT1 ("sigprocmask failed: %m"); - - if (pipe2 (pipefd, O_CLOEXEC)) -- { -- printf ("sigprocmask failed: %m\n"); -- return 1; -- } -- -- pid_t ppid = getpid (); -+ FAIL_EXIT1 ("pipe failed: %m"); - -+ int clone_flags = 0; - #ifdef __ia64__ - extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, - size_t __child_stack_size, int __flags, -@@ -88,61 +87,47 @@ clone_test (int clone_flags) - #error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" - #endif - #endif -+ - close (pipefd[1]); - - if (p == -1) -+ FAIL_EXIT1("clone failed: %m"); -+ -+ pid_t ppid, pid, tid; -+ if (read (pipefd[0], &ppid, sizeof pid) != sizeof pid) - { -- printf ("clone failed: %m\n"); -- return 1; -+ kill (p, SIGKILL); -+ FAIL_EXIT1 ("read ppid failed: %m"); - } -- -- pid_t pid, tid; - if (read (pipefd[0], &pid, sizeof pid) != sizeof pid) - { -- printf ("read pid failed: %m\n"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("read pid failed: %m"); - } - if (read (pipefd[0], &tid, sizeof tid) != sizeof tid) - { -- printf ("read pid failed: %m\n"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("read tid failed: %m"); - } - - close (pipefd[0]); - - int ret = 0; - -- /* For CLONE_VM glibc clone implementation does not change the pthread -- pid/tid field. */ -- if ((clone_flags & CLONE_VM) == CLONE_VM) -- { -- if ((ppid != pid) || (ppid != tid)) -- { -- printf ("parent pid (%i) != received pid/tid (%i/%i)\n", -- (int)ppid, (int)pid, (int)tid); -- ret = 1; -- } -- } -- /* For any other flag clone updates the new pthread pid and tid with -- the clone return value. */ -- else -- { -- if ((p != pid) || (p != tid)) -- { -- printf ("child pid (%i) != received pid/tid (%i/%i)\n", -- (int)p, (int)pid, (int)tid); -- ret = 1; -- } -- } -+ pid_t own_pid = getpid (); -+ pid_t own_tid = syscall (__NR_gettid); -+ -+ /* Some sanity checks for clone syscall: returned ppid should be current -+ pid and both returned tid/pid should be different from current one. */ -+ if ((ppid != own_pid) || (pid == own_pid) || (tid == own_tid)) -+ FAIL_RET ("ppid=%i pid=%i tid=%i | own_pid=%i own_tid=%i", -+ (int)ppid, (int)pid, (int)tid, (int)own_pid, (int)own_tid); - - int e; - if (waitpid (p, &e, __WCLONE) != p) - { -- puts ("waitpid failed"); - kill (p, SIGKILL); -- return 1; -+ FAIL_EXIT1 ("waitpid failed"); - } - if (!WIFEXITED (e)) - { -@@ -150,29 +135,12 @@ clone_test (int clone_flags) - printf ("died from signal %s\n", strsignal (WTERMSIG (e))); - else - puts ("did not terminate correctly"); -- return 1; -+ exit (EXIT_FAILURE); - } - if (WEXITSTATUS (e) != 0) -- { -- printf ("exit code %d\n", WEXITSTATUS (e)); -- return 1; -- } -+ FAIL_EXIT1 ("exit code %d", WEXITSTATUS (e)); - - return ret; - } - --int --do_test (void) --{ -- /* First, check that the clone implementation, without any flag, updates -- the struct pthread to contain the new PID and TID. */ -- int ret = clone_test (0); -- /* Second, check that with CLONE_VM the struct pthread PID and TID fields -- remain unmodified after the clone. Any modifications would cause problem -- for the parent as described in bug 19957. */ -- ret += clone_test (CLONE_VM); -- return ret; --} -- --#define TEST_FUNCTION do_test () --#include "../test-skeleton.c" -+#include -diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S -index 66f4b11490..5629aed395 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/clone.S -+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S -@@ -91,14 +91,6 @@ L(thread_start): - the outermost frame obviously. */ - xorl %ebp, %ebp - -- andq $CLONE_VM, %rdi -- jne 1f -- movl $SYS_ify(getpid), %eax -- syscall -- movl %eax, %fs:PID -- movl %eax, %fs:TID --1: -- - /* Set up arguments for the function call. */ - popq %rax /* Function to call. */ - popq %rdi /* Argument. */ -diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S -index 8332ade9fb..cdd2dea32a 100644 ---- a/sysdeps/unix/sysv/linux/x86_64/vfork.S -+++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S -@@ -34,16 +34,6 @@ ENTRY (__vfork) - cfi_adjust_cfa_offset(-8) - cfi_register(%rip, %rdi) - -- /* Save the TCB-cached PID away in %esi, and then negate the TCB -- field. But if it's zero, set it to 0x80000000 instead. See -- raise.c for the logic that relies on this value. */ -- movl %fs:PID, %esi -- movl $0x80000000, %ecx -- movl %esi, %edx -- negl %edx -- cmove %ecx, %edx -- movl %edx, %fs:PID -- - /* Stuff the syscall number in RAX and enter into the kernel. */ - movl $SYS_ify (vfork), %eax - syscall -@@ -52,14 +42,6 @@ ENTRY (__vfork) - pushq %rdi - cfi_adjust_cfa_offset(8) - -- /* Restore the original value of the TCB cache of the PID, if we're -- the parent. But in the child (syscall return value equals zero), -- leave things as they are. */ -- testq %rax, %rax -- je 1f -- movl %esi, %fs:PID --1: -- - cmpl $-4095, %eax - jae SYSCALL_ERROR_LABEL /* Branch forward if it failed. */ - -diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c -index 9ce4b495a5..508ad2ae7b 100644 ---- a/sysdeps/x86/cpu-features.c -+++ b/sysdeps/x86/cpu-features.c -@@ -133,8 +133,6 @@ init_cpu_features (struct cpu_features *cpu_features) - - case 0x57: - /* Knights Landing. Enable Silvermont optimizations. */ -- cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] -- |= bit_arch_Prefer_No_VZEROUPPER; - - case 0x5c: - case 0x5f: -@@ -205,6 +203,33 @@ init_cpu_features (struct cpu_features *cpu_features) - if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)) - cpu_features->feature[index_arch_AVX_Fast_Unaligned_Load] - |= bit_arch_AVX_Fast_Unaligned_Load; -+ -+ /* Since AVX512ER is unique to Xeon Phi, set Prefer_No_VZEROUPPER -+ if AVX512ER is available. Don't use AVX512 to avoid lower CPU -+ frequency if AVX512ER isn't available. */ -+ if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER)) -+ cpu_features->feature[index_arch_Prefer_No_VZEROUPPER] -+ |= bit_arch_Prefer_No_VZEROUPPER; -+ else -+ cpu_features->feature[index_arch_Prefer_No_AVX512] -+ |= bit_arch_Prefer_No_AVX512; -+ -+ /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow. -+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. -+ Use _dl_runtime_resolve_opt only with AVX512F since it is -+ slower than _dl_runtime_resolve_slow with AVX. */ -+ cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow] -+ |= bit_arch_Use_dl_runtime_resolve_slow; -+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) -+ && cpu_features->max_cpuid >= 0xd) -+ { -+ unsigned int eax; -+ -+ __cpuid_count (0xd, 1, eax, ebx, ecx, edx); -+ if ((eax & (1 << 2)) != 0) -+ cpu_features->feature[index_arch_Use_dl_runtime_resolve_opt] -+ |= bit_arch_Use_dl_runtime_resolve_opt; -+ } - } - /* This spells out "AuthenticAMD". */ - else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) -diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h -index 97ffe765f4..2609ac0999 100644 ---- a/sysdeps/x86/cpu-features.h -+++ b/sysdeps/x86/cpu-features.h -@@ -37,6 +37,9 @@ - #define bit_arch_Prefer_No_VZEROUPPER (1 << 17) - #define bit_arch_Fast_Unaligned_Copy (1 << 18) - #define bit_arch_Prefer_ERMS (1 << 19) -+#define bit_arch_Use_dl_runtime_resolve_opt (1 << 20) -+#define bit_arch_Use_dl_runtime_resolve_slow (1 << 21) -+#define bit_arch_Prefer_No_AVX512 (1 << 22) - - /* CPUID Feature flags. */ - -@@ -60,6 +63,11 @@ - #define bit_cpu_AVX2 (1 << 5) - #define bit_cpu_AVX512F (1 << 16) - #define bit_cpu_AVX512DQ (1 << 17) -+#define bit_cpu_AVX512PF (1 << 26) -+#define bit_cpu_AVX512ER (1 << 27) -+#define bit_cpu_AVX512CD (1 << 28) -+#define bit_cpu_AVX512BW (1 << 30) -+#define bit_cpu_AVX512VL (1u << 31) - - /* XCR0 Feature flags. */ - #define bit_XMM_state (1 << 1) -@@ -107,6 +115,9 @@ - # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1*FEATURE_SIZE - # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1*FEATURE_SIZE - # define index_arch_Prefer_ERMS FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1*FEATURE_SIZE -+# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1*FEATURE_SIZE - - - # if defined (_LIBC) && !IS_IN (nonlib) -@@ -232,6 +243,11 @@ extern const struct cpu_features *__get_cpu_features (void) - # define index_cpu_AVX2 COMMON_CPUID_INDEX_7 - # define index_cpu_AVX512F COMMON_CPUID_INDEX_7 - # define index_cpu_AVX512DQ COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512PF COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512ER COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512CD COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512BW COMMON_CPUID_INDEX_7 -+# define index_cpu_AVX512VL COMMON_CPUID_INDEX_7 - # define index_cpu_ERMS COMMON_CPUID_INDEX_7 - # define index_cpu_RTM COMMON_CPUID_INDEX_7 - # define index_cpu_FMA COMMON_CPUID_INDEX_1 -@@ -250,6 +266,11 @@ extern const struct cpu_features *__get_cpu_features (void) - # define reg_AVX2 ebx - # define reg_AVX512F ebx - # define reg_AVX512DQ ebx -+# define reg_AVX512PF ebx -+# define reg_AVX512ER ebx -+# define reg_AVX512CD ebx -+# define reg_AVX512BW ebx -+# define reg_AVX512VL ebx - # define reg_ERMS ebx - # define reg_RTM ebx - # define reg_FMA ecx -@@ -277,6 +298,9 @@ extern const struct cpu_features *__get_cpu_features (void) - # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1 - # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1 - # define index_arch_Prefer_ERMS FEATURE_INDEX_1 -+# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1 -+# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1 -+# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1 - - #endif /* !__ASSEMBLER__ */ - -diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile -index 6d99284cd0..cc990a9685 100644 ---- a/sysdeps/x86_64/Makefile -+++ b/sysdeps/x86_64/Makefile -@@ -27,7 +27,7 @@ ifeq ($(subdir),elf) - CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\ - -mno-mmx) - --sysdep-dl-routines += tlsdesc dl-tlsdesc -+sysdep-dl-routines += tlsdesc dl-tlsdesc tls_get_addr - - tests += ifuncmain8 - modules-names += ifuncmod8 -@@ -49,9 +49,12 @@ extra-test-objs += tst-quadmod1pie.o tst-quadmod2pie.o - $(objpfx)tst-quad1pie: $(objpfx)tst-quadmod1pie.o - $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o - --tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 tst-audit10 --test-extras += tst-audit4-aux tst-audit10-aux --extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o -+tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \ -+ tst-audit10 tst-sse tst-avx tst-avx512 -+test-extras += tst-audit4-aux tst-audit10-aux \ -+ tst-avx-aux tst-avx512-aux -+extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o \ -+ tst-avx-aux.o tst-avx512-aux.o - - tests += tst-split-dynreloc - LDFLAGS-tst-split-dynreloc = -Wl,-T,$(..)sysdeps/x86_64/tst-split-dynreloc.lds -@@ -62,7 +65,8 @@ modules-names += tst-auditmod3a tst-auditmod3b \ - tst-auditmod5a tst-auditmod5b \ - tst-auditmod6a tst-auditmod6b tst-auditmod6c \ - tst-auditmod7a tst-auditmod7b \ -- tst-auditmod10a tst-auditmod10b -+ tst-auditmod10a tst-auditmod10b \ -+ tst-ssemod tst-avxmod tst-avx512mod - - $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so - $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so -@@ -89,6 +93,10 @@ $(objpfx)tst-audit10: $(objpfx)tst-audit10-aux.o $(objpfx)tst-auditmod10a.so - $(objpfx)tst-audit10.out: $(objpfx)tst-auditmod10b.so - tst-audit10-ENV = LD_AUDIT=$(objpfx)tst-auditmod10b.so - -+$(objpfx)tst-sse: $(objpfx)tst-ssemod.so -+$(objpfx)tst-avx: $(objpfx)tst-avx-aux.o $(objpfx)tst-avxmod.so -+$(objpfx)tst-avx512: $(objpfx)tst-avx512-aux.o $(objpfx)tst-avx512mod.so -+ - AVX-CFLAGS=-mavx -mno-vzeroupper - CFLAGS-tst-audit4-aux.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS) -@@ -96,14 +104,18 @@ CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS) - CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS) -+CFLAGS-tst-avx-aux.c += $(AVX-CFLAGS) -+CFLAGS-tst-avxmod.c += $(AVX-CFLAGS) - ifeq (yes,$(config-cflags-avx512)) - AVX512-CFLAGS = -mavx512f - CFLAGS-tst-audit10-aux.c += $(AVX512-CFLAGS) - CFLAGS-tst-auditmod10a.c += $(AVX512-CFLAGS) - CFLAGS-tst-auditmod10b.c += $(AVX512-CFLAGS) -+CFLAGS-tst-avx512-aux.c += $(AVX512-CFLAGS) -+CFLAGS-tst-avx512mod.c += $(AVX512-CFLAGS) - endif - endif - - ifeq ($(subdir),csu) --gen-as-const-headers += tlsdesc.sym -+gen-as-const-headers += tlsdesc.sym rtld-offsets.sym - endif -diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h -index ed0c1a8efd..c0f0fa16a2 100644 ---- a/sysdeps/x86_64/dl-machine.h -+++ b/sysdeps/x86_64/dl-machine.h -@@ -68,7 +68,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - Elf64_Addr *got; - extern void _dl_runtime_resolve_sse (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_resolve_avx (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx_slow (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx_opt (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_resolve_avx512 (ElfW(Word)) attribute_hidden; -+ extern void _dl_runtime_resolve_avx512_opt (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_sse (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_avx (ElfW(Word)) attribute_hidden; - extern void _dl_runtime_profile_avx512 (ElfW(Word)) attribute_hidden; -@@ -118,9 +121,26 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) - indicated by the offset on the stack, and then jump to - the resolved address. */ - if (HAS_ARCH_FEATURE (AVX512F_Usable)) -- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_avx512; -+ { -+ if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx512_opt; -+ else -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx512; -+ } - else if (HAS_ARCH_FEATURE (AVX_Usable)) -- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_avx; -+ { -+ if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx_opt; -+ else if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_slow)) -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx_slow; -+ else -+ *(ElfW(Addr) *) (got + 2) -+ = (ElfW(Addr)) &_dl_runtime_resolve_avx; -+ } - else - *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_sse; - } -diff --git a/sysdeps/x86_64/dl-tls.c b/sysdeps/x86_64/dl-tls.c -new file mode 100644 -index 0000000000..3584805c8e ---- /dev/null -+++ b/sysdeps/x86_64/dl-tls.c -@@ -0,0 +1,53 @@ -+/* Thread-local storage handling in the ELF dynamic linker. x86-64 version. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifdef SHARED -+/* Work around GCC PR58066, due to which __tls_get_addr may be called -+ with an unaligned stack. The compat implementation is in -+ tls_get_addr-compat.S. */ -+ -+# include -+ -+/* Define __tls_get_addr within elf/dl-tls.c under a different -+ name. */ -+extern __typeof__ (__tls_get_addr) ___tls_get_addr; -+ -+# define __tls_get_addr ___tls_get_addr -+# include -+# undef __tls_get_addr -+ -+hidden_ver (___tls_get_addr, __tls_get_addr) -+ -+/* Only handle slow paths for __tls_get_addr. */ -+attribute_hidden -+void * -+__tls_get_addr_slow (GET_ADDR_ARGS) -+{ -+ dtv_t *dtv = THREAD_DTV (); -+ -+ if (__glibc_unlikely (dtv[0].counter != GL(dl_tls_generation))) -+ return update_get_addr (GET_ADDR_PARAM); -+ -+ return tls_get_addr_tail (GET_ADDR_PARAM, dtv, NULL); -+} -+#else -+ -+/* No compatibility symbol needed. */ -+# include -+ -+#endif -diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h -index cf6c107f54..fa5bf6cd93 100644 ---- a/sysdeps/x86_64/dl-tls.h -+++ b/sysdeps/x86_64/dl-tls.h -@@ -16,6 +16,9 @@ - License along with the GNU C Library; if not, see - . */ - -+#ifndef _X86_64_DL_TLS_H -+#define _X86_64_DL_TLS_H -+ - #include - - /* Type used for the representation of TLS information in the GOT. */ -@@ -27,3 +30,5 @@ typedef struct dl_tls_index - - - extern void *__tls_get_addr (tls_index *ti); -+ -+#endif /* _X86_64_DL_TLS_H */ -diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S -index 12f1a5cf84..50b23633e3 100644 ---- a/sysdeps/x86_64/dl-trampoline.S -+++ b/sysdeps/x86_64/dl-trampoline.S -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - - #ifndef DL_STACK_ALIGNMENT -@@ -104,9 +105,11 @@ - #endif - #define VEC(i) ymm##i - #define _dl_runtime_resolve _dl_runtime_resolve_avx -+#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx_opt - #define _dl_runtime_profile _dl_runtime_profile_avx - #include "dl-trampoline.h" - #undef _dl_runtime_resolve -+#undef _dl_runtime_resolve_opt - #undef _dl_runtime_profile - #undef VEC - #undef VMOV -@@ -126,3 +129,19 @@ - #define _dl_runtime_profile _dl_runtime_profile_sse - #undef RESTORE_AVX - #include "dl-trampoline.h" -+#undef _dl_runtime_resolve -+#undef _dl_runtime_profile -+#undef VMOV -+#undef VMOVA -+ -+/* Used by _dl_runtime_resolve_avx_opt/_dl_runtime_resolve_avx512_opt -+ to preserve the full vector registers with zero upper bits. */ -+#define VMOVA vmovdqa -+#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT -+# define VMOV vmovdqa -+#else -+# define VMOV vmovdqu -+#endif -+#define _dl_runtime_resolve _dl_runtime_resolve_sse_vex -+#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt -+#include "dl-trampoline.h" -diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h -index b90836ab13..d21c5a987a 100644 ---- a/sysdeps/x86_64/dl-trampoline.h -+++ b/sysdeps/x86_64/dl-trampoline.h -@@ -50,6 +50,106 @@ - #endif - - .text -+#ifdef _dl_runtime_resolve_opt -+/* Use the smallest vector registers to preserve the full YMM/ZMM -+ registers to avoid SSE transition penalty. */ -+ -+# if VEC_SIZE == 32 -+/* Check if the upper 128 bits in %ymm0 - %ymm7 registers are non-zero -+ and preserve %xmm0 - %xmm7 registers with the zero upper bits. Since -+ there is no SSE transition penalty on AVX512 processors which don't -+ support XGETBV with ECX == 1, _dl_runtime_resolve_avx512_slow isn't -+ provided. */ -+ .globl _dl_runtime_resolve_avx_slow -+ .hidden _dl_runtime_resolve_avx_slow -+ .type _dl_runtime_resolve_avx_slow, @function -+ .align 16 -+_dl_runtime_resolve_avx_slow: -+ cfi_startproc -+ cfi_adjust_cfa_offset(16) # Incorporate PLT -+ vorpd %ymm0, %ymm1, %ymm8 -+ vorpd %ymm2, %ymm3, %ymm9 -+ vorpd %ymm4, %ymm5, %ymm10 -+ vorpd %ymm6, %ymm7, %ymm11 -+ vorpd %ymm8, %ymm9, %ymm9 -+ vorpd %ymm10, %ymm11, %ymm10 -+ vpcmpeqd %xmm8, %xmm8, %xmm8 -+ vorpd %ymm9, %ymm10, %ymm10 -+ vptest %ymm10, %ymm8 -+ # Preserve %ymm0 - %ymm7 registers if the upper 128 bits of any -+ # %ymm0 - %ymm7 registers aren't zero. -+ PRESERVE_BND_REGS_PREFIX -+ jnc _dl_runtime_resolve_avx -+ # Use vzeroupper to avoid SSE transition penalty. -+ vzeroupper -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits -+ # when the upper 128 bits of %ymm0 - %ymm7 registers are zero. -+ PRESERVE_BND_REGS_PREFIX -+ jmp _dl_runtime_resolve_sse_vex -+ cfi_adjust_cfa_offset(-16) # Restore PLT adjustment -+ cfi_endproc -+ .size _dl_runtime_resolve_avx_slow, .-_dl_runtime_resolve_avx_slow -+# endif -+ -+/* Use XGETBV with ECX == 1 to check which bits in vector registers are -+ non-zero and only preserve the non-zero lower bits with zero upper -+ bits. */ -+ .globl _dl_runtime_resolve_opt -+ .hidden _dl_runtime_resolve_opt -+ .type _dl_runtime_resolve_opt, @function -+ .align 16 -+_dl_runtime_resolve_opt: -+ cfi_startproc -+ cfi_adjust_cfa_offset(16) # Incorporate PLT -+ pushq %rax -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rax, 0) -+ pushq %rcx -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rcx, 0) -+ pushq %rdx -+ cfi_adjust_cfa_offset(8) -+ cfi_rel_offset(%rdx, 0) -+ movl $1, %ecx -+ xgetbv -+ movl %eax, %r11d -+ popq %rdx -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rdx) -+ popq %rcx -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rcx) -+ popq %rax -+ cfi_adjust_cfa_offset(-8) -+ cfi_restore (%rax) -+# if VEC_SIZE == 32 -+ # For YMM registers, check if YMM state is in use. -+ andl $bit_YMM_state, %r11d -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits if -+ # YMM state isn't in use. -+ PRESERVE_BND_REGS_PREFIX -+ jz _dl_runtime_resolve_sse_vex -+# elif VEC_SIZE == 16 -+ # For ZMM registers, check if YMM state and ZMM state are in -+ # use. -+ andl $(bit_YMM_state | bit_ZMM0_15_state), %r11d -+ cmpl $bit_YMM_state, %r11d -+ # Preserve %zmm0 - %zmm7 registers if ZMM state is in use. -+ PRESERVE_BND_REGS_PREFIX -+ jg _dl_runtime_resolve_avx512 -+ # Preserve %ymm0 - %ymm7 registers with the zero upper 256 bits if -+ # ZMM state isn't in use. -+ PRESERVE_BND_REGS_PREFIX -+ je _dl_runtime_resolve_avx -+ # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if -+ # neither YMM state nor ZMM state are in use. -+# else -+# error Unsupported VEC_SIZE! -+# endif -+ cfi_adjust_cfa_offset(-16) # Restore PLT adjustment -+ cfi_endproc -+ .size _dl_runtime_resolve_opt, .-_dl_runtime_resolve_opt -+#endif - .globl _dl_runtime_resolve - .hidden _dl_runtime_resolve - .type _dl_runtime_resolve, @function -@@ -69,7 +169,9 @@ _dl_runtime_resolve: - and $-VEC_SIZE, %RSP_LP - #endif - sub $REGISTER_SAVE_AREA, %RSP_LP -+#if !DL_RUNTIME_RESOLVE_REALIGN_STACK - cfi_adjust_cfa_offset(REGISTER_SAVE_AREA) -+#endif - # Preserve registers otherwise clobbered. - movq %rax, REGISTER_SAVE_RAX(%rsp) - movq %rcx, REGISTER_SAVE_RCX(%rsp) -@@ -162,7 +264,10 @@ _dl_runtime_resolve: - .size _dl_runtime_resolve, .-_dl_runtime_resolve - - --#ifndef PROF -+/* To preserve %xmm0 - %xmm7 registers, dl-trampoline.h is included -+ twice, for _dl_runtime_resolve_sse and _dl_runtime_resolve_sse_vex. -+ But we don't need another _dl_runtime_profile for XMM registers. */ -+#if !defined PROF && defined _dl_runtime_profile - # if (LR_VECTOR_OFFSET % VEC_SIZE) != 0 - # error LR_VECTOR_OFFSET must be multples of VEC_SIZE - # endif -diff --git a/sysdeps/x86_64/memcpy_chk.S b/sysdeps/x86_64/memcpy_chk.S -index 2296b55119..a95b3ad3cf 100644 ---- a/sysdeps/x86_64/memcpy_chk.S -+++ b/sysdeps/x86_64/memcpy_chk.S -@@ -19,7 +19,7 @@ - #include - #include "asm-syntax.h" - --#ifndef PIC -+#ifndef SHARED - /* For libc.so this is defined in memcpy.S. - For libc.a, this is a separate source to avoid - memcpy bringing in __chk_fail and all routines -diff --git a/sysdeps/x86_64/multiarch/memcpy.S b/sysdeps/x86_64/multiarch/memcpy.S -index b8677596f9..ea4ec70d1a 100644 ---- a/sysdeps/x86_64/multiarch/memcpy.S -+++ b/sysdeps/x86_64/multiarch/memcpy.S -@@ -32,6 +32,8 @@ ENTRY(__new_memcpy) - lea __memcpy_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memcpy_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memcpy_chk.S b/sysdeps/x86_64/multiarch/memcpy_chk.S -index 9d92c8a7e3..26b49de6f6 100644 ---- a/sysdeps/x86_64/multiarch/memcpy_chk.S -+++ b/sysdeps/x86_64/multiarch/memcpy_chk.S -@@ -30,6 +30,8 @@ - ENTRY(__memcpy_chk) - .type __memcpy_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memmove.S b/sysdeps/x86_64/multiarch/memmove.S -index ff5e041420..ef92afde5a 100644 ---- a/sysdeps/x86_64/multiarch/memmove.S -+++ b/sysdeps/x86_64/multiarch/memmove.S -@@ -30,6 +30,8 @@ ENTRY(__libc_memmove) - lea __memmove_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memmove_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memmove_chk.S b/sysdeps/x86_64/multiarch/memmove_chk.S -index 7f861206df..a9129c460a 100644 ---- a/sysdeps/x86_64/multiarch/memmove_chk.S -+++ b/sysdeps/x86_64/multiarch/memmove_chk.S -@@ -29,6 +29,8 @@ - ENTRY(__memmove_chk) - .type __memmove_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __memmove_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/mempcpy.S b/sysdeps/x86_64/multiarch/mempcpy.S -index 51970687cf..87c8299fea 100644 ---- a/sysdeps/x86_64/multiarch/mempcpy.S -+++ b/sysdeps/x86_64/multiarch/mempcpy.S -@@ -32,6 +32,8 @@ ENTRY(__mempcpy) - lea __mempcpy_erms(%rip), %RAX_LP - HAS_ARCH_FEATURE (Prefer_ERMS) - jnz 2f -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __mempcpy_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.S b/sysdeps/x86_64/multiarch/mempcpy_chk.S -index 9e49f6f26e..642c67973b 100644 ---- a/sysdeps/x86_64/multiarch/mempcpy_chk.S -+++ b/sysdeps/x86_64/multiarch/mempcpy_chk.S -@@ -30,6 +30,8 @@ - ENTRY(__mempcpy_chk) - .type __mempcpy_chk, @gnu_indirect_function - LOAD_RTLD_GLOBAL_RO_RDX -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 1f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 1f - lea __mempcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -index 28e71fd576..acf448c9a6 100644 ---- a/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -+++ b/sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S -@@ -110,6 +110,8 @@ ENTRY (__memset_erms) - ENTRY (MEMSET_SYMBOL (__memset, erms)) - # endif - L(stosb): -+ /* Issue vzeroupper before rep stosb. */ -+ VZEROUPPER - movq %rdx, %rcx - movzbl %sil, %eax - movq %rdi, %rdx -diff --git a/sysdeps/x86_64/multiarch/memset.S b/sysdeps/x86_64/multiarch/memset.S -index 96e99341aa..eae39e2ecd 100644 ---- a/sysdeps/x86_64/multiarch/memset.S -+++ b/sysdeps/x86_64/multiarch/memset.S -@@ -41,6 +41,8 @@ ENTRY(memset) - jnz L(AVX512F) - lea __memset_avx2_unaligned(%rip), %RAX_LP - L(AVX512F): -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 2f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 2f - lea __memset_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/multiarch/memset_chk.S b/sysdeps/x86_64/multiarch/memset_chk.S -index 2efe6ed909..38d7bef6df 100644 ---- a/sysdeps/x86_64/multiarch/memset_chk.S -+++ b/sysdeps/x86_64/multiarch/memset_chk.S -@@ -38,6 +38,8 @@ ENTRY(__memset_chk) - jnz L(AVX512F) - lea __memset_chk_avx2_unaligned(%rip), %RAX_LP - L(AVX512F): -+ HAS_ARCH_FEATURE (Prefer_No_AVX512) -+ jnz 2f - HAS_ARCH_FEATURE (AVX512F_Usable) - jz 2f - lea __memset_chk_avx512_no_vzeroupper(%rip), %RAX_LP -diff --git a/sysdeps/x86_64/nptl/tcb-offsets.sym b/sysdeps/x86_64/nptl/tcb-offsets.sym -index aeb752673a..8a25c482cb 100644 ---- a/sysdeps/x86_64/nptl/tcb-offsets.sym -+++ b/sysdeps/x86_64/nptl/tcb-offsets.sym -@@ -4,7 +4,6 @@ - - RESULT offsetof (struct pthread, result) - TID offsetof (struct pthread, tid) --PID offsetof (struct pthread, pid) - CANCELHANDLING offsetof (struct pthread, cancelhandling) - CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) - CLEANUP offsetof (struct pthread, cleanup) -diff --git a/sysdeps/x86_64/rtld-offsets.sym b/sysdeps/x86_64/rtld-offsets.sym -new file mode 100644 -index 0000000000..fd41b51521 ---- /dev/null -+++ b/sysdeps/x86_64/rtld-offsets.sym -@@ -0,0 +1,6 @@ -+#define SHARED -+#include -+ -+-- -+ -+GL_TLS_GENERATION_OFFSET offsetof (struct rtld_global, _dl_tls_generation) -diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h -index 75ac747be8..4b67fa80c1 100644 ---- a/sysdeps/x86_64/sysdep.h -+++ b/sysdeps/x86_64/sysdep.h -@@ -89,13 +89,14 @@ lose: \ - END (name) - - #undef JUMPTARGET --#ifdef PIC -+#ifdef SHARED - # ifdef BIND_NOW - # define JUMPTARGET(name) *name##@GOTPCREL(%rip) - # else - # define JUMPTARGET(name) name##@PLT - # endif - #else -+/* For static archives, branch to target directly. */ - # define JUMPTARGET(name) name - #endif - -diff --git a/sysdeps/x86_64/tls_get_addr.S b/sysdeps/x86_64/tls_get_addr.S -new file mode 100644 -index 0000000000..9d38fb3be5 ---- /dev/null -+++ b/sysdeps/x86_64/tls_get_addr.S -@@ -0,0 +1,61 @@ -+/* Stack-aligning implementation of __tls_get_addr. x86-64 version. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifdef SHARED -+ -+# include -+# include "tlsdesc.h" -+# include "rtld-offsets.h" -+ -+/* See __tls_get_addr and __tls_get_addr_slow in dl-tls.c. This function -+ call __tls_get_addr_slow on both slow paths. It realigns the stack -+ before the call to work around GCC PR58066. */ -+ -+ENTRY (__tls_get_addr) -+ mov %fs:DTV_OFFSET, %RDX_LP -+ mov GL_TLS_GENERATION_OFFSET+_rtld_local(%rip), %RAX_LP -+ /* GL(dl_tls_generation) == dtv[0].counter */ -+ cmp %RAX_LP, (%rdx) -+ jne 1f -+ mov TI_MODULE_OFFSET(%rdi), %RAX_LP -+ /* dtv[ti->ti_module] */ -+# ifdef __LP64__ -+ salq $4, %rax -+ movq (%rdx,%rax), %rax -+# else -+ movl (%rdx,%rax, 8), %eax -+# endif -+ cmp $-1, %RAX_LP -+ je 1f -+ add TI_OFFSET_OFFSET(%rdi), %RAX_LP -+ ret -+1: -+ /* On the slow path, align the stack. */ -+ pushq %rbp -+ cfi_def_cfa_offset (16) -+ cfi_offset (%rbp, -16) -+ mov %RSP_LP, %RBP_LP -+ cfi_def_cfa_register (%rbp) -+ and $-16, %RSP_LP -+ call __tls_get_addr_slow -+ mov %RBP_LP, %RSP_LP -+ popq %rbp -+ cfi_def_cfa (%rsp, 8) -+ ret -+END (__tls_get_addr) -+#endif /* SHARED */ -diff --git a/sysdeps/x86_64/tlsdesc.sym b/sysdeps/x86_64/tlsdesc.sym -index 33854975d0..fc897ab4b5 100644 ---- a/sysdeps/x86_64/tlsdesc.sym -+++ b/sysdeps/x86_64/tlsdesc.sym -@@ -15,3 +15,6 @@ TLSDESC_ARG offsetof(struct tlsdesc, arg) - TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count) - TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module) - TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset) -+ -+TI_MODULE_OFFSET offsetof(tls_index, ti_module) -+TI_OFFSET_OFFSET offsetof(tls_index, ti_offset) -diff --git a/sysdeps/x86_64/tst-avx-aux.c b/sysdeps/x86_64/tst-avx-aux.c -new file mode 100644 -index 0000000000..e3807de7bb ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx-aux.c -@@ -0,0 +1,47 @@ -+/* Test case for preserved AVX registers in dynamic linker, -mavx part. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+tst_avx_aux (void) -+{ -+#ifdef __AVX__ -+ extern __m256i avx_test (__m256i, __m256i, __m256i, __m256i, -+ __m256i, __m256i, __m256i, __m256i); -+ -+ __m256i ymm0 = _mm256_set1_epi32 (0); -+ __m256i ymm1 = _mm256_set1_epi32 (1); -+ __m256i ymm2 = _mm256_set1_epi32 (2); -+ __m256i ymm3 = _mm256_set1_epi32 (3); -+ __m256i ymm4 = _mm256_set1_epi32 (4); -+ __m256i ymm5 = _mm256_set1_epi32 (5); -+ __m256i ymm6 = _mm256_set1_epi32 (6); -+ __m256i ymm7 = _mm256_set1_epi32 (7); -+ __m256i ret = avx_test (ymm0, ymm1, ymm2, ymm3, -+ ymm4, ymm5, ymm6, ymm7); -+ ymm0 = _mm256_set1_epi32 (0x12349876); -+ if (memcmp (&ymm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+#else /* __AVX__ */ -+ return 77; -+#endif /* __AVX__ */ -+} -diff --git a/sysdeps/x86_64/tst-avx.c b/sysdeps/x86_64/tst-avx.c -new file mode 100644 -index 0000000000..ec2e3a79ff ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx.c -@@ -0,0 +1,49 @@ -+/* Test case for preserved AVX registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int tst_avx_aux (void); -+ -+static int -+avx_enabled (void) -+{ -+ unsigned int eax, ebx, ecx, edx; -+ -+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 -+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) -+ return 0; -+ -+ /* Check the OS has AVX and SSE saving enabled. */ -+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); -+ -+ return (eax & 6) == 6; -+} -+ -+static int -+do_test (void) -+{ -+ /* Run AVX test only if AVX is supported. */ -+ if (avx_enabled ()) -+ return tst_avx_aux (); -+ else -+ return 77; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-avx512-aux.c b/sysdeps/x86_64/tst-avx512-aux.c -new file mode 100644 -index 0000000000..6cebc523f2 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512-aux.c -@@ -0,0 +1,48 @@ -+/* Test case for preserved AVX512 registers in dynamic linker, -+ -mavx512 part. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+int -+tst_avx512_aux (void) -+{ -+#ifdef __AVX512F__ -+ extern __m512i avx512_test (__m512i, __m512i, __m512i, __m512i, -+ __m512i, __m512i, __m512i, __m512i); -+ -+ __m512i zmm0 = _mm512_set1_epi32 (0); -+ __m512i zmm1 = _mm512_set1_epi32 (1); -+ __m512i zmm2 = _mm512_set1_epi32 (2); -+ __m512i zmm3 = _mm512_set1_epi32 (3); -+ __m512i zmm4 = _mm512_set1_epi32 (4); -+ __m512i zmm5 = _mm512_set1_epi32 (5); -+ __m512i zmm6 = _mm512_set1_epi32 (6); -+ __m512i zmm7 = _mm512_set1_epi32 (7); -+ __m512i ret = avx512_test (zmm0, zmm1, zmm2, zmm3, -+ zmm4, zmm5, zmm6, zmm7); -+ zmm0 = _mm512_set1_epi32 (0x12349876); -+ if (memcmp (&zmm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+#else /* __AVX512F__ */ -+ return 77; -+#endif /* __AVX512F__ */ -+} -diff --git a/sysdeps/x86_64/tst-avx512.c b/sysdeps/x86_64/tst-avx512.c -new file mode 100644 -index 0000000000..a8e42ef553 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512.c -@@ -0,0 +1,57 @@ -+/* Test case for preserved AVX512 registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+ -+int tst_avx512_aux (void); -+ -+static int -+avx512_enabled (void) -+{ -+#ifdef bit_AVX512F -+ unsigned int eax, ebx, ecx, edx; -+ -+ if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0 -+ || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE)) -+ return 0; -+ -+ __cpuid_count (7, 0, eax, ebx, ecx, edx); -+ if (!(ebx & bit_AVX512F)) -+ return 0; -+ -+ asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0)); -+ -+ /* Verify that ZMM, YMM and XMM states are enabled. */ -+ return (eax & 0xe6) == 0xe6; -+#else -+ return 0; -+#endif -+} -+ -+static int -+do_test (void) -+{ -+ /* Run AVX512 test only if AVX512 is supported. */ -+ if (avx512_enabled ()) -+ return tst_avx512_aux (); -+ else -+ return 77; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-avx512mod.c b/sysdeps/x86_64/tst-avx512mod.c -new file mode 100644 -index 0000000000..4cfb3a2c3d ---- /dev/null -+++ b/sysdeps/x86_64/tst-avx512mod.c -@@ -0,0 +1,48 @@ -+/* Test case for x86-64 preserved AVX512 registers in dynamic linker. */ -+ -+#ifdef __AVX512F__ -+#include -+#include -+#include -+ -+__m512i -+avx512_test (__m512i x0, __m512i x1, __m512i x2, __m512i x3, -+ __m512i x4, __m512i x5, __m512i x6, __m512i x7) -+{ -+ __m512i zmm; -+ -+ zmm = _mm512_set1_epi32 (0); -+ if (memcmp (&zmm, &x0, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (1); -+ if (memcmp (&zmm, &x1, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (2); -+ if (memcmp (&zmm, &x2, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (3); -+ if (memcmp (&zmm, &x3, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (4); -+ if (memcmp (&zmm, &x4, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (5); -+ if (memcmp (&zmm, &x5, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (6); -+ if (memcmp (&zmm, &x6, sizeof (zmm))) -+ abort (); -+ -+ zmm = _mm512_set1_epi32 (7); -+ if (memcmp (&zmm, &x7, sizeof (zmm))) -+ abort (); -+ -+ return _mm512_set1_epi32 (0x12349876); -+} -+#endif -diff --git a/sysdeps/x86_64/tst-avxmod.c b/sysdeps/x86_64/tst-avxmod.c -new file mode 100644 -index 0000000000..6e5b154997 ---- /dev/null -+++ b/sysdeps/x86_64/tst-avxmod.c -@@ -0,0 +1,48 @@ -+/* Test case for x86-64 preserved AVX registers in dynamic linker. */ -+ -+#ifdef __AVX__ -+#include -+#include -+#include -+ -+__m256i -+avx_test (__m256i x0, __m256i x1, __m256i x2, __m256i x3, -+ __m256i x4, __m256i x5, __m256i x6, __m256i x7) -+{ -+ __m256i ymm; -+ -+ ymm = _mm256_set1_epi32 (0); -+ if (memcmp (&ymm, &x0, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (1); -+ if (memcmp (&ymm, &x1, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (2); -+ if (memcmp (&ymm, &x2, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (3); -+ if (memcmp (&ymm, &x3, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (4); -+ if (memcmp (&ymm, &x4, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (5); -+ if (memcmp (&ymm, &x5, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (6); -+ if (memcmp (&ymm, &x6, sizeof (ymm))) -+ abort (); -+ -+ ymm = _mm256_set1_epi32 (7); -+ if (memcmp (&ymm, &x7, sizeof (ymm))) -+ abort (); -+ -+ return _mm256_set1_epi32 (0x12349876); -+} -+#endif -diff --git a/sysdeps/x86_64/tst-sse.c b/sysdeps/x86_64/tst-sse.c -new file mode 100644 -index 0000000000..dd1537cf27 ---- /dev/null -+++ b/sysdeps/x86_64/tst-sse.c -@@ -0,0 +1,46 @@ -+/* Test case for preserved SSE registers in dynamic linker. -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+ -+extern __m128i sse_test (__m128i, __m128i, __m128i, __m128i, -+ __m128i, __m128i, __m128i, __m128i); -+ -+static int -+do_test (void) -+{ -+ __m128i xmm0 = _mm_set1_epi32 (0); -+ __m128i xmm1 = _mm_set1_epi32 (1); -+ __m128i xmm2 = _mm_set1_epi32 (2); -+ __m128i xmm3 = _mm_set1_epi32 (3); -+ __m128i xmm4 = _mm_set1_epi32 (4); -+ __m128i xmm5 = _mm_set1_epi32 (5); -+ __m128i xmm6 = _mm_set1_epi32 (6); -+ __m128i xmm7 = _mm_set1_epi32 (7); -+ __m128i ret = sse_test (xmm0, xmm1, xmm2, xmm3, -+ xmm4, xmm5, xmm6, xmm7); -+ xmm0 = _mm_set1_epi32 (0x12349876); -+ if (memcmp (&xmm0, &ret, sizeof (ret))) -+ abort (); -+ return 0; -+} -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-ssemod.c b/sysdeps/x86_64/tst-ssemod.c -new file mode 100644 -index 0000000000..907a64c69e ---- /dev/null -+++ b/sysdeps/x86_64/tst-ssemod.c -@@ -0,0 +1,46 @@ -+/* Test case for x86-64 preserved SSE registers in dynamic linker. */ -+ -+#include -+#include -+#include -+ -+__m128i -+sse_test (__m128i x0, __m128i x1, __m128i x2, __m128i x3, -+ __m128i x4, __m128i x5, __m128i x6, __m128i x7) -+{ -+ __m128i xmm; -+ -+ xmm = _mm_set1_epi32 (0); -+ if (memcmp (&xmm, &x0, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (1); -+ if (memcmp (&xmm, &x1, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (2); -+ if (memcmp (&xmm, &x2, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (3); -+ if (memcmp (&xmm, &x3, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (4); -+ if (memcmp (&xmm, &x4, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (5); -+ if (memcmp (&xmm, &x5, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (6); -+ if (memcmp (&xmm, &x6, sizeof (xmm))) -+ abort (); -+ -+ xmm = _mm_set1_epi32 (7); -+ if (memcmp (&xmm, &x7, sizeof (xmm))) -+ abort (); -+ -+ return _mm_set1_epi32 (0x12349876); -+} diff --git a/glibc/glibc-2.26-6.patch b/glibc/glibc-2.26-6.patch new file mode 100644 index 00000000..7c74fa92 --- /dev/null +++ b/glibc/glibc-2.26-6.patch @@ -0,0 +1,18954 @@ +diff --git a/ChangeLog b/ChangeLog +index 8dbfc7eaff..1793816794 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,974 @@ ++2017-10-23 Wilco Dijkstra ++ ++ * malloc/malloc.c (_int_malloc): Add SINGLE_THREAD_P path. ++ ++2017-10-23 Wilco Dijkstra ++ ++ * malloc/malloc.c (__libc_malloc): Add SINGLE_THREAD_P path. ++ (__libc_realloc): Likewise. ++ (_mid_memalign): Likewise. ++ (__libc_calloc): Likewise. ++ ++2017-10-20 Wilco Dijkstra ++ ++ * malloc/malloc.c (sysdep-cancel.h): Add include. ++ ++2017-10-20 Wilco Dijkstra ++ ++ * malloc/malloc.c (_int_free): Add SINGLE_THREAD_P fast paths. ++ ++2017-10-19 Wilco Dijkstra ++ ++ * malloc/malloc.c (_int_free): Fix deadlock bug in consistency check. ++ ++2017-08-31 Florian Weimer ++ ++ * malloc/malloc.c (_int_free): Remove locked variable and related ++ asserts. ++ ++2017-08-31 Florian Weimer ++ ++ * malloc/malloc.c (top_check): Change return type to void. Remove ++ internal_function. ++ * malloc/hooks.c (top_check): Likewise. ++ (malloc_check, realloc_check, memalign_check): Adjust. ++ ++2017-08-30 Florian Weimer ++ ++ * malloc/malloc.c (ARENA_CORRUPTION_BIT, arena_is_corrupt) ++ (set_arena_corrupt): Remove definitions. ++ (mtrim): Do not check for corrupt arena. ++ * malloc/arena.c (arena_lock, reused_arena, arena_get_retry): ++ Likewise. ++ ++2017-08-30 Florian Weimer ++ ++ [BZ #21754] ++ * malloc/arena.c (TUNABLE_CALLBACK set_mallopt_check): Do not set ++ check_action. ++ (ptmalloc_init): Do not set or use check_action. ++ * malloc/hooks.c (malloc_check_get_size, realloc_check): Adjust ++ call to malloc_printerr. Remove return statement. ++ (free_check): Likewise. Remove arena unlock. ++ (top_check): Update comment. Adjust call to malloc_printerr. ++ Remove heap repair code. ++ * malloc/malloc.c (unlink): Adjust calls to malloc_printerr. ++ (DEFAULT_CHECK_ACTION, check_action): Remove definitions. ++ (sysmalloc): Adjust call to malloc_printerr. ++ (munmap_chunk, __libc_realloc): Likewise. Remove return ++ statement. ++ (_int_malloc, int_realloc): Likewise. Remove errstr variable. ++ Remove errout label and corresponding gotos. ++ (_int_free): Likewise. Remove arena unlock. ++ (do_set_mallopt_check): Do not set check_action. ++ (malloc_printerr): Adjust parameter list. Do not mark arena as ++ corrupt. ++ * manual/memory.texi (Malloc Tunable Parameters): Remove TODO ++ comment. ++ * manual/probes.texi (Memory Allocation Probes): Remove ++ memory_mallopt_check_action. ++ ++2017-08-30 Florian Weimer ++ ++ [BZ #21754] ++ * malloc/malloc.c (malloc_printerr): Always terminate the process, ++ without printing a backtrace. Do not leak any information in the ++ error message. ++ * manual/memory.texi (Heap Consistency Checking): Update. ++ * manual/tunables.texi (Memory Allocation Tunables): Likewise. ++ ++2017-11-17 Tulio Magno Quites Machado Filho ++ ++ * sysdeps/powerpc/bits/hwcap.h (PPC_FEATURE2_HTM_NO_SUSPEND): New ++ macro. ++ ++2017-08-09 Andreas Schwab ++ ++ * nptl/Makefile (tests) [$(build-shared) = yes]: Add ++ tst-compat-forwarder. ++ (modules-names): Add tst-compat-forwarder-mod. ++ ($(objpfx)tst-compat-forwarder): Depend on ++ $(objpfx)tst-compat-forwarder-mod.so. ++ * nptl/tst-compat-forwarder.c: New file. ++ * nptl/tst-compat-forwarder-mod.c: New file. ++ ++2017-08-09 Andreas Schwab ++ ++ * sysdeps/unix/sysv/linux/s390/pt-longjmp.c: Update reference to ++ renamed alias. ++ ++2017-08-08 Andreas Schwab ++ ++ [BZ #21041] ++ * nptl/pt-longjmp.c (longjmp, siglongjmp): Don't use IFUNC resolver. ++ * nptl/pt-system.c (system): Likewise. ++ ++2017-11-21 Rajalakshmi Srinivasaraghavan ++ ++ * sysdeps/powerpc/powerpc64/power7/memcpy.S: Replace ++ lxvd2x/stxvd2x with lvx/stvx. ++ * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise. ++ ++2017-10-04 Florian Weimer ++ ++ * scripts/check-local-headers.sh: Ignore nspr4 header file ++ directory in addition to nspr. ++ ++2017-10-04 Guido Trentalancia ++ ++ [BZ #17956] ++ * configure.ac (--enable-nss-crypt): Use NSPR include directory. ++ * configure: Regenerate. ++ * crypt/Makefile (nss-cpp-flags): New variable. ++ (CPPFLAGS-sha256-crypt.c, CPPFLAGS-sha512-crypt.c) ++ (CPPFLAGS-md5-crypt.c): Use it. ++ * scripts/check-local-headers.sh: Ignore nspr header file ++ directory. ++ ++2017-10-18 Wilco Dijkstra ++ ++ * malloc/malloc.c (malloc_state): Use int for have_fastchunks since ++ not all targets support atomics on bool. ++ ++2017-10-17 Wilco Dijkstra ++ ++ * malloc/malloc.c (FASTCHUNKS_BIT): Remove. ++ (have_fastchunks): Remove. ++ (clear_fastchunks): Remove. ++ (set_fastchunks): Remove. ++ (malloc_state): Add have_fastchunks. ++ (malloc_init_state): Use have_fastchunks. ++ (do_check_malloc_state): Remove incorrect invariant checks. ++ (_int_malloc): Use have_fastchunks. ++ (_int_free): Likewise. ++ (malloc_consolidate): Likewise. ++ ++2017-10-17 Wilco Dijkstra ++ ++ * malloc/malloc.c (tcache_put): Inline. ++ (tcache_get): Inline. ++ ++2017-10-13 James Clarke ++ ++ * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): ++ Assign sym_map to be map for local symbols, as TLS relocations ++ use sym_map to determine whether the symbol is defined and to ++ extract the TLS information. ++ * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Likewise. ++ * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise. ++ ++2017-08-23 H.J. Lu ++ ++ * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated. ++ ++2017-11-07 Adhemerval Zanella ++ ++ [BZ #22298] ++ * nptl/allocatestack.c (allocate_stack): Check if ++ __PTHREAD_MUTEX_HAVE_PREV is non-zero, instead if ++ __PTHREAD_MUTEX_HAVE_PREV is defined. ++ * nptl/descr.h (pthread): Likewise. ++ * nptl/nptl-init.c (__pthread_initialize_minimal_internal): ++ Likewise. ++ * nptl/pthread_create.c (START_THREAD_DEFN): Likewise. ++ * sysdeps/nptl/fork.c (__libc_fork): Likewise. ++ * sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER): Likewise. ++ * sysdeps/nptl/bits/thread-shared-types.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New ++ defines. ++ (__pthread_internal_list): Check __PTHREAD_MUTEX_USE_UNION instead ++ of __WORDSIZE for internal layout. ++ (__pthread_mutex_s): Check __PTHREAD_MUTEX_NUSERS_AFTER_KIND instead ++ of __WORDSIZE for internal __nusers layout and __PTHREAD_MUTEX_USE_UNION ++ instead of __WORDSIZE whether to use an union for __spins and __list ++ fields. ++ (__PTHREAD_MUTEX_HAVE_PREV): Define also for __PTHREAD_MUTEX_USE_UNION ++ case. ++ * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New ++ defines. ++ * sysdeps/alpha/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/arm/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/hppa/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/ia64/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/mips/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/s390/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/sh/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/sparc/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/tile/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ * sysdeps/x86/nptl/bits/pthreadtypes-arch.h ++ (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): ++ Likewise. ++ ++ * nptl/pthreadP.h (ASSERT_PTHREAD_STRING, ++ ASSERT_PTHREAD_INTERNAL_OFFSET): New macro. ++ * nptl/pthread_mutex_init.c (__pthread_mutex_init): Add build time ++ checks for internal pthread_mutex_t offsets. ++ * sysdeps/aarch64/nptl/pthread-offsets.h ++ (__PTHREAD_MUTEX_NUSERS_OFFSET, __PTHREAD_MUTEX_KIND_OFFSET, ++ __PTHREAD_MUTEX_SPINS_OFFSET, __PTHREAD_MUTEX_ELISION_OFFSET, ++ __PTHREAD_MUTEX_LIST_OFFSET): New macro. ++ * sysdeps/alpha/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/arm/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/hppa/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/i386/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/ia64/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/m68k/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/microblaze/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/mips/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/nios2/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/powerpc/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/s390/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/sh/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/sparc/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/tile/nptl/pthread-offsets.h: Likewise. ++ * sysdeps/x86_64/nptl/pthread-offsets.h: Likewise. ++ ++ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Use 0 instead of ++ WNOHANG in waitpid call. ++ ++ [BZ #22273] ++ * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Handle the case where ++ the auxiliary process is terminated by a signal before calling _exit ++ or execve. ++ ++2017-09-13 Adhemerval Zanella ++ ++ * sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c: New file. ++ * sysdeps/unix/sysv/linux/alpha/Makefile ++ [$(subdir) = csu] (sysdep_routines): Remove rule. ++ ++2017-09-08 Adhemerval Zanella ++ ++ * sysdeps/unix/sysv/linux/arm/glob64.c: Remove file. ++ * sysdeps/unix/sysv/linux/i386/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/m68k/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/wordsize-64/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/x32/glob.c: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. ++ * sysdeps/wordsize-64/glob.c: Likewise. ++ * sysdeps/wordsize-64/glob64.c: Likewise. ++ * sysdeps/wordsize-64/globfree.c: Likewise. ++ * sysdeps/wordsize-64/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/glob.c: New file. ++ * sysdeps/unix/sysv/linux/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/globfree.c: Likewise. ++ * sysdeps/unix/sysv/linux/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/s390/s390-32/glob64.c: Likewise. ++ * sysdeps/unix/sysv/linux/oldglob.c [SHLIB_COMPAT]: Also ++ adds !GLOB_NO_OLD_VERSION as an extra condition. ++ * sysdeps/unix/sysv/linux/i386/alphasort64.c: Include olddirent.h ++ using relative path instead of absolute one. ++ * sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise. ++ * sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise. ++ * sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise. ++ * sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise. ++ * sysdeps/unix/sysv/linux/i386/olddirent.h: Move to ... ++ * sysdeps/unix/sysv/linux//olddirent.h: ... here. ++ ++2017-10-26 Valery Reznic ++ H.J. Lu ++ ++ [BZ #22299] ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Don't set ++ GLRO(dl_platform) to NULL. ++ * sysdeps/x86_64/Makefile (tests): Add tst-platform-1. ++ (modules-names): Add tst-platformmod-1 and ++ x86_64/tst-platformmod-2. ++ (CFLAGS-tst-platform-1.c): New. ++ (CFLAGS-tst-platformmod-1.c): Likewise. ++ (CFLAGS-tst-platformmod-2.c): Likewise. ++ (LDFLAGS-tst-platformmod-2.so): Likewise. ++ ($(objpfx)tst-platform-1): Likewise. ++ ($(objpfx)tst-platform-1.out): Likewise. ++ (tst-platform-1-ENV): Likewise. ++ ($(objpfx)x86_64/tst-platformmod-2.os): Likewise. ++ * sysdeps/x86_64/tst-platform-1.c: New file. ++ * sysdeps/x86_64/tst-platformmod-1.c: Likewise. ++ * sysdeps/x86_64/tst-platformmod-2.c: Likewise. ++ ++2017-10-23 Alexey Makhalov ++ ++ * elf/dl-tunables.c (do_tunable_update_val): Range checking fix. ++ * scripts/gen-tunables.awk: Set unspecified minval and/or maxval ++ values to correct default value for given type. ++ ++2017-10-19 Joseph Myers ++ ++ [BZ #22322] ++ * sysdeps/mips/bits/long-double.h: Move to .... ++ * sysdeps/mips/ieee754/bits/long-double.h: ... here. ++ ++2017-10-17 Romain Naour (tiny change) ++ ++ [BZ #22296] ++ * math/math.h: Let signbit use the builtin in C++ mode with gcc ++ < 6.x ++ ++2017-10-22 H.J. Lu ++ ++ [BZ #21265] ++ * sysdeps/x86/cpu-features-offsets.sym (XSAVE_STATE_SIZE_OFFSET): ++ New. ++ * sysdeps/x86/cpu-features.c: Include . ++ (get_common_indeces): Set xsave_state_size, xsave_state_full_size ++ and bit_arch_XSAVEC_Usable if needed. ++ (init_cpu_features): Remove bit_arch_Use_dl_runtime_resolve_slow ++ and bit_arch_Use_dl_runtime_resolve_opt. ++ * sysdeps/x86/cpu-features.h (bit_arch_Use_dl_runtime_resolve_opt): ++ Removed. ++ (bit_arch_Use_dl_runtime_resolve_slow): Likewise. ++ (bit_arch_Prefer_No_AVX512): Updated. ++ (bit_arch_MathVec_Prefer_No_AVX512): Likewise. ++ (bit_arch_XSAVEC_Usable): New. ++ (STATE_SAVE_OFFSET): Likewise. ++ (STATE_SAVE_MASK): Likewise. ++ [__ASSEMBLER__]: Include . ++ (cpu_features): Add xsave_state_size and xsave_state_full_size. ++ (index_arch_Use_dl_runtime_resolve_opt): Removed. ++ (index_arch_Use_dl_runtime_resolve_slow): Likewise. ++ (index_arch_XSAVEC_Usable): New. ++ * sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)): ++ Support XSAVEC_Usable. Remove Use_dl_runtime_resolve_slow. ++ * sysdeps/x86_64/Makefile (tst-x86_64-1-ENV): New if tunables ++ is enabled. ++ * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup): ++ Replace _dl_runtime_resolve_sse, _dl_runtime_resolve_avx, ++ _dl_runtime_resolve_avx_slow, _dl_runtime_resolve_avx_opt, ++ _dl_runtime_resolve_avx512 and _dl_runtime_resolve_avx512_opt ++ with _dl_runtime_resolve_fxsave, _dl_runtime_resolve_xsave and ++ _dl_runtime_resolve_xsavec. ++ * sysdeps/x86_64/dl-trampoline.S (DL_RUNTIME_UNALIGNED_VEC_SIZE): ++ Removed. ++ (DL_RUNTIME_RESOLVE_REALIGN_STACK): Check STATE_SAVE_ALIGNMENT ++ instead of VEC_SIZE. ++ (REGISTER_SAVE_BND0): Removed. ++ (REGISTER_SAVE_BND1): Likewise. ++ (REGISTER_SAVE_BND3): Likewise. ++ (REGISTER_SAVE_RAX): Always defined to 0. ++ (VMOV): Removed. ++ (_dl_runtime_resolve_avx): Likewise. ++ (_dl_runtime_resolve_avx_slow): Likewise. ++ (_dl_runtime_resolve_avx_opt): Likewise. ++ (_dl_runtime_resolve_avx512): Likewise. ++ (_dl_runtime_resolve_avx512_opt): Likewise. ++ (_dl_runtime_resolve_sse): Likewise. ++ (_dl_runtime_resolve_sse_vex): Likewise. ++ (USE_FXSAVE): New. ++ (_dl_runtime_resolve_fxsave): Likewise. ++ (USE_XSAVE): Likewise. ++ (_dl_runtime_resolve_xsave): Likewise. ++ (USE_XSAVEC): Likewise. ++ (_dl_runtime_resolve_xsavec): Likewise. ++ * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_avx512): ++ Removed. ++ (_dl_runtime_resolve_avx512_opt): Likewise. ++ (_dl_runtime_resolve_avx): Likewise. ++ (_dl_runtime_resolve_avx_opt): Likewise. ++ (_dl_runtime_resolve_sse): Likewise. ++ (_dl_runtime_resolve_sse_vex): Likewise. ++ (_dl_runtime_resolve_fxsave): New. ++ (_dl_runtime_resolve_xsave): Likewise. ++ (_dl_runtime_resolve_xsavec): Likewise. ++ ++2017-10-22 H.J. Lu ++ ++ [BZ #22093] ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Initialize ++ GLRO(dl_hwcap) to HWCAP_X86_64 for x86-64. ++ * sysdeps/x86/dl-hwcap.h (HWCAP_COUNT): Updated. ++ (HWCAP_IMPORTANT): Likewise. ++ (HWCAP_X86_64): New enum. ++ (HWCAP_X86_AVX512_1): Updated. ++ * sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): Add "x86_64". ++ * sysdeps/x86_64/Makefile (tests): Add tst-x86_64-1. ++ (modules-names): Add x86_64/tst-x86_64mod-1. ++ (LDFLAGS-tst-x86_64mod-1.so): New. ++ ($(objpfx)tst-x86_64-1): Likewise. ++ ($(objpfx)x86_64/tst-x86_64mod-1.os): Likewise. ++ (tst-x86_64-1-clean): Likewise. ++ * sysdeps/x86_64/tst-x86_64-1.c: New file. ++ * sysdeps/x86_64/tst-x86_64mod-1.c: Likewise. ++ ++2017-10-21 Florian Weimer ++ ++ * posix/Makefile (tests): Add tst-glob-tilde. ++ (tests-special): Add tst-glob-tilde-mem.out ++ (tst-glob-tilde-ENV): Set MALLOC_TRACE. ++ (tst-glob-tilde-mem.out): Add mtrace check. ++ * posix/tst-glob-tilde.c: New file. ++ ++2017-10-20 Paul Eggert ++ ++ [BZ #22320] ++ CVE-2017-15670 ++ * posix/glob.c (__glob): Fix one-byte overflow. ++ ++2017-09-08 Adhemerval Zanella ++ ++ [BZ #1062] ++ [BZ #22325] ++ CVE-2017-15671 ++ * posix/Makefile (routines): Add globfree, globfree64, and ++ glob_pattern_p. ++ * posix/flexmember.h: New file. ++ * posix/glob_internal.h: Likewise. ++ * posix/glob_pattern_p.c: Likewise. ++ * posix/globfree.c: Likewise. ++ * posix/globfree64.c: Likewise. ++ * sysdeps/gnu/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/alpha/globfree.c: Likewise. ++ * sysdeps/unix/sysv/linux/mips/mips64/n64/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/oldglob.c: Likewise. ++ * sysdeps/unix/sysv/linux/wordsize-64/globfree64.c: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/x32/globfree.c: Likewise. ++ * sysdeps/wordsize-64/globfree.c: Likewise. ++ * sysdeps/wordsize-64/globfree64.c: Likewise. ++ * posix/glob.c (HAVE_CONFIG_H): Use !_LIBC instead. ++ [NDEBUG): Remove comments. ++ (GLOB_ONLY_P, _AMIGA, VMS): Remove define. ++ (dirent_type): New type. Use uint_fast8_t not ++ uint8_t, as C99 does not require uint8_t. ++ (DT_UNKNOWN, DT_DIR, DT_LNK): New macros. ++ (struct readdir_result): Use dirent_type. Do not define skip_entry ++ unless it is needed; this saves a byte on platforms lacking d_ino. ++ (readdir_result_type, readdir_result_skip_entry): ++ New functions, replacing ... ++ (readdir_result_might_be_symlink, readdir_result_might_be_dir): ++ these functions, which were removed. This makes the callers ++ easier to read. All callers changed. ++ (D_INO_TO_RESULT): Now empty if there is no d_ino. ++ (size_add_wrapv, glob_use_alloca): New static functions. ++ (glob, glob_in_dir): Check for size_t overflow in several places, ++ and fix some size_t checks that were not quite right. ++ Remove old code using SHELL since Bash no longer ++ uses this. ++ (glob, prefix_array): Separate MS code better. ++ (glob_in_dir): Remove old Amiga and VMS code. ++ (globfree, __glob_pattern_type, __glob_pattern_p): Move to ++ separate files. ++ (glob_in_dir): Do not rely on undefined behavior in accessing ++ struct members beyond their bounds. Use a flexible array member ++ instead ++ (link_stat): Rename from link_exists2_p and return -1/0 instead of ++ 0/1. Caller changed. ++ (glob): Fix memory leaks. ++ * posix/glob64 (globfree64): Move to separate file. ++ * sysdeps/gnu/glob64.c (NO_GLOB_PATTERN_P): Remove define. ++ (globfree64): Remove hidden alias. ++ * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add ++ oldglob. ++ * sysdeps/unix/sysv/linux/alpha/glob.c (__new_globfree): Move to ++ separate file. ++ * sysdeps/unix/sysv/linux/i386/glob64.c (NO_GLOB_PATTERN_P): Remove ++ define. ++ Move compat code to separate file. ++ * sysdeps/wordsize-64/glob.c (globfree): Move definitions to ++ separate file. ++ ++2017-08-20 H.J. Lu ++ ++ [BZ #18822] ++ * sysdeps/unix/sysv/linux/i386/glob64.c (__old_glob64): Add ++ libc_hidden_proto and libc_hidden_def. ++ ++2017-10-20 Florian Weimer ++ ++ [BZ #22321] ++ sysconf: Fix missing definition of UIO_MAXIOV on Linux. ++ * sysdeps/posix/sysconf.c: Include . ++ * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-sysconf-iov_max. ++ (tst-sysconf-iov_max): Link with tst-sysconf-iov_max-uapi.o. ++ * sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c: New file. ++ * sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c: Likewise. ++ ++2017-10-11 Florian Weimer ++ ++ [BZ #22078] ++ Avoid large NSS buffers with many addresses, aliases. ++ * nss/nss_files/files-hosts.c (gethostbyname3_multi): Rewrite ++ using dynarrays and struct alloc_buffer. ++ * nss/Makefile (tests): Add tst-nss-files-hosts-multi. ++ (tst-nss-files-hosts-multi): Link with -ldl. ++ * nss/tst-nss-files-hosts-multi.c: New file. ++ ++2017-10-11 Florian Weimer ++ ++ [BZ #18023] ++ * nss/nss_files/files-hosts.c (gethostbyname3_multi): Use struct ++ scratch_buffer. Eliminate gotos. ++ ++2017-10-10 Florian Weimer ++ ++ * nss/nss_files/files-hosts.c (gethostbyname3_multi): New ++ function. ++ (_nss_files_gethostbyname3_r): Call it. ++ ++2017-09-21 Gabriel F. T. Gomes ++ ++ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgammal_r): ++ Remove conditionals on LDBL_MANT_DIG. ++ * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c ++ (__ieee754_lgammal_r): Likewise. ++ ++2017-09-21 Gabriel F. T. Gomes ++ ++ * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Remove definitions of ++ _Float128 and L(). ++ * sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Remove definitions of ++ _Float128 and L(). Replace _Float128 with long double and L(x) ++ with xL, throughout the file. ++ * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise. ++ ++2017-09-21 Gabriel F. T. Gomes ++ ++ * sysdeps/ieee754/ldbl-128ibm/e_expl.c: Include tables from ++ sysdeps/ieee754/ldbl-128ibm. ++ * sysdeps/ieee754/ldbl-128ibm/e_j0l.c: Copy contents from the ++ equivalent implementation in sysdeps/ieee754/ldbl-128/ instead ++ of including it. Keep _Float128 and L() intact. These will be ++ reviewed by a separate patch. ++ * sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c: Likewise. ++ * sysdeps/ieee754/ldbl-128ibm/t_expl.h: Likewise. ++ ++2017-09-21 Gabriel F. T. Gomes ++ ++ * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c ++ (__finitef128): Define to __redirect___finitef128. ++ * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c ++ (__isinff128): Define to __redirect___isinff128. ++ * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c ++ (__isnanf128): Define to __redirect___isnanf128. ++ ++2017-09-21 Gabriel F. T. Gomes ++ ++ * sysdeps/powerpc/powerpc64le/Makefile ++ (CFLAGS-tst-strtod-nan-locale.c): New variable. ++ (CFLAGS-tst-wcstod-nan-locale.c): New variable. ++ ++2017-10-10 Steve Ellcey ++ ++ * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (get_midr_from_mcpu): ++ Use strcmp instead of tunable_is_name. ++ ++2017-10-10 Siddhesh Poyarekar ++ ++ * sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add ++ memmove_falkor. ++ * sysdeps/aarch64/multiarch/ifunc-impl-list.c ++ (__libc_ifunc_impl_list): Likewise. ++ * sysdeps/aarch64/multiarch/memmove.c: Likewise. ++ * sysdeps/aarch64/multiarch/memmove_falkor.S: New file. ++ ++ * benchtests/bench-memmove-walk.c: New file. ++ * benchtests/Makefile (string-benchset): Add it. ++ ++ * benchtests/bench-memset-walk.c: New file. ++ * benchtests/Makefile (string-benchset): Add it. ++ ++ * benchtests/bench-memcpy-walk.c: New file. ++ * benchtests/Makefile (string-benchset): Add it. ++ ++ * po/sv.po: Update translations. ++ * po/fr.po: Likewise. ++ ++ * sysdeps/aarch64/multiarch/memcpy_falkor.S: Fix code style in ++ comments. ++ ++ * manual/tunables.texi (Tunable glibc.tune.cpu): Add falkor. ++ * sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add ++ memcpy_falkor. ++ * sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC): ++ Bump. ++ (__libc_ifunc_impl_list): Add __memcpy_falkor. ++ * sysdeps/aarch64/multiarch/memcpy.c: Likewise. ++ * sysdeps/aarch64/multiarch/memcpy_falkor.S: New file. ++ * sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list): ++ Add falkor. ++ * sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_FALKOR): ++ New macro. ++ ++2017-10-06 Carlos O'Donell ++ ++ [BZ #22111] ++ * malloc/malloc.c (tcache_shutting_down): Use bool type. ++ (tcache_thread_freeres): Set tcache_shutting_down before ++ freeing the tcache. ++ * malloc/Makefile (tests): Add tst-malloc-tcache-leak. ++ * malloc/tst-malloc-tcache-leak.c: New file. ++ ++2017-10-04 H.J. Lu ++ ++ * math/test-math-iscanonical.cc (error): Replace bool with int. ++ (do_test): Return errors != 0. ++ ++2017-10-03 Gabriel F. T. Gomes ++ ++ [BZ #22235] ++ * math/math.h: Trivial fix for unbalanced parentheses in comment. ++ * math/Makefile [CXX] (tests): Add test-math-iscanonical.cc. ++ (CFLAGS-test-math-iscanonical.cc): New variable. ++ * math/test-math-iscanonical.cc: New file. ++ * sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical): ++ Provide a C++ implementation based on function overloading, ++ rather than using __MATH_TG, which uses C-only builtins. ++ * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical): ++ Likewise. ++ * sysdeps/powerpc/powerpc64le/Makefile ++ (CFLAGS-test-math-iscanonical.cc): New variable. ++ ++2017-08-22 Joseph Myers ++ ++ [BZ #21987] ++ * sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Remove file ++ and copy to ... ++ * sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h: ++ ... here. ++ * sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h: ++ ... and here. ++ ++2017-09-28 Joseph Myers ++ ++ [BZ #22225] ++ * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use ++ math_opt_barrier on argument when doing arithmetic on it. ++ * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint): ++ Likewise. Use math_force_eval not math_opt_barrier after ++ arithmetic. ++ * sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use ++ math_opt_barrier on argument when doing arithmetic on it. ++ * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl): ++ Likewise. ++ ++2017-09-22 Gabriel F. T. Gomes ++ ++ [BZ #22146] ++ math/math.h: Let fpclassify use the builtin in C++ mode, even ++ when optimazing for size. ++ ++2017-08-22 Gabriel F. T. Gomes ++ ++ * include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc): ++ Change the return type of the ifunc resolver to match the return ++ type of the target function. ++ ++2017-08-22 Martin Sebor ++ ++ * include/libc-symbols.h (__ifunc_resolver): Declare resolver ++ to return a pointer to the same type as the target function. ++ ++2017-08-03 Alan Modra ++ ++ * sysdeps/powerpc/mod-tlsopt-powerpc.c: Extract from ++ tst-tlsopt-powerpc.c with function name change and no test harness. ++ * sysdeps/powerpc/tst-tlsopt-powerpc.c: Remove body of test. ++ Call tls_get_addr_opt_test. ++ * sysdeps/powerpc/Makefile (LDFLAGS-tst-tlsopt-powerpc): Don't define. ++ (modules-names): Add mod-tlsopt-powerpc. ++ (mod-tlsopt-powerpc.so-no-z-defs): Define. ++ (tst-tlsopt-powerpc): Depend on .so. ++ * sysdeps/powerpc/powerpc64/tls-macros.h (__TLS_GET_ADDR): Don't ++ define. Expand use in TLS_GD and TLS_LD. ++ ++2017-09-11 H.J. Lu ++ ++ [BZ #21982] ++ * string/stratcliff.c (do_test): Declare size, nchars, inner, ++ middle and outer with size_t instead of int. Repleace %d and ++ %Zd with %zu in printf. Update "MAX (0, nchars - 128)" and ++ "MAX (outer, nchars - 64)" to support unsigned outer and ++ nchars. Also exit loop when outer == 0. ++ ++2017-09-08 Markus Trippelsdorf ++ ++ * sysdeps/x86_64/fpu/libm-test-ulps: Update for AMD Ryzen. ++ ++2017-09-07 H.J. Lu ++ ++ * resolv/tst-resolv-qtypes.c (domain): Changed to ++ "const char domain[] =". ++ ++2017-08-31 H.J. Lu ++ ++ [BZ #22051] ++ * Makerules (build-module-helper-objlist): Filter out ++ $(elf-objpfx)sofini.os. ++ (build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is ++ needed. ++ ++2017-08-30 Florian Weimer ++ ++ * malloc/dynarray_emplace_enlarge.c ++ (__libc_dynarray_emplace_enlarge): Set errno on overflow. ++ * malloc/dynarray_resize.c (__libc_dynarray_resize): Likewise. ++ * malloc/tst-dynarray.c (test_long_overflow): New function. ++ (do_test): Call it. ++ ++2017-09-06 Florian Weimer ++ ++ * malloc/dynarray_emplace_enlarge.c ++ (__libc_dynarray_emplace_enlarge): Add missing else. ++ ++2017-09-06 Florian Weimer ++ ++ [BZ #22096] ++ * resolv/resolv_conf.c (__resolv_conf_attach): Do not free conf in ++ case of failure to obtain the global conf object. ++ ++2017-09-06 Florian Weimer ++ ++ [BZ #22095] ++ * resolv/res_init.c (res_vinit_1): Avoid memory leak in case of ++ dynarray allocation failure. ++ ++2017-09-06 Florian Weimer ++ ++ Remove dead PTR IPv4-to-IPv6 mapping code from nss_dns. ++ * resolv/nss_dns/dns-host.c (getanswer_r): Remove dead code. ++ * resolv/tst-res_use_inet6.c (response_ptr_v4, response_ptr_v6): ++ New functions. ++ (response): Call them. Add 'p', '6' flag processing. ++ (test_reverse): New function. ++ (test_get2_any): Call it. ++ (test_no_inet6): Add 'p' test. ++ (test_inet6): Likewise. ++ ++2017-09-06 Florian Weimer ++ ++ Enhance tst-res_use_inet6 to test IPv4-to-IPv6 address mapping. ++ * resolv/tst-res_use_inet6.c (response): Process flags embedded in ++ the QNAME. ++ (test_gai): Adjust query names. Add additional tests. ++ (test_get2_any, test_get2_no_inet6, test_get2_inet6): Split from ++ test_get2. Adjust query names. Add additional tests. ++ (test_no_inet6): New function, extracted from threadfunc. ++ (threadfunc): Call test_get2_any, test_get2_inet6, test_no_inet6. ++ Add additional tests. ++ ++2017-09-01 Florian Weimer ++ ++ [BZ #21915] ++ [BZ #21922] ++ * sysdeps/posix/getaddrinfo.c (gethosts): Look at NSS function ++ result to determine success or failure, not the errno value. ++ * nss/Makefile (tests): Add tst-nss-files-hosts-erange. ++ (tst-nss-files-hosts-erange): Link with -ldl. ++ * nss/tst-nss-files-hosts-erange.c: New file. ++ * nss/tst-resolv-basic.c (response): Handle nodata.example. ++ (do_test): Add NO_DATA tests. ++ * resolv/tst-resolv-basic.c (test_nodata_nxdomain): New function. ++ (do_test): Call it. ++ ++2017-09-01 Florian Weimer ++ ++ [BZ #21922] ++ * sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error ++ coming from gethostbyname2_r. ++ ++2017-09-01 Florian Weimer ++ ++ * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if ++ status indicates it is set. ++ ++2017-09-01 Florian Weimer ++ ++ * sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS ++ function lookup failures more reliable. ++ ++2017-09-01 Florian Weimer ++ ++ * sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly. ++ (getcanonname): Likewise. ++ (gaih_inet): Likewise. ++ ++2017-09-01 Florian Weimer ++ ++ * sysdeps/posix/getaddrinfo.c (gethosts): Use errno directly. ++ (getcanonname): Likewise. ++ (gaih_inet): Likewise. ++ ++2017-08-08 Florian Weimer ++ ++ * sysdeps/posix/getaddrinfo.c (gaih_inet): Remove unreachable ++ return statement. ++ ++2017-08-22 Joseph Myers ++ ++ * assert/Makefile [$(have-cxx-thread_local)]: Move conditional ++ variable definitions above inclusion of ../Rules. ++ ++2017-08-28 Gabriel F. T. Gomes ++ ++ [BZ #21930] ++ * math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__] ++ (iszero): New C++ implementation that does not use ++ fpclassify/__MATH_TG/__builtin_types_compatible_p, when ++ signaling nans are enabled, since __builtin_types_compatible_p ++ is a C-only feature. ++ * math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is ++ defined, include ieee754_float128.h for access to the union and ++ member ieee854_float128.ieee. ++ [__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128. ++ [__HAVE_DISTINCT_FLOAT128] (check_float128): New function. ++ * sysdeps/powerpc/powerpc64le/Makefile [subdir == math] ++ (CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build ++ options of test-math-zero on powerpc64le. ++ ++2017-08-24 Gabriel F. T. Gomes ++ ++ * math/math.h [defined __cplusplus] (issignaling): In the long ++ double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH ++ is not defined. Call __issignaling, otherwise. ++ ++2017-08-22 Gabriel F. T. Gomes ++ ++ * math/math.h [defined __cplusplus] (issignaling): Provide a C++ ++ definition for issignaling that does not rely on __MATH_TG, ++ since __MATH_TG uses __builtin_types_compatible_p, which is only ++ available in C mode. ++ (CFLAGS-test-math-issignaling.cc): New variable. ++ * math/Makefile [CXX] (tests): Add test-math-issignaling. ++ * math/test-math-issignaling.cc: New test for C++ implementation ++ of type-generic issignaling. ++ * sysdeps/powerpc/powerpc64le/Makefile [subdir == math] ++ (CXXFLAGS-test-math-issignaling.cc): Add -mfloat128 to the build ++ options of test-math-issignaling on powerpc64le. ++ ++2017-08-16 Andreas Schwab ++ ++ [BZ #16750] ++ CVE-2009-5064 ++ * elf/ldd.bash.in: Never run file directly. ++ ++2017-08-10 Florian Weimer ++ ++ * inet/net-internal.h (__inet6_scopeid_pton): Remove ++ attribute_hidden, internal_function. ++ * inet/inet6_scopeid_pton.c (__inet6_scopeid_pton): Remove ++ internal_function. ++ ++2017-08-21 Florian Weimer ++ ++ [BZ #21972] ++ * assert/assert.h (assert): Use static_cast (bool) for C++. ++ Use the ternary operator in the warning branch for GNU C. ++ * assert/Makefile (tests): Add tst-assert-c++, tst-assert-g++. ++ (CFLAGS-tst-assert-c++.o): Compile in C++11 mode. ++ (CFLAGS-tst-assert-g++.o): Compile in GnU C++11 mode. ++ (LDLIBS-tst-assert-c++, LDLIBS-tst-assert-g++): Link with libstdc++. ++ * assert/tst-assert-c++.cc, assert/tst-assert-g++.cc: New files. ++ ++2017-08-18 Gabriel F. T. Gomes ++ ++ * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if ++ in C++ mode. ++ ++2017-08-18 Gabriel F. T. Gomes ++ ++ [BZ #21930] ++ * math/math.h (isinf): Check if in C or C++ mode before using ++ __builtin_types_compatible_p, since this is a C mode feature. ++ ++2017-08-10 Gabriel F. T. Gomes ++ ++ [BZ #21941] ++ * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since ++ xssqrtqp requires operands to be in Vector Registers ++ (Altivec/VMX), replace the register constraint 'wq' with 'v'. ++ * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c ++ (__ieee754_sqrtf128): Likewise. ++ ++2017-08-11 Florian Weimer ++ ++ [BZ #21242] ++ * assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert): ++ Suppress pedantic warning resulting from statement expression. ++ (__ASSERT_FUNCTION): Add missing __extension__. ++ ++2017-08-10 Florian Weimer ++ ++ * malloc/malloc.c (get_max_fast): Reimplement as an inline ++ function which calls __builtin_unreachable. ++ ++2017-08-09 Florian Weimer ++ ++ [BZ #21932] ++ * nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put ++ before early return. ++ ++2017-08-09 Adhemerval Zanella ++ ++ [BZ #21780] ++ * sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of ++ EOPNOTSUPP. ++ * sysdeps/posix/preadv64v2.c (preadv64v2): Likewise. ++ * sysdeps/posix/pwritev2.c (pwritev2): Likewise. ++ * sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise. ++ * sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise. ++ * sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise. ++ * sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise. ++ * sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise. ++ ++2017-08-06 H.J. Lu ++ ++ [BZ #21871] ++ * sysdeps/x86/cpu-features.c (init_cpu_features): Set ++ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F. ++ ++2017-08-03 Aurelien Jarno ++ ++ * stdlib/getentropy.c (getentropy): Change return type to int. ++ ++2017-08-03 Aurelien Jarno ++ ++ * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated. ++ ++2017-08-03 Florian Weimer ++ ++ [BZ #21885] ++ * sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context ++ on memory allocation failure. ++ + 2017-08-02 Siddhesh Poyarekar + + * version.h (RELEASE): Set to "stable" +diff --git a/Makerules b/Makerules +index 9bb707c168..828a445f24 100644 +--- a/Makerules ++++ b/Makerules +@@ -686,14 +686,17 @@ $(build-module-helper) -o $@ $(shlib-lds-flags) \ + $(call after-link,$@) + endef + ++# sofini.os must be placed last since it terminates .eh_frame section. + build-module-helper-objlist = \ + $(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\ + $(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \ ++ $(elf-objpfx)sofini.os \ + $(link-libc-deps),$^)) + + build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so) + build-shlib-objlist = $(build-module-helper-objlist) \ +- $(LDLIBS-$(@F:lib%.so=%).so) ++ $(LDLIBS-$(@F:lib%.so=%).so) \ ++ $(filter $(elf-objpfx)sofini.os,$^) + + # Don't try to use -lc when making libc.so itself. + # Also omits crti.o and crtn.o, which we do not want +diff --git a/NEWS b/NEWS +index 8295f20c0a..359465ff3e 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,65 @@ See the end for copying conditions. + Please send GNU C library bug reports via + using `glibc' in the "product" field. + ++Version 2.26.1 ++ ++Major new features: ++ ++* In order to support faster and safer process termination the malloc API ++ family of functions will no longer print a failure address and stack ++ backtrace after detecting heap corruption. The goal is to minimize the ++ amount of work done after corruption is detected and to avoid potential ++ security issues in continued process execution. Reducing shutdown time ++ leads to lower overall process restart latency, so there is benefit both ++ from a security and performance perspective. ++ ++Security related changes: ++ ++ CVE-2009-5064: The ldd script would sometimes run the program under ++ examination directly, without preventing code execution through the ++ dynamic linker. (The glibc project disputes that this is a security ++ vulnerability; only trusted binaries must be examined using the ldd ++ script.) ++ ++ CVE-2017-15670: The glob function, when invoked with GLOB_TILDE, ++ suffered from a one-byte overflow during ~ operator processing (either ++ on the stack or the heap, depending on the length of the user name). ++ Reported by Tim Rühsen. ++ ++The following bugs are resolved with this release: ++ ++ [16750] ldd: Never run file directly. ++ [17956] crypt: Use NSPR header files in addition to NSS header files ++ [21242] assert: Suppress pedantic warning caused by statement expression ++ [21265] x86-64: Use fxsave/xsave/xsavec in _dl_runtime_resolve ++ [21780] posix: Set p{read,write}v2 to return ENOTSUP ++ [21871] x86-64: Use _dl_runtime_resolve_opt only with AVX512F ++ [21885] getaddrinfo: Release resolver context on error in gethosts ++ [21915] getaddrinfo: incorrect result handling for NSS service modules ++ [21922] getaddrinfo with AF_INET(6) returns EAI_NONAME, not EAI_NODATA ++ [21930] Do not use __builtin_types_compatible_p in C++ mode ++ [21932] Unpaired __resolv_context_get in generic get*_r implementation ++ [21941] powerpc: Restrict xssqrtqp operands to Vector Registers ++ [21972] assert macro requires operator== (int) for its argument type ++ [21982] string: stratcliff.c: error: assuming signed overflow does not ++ occur with -O3 ++ [21987] Fix sparc32 bits/long-double.h ++ [22051] libc: zero terminator in the middle of glibc's .eh_frame ++ [22078] nss_files performance issue in hosts multi mode ++ [22093] x86: Add x86_64 to x86-64 HWCAP ++ [22095] resolv: Fix memory leak with OOM during resolv.conf parsing ++ [22096] resolv: __resolv_conf_attach must not free passed conf object ++ [22111] malloc: per thread cache is not returned when thread exits ++ [22146] Let fpclassify use the builtin when optimizing for size in C++ mode ++ [22225] math: nearbyint arithmetic moved before feholdexcept ++ [22235] Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm ++ [22296] Let signbit use the builtin in C++ mode with gcc < 6.x ++ [22299] x86-64: Don't set GLRO(dl_platform) to NULL ++ [22320] glob: Fix one-byte overflow (CVE-2017-15670) ++ [22321] sysconf: Fix missing definition of UIO_MAXIOV on Linux ++ [22322] libc: [mips64] wrong bits/long-double.h installed ++ [22325] glibc: Memory leak in glob with GLOB_TILDE (CVE-2017-15671) ++ + Version 2.26 + + Major new features: +diff --git a/assert/Makefile b/assert/Makefile +index 1c3be9b01f..222ab516f0 100644 +--- a/assert/Makefile ++++ b/assert/Makefile +@@ -25,6 +25,15 @@ include ../Makeconfig + headers := assert.h + + routines := assert assert-perr __assert +-tests := test-assert test-assert-perr ++tests := test-assert test-assert-perr tst-assert-c++ tst-assert-g++ ++ ++ifeq ($(have-cxx-thread_local),yes) ++CFLAGS-tst-assert-c++.o = -std=c++11 ++LDLIBS-tst-assert-c++ = -lstdc++ ++CFLAGS-tst-assert-g++.o = -std=gnu++11 ++LDLIBS-tst-assert-g++ = -lstdc++ ++else ++tests-unsupported += tst-assert-c++ tst-assert-g++ ++endif + + include ../Rules +diff --git a/assert/assert.h b/assert/assert.h +index 22f019537c..640c95c063 100644 +--- a/assert/assert.h ++++ b/assert/assert.h +@@ -85,19 +85,29 @@ __END_DECLS + /* When possible, define assert so that it does not add extra + parentheses around EXPR. Otherwise, those added parentheses would + suppress warnings we'd expect to be detected by gcc's -Wparentheses. */ +-# if !defined __GNUC__ || defined __STRICT_ANSI__ ++# if defined __cplusplus ++# define assert(expr) \ ++ (static_cast (expr) \ ++ ? void (0) \ ++ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) ++# elif !defined __GNUC__ || defined __STRICT_ANSI__ + # define assert(expr) \ + ((expr) \ + ? __ASSERT_VOID_CAST (0) \ + : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) + # else ++/* The first occurrence of EXPR is not evaluated due to the sizeof, ++ but will trigger any pedantic warnings masked by the __extension__ ++ for the second occurrence. The ternary operator is required to ++ support function pointers and bit fields in this context, and to ++ suppress the evaluation of variable length arrays. */ + # define assert(expr) \ +- ({ \ ++ ((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \ + if (expr) \ + ; /* empty */ \ + else \ + __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \ +- }) ++ })) + # endif + + # ifdef __USE_GNU +@@ -113,7 +123,7 @@ __END_DECLS + C9x has a similar variable called __func__, but prefer the GCC one since + it demangles C++ function names. */ + # if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4) +-# define __ASSERT_FUNCTION __PRETTY_FUNCTION__ ++# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__ + # else + # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L + # define __ASSERT_FUNCTION __func__ +diff --git a/assert/tst-assert-c++.cc b/assert/tst-assert-c++.cc +new file mode 100644 +index 0000000000..12a5e690cb +--- /dev/null ++++ b/assert/tst-assert-c++.cc +@@ -0,0 +1,78 @@ ++/* Tests for interactions between C++ and assert. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++/* The C++ standard requires that if the assert argument is a constant ++ subexpression, then the assert itself is one, too. */ ++constexpr int ++check_constexpr () ++{ ++ return (assert (true), 1); ++} ++ ++/* Objects of this class can be contextually converted to bool, but ++ cannot be compared to int. */ ++struct no_int ++{ ++ no_int () = default; ++ no_int (const no_int &) = delete; ++ ++ explicit operator bool () const ++ { ++ return true; ++ } ++ ++ bool operator! () const; /* No definition. */ ++ template bool operator== (T) const; /* No definition. */ ++ template bool operator!= (T) const; /* No definition. */ ++}; ++ ++/* This class tests that operator== is not used by assert. */ ++struct bool_and_int ++{ ++ bool_and_int () = default; ++ bool_and_int (const no_int &) = delete; ++ ++ explicit operator bool () const ++ { ++ return true; ++ } ++ ++ bool operator! () const; /* No definition. */ ++ template bool operator== (T) const; /* No definition. */ ++ template bool operator!= (T) const; /* No definition. */ ++}; ++ ++static int ++do_test () ++{ ++ { ++ no_int value; ++ assert (value); ++ } ++ ++ { ++ bool_and_int value; ++ assert (value); ++ } ++ ++ return 0; ++} ++ ++#include +diff --git a/assert/tst-assert-g++.cc b/assert/tst-assert-g++.cc +new file mode 100644 +index 0000000000..8c06402825 +--- /dev/null ++++ b/assert/tst-assert-g++.cc +@@ -0,0 +1,19 @@ ++/* Tests for interactions between C++ and assert. GNU C++11 version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include +diff --git a/configure b/configure +index d8e1c50e11..47d8c75248 100755 +--- a/configure ++++ b/configure +@@ -3547,8 +3547,12 @@ if test x$nss_crypt = xyes; then + if test $? -ne 0; then + as_fn_error $? "cannot find include directory with nss-config" "$LINENO" 5 + fi ++ nspr_includes=-I$(nspr-config --includedir 2>/dev/null) ++ if test $? -ne 0; then ++ as_fn_error $? "cannot find include directory with nspr-config" "$LINENO" 5 ++ fi + old_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $nss_includes" ++ CFLAGS="$CFLAGS $nss_includes $nspr_includes" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +diff --git a/configure.ac b/configure.ac +index 77456aa8d9..e8a1ab3562 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -330,8 +330,12 @@ if test x$nss_crypt = xyes; then + if test $? -ne 0; then + AC_MSG_ERROR([cannot find include directory with nss-config]) + fi ++ nspr_includes=-I$(nspr-config --includedir 2>/dev/null) ++ if test $? -ne 0; then ++ AC_MSG_ERROR([cannot find include directory with nspr-config]) ++ fi + old_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS $nss_includes" ++ CFLAGS="$CFLAGS $nss_includes $nspr_includes" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; + #include + #include +diff --git a/crypt/Makefile b/crypt/Makefile +index 0280fba8a7..8bbbf2a121 100644 +--- a/crypt/Makefile ++++ b/crypt/Makefile +@@ -37,9 +37,11 @@ routines += $(libcrypt-routines) + endif + + ifeq ($(nss-crypt),yes) +-CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) +-CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) +-CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) ++nss-cpp-flags := -DUSE_NSS \ ++ -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) ++CPPFLAGS-sha256-crypt.c = $(nss-cpp-flags) ++CPPFLAGS-sha512-crypt.c = $(nss-cpp-flags) ++CPPFLAGS-md5-crypt.c = $(nss-cpp-flags) + LDLIBS-crypt.so = -lfreebl3 + else + libcrypt-routines += md5 sha256 sha512 +diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c +index 231fb8ca93..d9975ef2d0 100644 +--- a/elf/dl-tunables.c ++++ b/elf/dl-tunables.c +@@ -88,18 +88,11 @@ get_next_env (char **envp, char **name, size_t *namelen, char **val, + return NULL; + } + +-#define TUNABLE_SET_VAL_IF_VALID_RANGE(__cur, __val, __type, __default_min, \ +- __default_max) \ ++#define TUNABLE_SET_VAL_IF_VALID_RANGE(__cur, __val, __type) \ + ({ \ + __type min = (__cur)->type.min; \ + __type max = (__cur)->type.max; \ + \ +- if (min == max) \ +- { \ +- min = __default_min; \ +- max = __default_max; \ +- } \ +- \ + if ((__type) (__val) >= min && (__type) (val) <= max) \ + { \ + (__cur)->val.numval = val; \ +@@ -119,17 +112,17 @@ do_tunable_update_val (tunable_t *cur, const void *valp) + { + case TUNABLE_TYPE_INT_32: + { +- TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, int64_t, INT32_MIN, INT32_MAX); ++ TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, int64_t); + break; + } + case TUNABLE_TYPE_UINT_64: + { +- TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, uint64_t, 0, UINT64_MAX); ++ TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, uint64_t); + break; + } + case TUNABLE_TYPE_SIZE_T: + { +- TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, uint64_t, 0, SIZE_MAX); ++ TUNABLE_SET_VAL_IF_VALID_RANGE (cur, val, uint64_t); + break; + } + case TUNABLE_TYPE_STRING: +diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in +index 7dd1fccf24..686785e235 100644 +--- a/elf/ldd.bash.in ++++ b/elf/ldd.bash.in +@@ -164,18 +164,6 @@ warning: you do not have execution permission for" "\`$file'" >&2 + fi + done + case $ret in +- 0) +- # If the program exits with exit code 5, it means the process has been +- # invoked with __libc_enable_secure. Fall back to running it through +- # the dynamic linker. +- try_trace "$file" +- rc=$? +- if [ $rc = 5 ]; then +- try_trace "$RTLD" "$file" +- rc=$? +- fi +- [ $rc = 0 ] || result=1 +- ;; + 1) + # This can be a non-ELF binary or no binary at all. + nonelf "$file" || { +@@ -183,7 +171,7 @@ warning: you do not have execution permission for" "\`$file'" >&2 + result=1 + } + ;; +- 2) ++ 0|2) + try_trace "$RTLD" "$file" || result=1 + ;; + *) +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +index 3310e3a678..5bf57703a9 100644 +--- a/include/libc-symbols.h ++++ b/include/libc-symbols.h +@@ -782,7 +782,8 @@ for linking") + + /* Helper / base macros for indirect function symbols. */ + #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \ +- classifier inhibit_stack_protector void *name##_ifunc (arg) \ ++ classifier inhibit_stack_protector \ ++ __typeof (type_name) *name##_ifunc (arg) \ + { \ + init (); \ + __typeof (type_name) *res = expr; \ +@@ -809,7 +810,7 @@ for linking") + + # define __ifunc(type_name, name, expr, arg, init) \ + extern __typeof (type_name) name; \ +- void *name##_ifunc (arg) __asm__ (#name); \ ++ __typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \ + __ifunc_resolver (type_name, name, expr, arg, init,) \ + __asm__ (".type " #name ", %gnu_indirect_function"); + +diff --git a/inet/inet6_scopeid_pton.c b/inet/inet6_scopeid_pton.c +index e09b1cb34d..cc8803fa10 100644 +--- a/inet/inet6_scopeid_pton.c ++++ b/inet/inet6_scopeid_pton.c +@@ -28,7 +28,7 @@ + + /* Parse SOURCE as a scope ID for ADDRESS. Return 0 on success and -1 + on error. */ +-internal_function int ++int + __inet6_scopeid_pton (const struct in6_addr *address, const char *scope, + uint32_t *result) + { +diff --git a/inet/net-internal.h b/inet/net-internal.h +index 2b2632c7ba..b2135893e8 100644 +--- a/inet/net-internal.h ++++ b/inet/net-internal.h +@@ -25,8 +25,7 @@ + #include + + int __inet6_scopeid_pton (const struct in6_addr *address, +- const char *scope, uint32_t *result) +- internal_function attribute_hidden; ++ const char *scope, uint32_t *result); + libc_hidden_proto (__inet6_scopeid_pton) + + +diff --git a/malloc/Makefile b/malloc/Makefile +index 3fa395b949..9e23db9343 100644 +--- a/malloc/Makefile ++++ b/malloc/Makefile +@@ -34,6 +34,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ + tst-interpose-nothread \ + tst-interpose-thread \ + tst-alloc_buffer \ ++ tst-malloc-tcache-leak \ + + tests-static := \ + tst-interpose-static-nothread \ +@@ -242,3 +243,5 @@ tst-dynarray-fail-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray-fail.mtrace + $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-dynarray-fail.mtrace > $@; \ + $(evaluate-test) ++ ++$(objpfx)tst-malloc-tcache-leak: $(shared-thread-library) +diff --git a/malloc/arena.c b/malloc/arena.c +index dc14fae152..afd423240a 100644 +--- a/malloc/arena.c ++++ b/malloc/arena.c +@@ -116,7 +116,7 @@ int __malloc_initialized = -1; + } while (0) + + #define arena_lock(ptr, size) do { \ +- if (ptr && !arena_is_corrupt (ptr)) \ ++ if (ptr) \ + __libc_lock_lock (ptr->mutex); \ + else \ + ptr = arena_get2 ((size), NULL); \ +@@ -215,8 +215,7 @@ void + TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp) + { + int32_t value = (int32_t) valp->numval; +- do_set_mallopt_check (value); +- if (check_action != 0) ++ if (value != 0) + __malloc_check_init (); + } + +@@ -397,12 +396,8 @@ ptmalloc_init (void) + } + } + } +- if (s && s[0]) +- { +- __libc_mallopt (M_CHECK_ACTION, (int) (s[0] - '0')); +- if (check_action != 0) +- __malloc_check_init (); +- } ++ if (s && s[0] != '\0' && s[0] != '0') ++ __malloc_check_init (); + #endif + + #if HAVE_MALLOC_INIT_HOOK +@@ -837,7 +832,7 @@ reused_arena (mstate avoid_arena) + result = next_to_use; + do + { +- if (!arena_is_corrupt (result) && !__libc_lock_trylock (result->mutex)) ++ if (!__libc_lock_trylock (result->mutex)) + goto out; + + /* FIXME: This is a data race, see _int_new_arena. */ +@@ -850,18 +845,6 @@ reused_arena (mstate avoid_arena) + if (result == avoid_arena) + result = result->next; + +- /* Make sure that the arena we get is not corrupted. */ +- mstate begin = result; +- while (arena_is_corrupt (result) || result == avoid_arena) +- { +- result = result->next; +- if (result == begin) +- /* We looped around the arena list. We could not find any +- arena that was either not corrupted or not the one we +- wanted to avoid. */ +- return NULL; +- } +- + /* No arena available without contention. Wait for the next in line. */ + LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena); + __libc_lock_lock (result->mutex); +@@ -958,10 +941,6 @@ arena_get_retry (mstate ar_ptr, size_t bytes) + if (ar_ptr != &main_arena) + { + __libc_lock_unlock (ar_ptr->mutex); +- /* Don't touch the main arena if it is corrupt. */ +- if (arena_is_corrupt (&main_arena)) +- return NULL; +- + ar_ptr = &main_arena; + __libc_lock_lock (ar_ptr->mutex); + } +diff --git a/malloc/dynarray_emplace_enlarge.c b/malloc/dynarray_emplace_enlarge.c +index dfc70017ce..a15245f4cb 100644 +--- a/malloc/dynarray_emplace_enlarge.c ++++ b/malloc/dynarray_emplace_enlarge.c +@@ -17,6 +17,7 @@ + . */ + + #include ++#include + #include + #include + #include +@@ -32,7 +33,7 @@ __libc_dynarray_emplace_enlarge (struct dynarray_header *list, + size. */ + if (element_size < 4) + new_allocated = 16; +- if (element_size < 8) ++ else if (element_size < 8) + new_allocated = 8; + else + new_allocated = 4; +@@ -43,8 +44,11 @@ __libc_dynarray_emplace_enlarge (struct dynarray_header *list, + { + new_allocated = list->allocated + list->allocated / 2 + 1; + if (new_allocated <= list->allocated) +- /* Overflow. */ +- return false; ++ { ++ /* Overflow. */ ++ __set_errno (ENOMEM); ++ return false; ++ } + } + + size_t new_size; +diff --git a/malloc/dynarray_resize.c b/malloc/dynarray_resize.c +index e6dc9fbc68..63c981bf61 100644 +--- a/malloc/dynarray_resize.c ++++ b/malloc/dynarray_resize.c +@@ -17,6 +17,7 @@ + . */ + + #include ++#include + #include + #include + #include +@@ -38,7 +39,11 @@ __libc_dynarray_resize (struct dynarray_header *list, size_t size, + + size_t new_size_bytes; + if (check_mul_overflow_size_t (size, element_size, &new_size_bytes)) +- return false; ++ { ++ /* Overflow. */ ++ __set_errno (ENOMEM); ++ return false; ++ } + void *new_array; + if (list->array == scratch) + { +diff --git a/malloc/hooks.c b/malloc/hooks.c +index 1d80be20d2..4398c0a017 100644 +--- a/malloc/hooks.c ++++ b/malloc/hooks.c +@@ -121,12 +121,7 @@ malloc_check_get_size (mchunkptr p) + size -= c) + { + if (c <= 0 || size < (c + 2 * SIZE_SZ)) +- { +- malloc_printerr (check_action, "malloc_check_get_size: memory corruption", +- chunk2mem (p), +- chunk_is_mmapped (p) ? NULL : arena_for_chunk (p)); +- return 0; +- } ++ malloc_printerr ("malloc_check_get_size: memory corruption"); + } + + /* chunk2mem size. */ +@@ -232,17 +227,11 @@ mem2chunk_check (void *mem, unsigned char **magic_p) + return p; + } + +-/* Check for corruption of the top chunk, and try to recover if +- necessary. */ +- +-static int +-internal_function ++/* Check for corruption of the top chunk. */ ++static void + top_check (void) + { + mchunkptr t = top (&main_arena); +- char *brk, *new_brk; +- INTERNAL_SIZE_T front_misalign, sbrk_size; +- unsigned long pagesz = GLRO (dl_pagesize); + + if (t == initial_top (&main_arena) || + (!chunk_is_mmapped (t) && +@@ -250,34 +239,9 @@ top_check (void) + prev_inuse (t) && + (!contiguous (&main_arena) || + (char *) t + chunksize (t) == mp_.sbrk_base + main_arena.system_mem))) +- return 0; +- +- malloc_printerr (check_action, "malloc: top chunk is corrupt", t, +- &main_arena); +- +- /* Try to set up a new top chunk. */ +- brk = MORECORE (0); +- front_misalign = (unsigned long) chunk2mem (brk) & MALLOC_ALIGN_MASK; +- if (front_misalign > 0) +- front_misalign = MALLOC_ALIGNMENT - front_misalign; +- sbrk_size = front_misalign + mp_.top_pad + MINSIZE; +- sbrk_size += pagesz - ((unsigned long) (brk + sbrk_size) & (pagesz - 1)); +- new_brk = (char *) (MORECORE (sbrk_size)); +- if (new_brk == (char *) (MORECORE_FAILURE)) +- { +- __set_errno (ENOMEM); +- return -1; +- } +- /* Call the `morecore' hook if necessary. */ +- void (*hook) (void) = atomic_forced_read (__after_morecore_hook); +- if (hook) +- (*hook)(); +- main_arena.system_mem = (new_brk - mp_.sbrk_base) + sbrk_size; +- +- top (&main_arena) = (mchunkptr) (brk + front_misalign); +- set_head (top (&main_arena), (sbrk_size - front_misalign) | PREV_INUSE); ++ return; + +- return 0; ++ malloc_printerr ("malloc: top chunk is corrupt"); + } + + static void * +@@ -292,7 +256,8 @@ malloc_check (size_t sz, const void *caller) + } + + __libc_lock_lock (main_arena.mutex); +- victim = (top_check () >= 0) ? _int_malloc (&main_arena, sz + 1) : NULL; ++ top_check (); ++ victim = _int_malloc (&main_arena, sz + 1); + __libc_lock_unlock (main_arena.mutex); + return mem2mem_check (victim, sz); + } +@@ -308,13 +273,7 @@ free_check (void *mem, const void *caller) + __libc_lock_lock (main_arena.mutex); + p = mem2chunk_check (mem, NULL); + if (!p) +- { +- __libc_lock_unlock (main_arena.mutex); +- +- malloc_printerr (check_action, "free(): invalid pointer", mem, +- &main_arena); +- return; +- } ++ malloc_printerr ("free(): invalid pointer"); + if (chunk_is_mmapped (p)) + { + __libc_lock_unlock (main_arena.mutex); +@@ -349,11 +308,7 @@ realloc_check (void *oldmem, size_t bytes, const void *caller) + const mchunkptr oldp = mem2chunk_check (oldmem, &magic_p); + __libc_lock_unlock (main_arena.mutex); + if (!oldp) +- { +- malloc_printerr (check_action, "realloc(): invalid pointer", oldmem, +- &main_arena); +- return malloc_check (bytes, NULL); +- } ++ malloc_printerr ("realloc(): invalid pointer"); + const INTERNAL_SIZE_T oldsize = chunksize (oldp); + + checked_request2size (bytes + 1, nb); +@@ -374,8 +329,8 @@ realloc_check (void *oldmem, size_t bytes, const void *caller) + else + { + /* Must alloc, copy, free. */ +- if (top_check () >= 0) +- newmem = _int_malloc (&main_arena, bytes + 1); ++ top_check (); ++ newmem = _int_malloc (&main_arena, bytes + 1); + if (newmem) + { + memcpy (newmem, oldmem, oldsize - 2 * SIZE_SZ); +@@ -386,12 +341,10 @@ realloc_check (void *oldmem, size_t bytes, const void *caller) + } + else + { +- if (top_check () >= 0) +- { +- INTERNAL_SIZE_T nb; +- checked_request2size (bytes + 1, nb); +- newmem = _int_realloc (&main_arena, oldp, oldsize, nb); +- } ++ top_check (); ++ INTERNAL_SIZE_T nb; ++ checked_request2size (bytes + 1, nb); ++ newmem = _int_realloc (&main_arena, oldp, oldsize, nb); + } + + /* mem2chunk_check changed the magic byte in the old chunk. +@@ -441,8 +394,8 @@ memalign_check (size_t alignment, size_t bytes, const void *caller) + } + + __libc_lock_lock (main_arena.mutex); +- mem = (top_check () >= 0) ? _int_memalign (&main_arena, alignment, bytes + 1) : +- NULL; ++ top_check (); ++ mem = _int_memalign (&main_arena, alignment, bytes + 1); + __libc_lock_unlock (main_arena.mutex); + return mem2mem_check (mem, bytes); + } +diff --git a/malloc/malloc.c b/malloc/malloc.c +index 54e406bcb6..7783d05651 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -243,6 +243,9 @@ + + #include + ++/* For SINGLE_THREAD_P. */ ++#include ++ + /* + Debugging: + +@@ -1019,10 +1022,10 @@ static void* _int_realloc(mstate, mchunkptr, INTERNAL_SIZE_T, + static void* _int_memalign(mstate, size_t, size_t); + static void* _mid_memalign(size_t, size_t, void *); + +-static void malloc_printerr(int action, const char *str, void *ptr, mstate av); ++static void malloc_printerr(const char *str) __attribute__ ((noreturn)); + + static void* internal_function mem2mem_check(void *p, size_t sz); +-static int internal_function top_check(void); ++static void top_check (void); + static void internal_function munmap_chunk(mchunkptr p); + #if HAVE_MREMAP + static mchunkptr internal_function mremap_chunk(mchunkptr p, size_t new_size); +@@ -1403,11 +1406,11 @@ typedef struct malloc_chunk *mbinptr; + /* Take a chunk off a bin list */ + #define unlink(AV, P, BK, FD) { \ + if (__builtin_expect (chunksize(P) != prev_size (next_chunk(P)), 0)) \ +- malloc_printerr (check_action, "corrupted size vs. prev_size", P, AV); \ ++ malloc_printerr ("corrupted size vs. prev_size"); \ + FD = P->fd; \ + BK = P->bk; \ + if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \ +- malloc_printerr (check_action, "corrupted double-linked list", P, AV); \ ++ malloc_printerr ("corrupted double-linked list"); \ + else { \ + FD->bk = BK; \ + BK->fd = FD; \ +@@ -1415,9 +1418,7 @@ typedef struct malloc_chunk *mbinptr; + && __builtin_expect (P->fd_nextsize != NULL, 0)) { \ + if (__builtin_expect (P->fd_nextsize->bk_nextsize != P, 0) \ + || __builtin_expect (P->bk_nextsize->fd_nextsize != P, 0)) \ +- malloc_printerr (check_action, \ +- "corrupted double-linked list (not small)", \ +- P, AV); \ ++ malloc_printerr ("corrupted double-linked list (not small)"); \ + if (FD->fd_nextsize == NULL) { \ + if (P->fd_nextsize == P) \ + FD->fd_nextsize = FD->bk_nextsize = FD; \ +@@ -1612,27 +1613,6 @@ typedef struct malloc_chunk *mfastbinptr; + + #define FASTBIN_CONSOLIDATION_THRESHOLD (65536UL) + +-/* +- Since the lowest 2 bits in max_fast don't matter in size comparisons, +- they are used as flags. +- */ +- +-/* +- FASTCHUNKS_BIT held in max_fast indicates that there are probably +- some fastbin chunks. It is set true on entering a chunk into any +- fastbin, and cleared only in malloc_consolidate. +- +- The truth value is inverted so that have_fastchunks will be true +- upon startup (since statics are zero-filled), simplifying +- initialization checks. +- */ +- +-#define FASTCHUNKS_BIT (1U) +- +-#define have_fastchunks(M) (((M)->flags & FASTCHUNKS_BIT) == 0) +-#define clear_fastchunks(M) catomic_or (&(M)->flags, FASTCHUNKS_BIT) +-#define set_fastchunks(M) catomic_and (&(M)->flags, ~FASTCHUNKS_BIT) +- + /* + NONCONTIGUOUS_BIT indicates that MORECORE does not return contiguous + regions. Otherwise, contiguity is exploited in merging together, +@@ -1649,14 +1629,8 @@ typedef struct malloc_chunk *mfastbinptr; + #define set_noncontiguous(M) ((M)->flags |= NONCONTIGUOUS_BIT) + #define set_contiguous(M) ((M)->flags &= ~NONCONTIGUOUS_BIT) + +-/* ARENA_CORRUPTION_BIT is set if a memory corruption was detected on the +- arena. Such an arena is no longer used to allocate chunks. Chunks +- allocated in that arena before detecting corruption are not freed. */ +- +-#define ARENA_CORRUPTION_BIT (4U) +- +-#define arena_is_corrupt(A) (((A)->flags & ARENA_CORRUPTION_BIT)) +-#define set_arena_corrupt(A) ((A)->flags |= ARENA_CORRUPTION_BIT) ++/* Maximum size of memory handled in fastbins. */ ++static INTERNAL_SIZE_T global_max_fast; + + /* + Set value of max_fast. +@@ -1668,13 +1642,36 @@ typedef struct malloc_chunk *mfastbinptr; + #define set_max_fast(s) \ + global_max_fast = (((s) == 0) \ + ? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK)) +-#define get_max_fast() global_max_fast + ++static inline INTERNAL_SIZE_T ++get_max_fast (void) ++{ ++ /* Tell the GCC optimizers that global_max_fast is never larger ++ than MAX_FAST_SIZE. This avoids out-of-bounds array accesses in ++ _int_malloc after constant propagation of the size parameter. ++ (The code never executes because malloc preserves the ++ global_max_fast invariant, but the optimizers may not recognize ++ this.) */ ++ if (global_max_fast > MAX_FAST_SIZE) ++ __builtin_unreachable (); ++ return global_max_fast; ++} + + /* + ----------- Internal state representation and initialization ----------- + */ + ++/* ++ have_fastchunks indicates that there are probably some fastbin chunks. ++ It is set true on entering a chunk into any fastbin, and cleared early in ++ malloc_consolidate. The value is approximate since it may be set when there ++ are no fastbin chunks, or it may be clear even if there are fastbin chunks ++ available. Given it's sole purpose is to reduce number of redundant calls to ++ malloc_consolidate, it does not affect correctness. As a result we can safely ++ use relaxed atomic accesses. ++ */ ++ ++ + struct malloc_state + { + /* Serialize access. */ +@@ -1683,6 +1680,10 @@ struct malloc_state + /* Flags (formerly in max_fast). */ + int flags; + ++ /* Set if the fastbin chunks contain recently inserted free blocks. */ ++ /* Note this is a bool but not all targets support atomics on booleans. */ ++ int have_fastchunks; ++ + /* Fastbins */ + mfastbinptr fastbinsY[NFASTBINS]; + +@@ -1797,9 +1798,6 @@ static struct malloc_par mp_ = + #endif + }; + +-/* Maximum size of memory handled in fastbins. */ +-static INTERNAL_SIZE_T global_max_fast; +- + /* + Initialize a malloc_state struct. + +@@ -1829,7 +1827,7 @@ malloc_init_state (mstate av) + set_noncontiguous (av); + if (av == &main_arena) + set_max_fast (DEFAULT_MXFAST); +- av->flags |= FASTCHUNKS_BIT; ++ atomic_store_relaxed (&av->have_fastchunks, false); + + av->top = initial_top (av); + } +@@ -1880,15 +1878,6 @@ void *weak_variable (*__memalign_hook) + void weak_variable (*__after_morecore_hook) (void) = NULL; + + +-/* ---------------- Error behavior ------------------------------------ */ +- +-#ifndef DEFAULT_CHECK_ACTION +-# define DEFAULT_CHECK_ACTION 3 +-#endif +- +-static int check_action = DEFAULT_CHECK_ACTION; +- +- + /* ------------------ Testing support ----------------------------------*/ + + static int perturb_byte; +@@ -2194,11 +2183,6 @@ do_check_malloc_state (mstate av) + } + } + +- if (total != 0) +- assert (have_fastchunks (av)); +- else if (!have_fastchunks (av)) +- assert (total == 0); +- + /* check normal bins */ + for (i = 1; i < NBINS; ++i) + { +@@ -2566,11 +2550,8 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) + set_head (old_top, (size + old_size) | PREV_INUSE); + + else if (contiguous (av) && old_size && brk < old_end) +- { +- /* Oops! Someone else killed our space.. Can't touch anything. */ +- malloc_printerr (3, "break adjusted to free malloc space", brk, +- av); +- } ++ /* Oops! Someone else killed our space.. Can't touch anything. */ ++ malloc_printerr ("break adjusted to free malloc space"); + + /* + Otherwise, make adjustments: +@@ -2861,11 +2842,7 @@ munmap_chunk (mchunkptr p) + (in the moment at least) so we combine the two values into one before + the bit test. */ + if (__builtin_expect (((block | total_size) & (GLRO (dl_pagesize) - 1)) != 0, 0)) +- { +- malloc_printerr (check_action, "munmap_chunk(): invalid pointer", +- chunk2mem (p), NULL); +- return; +- } ++ malloc_printerr ("munmap_chunk(): invalid pointer"); + + atomic_decrement (&mp_.n_mmaps); + atomic_add (&mp_.mmapped_mem, -total_size); +@@ -2940,12 +2917,12 @@ typedef struct tcache_perthread_struct + tcache_entry *entries[TCACHE_MAX_BINS]; + } tcache_perthread_struct; + +-static __thread char tcache_shutting_down = 0; ++static __thread bool tcache_shutting_down = false; + static __thread tcache_perthread_struct *tcache = NULL; + + /* Caller must ensure that we know tc_idx is valid and there's room + for more chunks. */ +-static void ++static __always_inline void + tcache_put (mchunkptr chunk, size_t tc_idx) + { + tcache_entry *e = (tcache_entry *) chunk2mem (chunk); +@@ -2957,7 +2934,7 @@ tcache_put (mchunkptr chunk, size_t tc_idx) + + /* Caller must ensure that we know tc_idx is valid and there's + available chunks to remove. */ +-static void * ++static __always_inline void * + tcache_get (size_t tc_idx) + { + tcache_entry *e = tcache->entries[tc_idx]; +@@ -2977,8 +2954,12 @@ tcache_thread_freeres (void) + if (!tcache) + return; + ++ /* Disable the tcache and prevent it from being reinitialized. */ + tcache = NULL; ++ tcache_shutting_down = true; + ++ /* Free all of the entries and the tcache itself back to the arena ++ heap for coalescing. */ + for (i = 0; i < TCACHE_MAX_BINS; ++i) + { + while (tcache_tmp->entries[i]) +@@ -2990,8 +2971,6 @@ tcache_thread_freeres (void) + } + + __libc_free (tcache_tmp); +- +- tcache_shutting_down = 1; + } + text_set_element (__libc_thread_subfreeres, tcache_thread_freeres); + +@@ -3066,6 +3045,14 @@ __libc_malloc (size_t bytes) + DIAG_POP_NEEDS_COMMENT; + #endif + ++ if (SINGLE_THREAD_P) ++ { ++ victim = _int_malloc (&main_arena, bytes); ++ assert (!victim || chunk_is_mmapped (mem2chunk (victim)) || ++ &main_arena == arena_for_chunk (mem2chunk (victim))); ++ return victim; ++ } ++ + arena_get (ar_ptr, bytes); + + victim = _int_malloc (ar_ptr, bytes); +@@ -3177,11 +3164,7 @@ __libc_realloc (void *oldmem, size_t bytes) + if ((__builtin_expect ((uintptr_t) oldp > (uintptr_t) -oldsize, 0) + || __builtin_expect (misaligned_chunk (oldp), 0)) + && !DUMPED_MAIN_ARENA_CHUNK (oldp)) +- { +- malloc_printerr (check_action, "realloc(): invalid pointer", oldmem, +- ar_ptr); +- return NULL; +- } ++ malloc_printerr ("realloc(): invalid pointer"); + + checked_request2size (bytes, nb); + +@@ -3226,6 +3209,15 @@ __libc_realloc (void *oldmem, size_t bytes) + return newmem; + } + ++ if (SINGLE_THREAD_P) ++ { ++ newp = _int_realloc (ar_ptr, oldp, oldsize, nb); ++ assert (!newp || chunk_is_mmapped (mem2chunk (newp)) || ++ ar_ptr == arena_for_chunk (mem2chunk (newp))); ++ ++ return newp; ++ } ++ + __libc_lock_lock (ar_ptr->mutex); + + newp = _int_realloc (ar_ptr, oldp, oldsize, nb); +@@ -3301,6 +3293,15 @@ _mid_memalign (size_t alignment, size_t bytes, void *address) + alignment = a; + } + ++ if (SINGLE_THREAD_P) ++ { ++ p = _int_memalign (&main_arena, alignment, bytes); ++ assert (!p || chunk_is_mmapped (mem2chunk (p)) || ++ &main_arena == arena_for_chunk (mem2chunk (p))); ++ ++ return p; ++ } ++ + arena_get (ar_ptr, bytes + alignment + MINSIZE); + + p = _int_memalign (ar_ptr, alignment, bytes); +@@ -3393,7 +3394,11 @@ __libc_calloc (size_t n, size_t elem_size) + + MAYBE_INIT_TCACHE (); + +- arena_get (av, sz); ++ if (SINGLE_THREAD_P) ++ av = &main_arena; ++ else ++ arena_get (av, sz); ++ + if (av) + { + /* Check if we hand out the top chunk, in which case there may be no +@@ -3423,19 +3428,21 @@ __libc_calloc (size_t n, size_t elem_size) + } + mem = _int_malloc (av, sz); + +- + assert (!mem || chunk_is_mmapped (mem2chunk (mem)) || + av == arena_for_chunk (mem2chunk (mem))); + +- if (mem == 0 && av != NULL) ++ if (!SINGLE_THREAD_P) + { +- LIBC_PROBE (memory_calloc_retry, 1, sz); +- av = arena_get_retry (av, sz); +- mem = _int_malloc (av, sz); +- } ++ if (mem == 0 && av != NULL) ++ { ++ LIBC_PROBE (memory_calloc_retry, 1, sz); ++ av = arena_get_retry (av, sz); ++ mem = _int_malloc (av, sz); ++ } + +- if (av != NULL) +- __libc_lock_unlock (av->mutex); ++ if (av != NULL) ++ __libc_lock_unlock (av->mutex); ++ } + + /* Allocation failed even after a retry. */ + if (mem == 0) +@@ -3527,8 +3534,6 @@ _int_malloc (mstate av, size_t bytes) + size_t tcache_unsorted_count; /* count of unsorted chunks processed */ + #endif + +- const char *errstr = NULL; +- + /* + Convert request size to internal form by adding SIZE_SZ bytes + overhead plus possibly more to obtain necessary alignment and/or +@@ -3570,42 +3575,50 @@ _int_malloc (mstate av, size_t bytes) + { + idx = fastbin_index (nb); + mfastbinptr *fb = &fastbin (av, idx); +- mchunkptr pp = *fb; +- REMOVE_FB (fb, victim, pp); +- if (victim != 0) +- { +- if (__builtin_expect (fastbin_index (chunksize (victim)) != idx, 0)) +- { +- errstr = "malloc(): memory corruption (fast)"; +- errout: +- malloc_printerr (check_action, errstr, chunk2mem (victim), av); +- return NULL; +- } +- check_remalloced_chunk (av, victim, nb); +-#if USE_TCACHE +- /* While we're here, if we see other chunks of the same size, +- stash them in the tcache. */ +- size_t tc_idx = csize2tidx (nb); +- if (tcache && tc_idx < mp_.tcache_bins) +- { +- mchunkptr tc_victim; ++ mchunkptr pp; ++ victim = *fb; + +- /* While bin not empty and tcache not full, copy chunks over. */ +- while (tcache->counts[tc_idx] < mp_.tcache_count +- && (pp = *fb) != NULL) ++ if (victim != NULL) ++ { ++ if (SINGLE_THREAD_P) ++ *fb = victim->fd; ++ else ++ REMOVE_FB (fb, pp, victim); ++ if (__glibc_likely (victim != NULL)) ++ { ++ size_t victim_idx = fastbin_index (chunksize (victim)); ++ if (__builtin_expect (victim_idx != idx, 0)) ++ malloc_printerr ("malloc(): memory corruption (fast)"); ++ check_remalloced_chunk (av, victim, nb); ++#if USE_TCACHE ++ /* While we're here, if we see other chunks of the same size, ++ stash them in the tcache. */ ++ size_t tc_idx = csize2tidx (nb); ++ if (tcache && tc_idx < mp_.tcache_bins) + { +- REMOVE_FB (fb, tc_victim, pp); +- if (tc_victim != 0) ++ mchunkptr tc_victim; ++ ++ /* While bin not empty and tcache not full, copy chunks. */ ++ while (tcache->counts[tc_idx] < mp_.tcache_count ++ && (tc_victim = *fb) != NULL) + { ++ if (SINGLE_THREAD_P) ++ *fb = tc_victim->fd; ++ else ++ { ++ REMOVE_FB (fb, pp, tc_victim); ++ if (__glibc_unlikely (tc_victim == NULL)) ++ break; ++ } + tcache_put (tc_victim, tc_idx); +- } ++ } + } +- } + #endif +- void *p = chunk2mem (victim); +- alloc_perturb (p, bytes); +- return p; +- } ++ void *p = chunk2mem (victim); ++ alloc_perturb (p, bytes); ++ return p; ++ } ++ } + } + + /* +@@ -3628,11 +3641,9 @@ _int_malloc (mstate av, size_t bytes) + else + { + bck = victim->bk; +- if (__glibc_unlikely (bck->fd != victim)) +- { +- errstr = "malloc(): smallbin double linked list corrupted"; +- goto errout; +- } ++ if (__glibc_unlikely (bck->fd != victim)) ++ malloc_printerr ++ ("malloc(): smallbin double linked list corrupted"); + set_inuse_bit_at_offset (victim, nb); + bin->bk = bck; + bck->fd = bin; +@@ -3687,7 +3698,7 @@ _int_malloc (mstate av, size_t bytes) + else + { + idx = largebin_index (nb); +- if (have_fastchunks (av)) ++ if (atomic_load_relaxed (&av->have_fastchunks)) + malloc_consolidate (av); + } + +@@ -3723,8 +3734,7 @@ _int_malloc (mstate av, size_t bytes) + if (__builtin_expect (chunksize_nomask (victim) <= 2 * SIZE_SZ, 0) + || __builtin_expect (chunksize_nomask (victim) + > av->system_mem, 0)) +- malloc_printerr (check_action, "malloc(): memory corruption", +- chunk2mem (victim), av); ++ malloc_printerr ("malloc(): memory corruption"); + size = chunksize (victim); + + /* +@@ -3929,11 +3939,8 @@ _int_malloc (mstate av, size_t bytes) + have to perform a complete insert here. */ + bck = unsorted_chunks (av); + fwd = bck->fd; +- if (__glibc_unlikely (fwd->bk != bck)) +- { +- errstr = "malloc(): corrupted unsorted chunks"; +- goto errout; +- } ++ if (__glibc_unlikely (fwd->bk != bck)) ++ malloc_printerr ("malloc(): corrupted unsorted chunks"); + remainder->bk = bck; + remainder->fd = fwd; + bck->fd = remainder; +@@ -4036,11 +4043,8 @@ _int_malloc (mstate av, size_t bytes) + have to perform a complete insert here. */ + bck = unsorted_chunks (av); + fwd = bck->fd; +- if (__glibc_unlikely (fwd->bk != bck)) +- { +- errstr = "malloc(): corrupted unsorted chunks 2"; +- goto errout; +- } ++ if (__glibc_unlikely (fwd->bk != bck)) ++ malloc_printerr ("malloc(): corrupted unsorted chunks 2"); + remainder->bk = bck; + remainder->fd = fwd; + bck->fd = remainder; +@@ -4102,7 +4106,7 @@ _int_malloc (mstate av, size_t bytes) + + /* When we are using atomic ops to free fast chunks we can get + here for all block sizes. */ +- else if (have_fastchunks (av)) ++ else if (atomic_load_relaxed (&av->have_fastchunks)) + { + malloc_consolidate (av); + /* restore original bin index */ +@@ -4141,9 +4145,6 @@ _int_free (mstate av, mchunkptr p, int have_lock) + mchunkptr bck; /* misc temp for linking */ + mchunkptr fwd; /* misc temp for linking */ + +- const char *errstr = NULL; +- int locked = 0; +- + size = chunksize (p); + + /* Little security check which won't hurt performance: the +@@ -4152,21 +4153,11 @@ _int_free (mstate av, mchunkptr p, int have_lock) + here by accident or by "design" from some intruder. */ + if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0) + || __builtin_expect (misaligned_chunk (p), 0)) +- { +- errstr = "free(): invalid pointer"; +- errout: +- if (!have_lock && locked) +- __libc_lock_unlock (av->mutex); +- malloc_printerr (check_action, errstr, chunk2mem (p), av); +- return; +- } ++ malloc_printerr ("free(): invalid pointer"); + /* We know that each chunk is at least MINSIZE bytes in size or a + multiple of MALLOC_ALIGNMENT. */ + if (__glibc_unlikely (size < MINSIZE || !aligned_OK (size))) +- { +- errstr = "free(): invalid size"; +- goto errout; +- } ++ malloc_printerr ("free(): invalid size"); + + check_inuse_chunk(av, p); + +@@ -4205,60 +4196,59 @@ _int_free (mstate av, mchunkptr p, int have_lock) + || __builtin_expect (chunksize (chunk_at_offset (p, size)) + >= av->system_mem, 0)) + { ++ bool fail = true; + /* We might not have a lock at this point and concurrent modifications +- of system_mem might have let to a false positive. Redo the test +- after getting the lock. */ +- if (have_lock +- || ({ assert (locked == 0); +- __libc_lock_lock (av->mutex); +- locked = 1; +- chunksize_nomask (chunk_at_offset (p, size)) <= 2 * SIZE_SZ +- || chunksize (chunk_at_offset (p, size)) >= av->system_mem; +- })) +- { +- errstr = "free(): invalid next size (fast)"; +- goto errout; +- } +- if (! have_lock) ++ of system_mem might result in a false positive. Redo the test after ++ getting the lock. */ ++ if (!have_lock) + { ++ __libc_lock_lock (av->mutex); ++ fail = (chunksize_nomask (chunk_at_offset (p, size)) <= 2 * SIZE_SZ ++ || chunksize (chunk_at_offset (p, size)) >= av->system_mem); + __libc_lock_unlock (av->mutex); +- locked = 0; + } ++ ++ if (fail) ++ malloc_printerr ("free(): invalid next size (fast)"); + } + + free_perturb (chunk2mem(p), size - 2 * SIZE_SZ); + +- set_fastchunks(av); ++ atomic_store_relaxed (&av->have_fastchunks, true); + unsigned int idx = fastbin_index(size); + fb = &fastbin (av, idx); + + /* Atomically link P to its fastbin: P->FD = *FB; *FB = P; */ + mchunkptr old = *fb, old2; +- unsigned int old_idx = ~0u; +- do +- { +- /* Check that the top of the bin is not the record we are going to add +- (i.e., double free). */ +- if (__builtin_expect (old == p, 0)) +- { +- errstr = "double free or corruption (fasttop)"; +- goto errout; +- } +- /* Check that size of fastbin chunk at the top is the same as +- size of the chunk that we are adding. We can dereference OLD +- only if we have the lock, otherwise it might have already been +- deallocated. See use of OLD_IDX below for the actual check. */ +- if (have_lock && old != NULL) +- old_idx = fastbin_index(chunksize(old)); +- p->fd = old2 = old; +- } +- while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) != old2); + +- if (have_lock && old != NULL && __builtin_expect (old_idx != idx, 0)) ++ if (SINGLE_THREAD_P) + { +- errstr = "invalid fastbin entry (free)"; +- goto errout; ++ /* Check that the top of the bin is not the record we are going to ++ add (i.e., double free). */ ++ if (__builtin_expect (old == p, 0)) ++ malloc_printerr ("double free or corruption (fasttop)"); ++ p->fd = old; ++ *fb = p; + } ++ else ++ do ++ { ++ /* Check that the top of the bin is not the record we are going to ++ add (i.e., double free). */ ++ if (__builtin_expect (old == p, 0)) ++ malloc_printerr ("double free or corruption (fasttop)"); ++ p->fd = old2 = old; ++ } ++ while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) ++ != old2); ++ ++ /* Check that size of fastbin chunk at the top is the same as ++ size of the chunk that we are adding. We can dereference OLD ++ only if we have the lock, otherwise it might have already been ++ allocated again. */ ++ if (have_lock && old != NULL ++ && __builtin_expect (fastbin_index (chunksize (old)) != idx, 0)) ++ malloc_printerr ("invalid fastbin entry (free)"); + } + + /* +@@ -4266,42 +4256,33 @@ _int_free (mstate av, mchunkptr p, int have_lock) + */ + + else if (!chunk_is_mmapped(p)) { +- if (! have_lock) { ++ ++ /* If we're single-threaded, don't lock the arena. */ ++ if (SINGLE_THREAD_P) ++ have_lock = true; ++ ++ if (!have_lock) + __libc_lock_lock (av->mutex); +- locked = 1; +- } + + nextchunk = chunk_at_offset(p, size); + + /* Lightweight tests: check whether the block is already the + top block. */ + if (__glibc_unlikely (p == av->top)) +- { +- errstr = "double free or corruption (top)"; +- goto errout; +- } ++ malloc_printerr ("double free or corruption (top)"); + /* Or whether the next chunk is beyond the boundaries of the arena. */ + if (__builtin_expect (contiguous (av) + && (char *) nextchunk + >= ((char *) av->top + chunksize(av->top)), 0)) +- { +- errstr = "double free or corruption (out)"; +- goto errout; +- } ++ malloc_printerr ("double free or corruption (out)"); + /* Or whether the block is actually not marked used. */ + if (__glibc_unlikely (!prev_inuse(nextchunk))) +- { +- errstr = "double free or corruption (!prev)"; +- goto errout; +- } ++ malloc_printerr ("double free or corruption (!prev)"); + + nextsize = chunksize(nextchunk); + if (__builtin_expect (chunksize_nomask (nextchunk) <= 2 * SIZE_SZ, 0) + || __builtin_expect (nextsize >= av->system_mem, 0)) +- { +- errstr = "free(): invalid next size (normal)"; +- goto errout; +- } ++ malloc_printerr ("free(): invalid next size (normal)"); + + free_perturb (chunk2mem(p), size - 2 * SIZE_SZ); + +@@ -4333,10 +4314,7 @@ _int_free (mstate av, mchunkptr p, int have_lock) + bck = unsorted_chunks(av); + fwd = bck->fd; + if (__glibc_unlikely (fwd->bk != bck)) +- { +- errstr = "free(): corrupted unsorted chunks"; +- goto errout; +- } ++ malloc_printerr ("free(): corrupted unsorted chunks"); + p->fd = fwd; + p->bk = bck; + if (!in_smallbin_range(size)) +@@ -4379,7 +4357,7 @@ _int_free (mstate av, mchunkptr p, int have_lock) + */ + + if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) { +- if (have_fastchunks(av)) ++ if (atomic_load_relaxed (&av->have_fastchunks)) + malloc_consolidate(av); + + if (av == &main_arena) { +@@ -4398,10 +4376,8 @@ _int_free (mstate av, mchunkptr p, int have_lock) + } + } + +- if (! have_lock) { +- assert (locked); ++ if (!have_lock) + __libc_lock_unlock (av->mutex); +- } + } + /* + If the chunk was allocated via mmap, release via munmap(). +@@ -4450,7 +4426,7 @@ static void malloc_consolidate(mstate av) + */ + + if (get_max_fast () != 0) { +- clear_fastchunks(av); ++ atomic_store_relaxed (&av->have_fastchunks, false); + + unsorted_bin = unsorted_chunks(av); + +@@ -4549,17 +4525,10 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize, + INTERNAL_SIZE_T* s; /* copy source */ + INTERNAL_SIZE_T* d; /* copy destination */ + +- const char *errstr = NULL; +- + /* oldmem size */ + if (__builtin_expect (chunksize_nomask (oldp) <= 2 * SIZE_SZ, 0) + || __builtin_expect (oldsize >= av->system_mem, 0)) +- { +- errstr = "realloc(): invalid old size"; +- errout: +- malloc_printerr (check_action, errstr, chunk2mem (oldp), av); +- return NULL; +- } ++ malloc_printerr ("realloc(): invalid old size"); + + check_inuse_chunk (av, oldp); + +@@ -4570,10 +4539,7 @@ _int_realloc(mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize, + INTERNAL_SIZE_T nextsize = chunksize (next); + if (__builtin_expect (chunksize_nomask (next) <= 2 * SIZE_SZ, 0) + || __builtin_expect (nextsize >= av->system_mem, 0)) +- { +- errstr = "realloc(): invalid next size"; +- goto errout; +- } ++ malloc_printerr ("realloc(): invalid next size"); + + if ((unsigned long) (oldsize) >= (unsigned long) (nb)) + { +@@ -4798,10 +4764,6 @@ _int_memalign (mstate av, size_t alignment, size_t bytes) + static int + mtrim (mstate av, size_t pad) + { +- /* Don't touch corrupt arenas. */ +- if (arena_is_corrupt (av)) +- return 0; +- + /* Ensure initialization/consolidation */ + malloc_consolidate (av); + +@@ -5113,8 +5075,6 @@ static inline int + __always_inline + do_set_mallopt_check (int32_t value) + { +- LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action); +- check_action = value; + return 1; + } + +@@ -5388,32 +5348,10 @@ libc_hidden_def (__libc_mallopt) + extern char **__libc_argv attribute_hidden; + + static void +-malloc_printerr (int action, const char *str, void *ptr, mstate ar_ptr) ++malloc_printerr (const char *str) + { +- /* Avoid using this arena in future. We do not attempt to synchronize this +- with anything else because we minimally want to ensure that __libc_message +- gets its resources safely without stumbling on the current corruption. */ +- if (ar_ptr) +- set_arena_corrupt (ar_ptr); +- +- if ((action & 5) == 5) +- __libc_message ((action & 2) ? (do_abort | do_backtrace) : do_message, +- "%s\n", str); +- else if (action & 1) +- { +- char buf[2 * sizeof (uintptr_t) + 1]; +- +- buf[sizeof (buf) - 1] = '\0'; +- char *cp = _itoa_word ((uintptr_t) ptr, &buf[sizeof (buf) - 1], 16, 0); +- while (cp > buf) +- *--cp = '0'; +- +- __libc_message ((action & 2) ? (do_abort | do_backtrace) : do_message, +- "*** Error in `%s': %s: 0x%s ***\n", +- __libc_argv[0] ? : "", str, cp); +- } +- else if (action & 2) +- abort (); ++ __libc_message (do_abort, "%s\n", str); ++ __builtin_unreachable (); + } + + /* We need a wrapper function for one of the additions of POSIX. */ +diff --git a/malloc/tst-dynarray.c b/malloc/tst-dynarray.c +index 2206d75e31..d11f7bb8a3 100644 +--- a/malloc/tst-dynarray.c ++++ b/malloc/tst-dynarray.c +@@ -18,6 +18,9 @@ + + #include "tst-dynarray-shared.h" + ++#include ++#include ++ + #define DYNARRAY_STRUCT dynarray_long + #define DYNARRAY_ELEMENT long + #define DYNARRAY_PREFIX dynarray_long_ +@@ -463,6 +466,31 @@ test_long_init (void) + } + } + ++/* Test overflow in resize. */ ++static void ++test_long_overflow (void) ++{ ++ { ++ struct dynarray_long dyn; ++ dynarray_long_init (&dyn); ++ errno = EINVAL; ++ TEST_VERIFY (!dynarray_long_resize ++ (&dyn, (SIZE_MAX / sizeof (long)) + 1)); ++ TEST_VERIFY (errno == ENOMEM); ++ TEST_VERIFY (dynarray_long_has_failed (&dyn)); ++ } ++ ++ { ++ struct dynarray_long_noscratch dyn; ++ dynarray_long_noscratch_init (&dyn); ++ errno = EINVAL; ++ TEST_VERIFY (!dynarray_long_noscratch_resize ++ (&dyn, (SIZE_MAX / sizeof (long)) + 1)); ++ TEST_VERIFY (errno == ENOMEM); ++ TEST_VERIFY (dynarray_long_noscratch_has_failed (&dyn)); ++ } ++} ++ + /* Test NUL-terminated string construction with the add function and + the simple finalize function. */ + static void +@@ -538,6 +566,7 @@ do_test (void) + test_int (); + test_str (); + test_long_init (); ++ test_long_overflow (); + test_zstr (); + return 0; + } +diff --git a/malloc/tst-malloc-tcache-leak.c b/malloc/tst-malloc-tcache-leak.c +new file mode 100644 +index 0000000000..22c679b65b +--- /dev/null ++++ b/malloc/tst-malloc-tcache-leak.c +@@ -0,0 +1,112 @@ ++/* Bug 22111: Test that threads do not leak their per thread cache. ++ Copyright (C) 2015-2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* The point of this test is to start and exit a large number of ++ threads, while at the same time looking to see if the used ++ memory grows with each round of threads run. If the memory ++ grows above some linear bound we declare the test failed and ++ that the malloc implementation is leaking memory with each ++ thread. This is a good indicator that the thread local cache ++ is leaking chunks. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++void * ++worker (void *data) ++{ ++ void *ret; ++ /* Allocate an arbitrary amount of memory that is known to fit into ++ the thread local cache (tcache). If we have at least 64 bins ++ (default e.g. TCACHE_MAX_BINS) we should be able to allocate 32 ++ bytes and force malloc to fill the tcache. We are assuming tcahce ++ init happens at the first small alloc, but it might in the future ++ be deferred to some other point. Therefore to future proof this ++ test we include a full alloc/free/alloc cycle for the thread. We ++ need a compiler barrier to avoid the removal of the useless ++ alloc/free. We send some memory back to main to have the memory ++ freed after the thread dies, as just another check that the chunks ++ that were previously in the tcache are still OK to free after ++ thread death. */ ++ ret = xmalloc (32); ++ __asm__ volatile ("" ::: "memory"); ++ free (ret); ++ return (void *) xmalloc (32); ++} ++ ++static int ++do_test (void) ++{ ++ pthread_t *thread; ++ struct mallinfo info_before, info_after; ++ void *retval; ++ ++ /* This is an arbitrary choice. We choose a total of THREADS ++ threads created and joined. This gives us enough iterations to ++ show a leak. */ ++ int threads = 100000; ++ ++ /* Avoid there being 0 malloc'd data at this point by allocating the ++ pthread_t required to run the test. */ ++ thread = (pthread_t *) xcalloc (1, sizeof (pthread_t)); ++ ++ info_before = mallinfo (); ++ ++ assert (info_before.uordblks != 0); ++ ++ printf ("INFO: %d (bytes) are in use before starting threads.\n", ++ info_before.uordblks); ++ ++ for (int loop = 0; loop < threads; loop++) ++ { ++ *thread = xpthread_create (NULL, worker, NULL); ++ retval = xpthread_join (*thread); ++ free (retval); ++ } ++ ++ info_after = mallinfo (); ++ printf ("INFO: %d (bytes) are in use after all threads joined.\n", ++ info_after.uordblks); ++ ++ /* We need to compare the memory in use before and the memory in use ++ after starting and joining THREADS threads. We almost always grow ++ memory slightly, but not much. Consider that if even 1-byte leaked ++ per thread we'd have THREADS bytes of additional memory, and in ++ general the in-use at the start of main is quite low. We will ++ always leak a full malloc chunk, and never just 1-byte, therefore ++ anything above "+ threads" from the start (constant offset) is a ++ leak. Obviously this assumes no thread-related malloc'd internal ++ libc data structures persist beyond the thread death, and any that ++ did would limit the number of times you could call pthread_create, ++ which is a QoI we'd want to detect and fix. */ ++ if (info_after.uordblks > (info_before.uordblks + threads)) ++ FAIL_EXIT1 ("Memory usage after threads is too high.\n"); ++ ++ /* Did not detect excessive memory usage. */ ++ free (thread); ++ exit (0); ++} ++ ++#include +diff --git a/manual/memory.texi b/manual/memory.texi +index 82f473806c..51a5f4e83c 100644 +--- a/manual/memory.texi ++++ b/manual/memory.texi +@@ -1104,7 +1104,6 @@ When calling @code{mallopt}, the @var{param} argument specifies the + parameter to be set, and @var{value} the new value to be set. Possible + choices for @var{param}, as defined in @file{malloc.h}, are: + +-@comment TODO: @item M_CHECK_ACTION + @vtable @code + @item M_MMAP_MAX + The maximum number of chunks to allocate with @code{mmap}. Setting this +@@ -1309,17 +1308,15 @@ The block was already freed. + + Another possibility to check for and guard against bugs in the use of + @code{malloc}, @code{realloc} and @code{free} is to set the environment +-variable @code{MALLOC_CHECK_}. When @code{MALLOC_CHECK_} is set, a +-special (less efficient) implementation is used which is designed to be +-tolerant against simple errors, such as double calls of @code{free} with +-the same argument, or overruns of a single byte (off-by-one bugs). Not +-all such errors can be protected against, however, and memory leaks can +-result. If @code{MALLOC_CHECK_} is set to @code{0}, any detected heap +-corruption is silently ignored; if set to @code{1}, a diagnostic is +-printed on @code{stderr}; if set to @code{2}, @code{abort} is called +-immediately. This can be useful because otherwise a crash may happen +-much later, and the true cause for the problem is then very hard to +-track down. ++variable @code{MALLOC_CHECK_}. When @code{MALLOC_CHECK_} is set to a ++non-zero value, a special (less efficient) implementation is used which ++is designed to be tolerant against simple errors, such as double calls ++of @code{free} with the same argument, or overruns of a single byte ++(off-by-one bugs). Not all such errors can be protected against, ++however, and memory leaks can result. ++ ++Any detected heap corruption results in immediate termination of the ++process. + + There is one problem with @code{MALLOC_CHECK_}: in SUID or SGID binaries + it could possibly be exploited since diverging from the normal programs +diff --git a/manual/probes.texi b/manual/probes.texi +index 96acaed206..8ab67562d7 100644 +--- a/manual/probes.texi ++++ b/manual/probes.texi +@@ -195,13 +195,6 @@ this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic + threshold adjustment was already disabled. + @end deftp + +-@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2}) +-This probe is triggered shortly after the @code{memory_mallopt} probe, +-when the parameter to be changed is @code{M_CHECK_ACTION}. Argument +-@var{$arg1} is the requested value, and @var{$arg2} is the previous +-value of this @code{malloc} parameter. +-@end deftp +- + @deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2}) + This probe is triggered shortly after the @code{memory_mallopt} probe, + when the parameter to be changed is @code{M_PERTURB}. Argument +diff --git a/manual/tunables.texi b/manual/tunables.texi +index 4c658bf3df..b09e3fe791 100644 +--- a/manual/tunables.texi ++++ b/manual/tunables.texi +@@ -71,27 +71,13 @@ following tunables in the @code{malloc} namespace: + This tunable supersedes the @env{MALLOC_CHECK_} environment variable and is + identical in features. + +-Setting this tunable enables a special (less efficient) memory allocator for +-the malloc family of functions that is designed to be tolerant against simple +-errors such as double calls of free with the same argument, or overruns of a +-single byte (off-by-one bugs). Not all such errors can be protected against, +-however, and memory leaks can result. The following list describes the values +-that this tunable can take and the effect they have on malloc functionality: +- +-@itemize @bullet +-@item @code{0} Ignore all errors. The default allocator continues to be in +-use, but all errors are silently ignored. +-@item @code{1} Report errors. The alternate allocator is selected and heap +-corruption, if detected, is reported as diagnostic messages to @code{stderr} +-and the program continues execution. +-@item @code{2} Abort on errors. The alternate allocator is selected and if +-heap corruption is detected, the program is ended immediately by calling +-@code{abort}. +-@item @code{3} Fully enabled. The alternate allocator is selected and is fully +-functional. That is, if heap corruption is detected, a verbose diagnostic +-message is printed to @code{stderr} and the program is ended by calling +-@code{abort}. +-@end itemize ++Setting this tunable to a non-zero value enables a special (less ++efficient) memory allocator for the malloc family of functions that is ++designed to be tolerant against simple errors such as double calls of ++free with the same argument, or overruns of a single byte (off-by-one ++bugs). Not all such errors can be protected against, however, and memory ++leaks can result. Any detected heap corruption results in immediate ++termination of the process. + + Like @env{MALLOC_CHECK_}, @code{glibc.malloc.check} has a problem in that it + diverges from normal program behavior by writing to @code{stderr}, which could +@@ -267,7 +253,7 @@ This tunable is specific to i386 and x86-64. + @deftp Tunable glibc.tune.cpu + The @code{glibc.tune.cpu=xxx} tunable allows the user to tell @theglibc{} to + assume that the CPU is @code{xxx} where xxx may have one of these values: +-@code{generic}, @code{thunderxt88}. ++@code{generic}, @code{falkor}, @code{thunderxt88}. + + This tunable is specific to aarch64. + @end deftp +diff --git a/math/Makefile b/math/Makefile +index e09b0c0545..2c17c68eda 100644 +--- a/math/Makefile ++++ b/math/Makefile +@@ -203,7 +203,8 @@ tests-static = test-fpucw-static test-fpucw-ieee-static \ + test-signgam-ullong-static test-signgam-ullong-init-static + + ifneq (,$(CXX)) +-tests += test-math-isinff test-math-iszero ++tests += test-math-isinff test-math-iszero test-math-issignaling \ ++ test-math-iscanonical + endif + + ifneq (no,$(PERL)) +@@ -350,6 +351,8 @@ CFLAGS-test-signgam-ullong-init-static.c = -std=c99 + + CFLAGS-test-math-isinff.cc = -std=gnu++11 + CFLAGS-test-math-iszero.cc = -std=gnu++11 ++CFLAGS-test-math-issignaling.cc = -std=gnu++11 ++CFLAGS-test-math-iscanonical.cc = -std=gnu++11 + + CFLAGS-test-iszero-excess-precision.c = -fexcess-precision=standard + CFLAGS-test-iseqsig-excess-precision.c = -fexcess-precision=standard +diff --git a/math/math.h b/math/math.h +index e21708045a..ba26624835 100644 +--- a/math/math.h ++++ b/math/math.h +@@ -402,7 +402,13 @@ enum + + /* Return number of classification appropriate for X. */ + # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ \ +- && !defined __OPTIMIZE_SIZE__ ++ && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus) ++ /* The check for __cplusplus allows the use of the builtin, even ++ when optimization for size is on. This is provided for ++ libstdc++, only to let its configure test work when it is built ++ with -Os. No further use of this definition of fpclassify is ++ expected in C++ mode, since libstdc++ provides its own version ++ of fpclassify in cmath (which undefines fpclassify). */ + # define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \ + FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x) + # else +@@ -412,6 +418,15 @@ enum + /* Return nonzero value if sign of X is negative. */ + # if __GNUC_PREREQ (6,0) + # define signbit(x) __builtin_signbit (x) ++# elif defined __cplusplus ++ /* In C++ mode, __MATH_TG cannot be used, because it relies on ++ __builtin_types_compatible_p, which is a C-only builtin. ++ The check for __cplusplus allows the use of the builtin instead of ++ __MATH_TG. This is provided for libstdc++, only to let its configure ++ test work. No further use of this definition of signbit is expected ++ in C++ mode, since libstdc++ provides its own version of signbit ++ in cmath (which undefines signbit). */ ++# define signbit(x) __builtin_signbitl (x) + # elif __GNUC_PREREQ (4,0) + # define signbit(x) __MATH_TG ((x), __builtin_signbit, (x)) + # else +@@ -442,8 +457,12 @@ enum + + /* Return nonzero value if X is positive or negative infinity. */ + # if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \ +- && !defined __SUPPORT_SNAN__ +- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */ ++ && !defined __SUPPORT_SNAN__ && !defined __cplusplus ++ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0, ++ use the helper function, __isinff128, with older compilers. This is ++ only provided for C mode, because in C++ mode, GCC has no support ++ for __builtin_types_compatible_p (and when in C++ mode, this macro is ++ not used anyway, because libstdc++ headers undefine it). */ + # define isinf(x) \ + (__builtin_types_compatible_p (__typeof (x), _Float128) \ + ? __isinff128 (x) : __builtin_isinf_sign (x)) +@@ -470,7 +489,32 @@ enum + # include + + /* Return nonzero value if X is a signaling NaN. */ +-# define issignaling(x) __MATH_TG ((x), __issignaling, (x)) ++# ifndef __cplusplus ++# define issignaling(x) __MATH_TG ((x), __issignaling, (x)) ++# else ++ /* In C++ mode, __MATH_TG cannot be used, because it relies on ++ __builtin_types_compatible_p, which is a C-only builtin. On the ++ other hand, overloading provides the means to distinguish between ++ the floating-point types. The overloading resolution will match ++ the correct parameter (regardless of type qualifiers (i.e.: const ++ and volatile)). */ ++extern "C++" { ++inline int issignaling (float __val) { return __issignalingf (__val); } ++inline int issignaling (double __val) { return __issignaling (__val); } ++inline int ++issignaling (long double __val) ++{ ++# ifdef __NO_LONG_DOUBLE_MATH ++ return __issignaling (__val); ++# else ++ return __issignalingl (__val); ++# endif ++} ++# if __HAVE_DISTINCT_FLOAT128 ++inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); } ++# endif ++} /* extern C++ */ ++# endif + + /* Return nonzero value if X is subnormal. */ + # define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL) +@@ -484,15 +528,40 @@ enum + # endif + # else /* __cplusplus */ + extern "C++" { ++# ifdef __SUPPORT_SNAN__ ++inline int ++iszero (float __val) ++{ ++ return __fpclassifyf (__val) == FP_ZERO; ++} ++inline int ++iszero (double __val) ++{ ++ return __fpclassify (__val) == FP_ZERO; ++} ++inline int ++iszero (long double __val) ++{ ++# ifdef __NO_LONG_DOUBLE_MATH ++ return __fpclassify (__val) == FP_ZERO; ++# else ++ return __fpclassifyl (__val) == FP_ZERO; ++# endif ++} ++# if __HAVE_DISTINCT_FLOAT128 ++inline int ++iszero (_Float128 __val) ++{ ++ return __fpclassifyf128 (__val) == FP_ZERO; ++} ++# endif ++# else + template inline bool + iszero (__T __val) + { +-# ifdef __SUPPORT_SNAN__ +- return fpclassify (__val) == FP_ZERO; +-# else + return __val == 0; +-# endif + } ++# endif + } /* extern C++ */ + # endif /* __cplusplus */ + #endif /* Use IEC_60559_BFP_EXT. */ +diff --git a/math/test-math-iscanonical.cc b/math/test-math-iscanonical.cc +new file mode 100644 +index 0000000000..4cfb1c5055 +--- /dev/null ++++ b/math/test-math-iscanonical.cc +@@ -0,0 +1,48 @@ ++/* Test for the C++ implementation of iscanonical. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#define _GNU_SOURCE 1 ++#include ++#include ++ ++static int errors; ++ ++template ++static void ++check_type () ++{ ++ T val = 0; ++ ++ /* Check if iscanonical is available in C++ mode (bug 22235). */ ++ if (iscanonical (val) == 0) ++ errors++; ++} ++ ++static int ++do_test (void) ++{ ++ check_type (); ++ check_type (); ++ check_type (); ++#if __HAVE_DISTINCT_FLOAT128 ++ check_type<_Float128> (); ++#endif ++ return errors != 0; ++} ++ ++#include +diff --git a/math/test-math-issignaling.cc b/math/test-math-issignaling.cc +new file mode 100644 +index 0000000000..22ae9e1bca +--- /dev/null ++++ b/math/test-math-issignaling.cc +@@ -0,0 +1,113 @@ ++/* Test for the C++ implementation of issignaling. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#define _GNU_SOURCE 1 ++#include ++#include ++ ++#include ++ ++/* There is no signaling_NaN for _Float128 in std::numeric_limits. ++ Include ieee754_float128.h and use the bitfields in the union ++ ieee854_float128.ieee_nan to build a signaling NaN. */ ++#if __HAVE_DISTINCT_FLOAT128 ++# include ++#endif ++ ++static bool errors; ++ ++static void ++check (int actual, int expected, const char *actual_expr, int line) ++{ ++ if (actual != expected) ++ { ++ errors = true; ++ printf ("%s:%d: error: %s\n", __FILE__, line, actual_expr); ++ printf ("%s:%d: expected: %d\n", __FILE__, line, expected); ++ printf ("%s:%d: actual: %d\n", __FILE__, line, actual); ++ } ++} ++ ++#define CHECK(actual, expected) \ ++ check ((actual), (expected), #actual, __LINE__) ++ ++template ++static void ++check_type () ++{ ++ typedef std::numeric_limits limits; ++ CHECK (issignaling (T{0}), 0); ++ if (limits::has_infinity) ++ { ++ CHECK (issignaling (limits::infinity ()), 0); ++ CHECK (issignaling (-limits::infinity ()), 0); ++ } ++ if (limits::has_quiet_NaN) ++ CHECK (issignaling (limits::quiet_NaN ()), 0); ++ if (limits::has_signaling_NaN) ++ CHECK (issignaling (limits::signaling_NaN ()), 1); ++} ++ ++#if __HAVE_DISTINCT_FLOAT128 ++static void ++check_float128 () ++{ ++ ieee854_float128 q; ++ ++ q.d = 0; ++ CHECK (issignaling (q.d), 0); ++ ++ /* Infinity. */ ++ q.ieee.negative = 0; ++ q.ieee.exponent = 0x7FFF; ++ q.ieee.mantissa0 = 0x0000; ++ q.ieee.mantissa1 = 0x00000000; ++ q.ieee.mantissa2 = 0x00000000; ++ q.ieee.mantissa3 = 0x00000000; ++ CHECK (issignaling (q.d), 0); ++ ++ /* Quiet NaN. */ ++ q.ieee_nan.quiet_nan = 1; ++ q.ieee_nan.mantissa0 = 0x0000; ++ CHECK (issignaling (q.d), 0); ++ ++ /* Still a quiet NaN. */ ++ q.ieee_nan.quiet_nan = 1; ++ q.ieee_nan.mantissa0 = 0x4000; ++ CHECK (issignaling (q.d), 0); ++ ++ /* Signaling NaN. */ ++ q.ieee_nan.quiet_nan = 0; ++ q.ieee_nan.mantissa0 = 0x4000; ++ CHECK (issignaling (q.d), 1); ++} ++#endif ++ ++static int ++do_test (void) ++{ ++ check_type (); ++ check_type (); ++ check_type (); ++#if __HAVE_DISTINCT_FLOAT128 ++ check_float128 (); ++#endif ++ return errors; ++} ++ ++#include +diff --git a/math/test-math-iszero.cc b/math/test-math-iszero.cc +index 027e972654..5c07261626 100644 +--- a/math/test-math-iszero.cc ++++ b/math/test-math-iszero.cc +@@ -22,6 +22,13 @@ + + #include + ++/* Support for _Float128 in std::numeric_limits is limited. ++ Include ieee754_float128.h and use the bitfields in the union ++ ieee854_float128.ieee_nan to build corner-case inputs. */ ++#if __HAVE_DISTINCT_FLOAT128 ++# include ++#endif ++ + static bool errors; + + static void +@@ -72,12 +79,84 @@ check_type () + std::numeric_limits::has_denorm == std::denorm_absent); + } + ++#if __HAVE_DISTINCT_FLOAT128 ++static void ++check_float128 () ++{ ++ ieee854_float128 q; ++ ++ q.d = 0.0Q; ++ CHECK (iszero (q.d), 1); ++ q.d = -0.0Q; ++ CHECK (iszero (q.d), 1); ++ q.d = 1.0Q; ++ CHECK (iszero (q.d), 0); ++ q.d = -1.0Q; ++ CHECK (iszero (q.d), 0); ++ ++ /* Normal min. */ ++ q.ieee.negative = 0; ++ q.ieee.exponent = 0x0001; ++ q.ieee.mantissa0 = 0x0000; ++ q.ieee.mantissa1 = 0x00000000; ++ q.ieee.mantissa2 = 0x00000000; ++ q.ieee.mantissa3 = 0x00000000; ++ CHECK (iszero (q.d), 0); ++ q.ieee.negative = 1; ++ CHECK (iszero (q.d), 0); ++ ++ /* Normal max. */ ++ q.ieee.negative = 0; ++ q.ieee.exponent = 0x7FFE; ++ q.ieee.mantissa0 = 0xFFFF; ++ q.ieee.mantissa1 = 0xFFFFFFFF; ++ q.ieee.mantissa2 = 0xFFFFFFFF; ++ q.ieee.mantissa3 = 0xFFFFFFFF; ++ CHECK (iszero (q.d), 0); ++ q.ieee.negative = 1; ++ CHECK (iszero (q.d), 0); ++ ++ /* Infinity. */ ++ q.ieee.negative = 0; ++ q.ieee.exponent = 0x7FFF; ++ q.ieee.mantissa0 = 0x0000; ++ q.ieee.mantissa1 = 0x00000000; ++ q.ieee.mantissa2 = 0x00000000; ++ q.ieee.mantissa3 = 0x00000000; ++ CHECK (iszero (q.d), 0); ++ ++ /* Quiet NaN. */ ++ q.ieee_nan.quiet_nan = 1; ++ q.ieee_nan.mantissa0 = 0x0000; ++ CHECK (iszero (q.d), 0); ++ ++ /* Signaling NaN. */ ++ q.ieee_nan.quiet_nan = 0; ++ q.ieee_nan.mantissa0 = 0x4000; ++ CHECK (iszero (q.d), 0); ++ ++ /* Denormal min. */ ++ q.ieee.negative = 0; ++ q.ieee.exponent = 0x0000; ++ q.ieee.mantissa0 = 0x0000; ++ q.ieee.mantissa1 = 0x00000000; ++ q.ieee.mantissa2 = 0x00000000; ++ q.ieee.mantissa3 = 0x00000001; ++ CHECK (iszero (q.d), 0); ++ q.ieee.negative = 1; ++ CHECK (iszero (q.d), 0); ++} ++#endif ++ + static int + do_test (void) + { + check_type (); + check_type (); + check_type (); ++#if __HAVE_DISTINCT_FLOAT128 ++ check_float128 (); ++#endif + return errors; + } + +diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h +index 06523bfe9c..0c808216a4 100644 +--- a/misc/sys/cdefs.h ++++ b/misc/sys/cdefs.h +@@ -464,17 +464,18 @@ + # define __glibc_macro_warning(msg) + #endif + +-/* Support for generic selection (ISO C11) is available in GCC since +- version 4.9. Previous versions do not provide generic selection, +- even though they might set __STDC_VERSION__ to 201112L, when in +- -std=c11 mode. Thus, we must check for !defined __GNUC__ when +- testing __STDC_VERSION__ for generic selection support. ++/* Generic selection (ISO C11) is a C-only feature, available in GCC ++ since version 4.9. Previous versions do not provide generic ++ selection, even though they might set __STDC_VERSION__ to 201112L, ++ when in -std=c11 mode. Thus, we must check for !defined __GNUC__ ++ when testing __STDC_VERSION__ for generic selection support. + On the other hand, Clang also defines __GNUC__, so a clang-specific + check is required to enable the use of generic selection. */ +-#if __GNUC_PREREQ (4, 9) \ +- || __glibc_clang_has_extension (c_generic_selections) \ +- || (!defined __GNUC__ && defined __STDC_VERSION__ \ +- && __STDC_VERSION__ >= 201112L) ++#if !defined __cplusplus \ ++ && (__GNUC_PREREQ (4, 9) \ ++ || __glibc_clang_has_extension (c_generic_selections) \ ++ || (!defined __GNUC__ && defined __STDC_VERSION__ \ ++ && __STDC_VERSION__ >= 201112L)) + # define __HAVE_GENERIC_SELECTION 1 + #else + # define __HAVE_GENERIC_SELECTION 0 +diff --git a/nptl/Makefile b/nptl/Makefile +index 5cb1bb2c3d..9ca6d01b8c 100644 +--- a/nptl/Makefile ++++ b/nptl/Makefile +@@ -367,7 +367,7 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ + tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \ + tst-oncex3 tst-oncex4 + ifeq ($(build-shared),yes) +-tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 ++tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 tst-compat-forwarder + tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 + tests-nolibpthread += tst-fini1 + ifeq ($(have-z-execstack),yes) +@@ -379,7 +379,7 @@ modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \ + tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \ + tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \ + tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod \ +- tst-join7mod ++ tst-join7mod tst-compat-forwarder-mod + extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ + tst-cleanup4aux.o tst-cleanupx4aux.o + test-extras += tst-cleanup4aux tst-cleanupx4aux +@@ -718,6 +718,8 @@ $(objpfx)tst-oddstacklimit.out: $(objpfx)tst-oddstacklimit $(objpfx)tst-basic1 + $(evaluate-test) + endif + ++$(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so ++ + # The tests here better do not run in parallel + ifneq ($(filter %tests,$(MAKECMDGOALS)),) + .NOTPARALLEL: +diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c +index ce2e24af95..dff5d3469e 100644 +--- a/nptl/allocatestack.c ++++ b/nptl/allocatestack.c +@@ -727,7 +727,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, + - offsetof (pthread_mutex_t, + __data.__list.__next)); + pd->robust_head.list_op_pending = NULL; +-#ifdef __PTHREAD_MUTEX_HAVE_PREV ++#if __PTHREAD_MUTEX_HAVE_PREV + pd->robust_prev = &pd->robust_head; + #endif + pd->robust_head.list = &pd->robust_head; +diff --git a/nptl/descr.h b/nptl/descr.h +index c5ad0c8dba..c83b17b674 100644 +--- a/nptl/descr.h ++++ b/nptl/descr.h +@@ -169,7 +169,7 @@ struct pthread + pid_t pid_ununsed; + + /* List of robust mutexes the thread is holding. */ +-#ifdef __PTHREAD_MUTEX_HAVE_PREV ++#if __PTHREAD_MUTEX_HAVE_PREV + void *robust_prev; + struct robust_list_head robust_head; + +diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c +index 29216077a2..869e926f17 100644 +--- a/nptl/nptl-init.c ++++ b/nptl/nptl-init.c +@@ -297,7 +297,7 @@ __pthread_initialize_minimal_internal (void) + + /* Initialize the robust mutex data. */ + { +-#ifdef __PTHREAD_MUTEX_HAVE_PREV ++#if __PTHREAD_MUTEX_HAVE_PREV + pd->robust_prev = &pd->robust_head; + #endif + pd->robust_head.list = &pd->robust_head; +diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c +index 2ef757e687..8f3c6b3a09 100644 +--- a/nptl/pt-longjmp.c ++++ b/nptl/pt-longjmp.c +@@ -25,21 +25,14 @@ + symbol in libpthread, but the historical ABI requires it. For static + linking, there is no need to provide anything here--the libc version + will be linked in. For shared library ABI compatibility, there must be +- longjmp and siglongjmp symbols in libpthread.so; so we define them using +- IFUNC to redirect to the libc function. */ ++ longjmp and siglongjmp symbols in libpthread.so. + +-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22) +- +-# if HAVE_IFUNC +- +-# undef INIT_ARCH +-# define INIT_ARCH() +-# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp) +- +-extern __typeof(longjmp) longjmp_ifunc; +-extern __typeof(siglongjmp) siglongjmp_ifunc; ++ With an IFUNC resolver, it would be possible to avoid the indirection, ++ but the IFUNC resolver might run before the __libc_longjmp symbol has ++ been relocated, in which case the IFUNC resolver would not be able to ++ provide the correct address. */ + +-# else /* !HAVE_IFUNC */ ++#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22) + + static void __attribute__ ((noreturn, used)) + longjmp_compat (jmp_buf env, int val) +@@ -47,14 +40,10 @@ longjmp_compat (jmp_buf env, int val) + __libc_longjmp (env, val); + } + +-# define DEFINE_LONGJMP(name) strong_alias (longjmp_compat, name) +- +-# endif /* HAVE_IFUNC */ +- +-DEFINE_LONGJMP (longjmp_ifunc) +-compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0); ++strong_alias (longjmp_compat, longjmp_alias) ++compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0); + +-strong_alias (longjmp_ifunc, siglongjmp_ifunc) +-compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0); ++strong_alias (longjmp_alias, siglongjmp_alias) ++compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0); + + #endif +diff --git a/nptl/pt-system.c b/nptl/pt-system.c +index f8ca6ba0d9..b30ddf2b39 100644 +--- a/nptl/pt-system.c ++++ b/nptl/pt-system.c +@@ -25,29 +25,21 @@ + libpthread, but the historical ABI requires it. For static linking, + there is no need to provide anything here--the libc version will be + linked in. For shared library ABI compatibility, there must be a +- 'system' symbol in libpthread.so; so we define it using IFUNC to +- redirect to the libc function. */ ++ 'system' symbol in libpthread.so. + +-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22) +- +-# if HAVE_IFUNC +- +-extern __typeof(system) system_ifunc; +-# undef INIT_ARCH +-# define INIT_ARCH() +-libc_ifunc (system_ifunc, &__libc_system) ++ With an IFUNC resolver, it would be possible to avoid the indirection, ++ but the IFUNC resolver might run before the __libc_system symbol has ++ been relocated, in which case the IFUNC resolver would not be able to ++ provide the correct address. */ + +-# else /* !HAVE_IFUNC */ ++#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22) + + static int __attribute__ ((used)) + system_compat (const char *line) + { + return __libc_system (line); + } +-strong_alias (system_compat, system_ifunc) +- +-# endif /* HAVE_IFUNC */ +- +-compat_symbol (libpthread, system_ifunc, system, GLIBC_2_0); ++strong_alias (system_compat, system_alias) ++compat_symbol (libpthread, system_alias, system, GLIBC_2_0); + + #endif +diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h +index 6e7d6ff09e..c5ae04692e 100644 +--- a/nptl/pthreadP.h ++++ b/nptl/pthreadP.h +@@ -647,4 +647,10 @@ check_stacksize_attr (size_t st) + return EINVAL; + } + ++#define ASSERT_PTHREAD_STRING(x) __STRING (x) ++#define ASSERT_PTHREAD_INTERNAL_OFFSET(type, member, offset) \ ++ _Static_assert (offsetof (type, member) == offset, \ ++ "offset of " #member " field of " #type " != " \ ++ ASSERT_PTHREAD_STRING (offset)) ++ + #endif /* pthreadP.h */ +diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c +index 2f8ada34d6..16c05c3a58 100644 +--- a/nptl/pthread_create.c ++++ b/nptl/pthread_create.c +@@ -520,7 +520,7 @@ START_THREAD_DEFN + + #ifndef __ASSUME_SET_ROBUST_LIST + /* If this thread has any robust mutexes locked, handle them now. */ +-# ifdef __PTHREAD_MUTEX_HAVE_PREV ++# if __PTHREAD_MUTEX_HAVE_PREV + void *robust = pd->robust_head.list; + # else + __pthread_slist_t *robust = pd->robust_list.__next; +@@ -538,7 +538,7 @@ START_THREAD_DEFN + __list.__next)); + robust = *((void **) robust); + +-# ifdef __PTHREAD_MUTEX_HAVE_PREV ++# if __PTHREAD_MUTEX_HAVE_PREV + this->__list.__prev = NULL; + # endif + this->__list.__next = NULL; +diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c +index 6f2fc808ff..e1f911bf29 100644 +--- a/nptl/pthread_mutex_init.c ++++ b/nptl/pthread_mutex_init.c +@@ -23,6 +23,7 @@ + #include + #include "pthreadP.h" + #include ++#include + + #include + +@@ -58,6 +59,18 @@ __pthread_mutex_init (pthread_mutex_t *mutex, + const struct pthread_mutexattr *imutexattr; + + assert (sizeof (pthread_mutex_t) <= __SIZEOF_PTHREAD_MUTEX_T); ++ ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__nusers, ++ __PTHREAD_MUTEX_NUSERS_OFFSET); ++ ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__kind, ++ __PTHREAD_MUTEX_KIND_OFFSET); ++ ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__spins, ++ __PTHREAD_MUTEX_SPINS_OFFSET); ++#if __PTHREAD_MUTEX_LOCK_ELISION ++ ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__elision, ++ __PTHREAD_MUTEX_ELISION_OFFSET); ++#endif ++ ASSERT_PTHREAD_INTERNAL_OFFSET (pthread_mutex_t, __data.__list, ++ __PTHREAD_MUTEX_LIST_OFFSET); + + imutexattr = ((const struct pthread_mutexattr *) mutexattr + ?: &default_mutexattr); +diff --git a/nptl/tst-compat-forwarder-mod.c b/nptl/tst-compat-forwarder-mod.c +new file mode 100644 +index 0000000000..823bfa22de +--- /dev/null ++++ b/nptl/tst-compat-forwarder-mod.c +@@ -0,0 +1,28 @@ ++/* Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Call the function system through a statically initialized pointer. */ ++ ++#include ++ ++int (*system_function) (const char *) = system; ++ ++void ++call_system (void) ++{ ++ system_function (NULL); ++} +diff --git a/nptl/tst-compat-forwarder.c b/nptl/tst-compat-forwarder.c +new file mode 100644 +index 0000000000..f96806b7fe +--- /dev/null ++++ b/nptl/tst-compat-forwarder.c +@@ -0,0 +1,35 @@ ++/* Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Test that the compat forwaders in libpthread work correctly. */ ++ ++#include ++ ++extern void call_system (void); ++ ++int ++do_test (void) ++{ ++ /* Calling the system function from a shared library that is not linked ++ against libpthread, when the main program is linked against ++ libpthread, should not crash. */ ++ call_system (); ++ ++ return 0; ++} ++ ++#include +diff --git a/nss/Makefile b/nss/Makefile +index d9f6d41181..8efb2a56fa 100644 +--- a/nss/Makefile ++++ b/nss/Makefile +@@ -58,6 +58,12 @@ tests = test-netdb test-digits-dots tst-nss-getpwent bug17079 \ + tst-nss-test5 + xtests = bug-erange + ++# Tests which need libdl ++ifeq (yes,$(build-shared)) ++tests += tst-nss-files-hosts-erange ++tests += tst-nss-files-hosts-multi ++endif ++ + # If we have a thread library then we can test cancellation against + # some routines like getpwuid_r. + ifeq (yes,$(have-thread-library)) +@@ -154,3 +160,6 @@ $(patsubst %,$(objpfx)%.out,$(tests)) : \ + ifeq (yes,$(have-thread-library)) + $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library) + endif ++ ++$(objpfx)tst-nss-files-hosts-erange: $(libdl) ++$(objpfx)tst-nss-files-hosts-multi: $(libdl) +diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c +index 6c547ea1ca..bce80e05dd 100644 +--- a/nss/getXXbyYY_r.c ++++ b/nss/getXXbyYY_r.c +@@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, + H_ERRNO_VAR_P)) + { + case -1: ++# ifdef NEED__RES ++ __resolv_context_put (res_ctx); ++# endif + return errno; + case 1: + #ifdef NEED_H_ERRNO +@@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, + nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result + H_ERRNO_VAR); + if (nscd_status >= 0) +- return nscd_status; ++ { ++# ifdef NEED__RES ++ __resolv_context_put (res_ctx); ++# endif ++ return nscd_status; ++ } + } + #endif + +diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c +index bccb6a5780..6f7cc4d94b 100644 +--- a/nss/nss_files/files-hosts.c ++++ b/nss/nss_files/files-hosts.c +@@ -22,6 +22,8 @@ + #include + #include + #include ++#include ++#include + + + /* Get implementation for some internal functions. */ +@@ -115,228 +117,250 @@ DB_LOOKUP (hostbyaddr, ,,, + }, const void *addr, socklen_t len, int af) + #undef EXTRA_ARGS_VALUE + +-enum nss_status +-_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result, +- char *buffer, size_t buflen, int *errnop, +- int *herrnop, int32_t *ttlp, char **canonp) +-{ +- FILE *stream = NULL; +- uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data); +- buffer += pad; +- buflen = buflen > pad ? buflen - pad : 0; ++/* Type of the address and alias arrays. */ ++#define DYNARRAY_STRUCT array ++#define DYNARRAY_ELEMENT char * ++#define DYNARRAY_PREFIX array_ ++#include + +- /* Open file. */ +- enum nss_status status = internal_setent (&stream); ++static enum nss_status ++gethostbyname3_multi (FILE * stream, const char *name, int af, ++ struct hostent *result, char *buffer, size_t buflen, ++ int *errnop, int *herrnop, int flags) ++{ ++ assert (af == AF_INET || af == AF_INET6); ++ ++ /* We have to get all host entries from the file. */ ++ struct scratch_buffer tmp_buffer; ++ scratch_buffer_init (&tmp_buffer); ++ struct hostent tmp_result_buf; ++ struct array addresses; ++ array_init (&addresses); ++ struct array aliases; ++ array_init (&aliases); ++ enum nss_status status; ++ ++ /* Preserve the addresses and aliases encountered so far. */ ++ for (size_t i = 0; result->h_addr_list[i] != NULL; ++i) ++ array_add (&addresses, result->h_addr_list[i]); ++ for (size_t i = 0; result->h_aliases[i] != NULL; ++i) ++ array_add (&aliases, result->h_aliases[i]); ++ ++ /* The output buffer re-uses now-unused space at the end of the ++ buffer, starting with the aliases array. It comes last in the ++ data produced by internal_getent. (The alias names themselves ++ are still located in the line read in internal_getent, which is ++ stored at the beginning of the buffer.) */ ++ struct alloc_buffer outbuf; ++ { ++ char *bufferend = (char *) result->h_aliases; ++ outbuf = alloc_buffer_create (bufferend, buffer + buflen - bufferend); ++ } + +- if (status == NSS_STATUS_SUCCESS) ++ while (true) + { +- /* XXX Is using _res to determine whether we want to convert IPv4 +- addresses to IPv6 addresses really the right thing to do? */ +- int flags = (res_use_inet6 () ? AI_V4MAPPED : 0); +- +- while ((status = internal_getent (stream, result, buffer, buflen, errnop, +- herrnop, af, flags)) +- == NSS_STATUS_SUCCESS) ++ status = internal_getent (stream, &tmp_result_buf, tmp_buffer.data, ++ tmp_buffer.length, errnop, herrnop, af, ++ flags); ++ /* Enlarge the buffer if necessary. */ ++ if (status == NSS_STATUS_TRYAGAIN && *herrnop == NETDB_INTERNAL ++ && *errnop == ERANGE) + { +- LOOKUP_NAME_CASE (h_name, h_aliases) ++ if (!scratch_buffer_grow (&tmp_buffer)) ++ { ++ *errnop = ENOMEM; ++ /* *herrnop and status already have the right value. */ ++ break; ++ } ++ /* Loop around and retry with a larger buffer. */ + } +- +- if (status == NSS_STATUS_SUCCESS +- && _res_hconf.flags & HCONF_FLAG_MULTI) ++ else if (status == NSS_STATUS_SUCCESS) + { +- /* We have to get all host entries from the file. */ +- size_t tmp_buflen = MIN (buflen, 4096); +- char tmp_buffer_stack[tmp_buflen] +- __attribute__ ((__aligned__ (__alignof__ (struct hostent_data)))); +- char *tmp_buffer = tmp_buffer_stack; +- struct hostent tmp_result_buf; +- int naddrs = 1; +- int naliases = 0; +- char *bufferend; +- bool tmp_buffer_malloced = false; +- +- while (result->h_aliases[naliases] != NULL) +- ++naliases; +- +- bufferend = (char *) &result->h_aliases[naliases + 1]; +- +- again: +- while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer, +- tmp_buflen, errnop, herrnop, af, +- flags)) +- == NSS_STATUS_SUCCESS) ++ /* A line was read. Check that it matches the search ++ criteria. */ ++ ++ int matches = 1; ++ struct hostent *old_result = result; ++ result = &tmp_result_buf; ++ /* The following piece is a bit clumsy but we want to use ++ the `LOOKUP_NAME_CASE' value. The optimizer should do ++ its job. */ ++ do + { +- int matches = 1; +- struct hostent *old_result = result; +- result = &tmp_result_buf; +- /* The following piece is a bit clumsy but we want to use the +- `LOOKUP_NAME_CASE' value. The optimizer should do its +- job. */ +- do +- { +- LOOKUP_NAME_CASE (h_name, h_aliases) +- result = old_result; +- } +- while ((matches = 0)); ++ LOOKUP_NAME_CASE (h_name, h_aliases) ++ result = old_result; ++ } ++ while ((matches = 0)); + +- if (matches) ++ /* If the line matches, we need to copy the addresses and ++ aliases, so that we can reuse tmp_buffer for the next ++ line. */ ++ if (matches) ++ { ++ /* Record the addresses. */ ++ for (size_t i = 0; tmp_result_buf.h_addr_list[i] != NULL; ++i) + { +- /* We could be very clever and try to recycle a few bytes +- in the buffer instead of generating new arrays. But +- we are not doing this here since it's more work than +- it's worth. Simply let the user provide a bit bigger +- buffer. */ +- char **new_h_addr_list; +- char **new_h_aliases; +- int newaliases = 0; +- size_t newstrlen = 0; +- int cnt; +- +- /* Count the new aliases and the length of the strings. */ +- while (tmp_result_buf.h_aliases[newaliases] != NULL) ++ /* Allocate the target space in the output buffer, ++ depending on the address family. */ ++ void *target; ++ if (af == AF_INET) + { +- char *cp = tmp_result_buf.h_aliases[newaliases]; +- ++newaliases; +- newstrlen += strlen (cp) + 1; ++ assert (tmp_result_buf.h_length == 4); ++ target = alloc_buffer_alloc (&outbuf, struct in_addr); + } +- /* If the real name is different add it also to the +- aliases. This means that there is a duplication +- in the alias list but this is really the user's +- problem. */ +- if (strcmp (old_result->h_name, +- tmp_result_buf.h_name) != 0) ++ else if (af == AF_INET6) + { +- ++newaliases; +- newstrlen += strlen (tmp_result_buf.h_name) + 1; ++ assert (tmp_result_buf.h_length == 16); ++ target = alloc_buffer_alloc (&outbuf, struct in6_addr); + } ++ else ++ __builtin_unreachable (); + +- /* Make sure bufferend is aligned. */ +- assert ((bufferend - (char *) 0) % sizeof (char *) == 0); +- +- /* Now we can check whether the buffer is large enough. +- 16 is the maximal size of the IP address. */ +- if (bufferend + 16 + (naddrs + 2) * sizeof (char *) +- + roundup (newstrlen, sizeof (char *)) +- + (naliases + newaliases + 1) * sizeof (char *) +- >= buffer + buflen) ++ if (target == NULL) + { ++ /* Request a larger output buffer. */ + *errnop = ERANGE; + *herrnop = NETDB_INTERNAL; + status = NSS_STATUS_TRYAGAIN; +- goto out; ++ break; + } ++ memcpy (target, tmp_result_buf.h_addr_list[i], ++ tmp_result_buf.h_length); ++ array_add (&addresses, target); ++ } + +- new_h_addr_list = +- (char **) (bufferend +- + roundup (newstrlen, sizeof (char *)) +- + 16); +- new_h_aliases = +- (char **) ((char *) new_h_addr_list +- + (naddrs + 2) * sizeof (char *)); ++ /* Record the aliases. */ ++ for (size_t i = 0; tmp_result_buf.h_aliases[i] != NULL; ++i) ++ { ++ char *alias = tmp_result_buf.h_aliases[i]; ++ array_add (&aliases, ++ alloc_buffer_copy_string (&outbuf, alias)); ++ } + +- /* Copy the old data in the new arrays. */ +- for (cnt = 0; cnt < naddrs; ++cnt) +- new_h_addr_list[cnt] = old_result->h_addr_list[cnt]; ++ /* If the real name is different add, it also to the ++ aliases. This means that there is a duplication in ++ the alias list but this is really the user's ++ problem. */ ++ { ++ char *new_name = tmp_result_buf.h_name; ++ if (strcmp (old_result->h_name, new_name) != 0) ++ array_add (&aliases, ++ alloc_buffer_copy_string (&outbuf, new_name)); ++ } ++ ++ /* Report memory allocation failures during the ++ expansion of the temporary arrays. */ ++ if (array_has_failed (&addresses) || array_has_failed (&aliases)) ++ { ++ *errnop = ENOMEM; ++ *herrnop = NETDB_INTERNAL; ++ status = NSS_STATUS_UNAVAIL; ++ break; ++ } + +- for (cnt = 0; cnt < naliases; ++cnt) +- new_h_aliases[cnt] = old_result->h_aliases[cnt]; ++ /* Request a larger output buffer if we ran out of room. */ ++ if (alloc_buffer_has_failed (&outbuf)) ++ { ++ *errnop = ERANGE; ++ *herrnop = NETDB_INTERNAL; ++ status = NSS_STATUS_TRYAGAIN; ++ break; ++ } + +- /* Store the new strings. */ +- cnt = 0; +- while (tmp_result_buf.h_aliases[cnt] != NULL) +- { +- new_h_aliases[naliases++] = bufferend; +- bufferend = (__stpcpy (bufferend, +- tmp_result_buf.h_aliases[cnt]) +- + 1); +- ++cnt; +- } ++ result = old_result; ++ } /* If match was found. */ + +- if (cnt < newaliases) +- { +- new_h_aliases[naliases++] = bufferend; +- bufferend = __stpcpy (bufferend, +- tmp_result_buf.h_name) + 1; +- } ++ /* If no match is found, loop around and fetch another ++ line. */ + +- /* Final NULL pointer. */ +- new_h_aliases[naliases] = NULL; ++ } /* status == NSS_STATUS_SUCCESS. */ ++ else ++ /* internal_getent returned an error. */ ++ break; ++ } /* while (true) */ + +- /* Round up the buffer end address. */ +- bufferend += (sizeof (char *) +- - ((bufferend - (char *) 0) +- % sizeof (char *))) % sizeof (char *); ++ /* Propagate the NSS_STATUS_TRYAGAIN error to the caller. It means ++ that we may not have loaded the complete result. ++ NSS_STATUS_NOTFOUND, however, means that we reached the end of ++ the file successfully. */ ++ if (status != NSS_STATUS_TRYAGAIN) ++ status = NSS_STATUS_SUCCESS; + +- /* Now the new address. */ +- new_h_addr_list[naddrs++] = +- memcpy (bufferend, tmp_result_buf.h_addr, +- tmp_result_buf.h_length); ++ if (status == NSS_STATUS_SUCCESS) ++ { ++ /* Copy the address and alias arrays into the output buffer and ++ add NULL terminators. The pointed-to elements were directly ++ written into the output buffer above and do not need to be ++ copied again. */ ++ size_t addresses_count = array_size (&addresses); ++ size_t aliases_count = array_size (&aliases); ++ char **out_addresses = alloc_buffer_alloc_array ++ (&outbuf, char *, addresses_count + 1); ++ char **out_aliases = alloc_buffer_alloc_array ++ (&outbuf, char *, aliases_count + 1); ++ if (out_addresses == NULL || out_aliases == NULL) ++ { ++ /* The output buffer is not large enough. */ ++ *errnop = ERANGE; ++ *herrnop = NETDB_INTERNAL; ++ status = NSS_STATUS_TRYAGAIN; ++ /* Fall through to function exit. */ ++ } ++ else ++ { ++ /* Everything is allocated in place. Make the copies and ++ adjust the array pointers. */ ++ memcpy (out_addresses, array_begin (&addresses), ++ addresses_count * sizeof (char *)); ++ out_addresses[addresses_count] = NULL; ++ memcpy (out_aliases, array_begin (&aliases), ++ aliases_count * sizeof (char *)); ++ out_aliases[aliases_count] = NULL; ++ ++ result->h_addr_list = out_addresses; ++ result->h_aliases = out_aliases; + +- /* Also here a final NULL pointer. */ +- new_h_addr_list[naddrs] = NULL; ++ status = NSS_STATUS_SUCCESS; ++ } ++ } + +- /* Store the new array pointers. */ +- old_result->h_aliases = new_h_aliases; +- old_result->h_addr_list = new_h_addr_list; ++ scratch_buffer_free (&tmp_buffer); ++ array_free (&addresses); ++ array_free (&aliases); ++ return status; ++} + +- /* Compute the new buffer end. */ +- bufferend = (char *) &new_h_aliases[naliases + 1]; +- assert (bufferend <= buffer + buflen); ++enum nss_status ++_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result, ++ char *buffer, size_t buflen, int *errnop, ++ int *herrnop, int32_t *ttlp, char **canonp) ++{ ++ FILE *stream = NULL; ++ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data); ++ buffer += pad; ++ buflen = buflen > pad ? buflen - pad : 0; + +- result = old_result; +- } +- } ++ /* Open file. */ ++ enum nss_status status = internal_setent (&stream); + +- if (status == NSS_STATUS_TRYAGAIN) +- { +- size_t newsize = 2 * tmp_buflen; +- if (tmp_buffer_malloced) +- { +- char *newp = realloc (tmp_buffer, newsize); +- if (newp != NULL) +- { +- assert ((((uintptr_t) newp) +- & (__alignof__ (struct hostent_data) - 1)) +- == 0); +- tmp_buffer = newp; +- tmp_buflen = newsize; +- goto again; +- } +- } +- else if (!__libc_use_alloca (buflen + newsize)) +- { +- tmp_buffer = malloc (newsize); +- if (tmp_buffer != NULL) +- { +- assert ((((uintptr_t) tmp_buffer) +- & (__alignof__ (struct hostent_data) - 1)) +- == 0); +- tmp_buffer_malloced = true; +- tmp_buflen = newsize; +- goto again; +- } +- } +- else +- { +- tmp_buffer +- = extend_alloca (tmp_buffer, tmp_buflen, +- newsize +- + __alignof__ (struct hostent_data)); +- tmp_buffer = (char *) (((uintptr_t) tmp_buffer +- + __alignof__ (struct hostent_data) +- - 1) +- & ~(__alignof__ (struct hostent_data) +- - 1)); +- goto again; +- } +- } +- else +- status = NSS_STATUS_SUCCESS; +- out: +- if (tmp_buffer_malloced) +- free (tmp_buffer); ++ if (status == NSS_STATUS_SUCCESS) ++ { ++ /* XXX Is using _res to determine whether we want to convert IPv4 ++ addresses to IPv6 addresses really the right thing to do? */ ++ int flags = (res_use_inet6 () ? AI_V4MAPPED : 0); ++ ++ while ((status = internal_getent (stream, result, buffer, buflen, errnop, ++ herrnop, af, flags)) ++ == NSS_STATUS_SUCCESS) ++ { ++ LOOKUP_NAME_CASE (h_name, h_aliases) + } + ++ if (status == NSS_STATUS_SUCCESS ++ && _res_hconf.flags & HCONF_FLAG_MULTI) ++ status = gethostbyname3_multi ++ (stream, name, af, result, buffer, buflen, errnop, herrnop, flags); ++ + internal_endent (&stream); + } + +diff --git a/nss/tst-nss-files-hosts-erange.c b/nss/tst-nss-files-hosts-erange.c +new file mode 100644 +index 0000000000..beb7aa9fa0 +--- /dev/null ++++ b/nss/tst-nss-files-hosts-erange.c +@@ -0,0 +1,109 @@ ++/* Parse /etc/hosts in multi mode with a trailing long line (bug 21915). ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct support_chroot *chroot_env; ++ ++#define X10 "XXXXXXXXXX" ++#define X100 X10 X10 X10 X10 X10 X10 X10 X10 X10 X10 ++#define X1000 X100 X100 X100 X100 X100 X100 X100 X100 X100 X100 ++ ++static void ++prepare (int argc, char **argv) ++{ ++ chroot_env = support_chroot_create ++ ((struct support_chroot_configuration) ++ { ++ .resolv_conf = "", ++ .hosts = ++ "127.0.0.1 localhost localhost.localdomain\n" ++ "::1 localhost localhost.localdomain\n" ++ "192.0.2.1 example.com\n" ++ "#" X1000 X100 "\n", ++ .host_conf = "multi on\n", ++ }); ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ if (!support_can_chroot ()) ++ return EXIT_UNSUPPORTED; ++ ++ __nss_configure_lookup ("hosts", "files"); ++ if (dlopen (LIBNSS_FILES_SO, RTLD_LAZY) == NULL) ++ FAIL_EXIT1 ("could not load " LIBNSS_DNS_SO ": %s", dlerror ()); ++ ++ xchroot (chroot_env->path_chroot); ++ ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ check_hostent ("gethostbyname example.com", ++ gethostbyname ("example.com"), ++ "name: example.com\n" ++ "address: 192.0.2.1\n"); ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ check_hostent ("gethostbyname2 AF_INET example.com", ++ gethostbyname2 ("example.com", AF_INET), ++ "name: example.com\n" ++ "address: 192.0.2.1\n"); ++ { ++ struct addrinfo hints = ++ { ++ .ai_family = AF_UNSPEC, ++ .ai_socktype = SOCK_STREAM, ++ .ai_protocol = IPPROTO_TCP, ++ }; ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ struct addrinfo *ai; ++ int ret = getaddrinfo ("example.com", "80", &hints, &ai); ++ check_addrinfo ("example.com AF_UNSPEC", ai, ret, ++ "address: STREAM/TCP 192.0.2.1 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ ++ hints.ai_family = AF_INET; ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ ret = getaddrinfo ("example.com", "80", &hints, &ai); ++ check_addrinfo ("example.com AF_INET", ai, ret, ++ "address: STREAM/TCP 192.0.2.1 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ } ++ ++ support_chroot_free (chroot_env); ++ return 0; ++} ++ ++#define PREPARE prepare ++#include +diff --git a/nss/tst-nss-files-hosts-multi.c b/nss/tst-nss-files-hosts-multi.c +new file mode 100644 +index 0000000000..195a19be4f +--- /dev/null ++++ b/nss/tst-nss-files-hosts-multi.c +@@ -0,0 +1,331 @@ ++/* Parse /etc/hosts in multi mode with many addresses/aliases. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct support_chroot *chroot_env; ++ ++static void ++prepare (int argc, char **argv) ++{ ++ chroot_env = support_chroot_create ++ ((struct support_chroot_configuration) ++ { ++ .resolv_conf = "", ++ .hosts = "", /* See write_hosts below. */ ++ .host_conf = "multi on\n", ++ }); ++} ++ ++/* Create the /etc/hosts file from outside the chroot. */ ++static void ++write_hosts (int count) ++{ ++ TEST_VERIFY (count > 0 && count <= 65535); ++ FILE *fp = xfopen (chroot_env->path_hosts, "w"); ++ fputs ("127.0.0.1 localhost localhost.localdomain\n" ++ "::1 localhost localhost.localdomain\n", ++ fp); ++ for (int i = 0; i < count; ++i) ++ { ++ fprintf (fp, "10.4.%d.%d www4.example.com\n", ++ (i / 256) & 0xff, i & 0xff); ++ fprintf (fp, "10.46.%d.%d www.example.com\n", ++ (i / 256) & 0xff, i & 0xff); ++ fprintf (fp, "192.0.2.1 alias.example.com v4-%d.example.com\n", i); ++ fprintf (fp, "2001:db8::6:%x www6.example.com\n", i); ++ fprintf (fp, "2001:db8::46:%x www.example.com\n", i); ++ fprintf (fp, "2001:db8::1 alias.example.com v6-%d.example.com\n", i); ++ } ++ xfclose (fp); ++} ++ ++/* Parameters of a single test. */ ++struct test_params ++{ ++ const char *name; /* Name to query. */ ++ const char *marker; /* Address marker for the name. */ ++ int count; /* Number of addresses/aliases. */ ++ int family; /* AF_INET, AF_INET_6 or AF_UNSPEC. */ ++ bool canonname; /* True if AI_CANONNAME should be enabled. */ ++}; ++ ++/* Expected result of gethostbyname/gethostbyname2. */ ++static char * ++expected_ghbn (const struct test_params *params) ++{ ++ TEST_VERIFY (params->family == AF_INET || params->family == AF_INET6); ++ ++ struct xmemstream expected; ++ xopen_memstream (&expected); ++ if (strcmp (params->name, "alias.example.com") == 0) ++ { ++ fprintf (expected.out, "name: %s\n", params->name); ++ char af; ++ if (params->family == AF_INET) ++ af = '4'; ++ else ++ af = '6'; ++ for (int i = 0; i < params->count; ++i) ++ fprintf (expected.out, "alias: v%c-%d.example.com\n", af, i); ++ ++ for (int i = 0; i < params->count; ++i) ++ if (params->family == AF_INET) ++ fputs ("address: 192.0.2.1\n", expected.out); ++ else ++ fputs ("address: 2001:db8::1\n", expected.out); ++ } ++ else /* www/www4/www6 name. */ ++ { ++ bool do_ipv4 = params->family == AF_INET ++ && strncmp (params->name, "www6", 4) != 0; ++ bool do_ipv6 = params->family == AF_INET6 ++ && strncmp (params->name, "www4", 4) != 0; ++ if (do_ipv4 || do_ipv6) ++ { ++ fprintf (expected.out, "name: %s\n", params->name); ++ if (do_ipv4) ++ for (int i = 0; i < params->count; ++i) ++ fprintf (expected.out, "address: 10.%s.%d.%d\n", ++ params->marker, i / 256, i % 256); ++ if (do_ipv6) ++ for (int i = 0; i < params->count; ++i) ++ fprintf (expected.out, "address: 2001:db8::%s:%x\n", ++ params->marker, i); ++ } ++ else ++ fputs ("error: HOST_NOT_FOUND\n", expected.out); ++ } ++ xfclose_memstream (&expected); ++ return expected.buffer; ++} ++ ++/* Expected result of getaddrinfo. */ ++static char * ++expected_gai (const struct test_params *params) ++{ ++ bool do_ipv4 = false; ++ bool do_ipv6 = false; ++ if (params->family == AF_UNSPEC) ++ do_ipv4 = do_ipv6 = true; ++ else if (params->family == AF_INET) ++ do_ipv4 = true; ++ else if (params->family == AF_INET6) ++ do_ipv6 = true; ++ ++ struct xmemstream expected; ++ xopen_memstream (&expected); ++ if (strcmp (params->name, "alias.example.com") == 0) ++ { ++ if (params->canonname) ++ fprintf (expected.out, ++ "flags: AI_CANONNAME\n" ++ "canonname: %s\n", ++ params->name); ++ ++ if (do_ipv4) ++ for (int i = 0; i < params->count; ++i) ++ fputs ("address: STREAM/TCP 192.0.2.1 80\n", expected.out); ++ if (do_ipv6) ++ for (int i = 0; i < params->count; ++i) ++ fputs ("address: STREAM/TCP 2001:db8::1 80\n", expected.out); ++ } ++ else /* www/www4/www6 name. */ ++ { ++ if (strncmp (params->name, "www4", 4) == 0) ++ do_ipv6 = false; ++ else if (strncmp (params->name, "www6", 4) == 0) ++ do_ipv4 = false; ++ /* Otherwise, we have www as the name, so we do both. */ ++ ++ if (do_ipv4 || do_ipv6) ++ { ++ if (params->canonname) ++ fprintf (expected.out, ++ "flags: AI_CANONNAME\n" ++ "canonname: %s\n", ++ params->name); ++ ++ if (do_ipv4) ++ for (int i = 0; i < params->count; ++i) ++ fprintf (expected.out, "address: STREAM/TCP 10.%s.%d.%d 80\n", ++ params->marker, i / 256, i % 256); ++ if (do_ipv6) ++ for (int i = 0; i < params->count; ++i) ++ fprintf (expected.out, ++ "address: STREAM/TCP 2001:db8::%s:%x 80\n", ++ params->marker, i); ++ } ++ else ++ fputs ("error: Name or service not known\n", expected.out); ++ } ++ xfclose_memstream (&expected); ++ return expected.buffer; ++} ++ ++static void ++run_gbhn_gai (struct test_params *params) ++{ ++ char *ctx = xasprintf ("name=%s marker=%s count=%d family=%d", ++ params->name, params->marker, params->count, ++ params->family); ++ if (test_verbose > 0) ++ printf ("info: %s\n", ctx); ++ ++ /* Check gethostbyname, gethostbyname2. */ ++ if (params->family == AF_INET) ++ { ++ char *expected = expected_ghbn (params); ++ check_hostent (ctx, gethostbyname (params->name), expected); ++ free (expected); ++ } ++ if (params->family != AF_UNSPEC) ++ { ++ char *expected = expected_ghbn (params); ++ check_hostent (ctx, gethostbyname2 (params->name, params->family), ++ expected); ++ free (expected); ++ } ++ ++ /* Check getaddrinfo. */ ++ for (int do_canonical = 0; do_canonical < 2; ++do_canonical) ++ { ++ params->canonname = do_canonical; ++ char *expected = expected_gai (params); ++ struct addrinfo hints = ++ { ++ .ai_family = params->family, ++ .ai_socktype = SOCK_STREAM, ++ .ai_protocol = IPPROTO_TCP, ++ }; ++ if (do_canonical) ++ hints.ai_flags |= AI_CANONNAME; ++ struct addrinfo *ai; ++ int ret = getaddrinfo (params->name, "80", &hints, &ai); ++ check_addrinfo (ctx, ai, ret, expected); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ free (expected); ++ } ++ ++ free (ctx); ++} ++ ++/* Callback for the subprocess which runs the test in a chroot. */ ++static void ++subprocess (void *closure) ++{ ++ struct test_params *params = closure; ++ ++ xchroot (chroot_env->path_chroot); ++ ++ static const int families[] = { AF_INET, AF_INET6, AF_UNSPEC, -1 }; ++ static const char *const names[] = ++ { ++ "www.example.com", "www4.example.com", "www6.example.com", ++ "alias.example.com", ++ NULL ++ }; ++ static const char *const names_marker[] = { "46", "4", "6", "" }; ++ ++ for (int family_idx = 0; families[family_idx] >= 0; ++family_idx) ++ { ++ params->family = families[family_idx]; ++ for (int names_idx = 0; names[names_idx] != NULL; ++names_idx) ++ { ++ params->name = names[names_idx]; ++ params->marker = names_marker[names_idx]; ++ run_gbhn_gai (params); ++ } ++ } ++} ++ ++/* Run the test for a specific number of addresses/aliases. */ ++static void ++run_test (int count) ++{ ++ write_hosts (count); ++ ++ struct test_params params = ++ { ++ .count = count, ++ }; ++ ++ support_isolate_in_subprocess (subprocess, ¶ms); ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ if (!support_can_chroot ()) ++ return EXIT_UNSUPPORTED; ++ ++ /* This test should not use gigabytes of memory. */ ++ { ++ struct rlimit limit; ++ if (getrlimit (RLIMIT_AS, &limit) != 0) ++ { ++ printf ("getrlimit (RLIMIT_AS) failed: %m\n"); ++ return 1; ++ } ++ long target = 200 * 1024 * 1024; ++ if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target) ++ { ++ limit.rlim_cur = target; ++ if (setrlimit (RLIMIT_AS, &limit) != 0) ++ { ++ printf ("setrlimit (RLIMIT_AS) failed: %m\n"); ++ return 1; ++ } ++ } ++ } ++ ++ __nss_configure_lookup ("hosts", "files"); ++ if (dlopen (LIBNSS_FILES_SO, RTLD_LAZY) == NULL) ++ FAIL_EXIT1 ("could not load " LIBNSS_DNS_SO ": %s", dlerror ()); ++ ++ /* Run the tests with a few different address/alias counts. */ ++ for (int count = 1; count <= 111; ++count) ++ run_test (count); ++ run_test (1111); ++ run_test (22222); ++ ++ support_chroot_free (chroot_env); ++ return 0; ++} ++ ++#define PREPARE prepare ++#include +diff --git a/po/fr.po b/po/fr.po +index 5a79695125..6764655d25 100644 +--- a/po/fr.po ++++ b/po/fr.po +@@ -5920,7 +5920,7 @@ msgstr "Le fichier existe" + #. TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}). + #: sysdeps/gnu/errlist.c:211 + msgid "Invalid cross-device link" +-msgstr "Lien croisé de périphéque invalide" ++msgstr "Lien physique inter-périphérique invalide" + + #. TRANS The wrong type of device was given to a function that expects a + #. TRANS particular sort of device. +diff --git a/po/sv.po b/po/sv.po +index 0ebfec5b7f..d10bfad482 100644 +--- a/po/sv.po ++++ b/po/sv.po +@@ -5,12 +5,12 @@ + # Jan Djärv , 1996, 1998, 2001, 2002, 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015. + # Göran Uddeborg , 2016, 2017. + # +-# $Revision: 1.7 $ ++# $Revision: 1.10 $ + msgid "" + msgstr "" +-"Project-Id-Version: libc 2.25-pre1\n" +-"POT-Creation-Date: 2017-01-11 17:27+0530\n" +-"PO-Revision-Date: 2017-05-30 12:14+0200\n" ++"Project-Id-Version: libc 2.25.90\n" ++"POT-Creation-Date: 2017-07-25 12:32+0530\n" ++"PO-Revision-Date: 2017-08-20 18:21+0200\n" + "Last-Translator: Göran Uddeborg \n" + "Language-Team: Swedish \n" + "Language: sv\n" +@@ -478,19 +478,19 @@ msgstr "FEL I DYNAMISK LÄNKARE!!!" + msgid "error while loading shared libraries" + msgstr "fel när delade bibliotek laddades" + +-#: elf/dl-fptr.c:88 sysdeps/hppa/dl-fptr.c:94 ++#: elf/dl-fptr.c:88 sysdeps/hppa/dl-fptr.c:95 + msgid "cannot map pages for fdesc table" + msgstr "kan inte minnesmappa sidor för fdesc-tabell" + +-#: elf/dl-fptr.c:192 sysdeps/hppa/dl-fptr.c:207 ++#: elf/dl-fptr.c:192 sysdeps/hppa/dl-fptr.c:213 + msgid "cannot map pages for fptr table" + msgstr "kan inte minnesmappa sidor för fptr-tabell" + +-#: elf/dl-fptr.c:221 sysdeps/hppa/dl-fptr.c:236 ++#: elf/dl-fptr.c:221 sysdeps/hppa/dl-fptr.c:242 + msgid "internal error: symidx out of range of fptr table" + msgstr "internt fel: symidx är utanför intervallet för fptr-tabellen" + +-#: elf/dl-hwcaps.c:184 elf/dl-hwcaps.c:196 ++#: elf/dl-hwcaps.c:191 elf/dl-hwcaps.c:203 + msgid "cannot create capability list" + msgstr "kan inte skapa egenskapslista" + +@@ -670,20 +670,20 @@ msgstr "ogiltig målnamnrymd för dlmopen()" + msgid "cannot allocate memory in static TLS block" + msgstr "kan inte allokera minne i statiskt TLS-block" + +-#: elf/dl-reloc.c:212 ++#: elf/dl-reloc.c:206 + msgid "cannot make segment writable for relocation" + msgstr "kan inte göra segment skrivbart för relokering" + +-#: elf/dl-reloc.c:283 ++#: elf/dl-reloc.c:277 + #, c-format + msgid "%s: out of memory to store relocation results for %s\n" + msgstr "%s: slut på minne för att lagra relokeringsresultat för %s\n" + +-#: elf/dl-reloc.c:299 ++#: elf/dl-reloc.c:293 + msgid "cannot restore segment prot after reloc" + msgstr "kan inte återställa segmenträttigheter efter relokering" + +-#: elf/dl-reloc.c:330 ++#: elf/dl-reloc.c:324 + msgid "cannot apply additional memory protection after relocation" + msgstr "kan inte applicera extra minnesskydd efter relokering" + +@@ -959,14 +959,14 @@ msgstr "Försök med \"ldd --help\" för mer information." + msgid "missing file arguments" + msgstr "filargument saknas" + +-#. TRANS No such file or directory. This is a ``file doesn't exist'' error ++#. TRANS This is a ``file doesn't exist'' error + #. TRANS for ordinary files that are referenced in contexts where they are + #. TRANS expected to already exist. + #: elf/ldd.bash.in:147 sysdeps/gnu/errlist.c:37 + msgid "No such file or directory" + msgstr "Filen eller katalogen finns inte" + +-#: elf/ldd.bash.in:150 inet/rcmd.c:475 ++#: elf/ldd.bash.in:150 inet/rcmd.c:480 + msgid "not regular file" + msgstr "inte en normal fil" + +@@ -1540,68 +1540,68 @@ msgstr "vid insättning i sökträd" + msgid "cannot generate output file" + msgstr "kan inte generera utfil" + +-#: inet/rcmd.c:155 ++#: inet/rcmd.c:157 + msgid "rcmd: Cannot allocate memory\n" + msgstr "rcmd: Kan inte allokera minne\n" + +-#: inet/rcmd.c:170 ++#: inet/rcmd.c:174 + msgid "rcmd: socket: All ports in use\n" + msgstr "rcmd: uttag (socket): Alla portar används\n" + +-#: inet/rcmd.c:198 ++#: inet/rcmd.c:202 + #, c-format + msgid "connect to address %s: " + msgstr "anslut till adress %s: " + +-#: inet/rcmd.c:211 ++#: inet/rcmd.c:215 + #, c-format + msgid "Trying %s...\n" + msgstr "Provar %s...\n" + +-#: inet/rcmd.c:247 ++#: inet/rcmd.c:251 + #, c-format + msgid "rcmd: write (setting up stderr): %m\n" + msgstr "rcmd: write: (sätter upp standard fel): %m\n" + +-#: inet/rcmd.c:263 ++#: inet/rcmd.c:267 + #, c-format + msgid "rcmd: poll (setting up stderr): %m\n" + msgstr "rcmd: poll (sätter upp standard fel): %m\n" + +-#: inet/rcmd.c:266 ++#: inet/rcmd.c:270 + msgid "poll: protocol failure in circuit setup\n" + msgstr "poll: protokollfel i förbindelseuppsättning\n" + +-#: inet/rcmd.c:298 ++#: inet/rcmd.c:302 + msgid "socket: protocol failure in circuit setup\n" + msgstr "uttag (socket): protokollfel i förbindelseuppsättning\n" + +-#: inet/rcmd.c:322 ++#: inet/rcmd.c:326 + #, c-format + msgid "rcmd: %s: short read" + msgstr "rcmd: %s: läsning gav för lite data" + +-#: inet/rcmd.c:473 ++#: inet/rcmd.c:478 + msgid "lstat failed" + msgstr "misslyckades ta status (lstat)" + +-#: inet/rcmd.c:480 ++#: inet/rcmd.c:485 + msgid "cannot open" + msgstr "kan inte öppna" + +-#: inet/rcmd.c:482 ++#: inet/rcmd.c:487 + msgid "fstat failed" + msgstr "misslyckades ta status (fstat)" + +-#: inet/rcmd.c:484 ++#: inet/rcmd.c:489 + msgid "bad owner" + msgstr "felaktig ägare" + +-#: inet/rcmd.c:486 ++#: inet/rcmd.c:491 + msgid "writeable by other than owner" + msgstr "skrivbar för andra än ägaren" + +-#: inet/rcmd.c:488 ++#: inet/rcmd.c:493 + msgid "hard linked somewhere" + msgstr "hårdlänkad någonstans" + +@@ -3143,7 +3143,7 @@ msgstr "Okänt systemfel" + msgid "unable to free arguments" + msgstr "kan inte avallokera argument" + +-#: nis/nis_error.h:1 nis/ypclnt.c:817 nis/ypclnt.c:905 posix/regcomp.c:137 ++#: nis/nis_error.h:1 nis/ypclnt.c:824 nis/ypclnt.c:913 posix/regcomp.c:137 + #: sysdeps/gnu/errlist.c:21 + msgid "Success" + msgstr "Lyckat" +@@ -3184,8 +3184,8 @@ msgstr "Generiskt systemfel" + msgid "First/next chain broken" + msgstr "Första/Nästa-kedja bruten" + +-#. TRANS Permission denied; the file permissions do not allow the attempted operation. +-#: nis/nis_error.h:11 nis/ypclnt.c:862 sysdeps/gnu/errlist.c:158 ++#. TRANS The file permissions do not allow the attempted operation. ++#: nis/nis_error.h:11 nis/ypclnt.c:869 sysdeps/gnu/errlist.c:158 + msgid "Permission denied" + msgstr "Åtkomst nekas" + +@@ -3337,128 +3337,128 @@ msgstr "Kan inte skapa process hos server" + msgid "Master server busy, full dump rescheduled." + msgstr "Huvudserver är upptagen, full dump åter schemalagd." + +-#: nis/nis_local_names.c:121 ++#: nis/nis_local_names.c:122 + #, c-format + msgid "LOCAL entry for UID %d in directory %s not unique\n" + msgstr "LOCAL-post för UID %d i katalog %s är inte unik\n" + +-#: nis/nis_print.c:51 ++#: nis/nis_print.c:52 + msgid "UNKNOWN" + msgstr "OKÄND" + +-#: nis/nis_print.c:109 ++#: nis/nis_print.c:110 + msgid "BOGUS OBJECT\n" + msgstr "SKENOBJEKT\n" + +-#: nis/nis_print.c:112 ++#: nis/nis_print.c:113 + msgid "NO OBJECT\n" + msgstr "INGET OBJEKT\n" + +-#: nis/nis_print.c:115 ++#: nis/nis_print.c:116 + msgid "DIRECTORY\n" + msgstr "KATALOG\n" + +-#: nis/nis_print.c:118 ++#: nis/nis_print.c:119 + msgid "GROUP\n" + msgstr "GRUPP\n" + +-#: nis/nis_print.c:121 ++#: nis/nis_print.c:122 + msgid "TABLE\n" + msgstr "TABELL\n" + +-#: nis/nis_print.c:124 ++#: nis/nis_print.c:125 + msgid "ENTRY\n" + msgstr "POST\n" + +-#: nis/nis_print.c:127 ++#: nis/nis_print.c:128 + msgid "LINK\n" + msgstr "LÄNK\n" + +-#: nis/nis_print.c:130 ++#: nis/nis_print.c:131 + msgid "PRIVATE\n" + msgstr "PRIVAT\n" + +-#: nis/nis_print.c:133 ++#: nis/nis_print.c:134 + msgid "(Unknown object)\n" + msgstr "(Okänt objekt)\n" + +-#: nis/nis_print.c:167 ++#: nis/nis_print.c:168 + #, c-format + msgid "Name : `%s'\n" + msgstr "Namn: \"%s\"\n" + +-#: nis/nis_print.c:168 ++#: nis/nis_print.c:169 + #, c-format + msgid "Type : %s\n" + msgstr "Typ: %s\n" + +-#: nis/nis_print.c:173 ++#: nis/nis_print.c:174 + msgid "Master Server :\n" + msgstr "Huvudserver:\n" + +-#: nis/nis_print.c:175 ++#: nis/nis_print.c:176 + msgid "Replicate :\n" + msgstr "Replikera:\n" + +-#: nis/nis_print.c:176 ++#: nis/nis_print.c:177 + #, c-format + msgid "\tName : %s\n" + msgstr "\tNamn : %s\n" + +-#: nis/nis_print.c:177 ++#: nis/nis_print.c:178 + msgid "\tPublic Key : " + msgstr "\tPublik nyckel: " + +-#: nis/nis_print.c:181 ++#: nis/nis_print.c:182 + msgid "None.\n" + msgstr "Ingen.\n" + +-#: nis/nis_print.c:184 ++#: nis/nis_print.c:185 + #, c-format + msgid "Diffie-Hellmann (%d bits)\n" + msgstr "Diffie-Hellmann (%d bitar)\n" + +-#: nis/nis_print.c:189 ++#: nis/nis_print.c:190 + #, c-format + msgid "RSA (%d bits)\n" + msgstr "RSA (%d bitar)\n" + +-#: nis/nis_print.c:192 ++#: nis/nis_print.c:193 + msgid "Kerberos.\n" + msgstr "Kerberos.\n" + +-#: nis/nis_print.c:195 ++#: nis/nis_print.c:196 + #, c-format + msgid "Unknown (type = %d, bits = %d)\n" + msgstr "Okänd (typ = %d, bitar = %d)\n" + +-#: nis/nis_print.c:206 ++#: nis/nis_print.c:207 + #, c-format + msgid "\tUniversal addresses (%u)\n" + msgstr "\tUniversella adresser (%u)\n" + +-#: nis/nis_print.c:228 ++#: nis/nis_print.c:229 + msgid "Time to live : " + msgstr "Livslängd: " + +-#: nis/nis_print.c:230 ++#: nis/nis_print.c:231 + msgid "Default Access rights :\n" + msgstr "Standard åtkomsträttigheter:\n" + +-#: nis/nis_print.c:239 ++#: nis/nis_print.c:240 + #, c-format + msgid "\tType : %s\n" + msgstr "\tTyp : %s\n" + +-#: nis/nis_print.c:240 ++#: nis/nis_print.c:241 + msgid "\tAccess rights: " + msgstr "\tRättigheter : " + +-#: nis/nis_print.c:254 ++#: nis/nis_print.c:255 + msgid "Group Flags :" + msgstr "Gruppflaggor: " + +-#: nis/nis_print.c:257 ++#: nis/nis_print.c:258 + msgid "" + "\n" + "Group Members :\n" +@@ -3466,95 +3466,95 @@ msgstr "" + "\n" + "Gruppmedlemmar:\n" + +-#: nis/nis_print.c:269 ++#: nis/nis_print.c:270 + #, c-format + msgid "Table Type : %s\n" + msgstr "Tabelltyp : %s\n" + +-#: nis/nis_print.c:270 ++#: nis/nis_print.c:271 + #, c-format + msgid "Number of Columns : %d\n" + msgstr "Antal kolumner : %d\n" + +-#: nis/nis_print.c:271 ++#: nis/nis_print.c:272 + #, c-format + msgid "Character Separator : %c\n" + msgstr "Teckenseparator : %c\n" + +-#: nis/nis_print.c:272 ++#: nis/nis_print.c:273 + #, c-format + msgid "Search Path : %s\n" + msgstr "Sökväg : %s\n" + +-#: nis/nis_print.c:273 ++#: nis/nis_print.c:274 + msgid "Columns :\n" + msgstr "Kolumner :\n" + +-#: nis/nis_print.c:276 ++#: nis/nis_print.c:277 + #, c-format + msgid "\t[%d]\tName : %s\n" + msgstr "\t[%d]\tNamn : %s\n" + +-#: nis/nis_print.c:278 ++#: nis/nis_print.c:279 + msgid "\t\tAttributes : " + msgstr "\t\tAttribut : " + +-#: nis/nis_print.c:280 ++#: nis/nis_print.c:281 + msgid "\t\tAccess Rights : " + msgstr "\t\tRättigheter : " + +-#: nis/nis_print.c:290 ++#: nis/nis_print.c:291 + msgid "Linked Object Type : " + msgstr "Länkad objekttyp : " + +-#: nis/nis_print.c:292 ++#: nis/nis_print.c:293 + #, c-format + msgid "Linked to : %s\n" + msgstr "Länkad till: %s\n" + +-#: nis/nis_print.c:302 ++#: nis/nis_print.c:303 + #, c-format + msgid "\tEntry data of type %s\n" + msgstr "\tPostdata av typ %s\n" + +-#: nis/nis_print.c:305 ++#: nis/nis_print.c:306 + #, c-format + msgid "\t[%u] - [%u bytes] " + msgstr "\t[%u] - [%u byte] " + +-#: nis/nis_print.c:308 ++#: nis/nis_print.c:309 + msgid "Encrypted data\n" + msgstr "Krypterat data\n" + +-#: nis/nis_print.c:310 ++#: nis/nis_print.c:311 + msgid "Binary data\n" + msgstr "Binärdata\n" + +-#: nis/nis_print.c:326 ++#: nis/nis_print.c:327 + #, c-format + msgid "Object Name : %s\n" + msgstr "Objektnamn : %s\n" + +-#: nis/nis_print.c:327 ++#: nis/nis_print.c:328 + #, c-format + msgid "Directory : %s\n" + msgstr "Katalog : %s\n" + +-#: nis/nis_print.c:328 ++#: nis/nis_print.c:329 + #, c-format + msgid "Owner : %s\n" + msgstr "Ägare : %s\n" + +-#: nis/nis_print.c:329 ++#: nis/nis_print.c:330 + #, c-format + msgid "Group : %s\n" + msgstr "Grupp : %s\n" + +-#: nis/nis_print.c:330 ++#: nis/nis_print.c:331 + msgid "Access Rights : " + msgstr "Rättigheter : " + +-#: nis/nis_print.c:332 ++#: nis/nis_print.c:333 + #, c-format + msgid "" + "\n" +@@ -3563,90 +3563,90 @@ msgstr "" + "\n" + "Livslängd : " + +-#: nis/nis_print.c:335 ++#: nis/nis_print.c:336 + #, c-format + msgid "Creation Time : %s" + msgstr "Skapad : %s" + +-#: nis/nis_print.c:337 ++#: nis/nis_print.c:338 + #, c-format + msgid "Mod. Time : %s" + msgstr "Ändr. tid : %s" + +-#: nis/nis_print.c:338 ++#: nis/nis_print.c:339 + msgid "Object Type : " + msgstr "Objekttyp : " + +-#: nis/nis_print.c:358 ++#: nis/nis_print.c:359 + #, c-format + msgid " Data Length = %u\n" + msgstr " Datalängd = %u\n" + +-#: nis/nis_print.c:372 ++#: nis/nis_print.c:373 + #, c-format + msgid "Status : %s\n" + msgstr "Status : %s\n" + +-#: nis/nis_print.c:373 ++#: nis/nis_print.c:374 + #, c-format + msgid "Number of objects : %u\n" + msgstr "Antal objekt : %u\n" + +-#: nis/nis_print.c:377 ++#: nis/nis_print.c:378 + #, c-format + msgid "Object #%d:\n" + msgstr "Objekt nr %d:\n" + +-#: nis/nis_print_group_entry.c:116 ++#: nis/nis_print_group_entry.c:117 + #, c-format + msgid "Group entry for \"%s.%s\" group:\n" + msgstr "Gruppost för \"%s.%s\" grupp:\n" + +-#: nis/nis_print_group_entry.c:124 ++#: nis/nis_print_group_entry.c:125 + msgid " Explicit members:\n" + msgstr " Explicita medlemmar:\n" + +-#: nis/nis_print_group_entry.c:129 ++#: nis/nis_print_group_entry.c:130 + msgid " No explicit members\n" + msgstr " Inga explicita medlemmar\n" + +-#: nis/nis_print_group_entry.c:132 ++#: nis/nis_print_group_entry.c:133 + msgid " Implicit members:\n" + msgstr " Implicita medlemmar:\n" + +-#: nis/nis_print_group_entry.c:137 ++#: nis/nis_print_group_entry.c:138 + msgid " No implicit members\n" + msgstr " Inga implicita medlemmar\n" + +-#: nis/nis_print_group_entry.c:140 ++#: nis/nis_print_group_entry.c:141 + msgid " Recursive members:\n" + msgstr " Rekursiva medlemmar:\n" + +-#: nis/nis_print_group_entry.c:145 ++#: nis/nis_print_group_entry.c:146 + msgid " No recursive members\n" + msgstr " Inga rekursiva medlemmar\n" + +-#: nis/nis_print_group_entry.c:148 ++#: nis/nis_print_group_entry.c:149 + msgid " Explicit nonmembers:\n" + msgstr " Explicita icke-medlemmar:\n" + +-#: nis/nis_print_group_entry.c:153 ++#: nis/nis_print_group_entry.c:154 + msgid " No explicit nonmembers\n" + msgstr " Inga explicita icke-medlemmar\n" + +-#: nis/nis_print_group_entry.c:156 ++#: nis/nis_print_group_entry.c:157 + msgid " Implicit nonmembers:\n" + msgstr " Implicita icke-medlemmar:\n" + +-#: nis/nis_print_group_entry.c:161 ++#: nis/nis_print_group_entry.c:162 + msgid " No implicit nonmembers\n" + msgstr " Inga implicita icke-medlemmar\n" + +-#: nis/nis_print_group_entry.c:164 ++#: nis/nis_print_group_entry.c:165 + msgid " Recursive nonmembers:\n" + msgstr " Rekursiva icke-medlemmar:\n" + +-#: nis/nis_print_group_entry.c:169 ++#: nis/nis_print_group_entry.c:170 + msgid " No recursive nonmembers\n" + msgstr " Inga rekursiva icke-medlemmar\n" + +@@ -3688,100 +3688,100 @@ msgstr "netname2user: LOCAL-post för %s i katalog %s är inte unik" + msgid "netname2user: should not have uid 0" + msgstr "netname2user: borde inte ha uid 0" + +-#: nis/ypclnt.c:820 ++#: nis/ypclnt.c:827 + msgid "Request arguments bad" + msgstr "Argument för förfrågan felaktiga" + +-#: nis/ypclnt.c:823 ++#: nis/ypclnt.c:830 + msgid "RPC failure on NIS operation" + msgstr "RPC-fel vid NIS-operation" + +-#: nis/ypclnt.c:826 ++#: nis/ypclnt.c:833 + msgid "Can't bind to server which serves this domain" + msgstr "Kan inte ansluta till servern som betjänar denna domän" + +-#: nis/ypclnt.c:829 ++#: nis/ypclnt.c:836 + msgid "No such map in server's domain" + msgstr "Ingen sådan tabell i serverns domän" + +-#: nis/ypclnt.c:832 ++#: nis/ypclnt.c:839 + msgid "No such key in map" + msgstr "Ingen sådan nyckel i tabellen" + +-#: nis/ypclnt.c:835 ++#: nis/ypclnt.c:842 + msgid "Internal NIS error" + msgstr "Internt NIS-fel" + +-#: nis/ypclnt.c:838 ++#: nis/ypclnt.c:845 + msgid "Local resource allocation failure" + msgstr "Allokeringsfel för lokal resurs" + +-#: nis/ypclnt.c:841 ++#: nis/ypclnt.c:848 + msgid "No more records in map database" + msgstr "Inga fler poster i tabelldatabasen" + +-#: nis/ypclnt.c:844 ++#: nis/ypclnt.c:851 + msgid "Can't communicate with portmapper" + msgstr "Kan inte kommunicera med portmapper" + +-#: nis/ypclnt.c:847 ++#: nis/ypclnt.c:854 + msgid "Can't communicate with ypbind" + msgstr "Kan inte kommunicera med ypbind" + +-#: nis/ypclnt.c:850 ++#: nis/ypclnt.c:857 + msgid "Can't communicate with ypserv" + msgstr "Kan inte kommunicera med ypserv" + +-#: nis/ypclnt.c:853 ++#: nis/ypclnt.c:860 + msgid "Local domain name not set" + msgstr "Lokalt domännamn inte satt" + +-#: nis/ypclnt.c:856 ++#: nis/ypclnt.c:863 + msgid "NIS map database is bad" + msgstr "NIS tabelldatabas är felaktig" + +-#: nis/ypclnt.c:859 ++#: nis/ypclnt.c:866 + msgid "NIS client/server version mismatch - can't supply service" + msgstr "NIS versionsskillnad klient/server - kan inte betjäna" + +-#: nis/ypclnt.c:865 ++#: nis/ypclnt.c:872 + msgid "Database is busy" + msgstr "Databasen är upptagen" + +-#: nis/ypclnt.c:868 ++#: nis/ypclnt.c:875 + msgid "Unknown NIS error code" + msgstr "Okänd NIS-felkod" + +-#: nis/ypclnt.c:908 ++#: nis/ypclnt.c:916 + msgid "Internal ypbind error" + msgstr "Internt ypbind-fel" + +-#: nis/ypclnt.c:911 ++#: nis/ypclnt.c:919 + msgid "Domain not bound" + msgstr "Domän inte bunden" + +-#: nis/ypclnt.c:914 ++#: nis/ypclnt.c:922 + msgid "System resource allocation failure" + msgstr "Allokeringsfel för systemresurs" + +-#: nis/ypclnt.c:917 ++#: nis/ypclnt.c:925 + msgid "Unknown ypbind error" + msgstr "Okänt ypbind-fel" + +-#: nis/ypclnt.c:958 ++#: nis/ypclnt.c:966 + msgid "yp_update: cannot convert host to netname\n" + msgstr "yp_update: kan inte omvandla värd till nätnamn\n" + +-#: nis/ypclnt.c:976 ++#: nis/ypclnt.c:984 + msgid "yp_update: cannot get server address\n" + msgstr "yp_update: kan inte hämta serveradress\n" + +-#: nscd/aicache.c:84 nscd/hstcache.c:485 ++#: nscd/aicache.c:85 nscd/hstcache.c:485 + #, c-format + msgid "Haven't found \"%s\" in hosts cache!" + msgstr "Hittar inte \"%s\" i värdcache!" + +-#: nscd/aicache.c:86 nscd/hstcache.c:487 ++#: nscd/aicache.c:87 nscd/hstcache.c:487 + #, c-format + msgid "Reloading \"%s\" in hosts cache!" + msgstr "Omladdar \"%s\" i värdcache!" +@@ -3815,269 +3815,264 @@ msgstr "beskär %s cache; tid %ld" + msgid "considering %s entry \"%s\", timeout %" + msgstr "överväger %s-post \"%s\", tidsgräns %" + +-#: nscd/connections.c:548 ++#: nscd/connections.c:537 + #, c-format + msgid "invalid persistent database file \"%s\": %s" + msgstr "ogiltig persistent databasfil \"%s\": %s" + +-#: nscd/connections.c:556 ++#: nscd/connections.c:545 + msgid "uninitialized header" + msgstr "oinitierat huvud" + +-#: nscd/connections.c:561 ++#: nscd/connections.c:550 + msgid "header size does not match" + msgstr "huvudstorlek stämmer inte" + +-#: nscd/connections.c:571 ++#: nscd/connections.c:560 + msgid "file size does not match" + msgstr "filstorlek stämmer inte" + +-#: nscd/connections.c:588 ++#: nscd/connections.c:577 + msgid "verification failed" + msgstr "verifikation misslyckades" + +-#: nscd/connections.c:602 ++#: nscd/connections.c:591 + #, c-format + msgid "suggested size of table for database %s larger than the persistent database's table" + msgstr "föreslagen storlek på tabellen för databas %s är större än den persistenta databasens tabell" + +-#: nscd/connections.c:613 nscd/connections.c:697 ++#: nscd/connections.c:602 nscd/connections.c:686 + #, c-format + msgid "cannot create read-only descriptor for \"%s\"; no mmap" + msgstr "kan inte skapa läsbar filidentifierare för \"%s\", ingen mmap" + +-#: nscd/connections.c:629 ++#: nscd/connections.c:618 + #, c-format + msgid "cannot access '%s'" + msgstr "kan inte komma åt \"%s\"" + +-#: nscd/connections.c:677 ++#: nscd/connections.c:666 + #, c-format + msgid "database for %s corrupted or simultaneously used; remove %s manually if necessary and restart" + msgstr "databas för %s korrupt eller använd av flera samtidigt; ta bort %s manuellt om det behövs och starta om" + +-#: nscd/connections.c:683 ++#: nscd/connections.c:672 + #, c-format + msgid "cannot create %s; no persistent database used" + msgstr "kan inte skapa %s; ingen persistent databas används" + +-#: nscd/connections.c:686 ++#: nscd/connections.c:675 + #, c-format + msgid "cannot create %s; no sharing possible" + msgstr "kan inte skapa %s; ingen delning möjlig" + +-#: nscd/connections.c:757 ++#: nscd/connections.c:746 + #, c-format + msgid "cannot write to database file %s: %s" + msgstr "kan inte skriva till databasfil %s: %s" + +-#: nscd/connections.c:796 +-#, c-format +-msgid "cannot set socket to close on exec: %s; disabling paranoia mode" +-msgstr "kan inte sätta uttag (socket) att stängas vid programstart: %s; kopplar ur paranoialäge" +- +-#: nscd/connections.c:831 ++#: nscd/connections.c:802 + #, c-format + msgid "cannot open socket: %s" + msgstr "kan inte öppna uttag (socket): %s" + +-#: nscd/connections.c:850 ++#: nscd/connections.c:821 + #, c-format + msgid "cannot enable socket to accept connections: %s" + msgstr "kan inte få uttag (socket) att acceptera förbindelser: %s" + +-#: nscd/connections.c:907 ++#: nscd/connections.c:878 + #, c-format + msgid "disabled inotify-based monitoring for file `%s': %s" + msgstr "avaktiverade inotify-baserad övervakning för filen ”%s”: %s" + +-#: nscd/connections.c:911 ++#: nscd/connections.c:882 + #, c-format + msgid "monitoring file `%s` (%d)" + msgstr "övervakar filen ”%s” (%d)" + +-#: nscd/connections.c:924 ++#: nscd/connections.c:895 + #, c-format + msgid "disabled inotify-based monitoring for directory `%s': %s" + msgstr "avaktiverade inotify-baserad övervakning av katalogen ”%s”: %s" + +-#: nscd/connections.c:928 ++#: nscd/connections.c:899 + #, c-format + msgid "monitoring directory `%s` (%d)" + msgstr "övervakar katalogen ”%s” (%d)" + +-#: nscd/connections.c:956 ++#: nscd/connections.c:927 + #, c-format + msgid "monitoring file %s for database %s" + msgstr "övervakar filen %s för databas %s" + +-#: nscd/connections.c:966 ++#: nscd/connections.c:937 + #, c-format + msgid "stat failed for file `%s'; will try again later: %s" + msgstr "stat misslyckades för filen ”%s”; kommer försöka igen senare: %s" + +-#: nscd/connections.c:1085 ++#: nscd/connections.c:1056 + #, c-format + msgid "provide access to FD %d, for %s" + msgstr "ge åtkomst till FD %d, för %s" + +-#: nscd/connections.c:1097 ++#: nscd/connections.c:1068 + #, c-format + msgid "cannot handle old request version %d; current version is %d" + msgstr "kan inte hantera äldre förfrågansversion %d, nuvarande version är %d" + +-#: nscd/connections.c:1119 ++#: nscd/connections.c:1090 + #, c-format + msgid "request from %ld not handled due to missing permission" + msgstr "begäran från %ld inte hanterad för att rättigheter saknas" + +-#: nscd/connections.c:1124 ++#: nscd/connections.c:1095 + #, c-format + msgid "request from '%s' [%ld] not handled due to missing permission" + msgstr "begäran från \"%s\" [%ld] inte hanterad för att rättigheter saknas" + +-#: nscd/connections.c:1129 ++#: nscd/connections.c:1100 + msgid "request not handled due to missing permission" + msgstr "begäran inte hanterad för att rättigheter saknas" + +-#: nscd/connections.c:1167 nscd/connections.c:1220 ++#: nscd/connections.c:1138 nscd/connections.c:1191 + #, c-format + msgid "cannot write result: %s" + msgstr "kan inte skriva resultat: %s" + +-#: nscd/connections.c:1311 ++#: nscd/connections.c:1282 + #, c-format + msgid "error getting caller's id: %s" + msgstr "kunde inte hämta anropandes identitet: %s" + +-#: nscd/connections.c:1371 ++#: nscd/connections.c:1342 + #, c-format + msgid "cannot open /proc/self/cmdline: %s; disabling paranoia mode" + msgstr "kan inte öppna /proc/slef/cmdline: %s, kopplar ur paranoialäge" + +-#: nscd/connections.c:1385 ++#: nscd/connections.c:1356 + #, c-format + msgid "cannot read /proc/self/cmdline: %s; disabling paranoia mode" + msgstr "kan inte läsa /proc/self/cmdline: %s, kopplar ur paranoialäge" + +-#: nscd/connections.c:1425 ++#: nscd/connections.c:1396 + #, c-format + msgid "cannot change to old UID: %s; disabling paranoia mode" + msgstr "kan inte byta till föregående UID: %s; kopplar ur paranoialäge" + +-#: nscd/connections.c:1435 ++#: nscd/connections.c:1406 + #, c-format + msgid "cannot change to old GID: %s; disabling paranoia mode" + msgstr "kan inte byta till föregående GID: %s; kopplar ur paranoialäge" + +-#: nscd/connections.c:1448 ++#: nscd/connections.c:1419 + #, c-format + msgid "cannot change to old working directory: %s; disabling paranoia mode" + msgstr "kan inte byta till föregående arbetskatalog: %s; kopplar ur paranoialäge" + +-#: nscd/connections.c:1494 ++#: nscd/connections.c:1465 + #, c-format + msgid "re-exec failed: %s; disabling paranoia mode" + msgstr "återstart misslyckades: %s; kopplar ur paranoialäge" + +-#: nscd/connections.c:1503 ++#: nscd/connections.c:1474 + #, c-format + msgid "cannot change current working directory to \"/\": %s" + msgstr "kan inte byta aktuell katalog till \"/\": %s" + +-#: nscd/connections.c:1696 ++#: nscd/connections.c:1657 + #, c-format + msgid "short read while reading request: %s" + msgstr "fattas data vid läsning av begäran: %s" + +-#: nscd/connections.c:1729 ++#: nscd/connections.c:1690 + #, c-format + msgid "key length in request too long: %d" + msgstr "nyckellängd i begäran för lång: %d" + +-#: nscd/connections.c:1742 ++#: nscd/connections.c:1703 + #, c-format + msgid "short read while reading request key: %s" + msgstr "fattas data vid läsning av begäransnyckel: %s" + +-#: nscd/connections.c:1752 ++#: nscd/connections.c:1713 + #, c-format + msgid "handle_request: request received (Version = %d) from PID %ld" + msgstr "handle_request: begäran mottagen (Version = %d) från PID %ld" + +-#: nscd/connections.c:1757 ++#: nscd/connections.c:1718 + #, c-format + msgid "handle_request: request received (Version = %d)" + msgstr "handle_request: begäran mottagen (Version = %d)" + +-#: nscd/connections.c:1897 ++#: nscd/connections.c:1858 + #, c-format + msgid "ignored inotify event for `%s` (file exists)" + msgstr "ignorerade inotify-händelse för ”%s” (filen finns)" + +-#: nscd/connections.c:1902 ++#: nscd/connections.c:1863 + #, c-format + msgid "monitored file `%s` was %s, removing watch" + msgstr "den övervakade filen ”%s” var %s, tar bort vakten" + +-#: nscd/connections.c:1910 nscd/connections.c:1952 ++#: nscd/connections.c:1871 nscd/connections.c:1913 + #, c-format + msgid "failed to remove file watch `%s`: %s" + msgstr "misslyckades att ta bort filvakt ”%s”: %s" + +-#: nscd/connections.c:1925 ++#: nscd/connections.c:1886 + #, c-format + msgid "monitored file `%s` was written to" + msgstr "den övervakade filen ”%s” skrevs till" + +-#: nscd/connections.c:1949 ++#: nscd/connections.c:1910 + #, c-format + msgid "monitored parent directory `%s` was %s, removing watch on `%s`" + msgstr "den övervakade föräldrakatalogen ”%s” var %s, tar bort vakten av ”%s”" + +-#: nscd/connections.c:1975 ++#: nscd/connections.c:1936 + #, c-format + msgid "monitored file `%s` was %s, adding watch" + msgstr "den övervakade filen ”%s” var %s, lägger till vakt" + +-#: nscd/connections.c:1987 ++#: nscd/connections.c:1948 + #, c-format + msgid "failed to add file watch `%s`: %s" + msgstr "misslyckades med att lägga till filvakt ”%s”: %s" + +-#: nscd/connections.c:2181 nscd/connections.c:2362 ++#: nscd/connections.c:2126 nscd/connections.c:2291 + #, c-format + msgid "disabled inotify-based monitoring after read error %d" + msgstr "avaktiverade inotify-baserad övervakning efter läsfel %d" + +-#: nscd/connections.c:2477 ++#: nscd/connections.c:2406 + msgid "could not initialize conditional variable" + msgstr "kan inte initiera villkorsvariabel" + +-#: nscd/connections.c:2485 ++#: nscd/connections.c:2414 + msgid "could not start clean-up thread; terminating" + msgstr "kunde inte starta städtråd; avslutar" + +-#: nscd/connections.c:2499 ++#: nscd/connections.c:2428 + msgid "could not start any worker thread; terminating" + msgstr "kunde inte starta någon arbetstråd; avslutar" + +-#: nscd/connections.c:2554 nscd/connections.c:2556 nscd/connections.c:2572 +-#: nscd/connections.c:2582 nscd/connections.c:2600 nscd/connections.c:2611 +-#: nscd/connections.c:2621 ++#: nscd/connections.c:2483 nscd/connections.c:2485 nscd/connections.c:2501 ++#: nscd/connections.c:2511 nscd/connections.c:2529 nscd/connections.c:2540 ++#: nscd/connections.c:2550 + #, c-format + msgid "Failed to run nscd as user '%s'" + msgstr "Misslyckades att köra nscd som användare \"%s\"" + +-#: nscd/connections.c:2574 ++#: nscd/connections.c:2503 + msgid "initial getgrouplist failed" + msgstr "första getgrouplist misslyckades" + +-#: nscd/connections.c:2583 ++#: nscd/connections.c:2512 + msgid "getgrouplist failed" + msgstr "getgrouplist misslyckades" + +-#: nscd/connections.c:2601 ++#: nscd/connections.c:2530 + msgid "setgroups failed" + msgstr "setgroups misslyckades" + +@@ -4760,62 +4755,41 @@ msgstr "odefinierad" + msgid "Unrecognized variable `%s'" + msgstr "Okänd variabel \"%s\"" + +-#: posix/getopt.c:592 posix/getopt.c:621 ++#: posix/getopt.c:277 + #, c-format +-msgid "%s: option '%s' is ambiguous; possibilities:" +-msgstr "%s: flaggan \"%s\" är tvetydig; alternativ:" ++msgid "%s: option '%s%s' is ambiguous\n" ++msgstr "%s: flaggan ”%s%s” är tvetydig\n" + +-#: posix/getopt.c:662 posix/getopt.c:666 ++#: posix/getopt.c:283 + #, c-format +-msgid "%s: option '--%s' doesn't allow an argument\n" +-msgstr "%s: flaggan \"--%s\" tar inget argument\n" ++msgid "%s: option '%s%s' is ambiguous; possibilities:" ++msgstr "%s: flaggan ”%s%s” är tvetydig; alternativ:" + +-#: posix/getopt.c:675 posix/getopt.c:680 ++#: posix/getopt.c:318 + #, c-format +-msgid "%s: option '%c%s' doesn't allow an argument\n" +-msgstr "%s: flaggan \"%c%s\" tar inget argument\n" ++msgid "%s: unrecognized option '%s%s'\n" ++msgstr "%s: okänd flagga ”%s%s”\n" + +-#: posix/getopt.c:723 posix/getopt.c:742 ++#: posix/getopt.c:344 + #, c-format +-msgid "%s: option '--%s' requires an argument\n" +-msgstr "%s: flaggan \"--%s\" kräver ett argument\n" ++msgid "%s: option '%s%s' doesn't allow an argument\n" ++msgstr "%s: flaggan ”%s%s” tar inget argument\n" + +-#: posix/getopt.c:780 posix/getopt.c:783 ++#: posix/getopt.c:359 + #, c-format +-msgid "%s: unrecognized option '--%s'\n" +-msgstr "%s: okänd flagga \"--%s\"\n" ++msgid "%s: option '%s%s' requires an argument\n" ++msgstr "%s: flaggan ”%s%s” kräver ett argument\n" + +-#: posix/getopt.c:791 posix/getopt.c:794 +-#, c-format +-msgid "%s: unrecognized option '%c%s'\n" +-msgstr "%s: okänd flagga \"%c%s\"\n" +- +-#: posix/getopt.c:843 posix/getopt.c:846 ++#: posix/getopt.c:620 + #, c-format + msgid "%s: invalid option -- '%c'\n" + msgstr "%s: ogiltig flagga -- \"%c\"\n" + +-#: posix/getopt.c:899 posix/getopt.c:916 posix/getopt.c:1126 +-#: posix/getopt.c:1144 ++#: posix/getopt.c:635 posix/getopt.c:681 + #, c-format + msgid "%s: option requires an argument -- '%c'\n" + msgstr "%s: flaggan kräver ett argument -- \"%c\"\n" + +-#: posix/getopt.c:972 posix/getopt.c:988 +-#, c-format +-msgid "%s: option '-W %s' is ambiguous\n" +-msgstr "%s: flaggan \"-W %s\" är tvetydig\n" +- +-#: posix/getopt.c:1012 posix/getopt.c:1030 +-#, c-format +-msgid "%s: option '-W %s' doesn't allow an argument\n" +-msgstr "%s: flaggan \"-W %s\" tar inget argument\n" +- +-#: posix/getopt.c:1051 posix/getopt.c:1069 +-#, c-format +-msgid "%s: option '-W %s' requires an argument\n" +-msgstr "%s: flaggan \"-W %s\" kräver ett argument\n" +- + #: posix/regcomp.c:140 + msgid "No match" + msgstr "Ingen träff" +@@ -4884,7 +4858,7 @@ msgstr "Obalanserade ) eller \\)" + msgid "No previous regular expression" + msgstr "Inget föregående reguljärt uttryck" + +-#: posix/wordexp.c:1852 ++#: posix/wordexp.c:1822 + msgid "parameter null or not set" + msgstr "parameter är tom eller inte satt" + +@@ -5069,7 +5043,7 @@ msgstr "Buffertplats för utdata tillgängligt" + msgid "Input message available" + msgstr "Inkommande meddelande tillgängligt" + +-#: stdio-common/psiginfo-data.h:46 timezone/zdump.c:541 timezone/zic.c:483 ++#: stdio-common/psiginfo-data.h:46 timezone/zdump.c:381 timezone/zic.c:520 + msgid "I/O error" + msgstr "I/O-fel" + +@@ -5149,170 +5123,170 @@ msgstr "Realtidssignal %d" + msgid "Unknown signal %d" + msgstr "Okänd signal %d" + +-#: sunrpc/auth_unix.c:111 sunrpc/clnt_tcp.c:123 sunrpc/clnt_udp.c:135 +-#: sunrpc/clnt_unix.c:124 sunrpc/svc_tcp.c:188 sunrpc/svc_tcp.c:233 +-#: sunrpc/svc_udp.c:160 sunrpc/svc_unix.c:188 sunrpc/svc_unix.c:229 +-#: sunrpc/xdr.c:627 sunrpc/xdr.c:787 sunrpc/xdr_array.c:101 +-#: sunrpc/xdr_rec.c:152 sunrpc/xdr_ref.c:78 ++#: sunrpc/auth_unix.c:112 sunrpc/clnt_tcp.c:124 sunrpc/clnt_udp.c:139 ++#: sunrpc/clnt_unix.c:125 sunrpc/svc_tcp.c:189 sunrpc/svc_tcp.c:234 ++#: sunrpc/svc_udp.c:161 sunrpc/svc_unix.c:189 sunrpc/svc_unix.c:230 ++#: sunrpc/xdr.c:628 sunrpc/xdr.c:788 sunrpc/xdr_array.c:102 ++#: sunrpc/xdr_rec.c:153 sunrpc/xdr_ref.c:79 + msgid "out of memory\n" + msgstr "minnet slut\n" + +-#: sunrpc/auth_unix.c:349 ++#: sunrpc/auth_unix.c:350 + msgid "auth_unix.c: Fatal marshalling problem" + msgstr "auth_unix.c: Fatalt kodningsproblem" + +-#: sunrpc/clnt_perr.c:95 sunrpc/clnt_perr.c:111 ++#: sunrpc/clnt_perr.c:96 sunrpc/clnt_perr.c:112 + #, c-format + msgid "%s: %s; low version = %lu, high version = %lu" + msgstr "%s: %s; undre version = %lu, övre version = %lu" + +-#: sunrpc/clnt_perr.c:102 ++#: sunrpc/clnt_perr.c:103 + #, c-format + msgid "%s: %s; why = %s\n" + msgstr "%s: %s; varför = %s\n" + +-#: sunrpc/clnt_perr.c:104 ++#: sunrpc/clnt_perr.c:105 + #, c-format + msgid "%s: %s; why = (unknown authentication error - %d)\n" + msgstr "%s: %s; varför = (okänt fel vid äkthetskontroll - %d)\n" + +-#: sunrpc/clnt_perr.c:153 ++#: sunrpc/clnt_perr.c:154 + msgid "RPC: Success" + msgstr "RPC: Lyckat" + +-#: sunrpc/clnt_perr.c:156 ++#: sunrpc/clnt_perr.c:157 + msgid "RPC: Can't encode arguments" + msgstr "RPC: Kan inte koda argumentet" + +-#: sunrpc/clnt_perr.c:160 ++#: sunrpc/clnt_perr.c:161 + msgid "RPC: Can't decode result" + msgstr "RPC: Kan inte avkoda resultatet" + +-#: sunrpc/clnt_perr.c:164 ++#: sunrpc/clnt_perr.c:165 + msgid "RPC: Unable to send" + msgstr "RPC: Kan inte skicka" + +-#: sunrpc/clnt_perr.c:168 ++#: sunrpc/clnt_perr.c:169 + msgid "RPC: Unable to receive" + msgstr "RPC: Kan inte ta emot" + +-#: sunrpc/clnt_perr.c:172 ++#: sunrpc/clnt_perr.c:173 + msgid "RPC: Timed out" + msgstr "RPC: Tiden löpte ut" + +-#: sunrpc/clnt_perr.c:176 ++#: sunrpc/clnt_perr.c:177 + msgid "RPC: Incompatible versions of RPC" + msgstr "RPC: Inkompatibla versioner av RPC" + +-#: sunrpc/clnt_perr.c:180 ++#: sunrpc/clnt_perr.c:181 + msgid "RPC: Authentication error" + msgstr "RPC: Fel vid äkthetskontroll" + +-#: sunrpc/clnt_perr.c:184 ++#: sunrpc/clnt_perr.c:185 + msgid "RPC: Program unavailable" + msgstr "RPC: Programmet otillgängligt" + +-#: sunrpc/clnt_perr.c:188 ++#: sunrpc/clnt_perr.c:189 + msgid "RPC: Program/version mismatch" + msgstr "RPC: Program/version-inkompatibilitet" + +-#: sunrpc/clnt_perr.c:192 ++#: sunrpc/clnt_perr.c:193 + msgid "RPC: Procedure unavailable" + msgstr "RPC: Procedur inte tillgänglig" + +-#: sunrpc/clnt_perr.c:196 ++#: sunrpc/clnt_perr.c:197 + msgid "RPC: Server can't decode arguments" + msgstr "RPC: Server kan inte avkoda argumenten" + +-#: sunrpc/clnt_perr.c:200 ++#: sunrpc/clnt_perr.c:201 + msgid "RPC: Remote system error" + msgstr "RPC: Fjärrsystemsfel" + +-#: sunrpc/clnt_perr.c:204 ++#: sunrpc/clnt_perr.c:205 + msgid "RPC: Unknown host" + msgstr "RPC: Okänd värdmaskin" + +-#: sunrpc/clnt_perr.c:208 ++#: sunrpc/clnt_perr.c:209 + msgid "RPC: Unknown protocol" + msgstr "RPC: Okänt protokoll" + +-#: sunrpc/clnt_perr.c:212 ++#: sunrpc/clnt_perr.c:213 + msgid "RPC: Port mapper failure" + msgstr "RPC: Fel i portöversättare" + +-#: sunrpc/clnt_perr.c:216 ++#: sunrpc/clnt_perr.c:217 + msgid "RPC: Program not registered" + msgstr "RPC: Programmet inte registrerat" + +-#: sunrpc/clnt_perr.c:220 ++#: sunrpc/clnt_perr.c:221 + msgid "RPC: Failed (unspecified error)" + msgstr "RPC: Misslyckades (ospecificerat fel)" + +-#: sunrpc/clnt_perr.c:261 ++#: sunrpc/clnt_perr.c:262 + msgid "RPC: (unknown error code)" + msgstr "RPC: (okänd felkod)" + +-#: sunrpc/clnt_perr.c:333 ++#: sunrpc/clnt_perr.c:334 + msgid "Authentication OK" + msgstr "Äkthetskontroll OK" + +-#: sunrpc/clnt_perr.c:336 ++#: sunrpc/clnt_perr.c:337 + msgid "Invalid client credential" + msgstr "Ogiltiga klientreferenser" + +-#: sunrpc/clnt_perr.c:340 ++#: sunrpc/clnt_perr.c:341 + msgid "Server rejected credential" + msgstr "Server förkastade kreditiv" + +-#: sunrpc/clnt_perr.c:344 ++#: sunrpc/clnt_perr.c:345 + msgid "Invalid client verifier" + msgstr "Ogiltig klientverifierare" + +-#: sunrpc/clnt_perr.c:348 ++#: sunrpc/clnt_perr.c:349 + msgid "Server rejected verifier" + msgstr "Server förkastade verifierare" + +-#: sunrpc/clnt_perr.c:352 ++#: sunrpc/clnt_perr.c:353 + msgid "Client credential too weak" + msgstr "Klientens referenser är för svaga" + +-#: sunrpc/clnt_perr.c:356 ++#: sunrpc/clnt_perr.c:357 + msgid "Invalid server verifier" + msgstr "Ogiltig serververifierare" + +-#: sunrpc/clnt_perr.c:360 ++#: sunrpc/clnt_perr.c:361 + msgid "Failed (unspecified error)" + msgstr "Misslyckades (ospecificerat fel)" + +-#: sunrpc/clnt_raw.c:115 ++#: sunrpc/clnt_raw.c:116 + msgid "clnt_raw.c: fatal header serialization error" + msgstr "clnt_raw.c: fatalt fel vid serialisering" + +-#: sunrpc/pm_getmaps.c:77 ++#: sunrpc/pm_getmaps.c:78 + msgid "pmap_getmaps.c: rpc problem" + msgstr "pmap_getmaps.c rpc problem" + +-#: sunrpc/pmap_clnt.c:127 ++#: sunrpc/pmap_clnt.c:128 + msgid "Cannot register service" + msgstr "Kan inte registrera tjänst" + +-#: sunrpc/pmap_rmt.c:244 ++#: sunrpc/pmap_rmt.c:245 + msgid "Cannot create socket for broadcast rpc" + msgstr "Kan inte skapa uttag (socket) för utsändnings-rpc" + +-#: sunrpc/pmap_rmt.c:251 ++#: sunrpc/pmap_rmt.c:252 + msgid "Cannot set socket option SO_BROADCAST" + msgstr "Kan inte sätta uttagsflaggan (socket option) SO_BROADCAST" + +-#: sunrpc/pmap_rmt.c:303 ++#: sunrpc/pmap_rmt.c:304 + msgid "Cannot send broadcast packet" + msgstr "Kan inte skicka utsändningspaket" + +-#: sunrpc/pmap_rmt.c:328 ++#: sunrpc/pmap_rmt.c:329 + msgid "Broadcast poll problem" + msgstr "Problem med poll vid utsändning" + +-#: sunrpc/pmap_rmt.c:341 ++#: sunrpc/pmap_rmt.c:342 + msgid "Cannot receive reply to broadcast" + msgstr "Kan inte ta emot svar på utsändning" + +@@ -5595,11 +5569,11 @@ msgstr "tom teckensträng" + msgid "preprocessor error" + msgstr "preprocessorfel" + +-#: sunrpc/svc_run.c:71 ++#: sunrpc/svc_run.c:72 + msgid "svc_run: - out of memory" + msgstr "svc_run: - minnet slut" + +-#: sunrpc/svc_run.c:91 ++#: sunrpc/svc_run.c:92 + msgid "svc_run: - poll failed" + msgstr "svc_run: - poll misslyckades" + +@@ -5631,204 +5605,204 @@ msgstr "problem att svara till prog %d\n" + msgid "never registered prog %d\n" + msgstr "aldrig registrerat prog %d\n" + +-#: sunrpc/svc_tcp.c:164 ++#: sunrpc/svc_tcp.c:165 + msgid "svc_tcp.c - tcp socket creation problem" + msgstr "svc_tcp.c - problem att skapa tcp-uttag (socket)" + +-#: sunrpc/svc_tcp.c:179 ++#: sunrpc/svc_tcp.c:180 + msgid "svc_tcp.c - cannot getsockname or listen" + msgstr "svc_tcp.c - kan inte anropa getsockname eller listen" + +-#: sunrpc/svc_udp.c:135 ++#: sunrpc/svc_udp.c:136 + msgid "svcudp_create: socket creation problem" + msgstr "svcudp_create: problem att skapa uttag (socket)" + +-#: sunrpc/svc_udp.c:149 ++#: sunrpc/svc_udp.c:150 + msgid "svcudp_create - cannot getsockname" + msgstr "svcudp_create - kan inte anropa getsockname" + +-#: sunrpc/svc_udp.c:181 ++#: sunrpc/svc_udp.c:182 + msgid "svcudp_create: xp_pad is too small for IP_PKTINFO\n" + msgstr "svcudp_create: xp_pad är för liten för IP_PKTINFO\n" + +-#: sunrpc/svc_udp.c:480 ++#: sunrpc/svc_udp.c:481 + msgid "enablecache: cache already enabled" + msgstr "enablecache: cache redan påslagen" + +-#: sunrpc/svc_udp.c:486 ++#: sunrpc/svc_udp.c:487 + msgid "enablecache: could not allocate cache" + msgstr "enablecache: kunde inte allokera cache" + +-#: sunrpc/svc_udp.c:495 ++#: sunrpc/svc_udp.c:496 + msgid "enablecache: could not allocate cache data" + msgstr "enablecache: kunde inte allokera cache-data" + +-#: sunrpc/svc_udp.c:503 ++#: sunrpc/svc_udp.c:504 + msgid "enablecache: could not allocate cache fifo" + msgstr "enablecache: kunde inte allokera cache-fifo" + +-#: sunrpc/svc_udp.c:539 ++#: sunrpc/svc_udp.c:540 + msgid "cache_set: victim not found" + msgstr "cache_set: offer hittades inte" + +-#: sunrpc/svc_udp.c:550 ++#: sunrpc/svc_udp.c:551 + msgid "cache_set: victim alloc failed" + msgstr "cache_set: offerallokering misslyckades" + +-#: sunrpc/svc_udp.c:557 ++#: sunrpc/svc_udp.c:558 + msgid "cache_set: could not allocate new rpc_buffer" + msgstr "cache_set: kunde inte allokera ny rpc-buffert" + +-#: sunrpc/svc_unix.c:162 ++#: sunrpc/svc_unix.c:163 + msgid "svc_unix.c - AF_UNIX socket creation problem" + msgstr "svc_unix.c - problem att skapa AF_UNIX uttag (socket)" + +-#: sunrpc/svc_unix.c:178 ++#: sunrpc/svc_unix.c:179 + msgid "svc_unix.c - cannot getsockname or listen" + msgstr "svc_unix.c - kan inte anropa getsockname eller listen" + +-#: sysdeps/generic/siglist.h:28 ++#: sysdeps/generic/siglist.h:29 + msgid "Hangup" + msgstr "Avringd" + +-#: sysdeps/generic/siglist.h:29 ++#: sysdeps/generic/siglist.h:30 + msgid "Interrupt" + msgstr "Avbruten (SIGINT)" + +-#: sysdeps/generic/siglist.h:30 ++#: sysdeps/generic/siglist.h:31 + msgid "Quit" + msgstr "Lämnad" + +-#: sysdeps/generic/siglist.h:31 ++#: sysdeps/generic/siglist.h:32 + msgid "Illegal instruction" + msgstr "Otillåten instruktion" + +-#: sysdeps/generic/siglist.h:32 ++#: sysdeps/generic/siglist.h:33 + msgid "Trace/breakpoint trap" + msgstr "Spårningsfälla" + +-#: sysdeps/generic/siglist.h:33 ++#: sysdeps/generic/siglist.h:34 + msgid "Aborted" + msgstr "Avbruten (SIGABRT)" + +-#: sysdeps/generic/siglist.h:34 ++#: sysdeps/generic/siglist.h:35 + msgid "Floating point exception" + msgstr "Flyttalsfel" + +-#: sysdeps/generic/siglist.h:35 ++#: sysdeps/generic/siglist.h:36 + msgid "Killed" + msgstr "Dödad" + +-#: sysdeps/generic/siglist.h:36 ++#: sysdeps/generic/siglist.h:37 + msgid "Bus error" + msgstr "Bussfel" + +-#: sysdeps/generic/siglist.h:37 ++#: sysdeps/generic/siglist.h:38 ++msgid "Bad system call" ++msgstr "Felaktigt systemanrop" ++ ++#: sysdeps/generic/siglist.h:39 + msgid "Segmentation fault" + msgstr "Segmenteringsfel" + +-#. TRANS Broken pipe; there is no process reading from the other end of a pipe. ++#. TRANS There is no process reading from the other end of a pipe. + #. TRANS Every library function that returns this error code also generates a + #. TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled + #. TRANS or blocked. Thus, your program will never actually see @code{EPIPE} + #. TRANS unless it has handled or blocked @code{SIGPIPE}. +-#: sysdeps/generic/siglist.h:38 sysdeps/gnu/errlist.c:360 ++#: sysdeps/generic/siglist.h:40 sysdeps/gnu/errlist.c:360 + msgid "Broken pipe" + msgstr "Brutet rör" + +-#: sysdeps/generic/siglist.h:39 ++#: sysdeps/generic/siglist.h:41 + msgid "Alarm clock" + msgstr "Alarmklocka" + +-#: sysdeps/generic/siglist.h:40 ++#: sysdeps/generic/siglist.h:42 + msgid "Terminated" + msgstr "Avslutad" + +-#: sysdeps/generic/siglist.h:41 ++#: sysdeps/generic/siglist.h:43 + msgid "Urgent I/O condition" + msgstr "Akut I/O-tillstånd" + +-#: sysdeps/generic/siglist.h:42 ++#: sysdeps/generic/siglist.h:44 + msgid "Stopped (signal)" + msgstr "Stoppad (signal)" + +-#: sysdeps/generic/siglist.h:43 ++#: sysdeps/generic/siglist.h:45 + msgid "Stopped" + msgstr "Stoppad" + +-#: sysdeps/generic/siglist.h:44 ++#: sysdeps/generic/siglist.h:46 + msgid "Continued" + msgstr "Återupptagen" + +-#: sysdeps/generic/siglist.h:45 ++#: sysdeps/generic/siglist.h:47 + msgid "Child exited" + msgstr "Barnprocess avslutad" + +-#: sysdeps/generic/siglist.h:46 ++#: sysdeps/generic/siglist.h:48 + msgid "Stopped (tty input)" + msgstr "Stoppad (terminalläsning)" + +-#: sysdeps/generic/siglist.h:47 ++#: sysdeps/generic/siglist.h:49 + msgid "Stopped (tty output)" + msgstr "Stoppad (terminalskrivning)" + +-#: sysdeps/generic/siglist.h:48 ++#: sysdeps/generic/siglist.h:50 + msgid "I/O possible" + msgstr "I/O möjligt" + +-#: sysdeps/generic/siglist.h:49 ++#: sysdeps/generic/siglist.h:51 + msgid "CPU time limit exceeded" + msgstr "Begränsning av CPU-tid överskriden" + +-#: sysdeps/generic/siglist.h:50 ++#: sysdeps/generic/siglist.h:52 + msgid "File size limit exceeded" + msgstr "Begränsning av filstorlek överskriden" + +-#: sysdeps/generic/siglist.h:51 ++#: sysdeps/generic/siglist.h:53 + msgid "Virtual timer expired" + msgstr "Alarmklocka - virtuell tid" + +-#: sysdeps/generic/siglist.h:52 ++#: sysdeps/generic/siglist.h:54 + msgid "Profiling timer expired" + msgstr "Profileringsklocka" + +-#: sysdeps/generic/siglist.h:53 ++#: sysdeps/generic/siglist.h:55 + msgid "User defined signal 1" + msgstr "Användarsignal 1" + +-#: sysdeps/generic/siglist.h:54 ++#: sysdeps/generic/siglist.h:56 + msgid "User defined signal 2" + msgstr "Användarsignal 2" + +-#: sysdeps/generic/siglist.h:58 +-msgid "EMT trap" +-msgstr "Emulatorfälla" ++#: sysdeps/generic/siglist.h:57 ++msgid "Window changed" ++msgstr "Ändrat fönster" + + #: sysdeps/generic/siglist.h:61 +-msgid "Bad system call" +-msgstr "Felaktigt systemanrop" ++msgid "EMT trap" ++msgstr "Emulatorfälla" + + #: sysdeps/generic/siglist.h:64 + msgid "Stack fault" + msgstr "Stackfel" + + #: sysdeps/generic/siglist.h:67 +-msgid "Information request" +-msgstr "Informationsbegäran" +- +-#: sysdeps/generic/siglist.h:69 + msgid "Power failure" + msgstr "Strömavbrott" + +-#: sysdeps/generic/siglist.h:72 ++#: sysdeps/generic/siglist.h:70 ++msgid "Information request" ++msgstr "Informationsbegäran" ++ ++#: sysdeps/generic/siglist.h:73 + msgid "Resource lost" + msgstr "Förlorad resurs" + +-#: sysdeps/generic/siglist.h:75 +-msgid "Window changed" +-msgstr "Ändrat fönster" +- +-#. TRANS Operation not permitted; only the owner of the file (or other resource) ++#. TRANS Only the owner of the file (or other resource) + #. TRANS or processes with special privileges can perform the operation. + #: sysdeps/gnu/errlist.c:26 + msgid "Operation not permitted" +@@ -5839,7 +5813,7 @@ msgstr "Operationen inte tillåten" + msgid "No such process" + msgstr "Processen finns inte" + +-#. TRANS Interrupted function call; an asynchronous signal occurred and prevented ++#. TRANS An asynchronous signal occurred and prevented + #. TRANS completion of the call. When this happens, you should try the call + #. TRANS again. + #. TRANS +@@ -5850,12 +5824,12 @@ msgstr "Processen finns inte" + msgid "Interrupted system call" + msgstr "Avbrutet systemanrop" + +-#. TRANS Input/output error; usually used for physical read or write errors. ++#. TRANS Usually used for physical read or write errors. + #: sysdeps/gnu/errlist.c:70 + msgid "Input/output error" + msgstr "In/ut-fel" + +-#. TRANS No such device or address. The system tried to use the device ++#. TRANS The system tried to use the device + #. TRANS represented by a file you specified, and it couldn't find the device. + #. TRANS This can mean that the device file was installed incorrectly, or that + #. TRANS the physical device is missing or not correctly attached to the +@@ -5864,7 +5838,7 @@ msgstr "In/ut-fel" + msgid "No such device or address" + msgstr "Enheten eller adressen finns inte" + +-#. TRANS Argument list too long; used when the arguments passed to a new program ++#. TRANS Used when the arguments passed to a new program + #. TRANS being executed with one of the @code{exec} functions (@pxref{Executing a + #. TRANS File}) occupy too much memory space. This condition never arises on + #. TRANS @gnuhurdsystems{}. +@@ -5878,21 +5852,21 @@ msgstr "Argumentlistan för lång" + msgid "Exec format error" + msgstr "Formatfel på körbar fil" + +-#. TRANS Bad file descriptor; for example, I/O on a descriptor that has been ++#. TRANS For example, I/O on a descriptor that has been + #. TRANS closed or reading from a descriptor open only for writing (or vice + #. TRANS versa). + #: sysdeps/gnu/errlist.c:116 + msgid "Bad file descriptor" + msgstr "Felaktig filidentifierare" + +-#. TRANS There are no child processes. This error happens on operations that are ++#. TRANS This error happens on operations that are + #. TRANS supposed to manipulate child processes, when there aren't any processes + #. TRANS to manipulate. + #: sysdeps/gnu/errlist.c:127 + msgid "No child processes" + msgstr "Inga barnprocesser" + +-#. TRANS Deadlock avoided; allocating a system resource would have resulted in a ++#. TRANS Allocating a system resource would have resulted in a + #. TRANS deadlock situation. The system does not guarantee that it will notice + #. TRANS all such situations. This error means you got lucky and the system + #. TRANS noticed; it might just hang. @xref{File Locks}, for an example. +@@ -5900,13 +5874,13 @@ msgstr "Inga barnprocesser" + msgid "Resource deadlock avoided" + msgstr "Resursdödläge undveks" + +-#. TRANS No memory available. The system cannot allocate more virtual memory ++#. TRANS The system cannot allocate more virtual memory + #. TRANS because its capacity is full. + #: sysdeps/gnu/errlist.c:149 + msgid "Cannot allocate memory" + msgstr "Kan inte allokera minne" + +-#. TRANS Bad address; an invalid pointer was detected. ++#. TRANS An invalid pointer was detected. + #. TRANS On @gnuhurdsystems{}, this error never happens; you get a signal instead. + #: sysdeps/gnu/errlist.c:168 + msgid "Bad address" +@@ -5919,14 +5893,14 @@ msgstr "Felaktig adress" + msgid "Block device required" + msgstr "Blockenhet krävs" + +-#. TRANS Resource busy; a system resource that can't be shared is already in use. ++#. TRANS A system resource that can't be shared is already in use. + #. TRANS For example, if you try to delete a file that is the root of a currently + #. TRANS mounted filesystem, you get this error. + #: sysdeps/gnu/errlist.c:190 + msgid "Device or resource busy" + msgstr "Enhet eller resurs upptagen" + +-#. TRANS File exists; an existing file was specified in a context where it only ++#. TRANS An existing file was specified in a context where it only + #. TRANS makes sense to specify a new file. + #: sysdeps/gnu/errlist.c:200 + msgid "File exists" +@@ -5950,13 +5924,13 @@ msgstr "Enheten finns inte" + msgid "Not a directory" + msgstr "Inte en katalog" + +-#. TRANS File is a directory; you cannot open a directory for writing, ++#. TRANS You cannot open a directory for writing, + #. TRANS or create or remove hard links to it. + #: sysdeps/gnu/errlist.c:240 + msgid "Is a directory" + msgstr "Är en katalog" + +-#. TRANS Invalid argument. This is used to indicate various kinds of problems ++#. TRANS This is used to indicate various kinds of problems + #. TRANS with passing the wrong argument to a library function. + #: sysdeps/gnu/errlist.c:250 + msgid "Invalid argument" +@@ -5995,12 +5969,12 @@ msgstr "Olämplig ioctl för enheten" + msgid "Text file busy" + msgstr "Kodfil upptagen" + +-#. TRANS File too big; the size of a file would be larger than allowed by the system. ++#. TRANS The size of a file would be larger than allowed by the system. + #: sysdeps/gnu/errlist.c:308 + msgid "File too large" + msgstr "För stor fil" + +-#. TRANS No space left on device; write operation on a file failed because the ++#. TRANS Write operation on a file failed because the + #. TRANS disk is full. + #: sysdeps/gnu/errlist.c:318 + msgid "No space left on device" +@@ -6016,26 +5990,26 @@ msgstr "Otillåten sökning" + msgid "Read-only file system" + msgstr "Skrivskyddat filsystem" + +-#. TRANS Too many links; the link count of a single file would become too large. ++#. TRANS The link count of a single file would become too large. + #. TRANS @code{rename} can cause this error if the file being renamed already has + #. TRANS as many links as it can take (@pxref{Renaming Files}). + #: sysdeps/gnu/errlist.c:347 + msgid "Too many links" + msgstr "För många länkar" + +-#. TRANS Domain error; used by mathematical functions when an argument value does ++#. TRANS Used by mathematical functions when an argument value does + #. TRANS not fall into the domain over which the function is defined. + #: sysdeps/gnu/errlist.c:370 + msgid "Numerical argument out of domain" + msgstr "Numeriskt argument är utanför området" + +-#. TRANS Range error; used by mathematical functions when the result value is ++#. TRANS Used by mathematical functions when the result value is + #. TRANS not representable because of overflow or underflow. + #: sysdeps/gnu/errlist.c:380 + msgid "Numerical result out of range" + msgstr "Numeriskt resultat är utanför giltigt intervall" + +-#. TRANS Resource temporarily unavailable; the call might work if you try again ++#. TRANS The call might work if you try again + #. TRANS later. The macro @code{EWOULDBLOCK} is another name for @code{EAGAIN}; + #. TRANS they are always the same in @theglibc{}. + #. TRANS +@@ -6223,76 +6197,75 @@ msgstr "Destinationsadress krävs" + msgid "Cannot send after transport endpoint shutdown" + msgstr "Kan inte skicka efter att transportslutpunkten stängts" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:677 ++#: sysdeps/gnu/errlist.c:676 + msgid "Too many references: cannot splice" + msgstr "För många referenser: kan inte skarva" + + #. TRANS A socket operation with a specified timeout received no response during + #. TRANS the timeout period. +-#: sysdeps/gnu/errlist.c:687 ++#: sysdeps/gnu/errlist.c:686 + msgid "Connection timed out" + msgstr "Förbindelsens tidsgräns löpte ut" + + #. TRANS A remote host refused to allow the network connection (typically because + #. TRANS it is not running the requested service). +-#: sysdeps/gnu/errlist.c:697 ++#: sysdeps/gnu/errlist.c:696 + msgid "Connection refused" + msgstr "Förbindelsen förvägrad" + + #. TRANS Too many levels of symbolic links were encountered in looking up a file name. + #. TRANS This often indicates a cycle of symbolic links. +-#: sysdeps/gnu/errlist.c:707 ++#: sysdeps/gnu/errlist.c:706 + msgid "Too many levels of symbolic links" + msgstr "För många nivåer av symboliska länkar" + + #. TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for + #. TRANS Files}) or host name too long (in @code{gethostname} or + #. TRANS @code{sethostname}; @pxref{Host Identification}). +-#: sysdeps/gnu/errlist.c:718 ++#: sysdeps/gnu/errlist.c:717 + msgid "File name too long" + msgstr "För långt filnamn" + + #. TRANS The remote host for a requested network connection is down. +-#: sysdeps/gnu/errlist.c:727 ++#: sysdeps/gnu/errlist.c:726 + msgid "Host is down" + msgstr "Värddator är nere" + + #. TRANS The remote host for a requested network connection is not reachable. +-#: sysdeps/gnu/errlist.c:736 ++#: sysdeps/gnu/errlist.c:735 + msgid "No route to host" + msgstr "Ingen väg till värd" + + #. TRANS Directory not empty, where an empty directory was expected. Typically, + #. TRANS this error occurs when you are trying to delete a directory. +-#: sysdeps/gnu/errlist.c:746 ++#: sysdeps/gnu/errlist.c:745 + msgid "Directory not empty" + msgstr "Katalog inte tom" + + #. TRANS This means that the per-user limit on new process would be exceeded by + #. TRANS an attempted @code{fork}. @xref{Limits on Resources}, for details on + #. TRANS the @code{RLIMIT_NPROC} limit. +-#: sysdeps/gnu/errlist.c:757 ++#: sysdeps/gnu/errlist.c:756 + msgid "Too many processes" + msgstr "För många processer" + + #. TRANS The file quota system is confused because there are too many users. + #. TRANS @c This can probably happen in a GNU system when using NFS. +-#: sysdeps/gnu/errlist.c:767 ++#: sysdeps/gnu/errlist.c:766 + msgid "Too many users" + msgstr "För många användare" + + #. TRANS The user's disk quota was exceeded. +-#: sysdeps/gnu/errlist.c:776 ++#: sysdeps/gnu/errlist.c:775 + msgid "Disk quota exceeded" + msgstr "Diskkvot överskriden" + +-#. TRANS Stale file handle. This indicates an internal confusion in the ++#. TRANS This indicates an internal confusion in the + #. TRANS file system which is due to file system rearrangements on the server host + #. TRANS for NFS file systems or corruption in other file systems. + #. TRANS Repairing this condition usually requires unmounting, possibly repairing + #. TRANS and remounting the file system. +-#: sysdeps/gnu/errlist.c:789 ++#: sysdeps/gnu/errlist.c:788 + msgid "Stale file handle" + msgstr "Förlegat filhandtag" + +@@ -6300,72 +6273,65 @@ msgstr "Förlegat filhandtag" + #. TRANS already specifies an NFS-mounted file. + #. TRANS (This is an error on some operating systems, but we expect it to work + #. TRANS properly on @gnuhurdsystems{}, making this error code impossible.) +-#: sysdeps/gnu/errlist.c:801 ++#: sysdeps/gnu/errlist.c:800 + msgid "Object is remote" + msgstr "Är ett fjärrobjekt" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:810 ++#: sysdeps/gnu/errlist.c:808 + msgid "RPC struct is bad" + msgstr "RPC-strukturen är felaktig" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:819 ++#: sysdeps/gnu/errlist.c:816 + msgid "RPC version wrong" + msgstr "RPC-versionen är felaktig" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:828 ++#: sysdeps/gnu/errlist.c:824 + msgid "RPC program not available" + msgstr "RPC-programmet inte tillgängligt" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:837 ++#: sysdeps/gnu/errlist.c:832 + msgid "RPC program version wrong" + msgstr "RPC-programversionen är felaktig" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:846 ++#: sysdeps/gnu/errlist.c:840 + msgid "RPC bad procedure for program" + msgstr "Felaktig RPC-procedur för programmet" + +-#. TRANS No locks available. This is used by the file locking facilities; see ++#. TRANS This is used by the file locking facilities; see + #. TRANS @ref{File Locks}. This error is never generated by @gnuhurdsystems{}, but + #. TRANS it can result from an operation to an NFS server running another + #. TRANS operating system. +-#: sysdeps/gnu/errlist.c:858 ++#: sysdeps/gnu/errlist.c:852 + msgid "No locks available" + msgstr "Inga lås tillgängliga" + +-#. TRANS Inappropriate file type or format. The file was the wrong type for the ++#. TRANS The file was the wrong type for the + #. TRANS operation, or a data file had the wrong format. + #. TRANS + #. TRANS On some systems @code{chmod} returns this error if you try to set the + #. TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. +-#: sysdeps/gnu/errlist.c:871 ++#: sysdeps/gnu/errlist.c:865 + msgid "Inappropriate file type or format" + msgstr "Filtyp eller format olämplig" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:880 ++#: sysdeps/gnu/errlist.c:873 + msgid "Authentication error" + msgstr "Autentiseringsfel" + +-#. TRANS ??? +-#: sysdeps/gnu/errlist.c:889 ++#: sysdeps/gnu/errlist.c:881 + msgid "Need authenticator" + msgstr "Behöver autentiserare" + +-#. TRANS Function not implemented. This indicates that the function called is ++#. TRANS This indicates that the function called is + #. TRANS not implemented at all, either in the C library itself or in the + #. TRANS operating system. When you get this error, you can be sure that this + #. TRANS particular function will always fail with @code{ENOSYS} unless you + #. TRANS install a new version of the C library or the operating system. +-#: sysdeps/gnu/errlist.c:902 ++#: sysdeps/gnu/errlist.c:894 + msgid "Function not implemented" + msgstr "Funktion inte implementerad" + +-#. TRANS Not supported. A function returns this error when certain parameter ++#. TRANS A function returns this error when certain parameter + #. TRANS values are valid, but the functionality they request is not available. + #. TRANS This can mean that the function does not implement a particular command + #. TRANS or option value or flag bit at all. For functions that operate on some +@@ -6377,13 +6343,13 @@ msgstr "Funktion inte implementerad" + #. TRANS + #. TRANS If the entire function is not available at all in the implementation, + #. TRANS it returns @code{ENOSYS} instead. +-#: sysdeps/gnu/errlist.c:922 ++#: sysdeps/gnu/errlist.c:914 + msgid "Not supported" + msgstr "Stöds ej" + + #. TRANS While decoding a multibyte character the function came along an invalid + #. TRANS or an incomplete sequence of bytes or the given wide character is invalid. +-#: sysdeps/gnu/errlist.c:932 ++#: sysdeps/gnu/errlist.c:924 + msgid "Invalid or incomplete multibyte or wide character" + msgstr "Ogiltigt eller ofullständigt flerbyte- eller brett tecken" + +@@ -6393,276 +6359,276 @@ msgstr "Ogiltigt eller ofullständigt flerbyte- eller brett tecken" + #. TRANS error because functions such as @code{read} and @code{write} translate + #. TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal. @xref{Job Control}, + #. TRANS for information on process groups and these signals. +-#: sysdeps/gnu/errlist.c:946 ++#: sysdeps/gnu/errlist.c:938 + msgid "Inappropriate operation for background process" + msgstr "Operation för bakgrundsprocess olämplig" + + #. TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is + #. TRANS translated by a program and the translator program dies while starting + #. TRANS up, before it has connected to the file. +-#: sysdeps/gnu/errlist.c:957 ++#: sysdeps/gnu/errlist.c:949 + msgid "Translator died" + msgstr "Översättaren dog" + + #. TRANS The experienced user will know what is wrong. + #. TRANS @c This error code is a joke. Its perror text is part of the joke. + #. TRANS @c Don't change it. +-#: sysdeps/gnu/errlist.c:968 ++#: sysdeps/gnu/errlist.c:960 + msgid "?" + msgstr "?" + + #. TRANS You did @strong{what}? +-#: sysdeps/gnu/errlist.c:977 ++#: sysdeps/gnu/errlist.c:969 + msgid "You really blew it this time" + msgstr "Du strulade till det den här gången" + + #. TRANS Go home and have a glass of warm, dairy-fresh milk. +-#: sysdeps/gnu/errlist.c:986 ++#: sysdeps/gnu/errlist.c:978 + msgid "Computer bought the farm" + msgstr "Datorn packade ihop" + + #. TRANS This error code has no purpose. +-#: sysdeps/gnu/errlist.c:995 ++#: sysdeps/gnu/errlist.c:987 + msgid "Gratuitous error" + msgstr "Omotiverat fel" + +-#: sysdeps/gnu/errlist.c:1003 ++#: sysdeps/gnu/errlist.c:995 + msgid "Bad message" + msgstr "Felaktigt meddelande" + +-#: sysdeps/gnu/errlist.c:1011 ++#: sysdeps/gnu/errlist.c:1003 + msgid "Identifier removed" + msgstr "Identifierare borttagen" + +-#: sysdeps/gnu/errlist.c:1019 ++#: sysdeps/gnu/errlist.c:1011 + msgid "Multihop attempted" + msgstr "Flerhopp försöktes" + +-#: sysdeps/gnu/errlist.c:1027 ++#: sysdeps/gnu/errlist.c:1019 + msgid "No data available" + msgstr "Inga data tillgängliga" + +-#: sysdeps/gnu/errlist.c:1035 ++#: sysdeps/gnu/errlist.c:1027 + msgid "Link has been severed" + msgstr "Länken har brutits" + +-#: sysdeps/gnu/errlist.c:1043 ++#: sysdeps/gnu/errlist.c:1035 + msgid "No message of desired type" + msgstr "Inget meddelande av önskad typ" + +-#: sysdeps/gnu/errlist.c:1051 ++#: sysdeps/gnu/errlist.c:1043 + msgid "Out of streams resources" + msgstr "Stream-resurserna är slut" + +-#: sysdeps/gnu/errlist.c:1059 ++#: sysdeps/gnu/errlist.c:1051 + msgid "Device not a stream" + msgstr "Enheten är inte en stream" + +-#: sysdeps/gnu/errlist.c:1067 ++#: sysdeps/gnu/errlist.c:1059 + msgid "Value too large for defined data type" + msgstr "Värdet för stort för definierad datatyp" + +-#: sysdeps/gnu/errlist.c:1075 ++#: sysdeps/gnu/errlist.c:1067 + msgid "Protocol error" + msgstr "Protokollfel" + +-#: sysdeps/gnu/errlist.c:1083 ++#: sysdeps/gnu/errlist.c:1075 + msgid "Timer expired" + msgstr "Klockan ringde" + +-#. TRANS Operation canceled; an asynchronous operation was canceled before it ++#. TRANS An asynchronous operation was canceled before it + #. TRANS completed. @xref{Asynchronous I/O}. When you call @code{aio_cancel}, + #. TRANS the normal result is for the operations affected to complete with this + #. TRANS error; @pxref{Cancel AIO Operations}. +-#: sysdeps/gnu/errlist.c:1095 ++#: sysdeps/gnu/errlist.c:1087 + msgid "Operation canceled" + msgstr "Operationen avbruten" + +-#: sysdeps/gnu/errlist.c:1103 ++#: sysdeps/gnu/errlist.c:1095 + msgid "Interrupted system call should be restarted" + msgstr "Avbrutet systemanrop borde omstartas" + +-#: sysdeps/gnu/errlist.c:1111 ++#: sysdeps/gnu/errlist.c:1103 + msgid "Channel number out of range" + msgstr "Kanalnummer utanför giltigt intervall" + +-#: sysdeps/gnu/errlist.c:1119 ++#: sysdeps/gnu/errlist.c:1111 + msgid "Level 2 not synchronized" + msgstr "Nivå 2 inte synkroniserad" + +-#: sysdeps/gnu/errlist.c:1127 ++#: sysdeps/gnu/errlist.c:1119 + msgid "Level 3 halted" + msgstr "Nivå 3 stannad" + +-#: sysdeps/gnu/errlist.c:1135 ++#: sysdeps/gnu/errlist.c:1127 + msgid "Level 3 reset" + msgstr "Nivå 3 omstartad" + +-#: sysdeps/gnu/errlist.c:1143 ++#: sysdeps/gnu/errlist.c:1135 + msgid "Link number out of range" + msgstr "Länkantal utanför giltigt intervall" + +-#: sysdeps/gnu/errlist.c:1151 ++#: sysdeps/gnu/errlist.c:1143 + msgid "Protocol driver not attached" + msgstr "Styrprogram för protokoll inte anslutet" + +-#: sysdeps/gnu/errlist.c:1159 ++#: sysdeps/gnu/errlist.c:1151 + msgid "No CSI structure available" + msgstr "Inga CSI-strukturer tillgängliga" + +-#: sysdeps/gnu/errlist.c:1167 ++#: sysdeps/gnu/errlist.c:1159 + msgid "Level 2 halted" + msgstr "Nivå 2 stannad" + +-#: sysdeps/gnu/errlist.c:1175 ++#: sysdeps/gnu/errlist.c:1167 + msgid "Invalid exchange" + msgstr "Ogiltig växel" + +-#: sysdeps/gnu/errlist.c:1183 ++#: sysdeps/gnu/errlist.c:1175 + msgid "Invalid request descriptor" +-msgstr "Ogiltig begärandeidendiferare" ++msgstr "Ogiltig begärandeidentifierare" + +-#: sysdeps/gnu/errlist.c:1191 ++#: sysdeps/gnu/errlist.c:1183 + msgid "Exchange full" + msgstr "Växeln full" + +-#: sysdeps/gnu/errlist.c:1199 ++#: sysdeps/gnu/errlist.c:1191 + msgid "No anode" + msgstr "Ingen anod" + +-#: sysdeps/gnu/errlist.c:1207 ++#: sysdeps/gnu/errlist.c:1199 + msgid "Invalid request code" + msgstr "Ogiltig begärandekod" + +-#: sysdeps/gnu/errlist.c:1215 ++#: sysdeps/gnu/errlist.c:1207 + msgid "Invalid slot" + msgstr "Ogiltig plats" + +-#: sysdeps/gnu/errlist.c:1223 ++#: sysdeps/gnu/errlist.c:1215 + msgid "File locking deadlock error" + msgstr "Fillåsning gav dödläge" + +-#: sysdeps/gnu/errlist.c:1231 ++#: sysdeps/gnu/errlist.c:1223 + msgid "Bad font file format" + msgstr "Felaktigt format på typsnittsfil" + +-#: sysdeps/gnu/errlist.c:1239 ++#: sysdeps/gnu/errlist.c:1231 + msgid "Machine is not on the network" + msgstr "Maskinen finns inte på nätverket" + +-#: sysdeps/gnu/errlist.c:1247 ++#: sysdeps/gnu/errlist.c:1239 + msgid "Package not installed" + msgstr "Paketet är inte installerat" + +-#: sysdeps/gnu/errlist.c:1255 ++#: sysdeps/gnu/errlist.c:1247 + msgid "Advertise error" + msgstr "Annonseringsfel" + +-#: sysdeps/gnu/errlist.c:1263 ++#: sysdeps/gnu/errlist.c:1255 + msgid "Srmount error" + msgstr "Srmount-fel" + +-#: sysdeps/gnu/errlist.c:1271 ++#: sysdeps/gnu/errlist.c:1263 + msgid "Communication error on send" + msgstr "Kommunikationsfel vid sändning" + +-#: sysdeps/gnu/errlist.c:1279 ++#: sysdeps/gnu/errlist.c:1271 + msgid "RFS specific error" + msgstr "RFS-specifikt fel" + +-#: sysdeps/gnu/errlist.c:1287 ++#: sysdeps/gnu/errlist.c:1279 + msgid "Name not unique on network" + msgstr "Namnet inte unikt i nätverket" + +-#: sysdeps/gnu/errlist.c:1295 ++#: sysdeps/gnu/errlist.c:1287 + msgid "File descriptor in bad state" + msgstr "Filidentifierare i felaktigt tillstånd" + +-#: sysdeps/gnu/errlist.c:1303 ++#: sysdeps/gnu/errlist.c:1295 + msgid "Remote address changed" + msgstr "Fjärradress ändrades" + +-#: sysdeps/gnu/errlist.c:1311 ++#: sysdeps/gnu/errlist.c:1303 + msgid "Can not access a needed shared library" + msgstr "Kan inte komma åt ett nödvändigt delat bibliotek" + +-#: sysdeps/gnu/errlist.c:1319 ++#: sysdeps/gnu/errlist.c:1311 + msgid "Accessing a corrupted shared library" + msgstr "Öppnar ett korrupt delat bibliotek" + +-#: sysdeps/gnu/errlist.c:1327 ++#: sysdeps/gnu/errlist.c:1319 + msgid ".lib section in a.out corrupted" + msgstr ".lib-sektion i a.out korrupt" + +-#: sysdeps/gnu/errlist.c:1335 ++#: sysdeps/gnu/errlist.c:1327 + msgid "Attempting to link in too many shared libraries" + msgstr "Försöker att länka in för många delade bibliotek" + +-#: sysdeps/gnu/errlist.c:1343 ++#: sysdeps/gnu/errlist.c:1335 + msgid "Cannot exec a shared library directly" + msgstr "Kan inte köra ett delat bibliotek direkt" + +-#: sysdeps/gnu/errlist.c:1351 ++#: sysdeps/gnu/errlist.c:1343 + msgid "Streams pipe error" + msgstr "Streams-rörfel" + +-#: sysdeps/gnu/errlist.c:1359 ++#: sysdeps/gnu/errlist.c:1351 + msgid "Structure needs cleaning" + msgstr "Strukturen behöver städas" + +-#: sysdeps/gnu/errlist.c:1367 ++#: sysdeps/gnu/errlist.c:1359 + msgid "Not a XENIX named type file" + msgstr "Inte en XENIX-namngiven fil" + +-#: sysdeps/gnu/errlist.c:1375 ++#: sysdeps/gnu/errlist.c:1367 + msgid "No XENIX semaphores available" + msgstr "Inga XENIX-semaforer tillgängliga" + +-#: sysdeps/gnu/errlist.c:1383 ++#: sysdeps/gnu/errlist.c:1375 + msgid "Is a named type file" + msgstr "Är av typ namnfil" + +-#: sysdeps/gnu/errlist.c:1391 ++#: sysdeps/gnu/errlist.c:1383 + msgid "Remote I/O error" + msgstr "I/O-fel på fjärrmaskin" + +-#: sysdeps/gnu/errlist.c:1399 ++#: sysdeps/gnu/errlist.c:1391 + msgid "No medium found" + msgstr "Inget medium funnet" + +-#: sysdeps/gnu/errlist.c:1407 ++#: sysdeps/gnu/errlist.c:1399 + msgid "Wrong medium type" + msgstr "Fel medietyp" + +-#: sysdeps/gnu/errlist.c:1415 ++#: sysdeps/gnu/errlist.c:1407 + msgid "Required key not available" + msgstr "Obligatorisk nyckel inte tillgänglig" + +-#: sysdeps/gnu/errlist.c:1423 ++#: sysdeps/gnu/errlist.c:1415 + msgid "Key has expired" + msgstr "Nyckeln har gått ut" + +-#: sysdeps/gnu/errlist.c:1431 ++#: sysdeps/gnu/errlist.c:1423 + msgid "Key has been revoked" + msgstr "Nyckeln har återkallats" + +-#: sysdeps/gnu/errlist.c:1439 ++#: sysdeps/gnu/errlist.c:1431 + msgid "Key was rejected by service" + msgstr "Nyckeln accepterades inte av tjänsten" + +-#: sysdeps/gnu/errlist.c:1447 ++#: sysdeps/gnu/errlist.c:1439 + msgid "Owner died" + msgstr "Ägaren dog" + +-#: sysdeps/gnu/errlist.c:1455 ++#: sysdeps/gnu/errlist.c:1447 + msgid "State not recoverable" + msgstr "Det går inte att återhämta från tillståndet" + +-#: sysdeps/gnu/errlist.c:1463 ++#: sysdeps/gnu/errlist.c:1455 + msgid "Operation not possible due to RF-kill" + msgstr "Operationen inte möjlig p.g.a. RF-kill" + +-#: sysdeps/gnu/errlist.c:1471 ++#: sysdeps/gnu/errlist.c:1463 + msgid "Memory page has hardware error" + msgstr "Minnessida har hårdvarufel" + +@@ -6767,73 +6733,90 @@ msgstr "kan inte öppna \"%s\"" + msgid "cannot read header from `%s'" + msgstr "kan inte läsa huvud från \"%s\"" + +-#: timezone/zdump.c:494 ++#: timezone/zdump.c:338 + msgid "has fewer than 3 characters" + msgstr "har färre än 3 tecken" + +-#: timezone/zdump.c:496 ++#: timezone/zdump.c:340 + msgid "has more than 6 characters" + msgstr "har fler än 6 tecken" + +-#: timezone/zdump.c:498 ++#: timezone/zdump.c:342 + msgid "has characters other than ASCII alphanumerics, '-' or '+'" + msgstr "har andra tecken än ASCII alfanumeriska, ”-” eller ”+”" + +-#: timezone/zdump.c:503 ++#: timezone/zdump.c:347 + #, c-format + msgid "%s: warning: zone \"%s\" abbreviation \"%s\" %s\n" + msgstr "%s: varning: zon \"%s\" förkortning \"%s\": %s\n" + +-#: timezone/zdump.c:553 ++#: timezone/zdump.c:393 + #, c-format + msgid "" +-"%s: usage: %s [--version] [--help] [-{vV}] [-{ct} [lo,]hi] zonename ...\n" ++"%s: usage: %s OPTIONS ZONENAME ...\n" ++"Options include:\n" ++" -c [L,]U Start at year L (default -500), end before year U (default 2500)\n" ++" -t [L,]U Start at time L, end before time U (in seconds since 1970)\n" ++" -i List transitions briefly (format is experimental)\n" ++" -v List transitions verbosely\n" ++" -V List transitions a bit less verbosely\n" ++" --help Output this help\n" ++" --version Output version info\n" + "\n" + "Report bugs to %s.\n" + msgstr "" +-"%s: användning: %s [ --version ] [ --help ] [ -{vV} ] [ -{ct} [start,]slut] zonnamn ...\n" ++"%s: användning: %s FLAGGOR ZONNAMN …\n" ++"Flaggorna inkluderar:\n" ++" -c [L,]Ö Starta vid år L (standard -500), och sluta före år Ö (standard 2500)\n" ++" -t [L,]Ö Starta vid tid L, och sluta före tid Ö (i sekunder sedan 1970)\n" ++" -i Lista övergångar kort (formatet är experimentellt)\n" ++" -v Lista övergångar utförligt\n" ++" -V Lista övergångar lite mindre utförligt\n" ++" --help Skriv ut denna hjälp\n" ++" --version Skriv ut versionsinformation\n" ++"\n" + "Rapportera fel till %s.\n" + "Rapportera fel eller synpunkter på översättningen till .\n" + +-#: timezone/zdump.c:635 ++#: timezone/zdump.c:479 + #, c-format + msgid "%s: wild -c argument %s\n" + msgstr "%s: argument \"%s\" till flaggan -c har fel format\n" + +-#: timezone/zdump.c:668 ++#: timezone/zdump.c:512 + #, c-format + msgid "%s: wild -t argument %s\n" + msgstr "%s: argument \"%s\" till flaggan -t har fel format\n" + +-#: timezone/zic.c:361 ++#: timezone/zic.c:398 + #, c-format + msgid "%s: Memory exhausted: %s\n" + msgstr "%s: Minnet slut: %s\n" + +-#: timezone/zic.c:369 ++#: timezone/zic.c:406 + msgid "size overflow" + msgstr "för stor storlek" + +-#: timezone/zic.c:416 +-msgid "int overflow" +-msgstr "för stort heltal" ++#: timezone/zic.c:454 ++msgid "integer overflow" ++msgstr "heltalsspill" + +-#: timezone/zic.c:451 ++#: timezone/zic.c:488 + #, c-format +-msgid "\"%s\", line %d: " +-msgstr "\"%s\", rad %d: " ++msgid "\"%s\", line %: " ++msgstr "”%s”, rad %: " + +-#: timezone/zic.c:454 ++#: timezone/zic.c:491 + #, c-format +-msgid " (rule from \"%s\", line %d)" +-msgstr " (regel från \"%s\", rad %d)" ++msgid " (rule from \"%s\", line %)" ++msgstr " (regel från ”%s”, rad %)" + +-#: timezone/zic.c:473 ++#: timezone/zic.c:510 + #, c-format + msgid "warning: " + msgstr "varning: " + +-#: timezone/zic.c:498 ++#: timezone/zic.c:535 + #, c-format + msgid "" + "%s: usage is %s [ --version ] [ --help ] [ -v ] \\\n" +@@ -6849,361 +6832,382 @@ msgstr "" + "Rapportera fel till %s.\n" + "Rapportera fel eller synpunkter på översättningen till .\n" + +-#: timezone/zic.c:534 ++#: timezone/zic.c:558 ++#, c-format ++msgid "%s: Can't chdir to %s: %s\n" ++msgstr "%s: Kan inte byta katalog till %s: %s\n" ++ ++#: timezone/zic.c:590 + msgid "wild compilation-time specification of zic_t" + msgstr "definitionen av zic_t vid kompilering är orimlig" + +-#: timezone/zic.c:554 ++#: timezone/zic.c:610 + #, c-format + msgid "%s: More than one -d option specified\n" + msgstr "%s: Flaggan -d given mer än en gång\n" + +-#: timezone/zic.c:564 ++#: timezone/zic.c:620 + #, c-format + msgid "%s: More than one -l option specified\n" + msgstr "%s: Flaggan -l given mer än en gång\n" + +-#: timezone/zic.c:574 ++#: timezone/zic.c:630 + #, c-format + msgid "%s: More than one -p option specified\n" + msgstr "%s: Flaggan -p given mer än en gång\n" + +-#: timezone/zic.c:584 ++#: timezone/zic.c:640 + #, c-format + msgid "%s: More than one -y option specified\n" + msgstr "%s: Flaggan -y given mer än en gång\n" + +-#: timezone/zic.c:594 ++#: timezone/zic.c:650 + #, c-format + msgid "%s: More than one -L option specified\n" + msgstr "%s: Flaggan -L given mer än en gång\n" + +-#: timezone/zic.c:603 ++#: timezone/zic.c:659 + msgid "-s ignored" + msgstr "-s ignoreras" + +-#: timezone/zic.c:641 ++#: timezone/zic.c:698 + msgid "link to link" + msgstr "länk till länk" + +-#: timezone/zic.c:644 timezone/zic.c:648 ++#: timezone/zic.c:701 timezone/zic.c:705 + msgid "command line" + msgstr "kommandorad" + +-#: timezone/zic.c:664 ++#: timezone/zic.c:721 + msgid "empty file name" + msgstr "tomt filnamn" + +-#: timezone/zic.c:667 ++#: timezone/zic.c:724 + #, c-format + msgid "file name '%s' begins with '/'" + msgstr "filnamnet ”%s” börjar med ”/”" + +-#: timezone/zic.c:676 ++#: timezone/zic.c:734 + #, c-format + msgid "file name '%s' contains '%.*s' component" + msgstr "filnamnet ”%s” innehåller en komponent ”%.*s”" + +-#: timezone/zic.c:682 ++#: timezone/zic.c:740 + #, c-format + msgid "file name '%s' component contains leading '-'" + msgstr "en komponent i filnamnet ”%s” innehåller en inledande ”-”" + +-#: timezone/zic.c:685 ++#: timezone/zic.c:743 + #, c-format + msgid "file name '%s' contains overlength component '%.*s...'" + msgstr "filnamnet ”%s” innehåller en för lång komponent ”%.*s…”" + +-#: timezone/zic.c:713 ++#: timezone/zic.c:771 + #, c-format + msgid "file name '%s' contains byte '%c'" + msgstr "filnamnet ”%s” innehåller en byte ”%c”" + +-#: timezone/zic.c:714 ++#: timezone/zic.c:772 + #, c-format + msgid "file name '%s' contains byte '\\%o'" + msgstr "filnamnet ”%s” innehåller en byte ”\\%o”" + +-#: timezone/zic.c:757 ++#: timezone/zic.c:842 ++#, c-format ++msgid "%s: link from %s/%s failed: %s\n" ++msgstr "%s: länk från %s/%s misslyckades: %s\n" ++ ++#: timezone/zic.c:852 timezone/zic.c:1815 ++#, c-format ++msgid "%s: Can't remove %s/%s: %s\n" ++msgstr "%s: Kan inte ta bort %s/%s: %s\n" ++ ++#: timezone/zic.c:874 + #, c-format +-msgid "%s: link from %s failed: %s" +-msgstr "%s: länk från %s misslyckades: %s" ++msgid "symbolic link used because hard link failed: %s" ++msgstr "symbolisk länk använd eftersom en hård länk misslyckades: %s" + +-#: timezone/zic.c:792 +-msgid "hard link failed, symbolic link used" +-msgstr "hård länk misslyckades, använder symbolisk länk" ++#: timezone/zic.c:882 ++#, c-format ++msgid "%s: Can't read %s/%s: %s\n" ++msgstr "%s: Kan inte läsa %s/%s: %s\n" + +-#: timezone/zic.c:802 ++#: timezone/zic.c:889 timezone/zic.c:1828 + #, c-format +-msgid "%s: Can't read %s: %s\n" +-msgstr "%s: Kan inte läsa %s: %s\n" ++msgid "%s: Can't create %s/%s: %s\n" ++msgstr "%s: Kan inte skapa %s/%s: %s\n" + +-#: timezone/zic.c:810 timezone/zic.c:1701 ++#: timezone/zic.c:898 + #, c-format +-msgid "%s: Can't create %s: %s\n" +-msgstr "%s: Kan inte skapa %s: %s\n" ++msgid "copy used because hard link failed: %s" ++msgstr "kopiering använd eftersom en hård länk misslyckades: %s" + +-#: timezone/zic.c:818 +-msgid "link failed, copy used" +-msgstr "länka misslyckades, kopia skapad" ++#: timezone/zic.c:901 ++#, c-format ++msgid "copy used because symbolic link failed: %s" ++msgstr "kopiering använd eftersom en symbolisk länk misslyckades: %s" + +-#: timezone/zic.c:913 timezone/zic.c:915 ++#: timezone/zic.c:1013 timezone/zic.c:1015 + msgid "same rule name in multiple files" + msgstr "samma regelnamn i flera filer" + +-#: timezone/zic.c:956 ++#: timezone/zic.c:1056 + msgid "unruly zone" + msgstr "besvärlig zon" + +-#: timezone/zic.c:963 ++#: timezone/zic.c:1063 + #, c-format + msgid "%s in ruleless zone" + msgstr "%s i zon utan regler" + +-#: timezone/zic.c:983 ++#: timezone/zic.c:1083 + msgid "standard input" + msgstr "standard in" + +-#: timezone/zic.c:988 ++#: timezone/zic.c:1088 + #, c-format + msgid "%s: Can't open %s: %s\n" + msgstr "%s: Kan inte öppna %s: %s\n" + +-#: timezone/zic.c:999 ++#: timezone/zic.c:1099 + msgid "line too long" + msgstr "för lång rad" + +-#: timezone/zic.c:1019 ++#: timezone/zic.c:1119 + msgid "input line of unknown type" + msgstr "inrad av okänd typ" + +-#: timezone/zic.c:1034 ++#: timezone/zic.c:1134 + #, c-format + msgid "%s: Leap line in non leap seconds file %s" + msgstr "%s: \"Leap\"-rad i fil %s som inte är skottsekundsfil" + +-#: timezone/zic.c:1042 timezone/zic.c:1447 timezone/zic.c:1469 ++#: timezone/zic.c:1142 timezone/zic.c:1547 timezone/zic.c:1569 + #, c-format + msgid "%s: panic: Invalid l_value %d\n" + msgstr "%s: panik: Ogiltigt l_value %d\n" + +-#: timezone/zic.c:1051 ++#: timezone/zic.c:1151 + msgid "expected continuation line not found" + msgstr "förväntad fortsättningsrad inte funnen" + +-#: timezone/zic.c:1093 timezone/zic.c:2826 ++#: timezone/zic.c:1193 timezone/zic.c:2976 + msgid "time overflow" + msgstr "för stort tidsvärde" + +-#: timezone/zic.c:1098 ++#: timezone/zic.c:1198 + msgid "values over 24 hours not handled by pre-2007 versions of zic" + msgstr "värden större än 24 timmar hanteras inte av zic-versioner före 2007" + +-#: timezone/zic.c:1109 ++#: timezone/zic.c:1209 + msgid "wrong number of fields on Rule line" + msgstr "fel antal fält på \"Rule\"-rad" + +-#: timezone/zic.c:1113 ++#: timezone/zic.c:1213 + msgid "nameless rule" + msgstr "namnlös regel" + +-#: timezone/zic.c:1118 ++#: timezone/zic.c:1218 + msgid "invalid saved time" + msgstr "ogiltig sparad tid" + +-#: timezone/zic.c:1135 ++#: timezone/zic.c:1235 + msgid "wrong number of fields on Zone line" + msgstr "fel antal fält på \"Zone\"-rad" + +-#: timezone/zic.c:1140 ++#: timezone/zic.c:1240 + #, c-format + msgid "\"Zone %s\" line and -l option are mutually exclusive" + msgstr "\"Zone %s\"-rad och flaggan -l är ömsesidigt uteslutande" + +-#: timezone/zic.c:1146 ++#: timezone/zic.c:1246 + #, c-format + msgid "\"Zone %s\" line and -p option are mutually exclusive" + msgstr "\"Zone %s\"-rad och flaggan -p är ömsesidigt uteslutande" + +-#: timezone/zic.c:1154 ++#: timezone/zic.c:1253 + #, c-format +-msgid "duplicate zone name %s (file \"%s\", line %d)" +-msgstr "dubblerat zonnamn %s (fil \"%s\", rad %d)" ++msgid "duplicate zone name %s (file \"%s\", line %)" ++msgstr "dubblerat zonnamn %s (filen ”%s”, rad %)" + +-#: timezone/zic.c:1167 ++#: timezone/zic.c:1267 + msgid "wrong number of fields on Zone continuation line" + msgstr "fel antal fält på \"Zone\"-fortsättningsrad" + +-#: timezone/zic.c:1207 ++#: timezone/zic.c:1307 + msgid "invalid UT offset" + msgstr "ogiltigt UT-tillägg" + +-#: timezone/zic.c:1211 ++#: timezone/zic.c:1311 + msgid "invalid abbreviation format" + msgstr "ogiltigt förkortningsformat" + +-#: timezone/zic.c:1220 ++#: timezone/zic.c:1320 + #, c-format + msgid "format '%s' not handled by pre-2015 versions of zic" + msgstr "formatet ”%s” hanteras inte av versioner av zic före 2015" + +-#: timezone/zic.c:1247 ++#: timezone/zic.c:1347 + msgid "Zone continuation line end time is not after end time of previous line" + msgstr "Zon-fortsättningsradens sluttid är inte efter sluttiden på föregående rad" + +-#: timezone/zic.c:1274 ++#: timezone/zic.c:1374 + msgid "wrong number of fields on Leap line" + msgstr "fel antal fält på \"Leap\"-rad" + +-#: timezone/zic.c:1283 ++#: timezone/zic.c:1383 + msgid "invalid leaping year" + msgstr "ogiltigt skottår" + +-#: timezone/zic.c:1303 timezone/zic.c:1401 ++#: timezone/zic.c:1403 timezone/zic.c:1501 + msgid "invalid month name" + msgstr "ogiltigt månadsnamn" + +-#: timezone/zic.c:1316 timezone/zic.c:1514 timezone/zic.c:1528 ++#: timezone/zic.c:1416 timezone/zic.c:1614 timezone/zic.c:1628 + msgid "invalid day of month" + msgstr "ogiltig dag i månaden" + +-#: timezone/zic.c:1321 ++#: timezone/zic.c:1421 + msgid "time too small" + msgstr "tid för kort" + +-#: timezone/zic.c:1325 ++#: timezone/zic.c:1425 + msgid "time too large" + msgstr "tid för lång" + +-#: timezone/zic.c:1329 timezone/zic.c:1430 ++#: timezone/zic.c:1429 timezone/zic.c:1530 + msgid "invalid time of day" + msgstr "ogiltig tid på dagen" + +-#: timezone/zic.c:1348 ++#: timezone/zic.c:1448 + msgid "illegal CORRECTION field on Leap line" + msgstr "otillåtet \"CORRECTION\"-fält på \"Leap\"-rad" + +-#: timezone/zic.c:1353 ++#: timezone/zic.c:1453 + msgid "illegal Rolling/Stationary field on Leap line" + msgstr "otillåtet \"Rolling/Stationary\"-fält på \"Leap\"-rad" + +-#: timezone/zic.c:1359 ++#: timezone/zic.c:1459 + msgid "leap second precedes Big Bang" + msgstr "skottsekund föregår Big Bang" + +-#: timezone/zic.c:1372 ++#: timezone/zic.c:1472 + msgid "wrong number of fields on Link line" + msgstr "fel antal fält på \"Link\"-rad" + +-#: timezone/zic.c:1376 ++#: timezone/zic.c:1476 + msgid "blank FROM field on Link line" + msgstr "tomt \"FROM\"-fält på \"Link\"-rad" + +-#: timezone/zic.c:1451 ++#: timezone/zic.c:1551 + msgid "invalid starting year" + msgstr "ogiltigt startår" + +-#: timezone/zic.c:1473 ++#: timezone/zic.c:1573 + msgid "invalid ending year" + msgstr "ogiltigt slutår" + +-#: timezone/zic.c:1477 ++#: timezone/zic.c:1577 + msgid "starting year greater than ending year" + msgstr "startår är större än slutår" + +-#: timezone/zic.c:1484 ++#: timezone/zic.c:1584 + msgid "typed single year" + msgstr "satte typ på endast ett år" + +-#: timezone/zic.c:1519 ++#: timezone/zic.c:1619 + msgid "invalid weekday name" + msgstr "ogiltigt veckodagsnamn" + +-#: timezone/zic.c:1638 ++#: timezone/zic.c:1743 ++#, c-format ++msgid "reference clients mishandle more than %d transition times" ++msgstr "referensklienter hanterar fler än %d övergångstider felaktigt" ++ ++#: timezone/zic.c:1747 + msgid "pre-2014 clients may mishandle more than 1200 transition times" + msgstr "klienter från före 2014 kan hantera fler än 1200 övergångstider felaktigt" + +-#: timezone/zic.c:1691 +-#, c-format +-msgid "%s: Can't remove %s: %s\n" +-msgstr "%s: Kan inte ta bort %s: %s\n" ++#: timezone/zic.c:1858 ++msgid "too many transition times" ++msgstr "för många övergångstider" + +-#: timezone/zic.c:1918 ++#: timezone/zic.c:2047 + #, c-format + msgid "%%z UTC offset magnitude exceeds 99:59:59" + msgstr "%%z storleken på avståndet från UTC överstiger 99.59.59" + +-#: timezone/zic.c:2291 ++#: timezone/zic.c:2424 + msgid "no POSIX environment variable for zone" + msgstr "ingen POSIX-miljövariabel för zon" + +-#: timezone/zic.c:2297 ++#: timezone/zic.c:2430 + #, c-format + msgid "%s: pre-%d clients may mishandle distant timestamps" + msgstr "%s: klienter före %d kan hantera avlägsna tidsstämplar felaktigt" + +-#: timezone/zic.c:2428 ++#: timezone/zic.c:2566 + msgid "two rules for same instant" + msgstr "två regler för samma tillfälle" + +-#: timezone/zic.c:2485 ++#: timezone/zic.c:2627 + msgid "can't determine time zone abbreviation to use just after until time" + msgstr "kan inte avgöra tidszonsförkortning att använda just efter \"until\"-tid" + +-#: timezone/zic.c:2531 timezone/zic.c:2593 ++#: timezone/zic.c:2725 + msgid "too many local time types" + msgstr "för många lokala tidstyper" + +-#: timezone/zic.c:2597 ++#: timezone/zic.c:2729 + msgid "UT offset out of range" + msgstr "UT-offset utanför giltigt intervall" + +-#: timezone/zic.c:2621 ++#: timezone/zic.c:2753 + msgid "too many leap seconds" + msgstr "för många skottsekunder" + +-#: timezone/zic.c:2627 ++#: timezone/zic.c:2759 + msgid "repeated leap second moment" + msgstr "upprepat skottsekundstillfälle" + +-#: timezone/zic.c:2677 ++#: timezone/zic.c:2830 + msgid "Wild result from command execution" + msgstr "Vilt resultat från kommandokörning" + +-#: timezone/zic.c:2678 ++#: timezone/zic.c:2831 + #, c-format + msgid "%s: command was '%s', result was %d\n" + msgstr "%s: kommandot var \"%s\", resultatet blev %d\n" + +-#: timezone/zic.c:2810 ++#: timezone/zic.c:2961 + msgid "Odd number of quotation marks" + msgstr "Ojämnt antal citationstecken" + +-#: timezone/zic.c:2896 ++#: timezone/zic.c:3046 + msgid "use of 2/29 in non leap-year" + msgstr "använder 29/2 i icke-skottår" + +-#: timezone/zic.c:2931 ++#: timezone/zic.c:3081 + msgid "rule goes past start/end of month; will not work with pre-2004 versions of zic" + msgstr "regeln går utanför start/slut på månad; fungerar inte med versioner av zic före 2004" + +-#: timezone/zic.c:2958 ++#: timezone/zic.c:3108 + msgid "time zone abbreviation has fewer than 3 characters" + msgstr "tidszonsförkortning har färre än 3 tecken" + +-#: timezone/zic.c:2960 ++#: timezone/zic.c:3110 + msgid "time zone abbreviation has too many characters" + msgstr "tidszonsförkortning har för många tecken" + +-#: timezone/zic.c:2962 ++#: timezone/zic.c:3112 + msgid "time zone abbreviation differs from POSIX standard" + msgstr "tidszonsförkortning skiljer sig från POSIX-standarden" + +-#: timezone/zic.c:2968 ++#: timezone/zic.c:3118 + msgid "too many, or too long, time zone abbreviations" + msgstr "för många eller för långa tidszonsförkortningar" + +-#: timezone/zic.c:3004 ++#: timezone/zic.c:3161 + #, c-format + msgid "%s: Can't create directory %s: %s" + msgstr "%s: Kan inte skapa katalog %s: %s" +diff --git a/posix/Makefile b/posix/Makefile +index 33abcaed7a..d35b7921b1 100644 +--- a/posix/Makefile ++++ b/posix/Makefile +@@ -45,7 +45,7 @@ routines := \ + getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \ + getresuid getresgid setresuid setresgid \ + pathconf sysconf fpathconf \ +- glob glob64 fnmatch regex \ ++ glob glob64 globfree globfree64 glob_pattern_p fnmatch regex \ + confstr \ + getopt getopt1 \ + sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \ +@@ -93,7 +93,7 @@ tests := test-errno tstgetopt testfnm runtests runptests \ + tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \ + tst-posix_spawn-fd tst-posix_spawn-setsid \ + tst-posix_fadvise tst-posix_fadvise64 \ +- tst-sysconf-empty-chroot ++ tst-sysconf-empty-chroot tst-glob-tilde + tests-internal := bug-regex5 bug-regex20 bug-regex33 \ + tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 + xtests := bug-ga2 +@@ -141,7 +141,8 @@ tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \ + $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \ + $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \ + $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \ +- $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out ++ $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out \ ++ $(objpfx)tst-glob-tilde-mem.out + xtests-special += $(objpfx)bug-ga2-mem.out + endif + +@@ -350,6 +351,12 @@ $(objpfx)bug-glob2-mem.out: $(objpfx)bug-glob2.out + $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@; \ + $(evaluate-test) + ++tst-glob-tilde-ENV = MALLOC_TRACE=$(objpfx)tst-glob-tilde.mtrace ++ ++$(objpfx)tst-glob-tilde-mem.out: $(objpfx)tst-glob-tilde.out ++ $(common-objpfx)malloc/mtrace $(objpfx)tst-glob-tilde.mtrace > $@; \ ++ $(evaluate-test) ++ + $(inst_libexecdir)/getconf: $(inst_bindir)/getconf \ + $(objpfx)getconf.speclist FORCE + $(addprefix $(..)./scripts/mkinstalldirs ,\ +diff --git a/posix/flexmember.h b/posix/flexmember.h +new file mode 100644 +index 0000000000..107c1f09e9 +--- /dev/null ++++ b/posix/flexmember.h +@@ -0,0 +1,45 @@ ++/* Sizes of structs with flexible array members. ++ ++ Copyright 2016-2017 Free Software Foundation, Inc. ++ ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . ++ ++ Written by Paul Eggert. */ ++ ++#include ++ ++/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below. ++ On older platforms without _Alignof, use a pessimistic bound that is ++ safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1. ++ On newer platforms, use _Alignof to get a tighter bound. */ ++ ++#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 ++# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1)) ++#else ++# define FLEXALIGNOF(type) _Alignof (type) ++#endif ++ ++/* Upper bound on the size of a struct of type TYPE with a flexible ++ array member named MEMBER that is followed by N bytes of other data. ++ This is not simply sizeof (TYPE) + N, since it may require ++ alignment on unusually picky C11 platforms, and ++ FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. ++ Yield a value less than N if and only if arithmetic overflow occurs. */ ++ ++#define FLEXSIZEOF(type, member, n) \ ++ ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \ ++ & ~ (FLEXALIGNOF (type) - 1)) +diff --git a/posix/glob.c b/posix/glob.c +index c653809118..c761c0861d 100644 +--- a/posix/glob.c ++++ b/posix/glob.c +@@ -15,7 +15,7 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef HAVE_CONFIG_H ++#ifndef _LIBC + # include + #endif + +@@ -27,29 +27,15 @@ + #include + #include + #include +- +-/* Outcomment the following line for production quality code. */ +-/* #define NDEBUG 1 */ + #include ++#include + +-#include /* Needed on stupid SunOS for assert. */ +- +-#if !defined _LIBC || !defined GLOB_ONLY_P +-#if defined HAVE_UNISTD_H || defined _LIBC +-# include +-# ifndef POSIX +-# ifdef _POSIX_VERSION +-# define POSIX +-# endif +-# endif ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++# define WINDOWS32 + #endif + +-#include +- +-#if defined HAVE_STDINT_H || defined _LIBC +-# include +-#elif !defined UINTPTR_MAX +-# define UINTPTR_MAX (~((size_t) 0)) ++#ifndef WINDOWS32 ++# include + #endif + + #include +@@ -57,24 +43,7 @@ + # define __set_errno(val) errno = (val) + #endif + +-#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ +-# include +-#else +-# define dirent direct +-# ifdef HAVE_SYS_NDIR_H +-# include +-# endif +-# ifdef HAVE_SYS_DIR_H +-# include +-# endif +-# ifdef HAVE_NDIR_H +-# include +-# endif +-# ifdef HAVE_VMSDIR_H +-# include "vmsdir.h" +-# endif /* HAVE_VMSDIR_H */ +-#endif +- ++#include + #include + #include + #include +@@ -87,27 +56,29 @@ + # define opendir(name) __opendir (name) + # define readdir(str) __readdir64 (str) + # define getpwnam_r(name, bufp, buf, len, res) \ +- __getpwnam_r (name, bufp, buf, len, res) ++ __getpwnam_r (name, bufp, buf, len, res) + # ifndef __stat64 + # define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf) + # endif + # define struct_stat64 struct stat64 ++# define FLEXIBLE_ARRAY_MEMBER + #else /* !_LIBC */ +-# include "getlogin_r.h" +-# include "mempcpy.h" +-# include "stat-macros.h" +-# include "strdup.h" +-# define __stat64(fname, buf) stat (fname, buf) +-# define struct_stat64 struct stat +-# define __stat(fname, buf) stat (fname, buf) +-# define __alloca alloca +-# define __readdir readdir +-# define __readdir64 readdir64 +-# define __glob_pattern_p glob_pattern_p ++# define __getlogin_r(buf, len) getlogin_r (buf, len) ++# define __stat64(fname, buf) stat (fname, buf) ++# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag) ++# define struct_stat64 struct stat ++# ifndef __MVS__ ++# define __alloca alloca ++# endif ++# define __readdir readdir ++# define COMPILE_GLOB64 + #endif /* _LIBC */ + + #include + ++#include ++#include ++ + #ifdef _SC_GETPW_R_SIZE_MAX + # define GETPW_R_SIZE_MAX() sysconf (_SC_GETPW_R_SIZE_MAX) + #else +@@ -121,61 +92,59 @@ + + static const char *next_brace_sub (const char *begin, int flags) __THROWNL; + ++typedef uint_fast8_t dirent_type; ++ ++#if !defined _LIBC && !defined HAVE_STRUCT_DIRENT_D_TYPE ++/* Any distinct values will do here. ++ Undef any existing macros out of the way. */ ++# undef DT_UNKNOWN ++# undef DT_DIR ++# undef DT_LNK ++# define DT_UNKNOWN 0 ++# define DT_DIR 1 ++# define DT_LNK 2 ++#endif ++ + /* A representation of a directory entry which does not depend on the + layout of struct dirent, or the size of ino_t. */ + struct readdir_result + { + const char *name; +-# if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE +- uint8_t type; +-# endif ++#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE ++ dirent_type type; ++#endif ++#if defined _LIBC || defined D_INO_IN_DIRENT + bool skip_entry; ++#endif + }; + +-# if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE +-/* Initializer based on the d_type member of struct dirent. */ +-# define D_TYPE_TO_RESULT(source) (source)->d_type, +- +-/* True if the directory entry D might be a symbolic link. */ +-static bool +-readdir_result_might_be_symlink (struct readdir_result d) +-{ +- return d.type == DT_UNKNOWN || d.type == DT_LNK; +-} +- +-/* True if the directory entry D might be a directory. */ +-static bool +-readdir_result_might_be_dir (struct readdir_result d) +-{ +- return d.type == DT_DIR || readdir_result_might_be_symlink (d); +-} +-# else /* defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE */ +-# define D_TYPE_TO_RESULT(source) +- +-/* If we do not have type information, symbolic links and directories +- are always a possibility. */ +- +-static bool +-readdir_result_might_be_symlink (struct readdir_result d) ++/* Initialize and return type member of struct readdir_result. */ ++static dirent_type ++readdir_result_type (struct readdir_result d) + { +- return true; ++#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE ++# define D_TYPE_TO_RESULT(source) (source)->d_type, ++ return d.type; ++#else ++# define D_TYPE_TO_RESULT(source) ++ return DT_UNKNOWN; ++#endif + } + ++/* Initialize and return skip_entry member of struct readdir_result. */ + static bool +-readdir_result_might_be_dir (struct readdir_result d) ++readdir_result_skip_entry (struct readdir_result d) + { +- return true; +-} +- +-# endif /* defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE */ +- +-# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ + /* Initializer for skip_entry. POSIX does not require that the d_ino + field be present, and some systems do not provide it. */ +-# define D_INO_TO_RESULT(source) false, +-# else +-# define D_INO_TO_RESULT(source) (source)->d_ino == 0, +-# endif ++#if defined _LIBC || defined D_INO_IN_DIRENT ++# define D_INO_TO_RESULT(source) (source)->d_ino == 0, ++ return d.skip_entry; ++#else ++# define D_INO_TO_RESULT(source) ++ return false; ++#endif ++} + + /* Construct an initializer for a struct readdir_result object from a + struct dirent *. No copy of the name is made. */ +@@ -186,8 +155,6 @@ readdir_result_might_be_dir (struct readdir_result d) + D_INO_TO_RESULT (source) \ + } + +-#endif /* !defined _LIBC || !defined GLOB_ONLY_P */ +- + /* Call gl_readdir on STREAM. This macro can be overridden to reduce + type safety if an old interface version needs to be supported. */ + #ifndef GL_READDIR +@@ -225,18 +192,55 @@ convert_dirent64 (const struct dirent64 *source) + } + #endif + ++#ifndef _LIBC ++/* The results of opendir() in this file are not used with dirfd and fchdir, ++ and we do not leak fds to any single-threaded code that could use stdio, ++ therefore save some unnecessary recursion in fchdir.c and opendir_safer.c. ++ FIXME - if the kernel ever adds support for multi-thread safety for ++ avoiding standard fds, then we should use opendir_safer. */ ++# ifdef GNULIB_defined_opendir ++# undef opendir ++# endif ++# ifdef GNULIB_defined_closedir ++# undef closedir ++# endif + +-#ifndef attribute_hidden +-# define attribute_hidden ++/* Just use malloc. */ ++# define __libc_use_alloca(n) false ++# define alloca_account(len, avar) ((void) (len), (void) (avar), (void *) 0) ++# define extend_alloca_account(buf, len, newlen, avar) \ ++ ((void) (buf), (void) (len), (void) (newlen), (void) (avar), (void *) 0) + #endif + ++/* Set *R = A + B. Return true if the answer is mathematically ++ incorrect due to overflow; in this case, *R is the low order ++ bits of the correct answer. */ ++ ++static bool ++size_add_wrapv (size_t a, size_t b, size_t *r) ++{ ++#if 5 <= __GNUC__ && !defined __ICC ++ return __builtin_add_overflow (a, b, r); ++#else ++ *r = a + b; ++ return *r < a; ++#endif ++} ++ ++static bool ++glob_use_alloca (size_t alloca_used, size_t len) ++{ ++ size_t size; ++ return (!size_add_wrapv (alloca_used, len, &size) ++ && __libc_use_alloca (size)); ++} ++ + static int glob_in_dir (const char *pattern, const char *directory, + int flags, int (*errfunc) (const char *, int), + glob_t *pglob, size_t alloca_used); + extern int __glob_pattern_type (const char *pattern, int quote) + attribute_hidden; + +-#if !defined _LIBC || !defined GLOB_ONLY_P + static int prefix_array (const char *prefix, char **array, size_t n) __THROWNL; + static int collated_compare (const void *, const void *) __THROWNL; + +@@ -265,16 +269,15 @@ next_brace_sub (const char *cp, int flags) + return *cp != '\0' ? cp : NULL; + } + +-#endif /* !defined _LIBC || !defined GLOB_ONLY_P */ + + /* Do glob searching for PATTERN, placing results in PGLOB. + The bits defined above may be set in FLAGS. + If a directory cannot be opened or read and ERRFUNC is not nil, + it is called with the pathname that caused the error, and the +- `errno' value from the failing call; if it returns non-zero +- `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. ++ 'errno' value from the failing call; if it returns non-zero ++ 'glob' returns GLOB_ABORTED; if it returns zero, the error is ignored. + If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. +- Otherwise, `glob' returns zero. */ ++ Otherwise, 'glob' returns zero. */ + int + #ifdef GLOB_ATTRIBUTE + GLOB_ATTRIBUTE +@@ -292,9 +295,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + int malloc_dirname = 0; + glob_t dirs; + int retval = 0; +-#ifdef _LIBC + size_t alloca_used = 0; +-#endif + + if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) + { +@@ -308,7 +309,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + flags |= GLOB_ONLYDIR; + + if (!(flags & GLOB_DOOFFS)) +- /* Have to do this so `globfree' knows where to start freeing. It ++ /* Have to do this so 'globfree' knows where to start freeing. It + also makes all the code that uses gl_offs simpler. */ + pglob->gl_offs = 0; + +@@ -372,14 +373,12 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + size_t rest_len; + char *onealt; + size_t pattern_len = strlen (pattern) - 1; +-#ifdef _LIBC +- int alloca_onealt = __libc_use_alloca (alloca_used + pattern_len); ++ int alloca_onealt = glob_use_alloca (alloca_used, pattern_len); + if (alloca_onealt) + onealt = alloca_account (pattern_len, alloca_used); + else +-#endif + { +- onealt = (char *) malloc (pattern_len); ++ onealt = malloc (pattern_len); + if (onealt == NULL) + return GLOB_NOSPACE; + } +@@ -392,11 +391,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + next = next_brace_sub (begin + 1, flags); + if (next == NULL) + { +- /* It is an illegal expression. */ ++ /* It is an invalid expression. */ + illegal_brace: +-#ifdef _LIBC + if (__glibc_unlikely (!alloca_onealt)) +-#endif + free (onealt); + flags &= ~GLOB_BRACE; + goto no_brace; +@@ -437,9 +434,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + /* If we got an error, return it. */ + if (result && result != GLOB_NOMATCH) + { +-#ifdef _LIBC + if (__glibc_unlikely (!alloca_onealt)) +-#endif + free (onealt); + if (!(flags & GLOB_APPEND)) + { +@@ -458,9 +453,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + assert (next != NULL); + } + +-#ifdef _LIBC + if (__glibc_unlikely (!alloca_onealt)) +-#endif + free (onealt); + + if (pglob->gl_pathc != firstc) +@@ -476,14 +469,16 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + + /* Find the filename. */ + filename = strrchr (pattern, '/'); ++ + #if defined __MSDOS__ || defined WINDOWS32 +- /* The case of "d:pattern". Since `:' is not allowed in ++ /* The case of "d:pattern". Since ':' is not allowed in + file names, we can safely assume that wherever it + happens in pattern, it signals the filename part. This + is so we could some day support patterns like "[a-z]:foo". */ + if (filename == NULL) + filename = strchr (pattern, ':'); + #endif /* __MSDOS__ || WINDOWS32 */ ++ + dirname_modified = 0; + if (filename == NULL) + { +@@ -508,11 +503,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + } + + filename = pattern; +-#ifdef _AMIGA +- dirname = (char *) ""; +-#else + dirname = (char *) "."; +-#endif + dirlen = 0; + } + } +@@ -536,22 +527,21 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + char *drive_spec; + + ++dirlen; +- drive_spec = (char *) __alloca (dirlen + 1); ++ drive_spec = __alloca (dirlen + 1); + *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0'; + /* For now, disallow wildcards in the drive spec, to + prevent infinite recursion in glob. */ + if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE))) + return GLOB_NOMATCH; +- /* If this is "d:pattern", we need to copy `:' to DIRNAME ++ /* If this is "d:pattern", we need to copy ':' to DIRNAME + as well. If it's "d:/pattern", don't remove the slash + from "d:/", since "d:" and "d:/" are not the same.*/ + } + #endif +-#ifdef _LIBC +- if (__libc_use_alloca (alloca_used + dirlen + 1)) ++ ++ if (glob_use_alloca (alloca_used, dirlen + 1)) + newp = alloca_account (dirlen + 1, alloca_used); + else +-#endif + { + newp = malloc (dirlen + 1); + if (newp == NULL) +@@ -562,14 +552,17 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + dirname = newp; + ++filename; + +- if (filename[0] == '\0' + #if defined __MSDOS__ || defined WINDOWS32 +- && dirname[dirlen - 1] != ':' +- && (dirlen < 3 || dirname[dirlen - 2] != ':' +- || dirname[dirlen - 1] != '/') ++ bool drive_root = (dirlen > 1 ++ && (dirname[dirlen - 1] == ':' ++ || (dirlen > 2 && dirname[dirlen - 2] == ':' ++ && dirname[dirlen - 1] == '/'))); ++#else ++ bool drive_root = false; + #endif +- && dirlen > 1) +- /* "pattern/". Expand "pattern", appending slashes. */ ++ ++ if (filename[0] == '\0' && dirlen > 1 && !drive_root) ++ /* "pattern/". Expand "pattern", appending slashes. */ + { + int orig_flags = flags; + if (!(flags & GLOB_NOESCAPE) && dirname[dirlen - 1] == '\\') +@@ -602,7 +595,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + } + } + +-#ifndef VMS + if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') + { + if (dirname[1] == '\0' || dirname[1] == '/' +@@ -612,100 +604,127 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + /* Look up home directory. */ + char *home_dir = getenv ("HOME"); + int malloc_home_dir = 0; +-# ifdef _AMIGA +- if (home_dir == NULL || home_dir[0] == '\0') +- home_dir = "SYS:"; +-# else +-# ifdef WINDOWS32 +- if (home_dir == NULL || home_dir[0] == '\0') +- home_dir = "c:/users/default"; /* poor default */ +-# else + if (home_dir == NULL || home_dir[0] == '\0') + { ++#ifdef WINDOWS32 ++ /* Windows NT defines HOMEDRIVE and HOMEPATH. But give ++ preference to HOME, because the user can change HOME. */ ++ const char *home_drive = getenv ("HOMEDRIVE"); ++ const char *home_path = getenv ("HOMEPATH"); ++ ++ if (home_drive != NULL && home_path != NULL) ++ { ++ size_t home_drive_len = strlen (home_drive); ++ size_t home_path_len = strlen (home_path); ++ char *mem = alloca (home_drive_len + home_path_len + 1); ++ ++ memcpy (mem, home_drive, home_drive_len); ++ memcpy (mem + home_drive_len, home_path, home_path_len + 1); ++ home_dir = mem; ++ } ++ else ++ home_dir = "c:/users/default"; /* poor default */ ++#else + int success; + char *name; ++ int malloc_name = 0; + size_t buflen = GET_LOGIN_NAME_MAX () + 1; + + if (buflen == 0) +- /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try ++ /* 'sysconf' does not support _SC_LOGIN_NAME_MAX. Try + a moderate value. */ + buflen = 20; +- name = alloca_account (buflen, alloca_used); ++ if (glob_use_alloca (alloca_used, buflen)) ++ name = alloca_account (buflen, alloca_used); ++ else ++ { ++ name = malloc (buflen); ++ if (name == NULL) ++ { ++ retval = GLOB_NOSPACE; ++ goto out; ++ } ++ malloc_name = 1; ++ } + + success = __getlogin_r (name, buflen) == 0; + if (success) + { + struct passwd *p; +-# if defined HAVE_GETPWNAM_R || defined _LIBC +- long int pwbuflen = GETPW_R_SIZE_MAX (); ++ char *malloc_pwtmpbuf = NULL; + char *pwtmpbuf; ++# if defined HAVE_GETPWNAM_R || defined _LIBC ++ long int pwbuflenmax = GETPW_R_SIZE_MAX (); ++ size_t pwbuflen = pwbuflenmax; + struct passwd pwbuf; +- int malloc_pwtmpbuf = 0; + int save = errno; + +-# ifndef _LIBC +- if (pwbuflen == -1) +- /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. ++# ifndef _LIBC ++ if (! (0 < pwbuflenmax && pwbuflenmax <= SIZE_MAX)) ++ /* 'sysconf' does not support _SC_GETPW_R_SIZE_MAX. + Try a moderate value. */ + pwbuflen = 1024; +-# endif +- if (__libc_use_alloca (alloca_used + pwbuflen)) ++# endif ++ if (glob_use_alloca (alloca_used, pwbuflen)) + pwtmpbuf = alloca_account (pwbuflen, alloca_used); + else + { + pwtmpbuf = malloc (pwbuflen); + if (pwtmpbuf == NULL) + { ++ if (__glibc_unlikely (malloc_name)) ++ free (name); + retval = GLOB_NOSPACE; + goto out; + } +- malloc_pwtmpbuf = 1; ++ malloc_pwtmpbuf = pwtmpbuf; + } + + while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) + != 0) + { ++ size_t newlen; ++ bool v; + if (errno != ERANGE) + { + p = NULL; + break; + } +- +- if (!malloc_pwtmpbuf +- && __libc_use_alloca (alloca_used +- + 2 * pwbuflen)) ++ v = size_add_wrapv (pwbuflen, pwbuflen, &newlen); ++ if (!v && malloc_pwtmpbuf == NULL ++ && glob_use_alloca (alloca_used, newlen)) + pwtmpbuf = extend_alloca_account (pwtmpbuf, pwbuflen, +- 2 * pwbuflen, +- alloca_used); ++ newlen, alloca_used); + else + { +- char *newp = realloc (malloc_pwtmpbuf +- ? pwtmpbuf : NULL, +- 2 * pwbuflen); ++ char *newp = (v ? NULL ++ : realloc (malloc_pwtmpbuf, newlen)); + if (newp == NULL) + { +- if (__glibc_unlikely (malloc_pwtmpbuf)) +- free (pwtmpbuf); ++ free (malloc_pwtmpbuf); ++ if (__glibc_unlikely (malloc_name)) ++ free (name); + retval = GLOB_NOSPACE; + goto out; + } +- pwtmpbuf = newp; +- pwbuflen = 2 * pwbuflen; +- malloc_pwtmpbuf = 1; ++ malloc_pwtmpbuf = pwtmpbuf = newp; + } ++ pwbuflen = newlen; + __set_errno (save); + } +-# else ++# else + p = getpwnam (name); +-# endif ++# endif ++ if (__glibc_unlikely (malloc_name)) ++ free (name); + if (p != NULL) + { +- if (!malloc_pwtmpbuf) ++ if (malloc_pwtmpbuf == NULL) + home_dir = p->pw_dir; + else + { + size_t home_dir_len = strlen (p->pw_dir) + 1; +- if (__libc_use_alloca (alloca_used + home_dir_len)) ++ if (glob_use_alloca (alloca_used, home_dir_len)) + home_dir = alloca_account (home_dir_len, + alloca_used); + else +@@ -720,26 +739,32 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + malloc_home_dir = 1; + } + memcpy (home_dir, p->pw_dir, home_dir_len); +- +- free (pwtmpbuf); + } + } ++ free (malloc_pwtmpbuf); + } ++ else ++ { ++ if (__glibc_unlikely (malloc_name)) ++ free (name); ++ } ++#endif /* WINDOWS32 */ + } + if (home_dir == NULL || home_dir[0] == '\0') + { ++ if (__glibc_unlikely (malloc_home_dir)) ++ free (home_dir); + if (flags & GLOB_TILDE_CHECK) + { +- if (__glibc_unlikely (malloc_home_dir)) +- free (home_dir); + retval = GLOB_NOMATCH; + goto out; + } + else +- home_dir = (char *) "~"; /* No luck. */ ++ { ++ home_dir = (char *) "~"; /* No luck. */ ++ malloc_home_dir = 0; ++ } + } +-# endif /* WINDOWS32 */ +-# endif + /* Now construct the full directory. */ + if (dirname[1] == '\0') + { +@@ -754,8 +779,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + { + char *newp; + size_t home_len = strlen (home_dir); +- int use_alloca = __libc_use_alloca (alloca_used +- + home_len + dirlen); ++ int use_alloca = glob_use_alloca (alloca_used, home_len + dirlen); + if (use_alloca) + newp = alloca_account (home_len + dirlen, alloca_used); + else +@@ -779,12 +803,15 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + dirname = newp; + dirlen += home_len - 1; + malloc_dirname = !use_alloca; ++ ++ if (__glibc_unlikely (malloc_home_dir)) ++ free (home_dir); + } + dirname_modified = 1; + } +-# if !defined _AMIGA && !defined WINDOWS32 + else + { ++#ifndef WINDOWS32 + char *end_name = strchr (dirname, '/'); + char *user_name; + int malloc_user_name = 0; +@@ -806,7 +833,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + else + { + char *newp; +- if (__libc_use_alloca (alloca_used + (end_name - dirname))) ++ if (glob_use_alloca (alloca_used, end_name - dirname)) + newp = alloca_account (end_name - dirname, alloca_used); + else + { +@@ -843,7 +870,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + *p = '\0'; + } + else +- *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) ++ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1)) + = '\0'; + user_name = newp; + } +@@ -851,20 +878,21 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + /* Look up specific user's home directory. */ + { + struct passwd *p; ++ char *malloc_pwtmpbuf = NULL; + # if defined HAVE_GETPWNAM_R || defined _LIBC +- long int buflen = GETPW_R_SIZE_MAX (); ++ long int buflenmax = GETPW_R_SIZE_MAX (); ++ size_t buflen = buflenmax; + char *pwtmpbuf; +- int malloc_pwtmpbuf = 0; + struct passwd pwbuf; + int save = errno; + + # ifndef _LIBC +- if (buflen == -1) +- /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a ++ if (! (0 <= buflenmax && buflenmax <= SIZE_MAX)) ++ /* Perhaps 'sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a + moderate value. */ + buflen = 1024; + # endif +- if (__libc_use_alloca (alloca_used + buflen)) ++ if (glob_use_alloca (alloca_used, buflen)) + pwtmpbuf = alloca_account (buflen, alloca_used); + else + { +@@ -877,32 +905,32 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + retval = GLOB_NOSPACE; + goto out; + } +- malloc_pwtmpbuf = 1; ++ malloc_pwtmpbuf = pwtmpbuf; + } + + while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0) + { ++ size_t newlen; ++ bool v; + if (errno != ERANGE) + { + p = NULL; + break; + } +- if (!malloc_pwtmpbuf +- && __libc_use_alloca (alloca_used + 2 * buflen)) ++ v = size_add_wrapv (buflen, buflen, &newlen); ++ if (!v && malloc_pwtmpbuf == NULL ++ && glob_use_alloca (alloca_used, newlen)) + pwtmpbuf = extend_alloca_account (pwtmpbuf, buflen, +- 2 * buflen, alloca_used); ++ newlen, alloca_used); + else + { +- char *newp = realloc (malloc_pwtmpbuf ? pwtmpbuf : NULL, +- 2 * buflen); ++ char *newp = v ? NULL : realloc (malloc_pwtmpbuf, newlen); + if (newp == NULL) + { +- if (__glibc_unlikely (malloc_pwtmpbuf)) +- free (pwtmpbuf); ++ free (malloc_pwtmpbuf); + goto nomem_getpw; + } +- pwtmpbuf = newp; +- malloc_pwtmpbuf = 1; ++ malloc_pwtmpbuf = pwtmpbuf = newp; + } + __set_errno (save); + } +@@ -923,7 +951,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + free (dirname); + malloc_dirname = 0; + +- if (__libc_use_alloca (alloca_used + home_len + rest_len + 1)) ++ if (glob_use_alloca (alloca_used, home_len + rest_len + 1)) + dirname = alloca_account (home_len + rest_len + 1, + alloca_used); + else +@@ -931,8 +959,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + dirname = malloc (home_len + rest_len + 1); + if (dirname == NULL) + { +- if (__glibc_unlikely (malloc_pwtmpbuf)) +- free (pwtmpbuf); ++ free (malloc_pwtmpbuf); + retval = GLOB_NOSPACE; + goto out; + } +@@ -944,24 +971,24 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + dirlen = home_len + rest_len; + dirname_modified = 1; + +- if (__glibc_unlikely (malloc_pwtmpbuf)) +- free (pwtmpbuf); ++ free (malloc_pwtmpbuf); + } + else + { +- if (__glibc_unlikely (malloc_pwtmpbuf)) +- free (pwtmpbuf); ++ free (malloc_pwtmpbuf); + + if (flags & GLOB_TILDE_CHECK) +- /* We have to regard it as an error if we cannot find the +- home directory. */ +- return GLOB_NOMATCH; ++ { ++ /* We have to regard it as an error if we cannot find the ++ home directory. */ ++ retval = GLOB_NOMATCH; ++ goto out; ++ } + } + } ++#endif /* !WINDOWS32 */ + } +-# endif /* Not Amiga && not WINDOWS32. */ + } +-#endif /* Not VMS. */ + + /* Now test whether we looked for "~" or "~NAME". In this case we + can give the answer now. */ +@@ -980,19 +1007,18 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + size_t newcount = pglob->gl_pathc + pglob->gl_offs; + char **new_gl_pathv; + +- if (newcount > UINTPTR_MAX - (1 + 1) +- || newcount + 1 + 1 > ~((size_t) 0) / sizeof (char *)) ++ if (newcount > SIZE_MAX / sizeof (char *) - 2) + { + nospace: + free (pglob->gl_pathv); + pglob->gl_pathv = NULL; + pglob->gl_pathc = 0; +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + +- new_gl_pathv +- = (char **) realloc (pglob->gl_pathv, +- (newcount + 1 + 1) * sizeof (char *)); ++ new_gl_pathv = realloc (pglob->gl_pathv, ++ (newcount + 2) * sizeof (char *)); + if (new_gl_pathv == NULL) + goto nospace; + pglob->gl_pathv = new_gl_pathv; +@@ -1006,12 +1032,19 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen); + p[0] = '/'; + p[1] = '\0'; ++ if (__glibc_unlikely (malloc_dirname)) ++ free (dirname); + } + else + { +- pglob->gl_pathv[newcount] = strdup (dirname); +- if (pglob->gl_pathv[newcount] == NULL) +- goto nospace; ++ if (__glibc_unlikely (malloc_dirname)) ++ pglob->gl_pathv[newcount] = dirname; ++ else ++ { ++ pglob->gl_pathv[newcount] = strdup (dirname); ++ if (pglob->gl_pathv[newcount] == NULL) ++ goto nospace; ++ } + } + pglob->gl_pathv[++newcount] = NULL; + ++pglob->gl_pathc; +@@ -1021,7 +1054,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + } + + /* Not found. */ +- return GLOB_NOMATCH; ++ retval = GLOB_NOMATCH; ++ goto out; + } + + meta = __glob_pattern_type (dirname, !(flags & GLOB_NOESCAPE)); +@@ -1067,7 +1101,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + if (status != 0) + { + if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH) +- return status; ++ { ++ retval = status; ++ goto out; ++ } + goto no_matches; + } + +@@ -1078,19 +1115,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + { + size_t old_pathc; + +-#ifdef SHELL +- { +- /* Make globbing interruptible in the bash shell. */ +- extern int interrupt_state; +- +- if (interrupt_state) +- { +- globfree (&dirs); +- return GLOB_ABORTED; +- } +- } +-#endif /* SHELL. */ +- + old_pathc = pglob->gl_pathc; + status = glob_in_dir (filename, dirs.gl_pathv[i], + ((flags | GLOB_APPEND) +@@ -1105,7 +1129,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + globfree (&dirs); + globfree (pglob); + pglob->gl_pathc = 0; +- return status; ++ retval = status; ++ goto out; + } + + /* Stick the directory on the front of each name. */ +@@ -1116,13 +1141,14 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + globfree (&dirs); + globfree (pglob); + pglob->gl_pathc = 0; +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + } + + flags |= GLOB_MAGCHAR; + +- /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls. ++ /* We have ignored the GLOB_NOCHECK flag in the 'glob_in_dir' calls. + But if we have not found any matching entry and the GLOB_NOCHECK + flag was set we must return the input pattern itself. */ + if (pglob->gl_pathc + pglob->gl_offs == oldcount) +@@ -1134,28 +1160,28 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + size_t newcount = pglob->gl_pathc + pglob->gl_offs; + char **new_gl_pathv; + +- if (newcount > UINTPTR_MAX - 2 +- || newcount + 2 > ~((size_t) 0) / sizeof (char *)) ++ if (newcount > SIZE_MAX / sizeof (char *) - 2) + { + nospace2: + globfree (&dirs); +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + +- new_gl_pathv = (char **) realloc (pglob->gl_pathv, +- (newcount + 2) +- * sizeof (char *)); ++ new_gl_pathv = realloc (pglob->gl_pathv, ++ (newcount + 2) * sizeof (char *)); + if (new_gl_pathv == NULL) + goto nospace2; + pglob->gl_pathv = new_gl_pathv; + +- pglob->gl_pathv[newcount] = __strdup (pattern); ++ pglob->gl_pathv[newcount] = strdup (pattern); + if (pglob->gl_pathv[newcount] == NULL) + { + globfree (&dirs); + globfree (pglob); + pglob->gl_pathc = 0; +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + + ++pglob->gl_pathc; +@@ -1167,7 +1193,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + else + { + globfree (&dirs); +- return GLOB_NOMATCH; ++ retval = GLOB_NOMATCH; ++ goto out; + } + } + +@@ -1213,7 +1240,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + flags = orig_flags; + goto no_matches; + } +- return status; ++ retval = status; ++ goto out; + } + + if (dirlen > 0) +@@ -1225,7 +1253,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + { + globfree (pglob); + pglob->gl_pathc = 0; +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + } + } +@@ -1250,7 +1279,8 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), + { + globfree (pglob); + pglob->gl_pathc = 0; +- return GLOB_NOSPACE; ++ retval = GLOB_NOSPACE; ++ goto out; + } + strcpy (&new[len - 2], "/"); + pglob->gl_pathv[i] = new; +@@ -1276,32 +1306,12 @@ libc_hidden_def (glob) + #endif + + +-#if !defined _LIBC || !defined GLOB_ONLY_P +- +-/* Free storage allocated in PGLOB by a previous `glob' call. */ +-void +-globfree (glob_t *pglob) +-{ +- if (pglob->gl_pathv != NULL) +- { +- size_t i; +- for (i = 0; i < pglob->gl_pathc; ++i) +- free (pglob->gl_pathv[pglob->gl_offs + i]); +- free (pglob->gl_pathv); +- pglob->gl_pathv = NULL; +- } +-} +-#if defined _LIBC && !defined globfree +-libc_hidden_def (globfree) +-#endif +- +- + /* Do a collated comparison of A and B. */ + static int + collated_compare (const void *a, const void *b) + { +- const char *const s1 = *(const char *const * const) a; +- const char *const s2 = *(const char *const * const) b; ++ char *const *ps1 = a; char *s1 = *ps1; ++ char *const *ps2 = b; char *s2 = *ps2; + + if (s1 == s2) + return 0; +@@ -1322,28 +1332,24 @@ prefix_array (const char *dirname, char **array, size_t n) + { + size_t i; + size_t dirlen = strlen (dirname); +-#if defined __MSDOS__ || defined WINDOWS32 +- int sep_char = '/'; +-# define DIRSEP_CHAR sep_char +-#else +-# define DIRSEP_CHAR '/' +-#endif ++ char dirsep_char = '/'; + + if (dirlen == 1 && dirname[0] == '/') + /* DIRNAME is just "/", so normal prepending would get us "//foo". + We want "/foo" instead, so don't prepend any chars from DIRNAME. */ + dirlen = 0; ++ + #if defined __MSDOS__ || defined WINDOWS32 +- else if (dirlen > 1) ++ if (dirlen > 1) + { + if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':') + /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */ + --dirlen; + else if (dirname[dirlen - 1] == ':') + { +- /* DIRNAME is "d:". Use `:' instead of `/'. */ ++ /* DIRNAME is "d:". Use ':' instead of '/'. */ + --dirlen; +- sep_char = ':'; ++ dirsep_char = ':'; + } + } + #endif +@@ -1351,7 +1357,7 @@ prefix_array (const char *dirname, char **array, size_t n) + for (i = 0; i < n; ++i) + { + size_t eltlen = strlen (array[i]) + 1; +- char *new = (char *) malloc (dirlen + 1 + eltlen); ++ char *new = malloc (dirlen + 1 + eltlen); + if (new == NULL) + { + while (i > 0) +@@ -1361,7 +1367,7 @@ prefix_array (const char *dirname, char **array, size_t n) + + { + char *endp = mempcpy (new, dirname, dirlen); +- *endp++ = DIRSEP_CHAR; ++ *endp++ = dirsep_char; + mempcpy (endp, array[i], eltlen); + } + free (array[i]); +@@ -1371,103 +1377,57 @@ prefix_array (const char *dirname, char **array, size_t n) + return 0; + } + +- +-/* We must not compile this function twice. */ +-#if !defined _LIBC || !defined NO_GLOB_PATTERN_P +-int +-__glob_pattern_type (const char *pattern, int quote) +-{ +- const char *p; +- int ret = 0; +- +- for (p = pattern; *p != '\0'; ++p) +- switch (*p) +- { +- case '?': +- case '*': +- return 1; +- +- case '\\': +- if (quote) +- { +- if (p[1] != '\0') +- ++p; +- ret |= 2; +- } +- break; +- +- case '[': +- ret |= 4; +- break; +- +- case ']': +- if (ret & 4) +- return 1; +- break; +- } +- +- return ret; +-} +- +-/* Return nonzero if PATTERN contains any metacharacters. +- Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ +-int +-__glob_pattern_p (const char *pattern, int quote) +-{ +- return __glob_pattern_type (pattern, quote) == 1; +-} +-# ifdef _LIBC +-weak_alias (__glob_pattern_p, glob_pattern_p) +-# endif +-#endif +- +-#endif /* !GLOB_ONLY_P */ +- +- + /* We put this in a separate function mainly to allow the memory + allocated with alloca to be recycled. */ +-#if !defined _LIBC || !defined GLOB_ONLY_P + static int + __attribute_noinline__ +-link_exists2_p (const char *dir, size_t dirlen, const char *fname, +- glob_t *pglob +-# ifndef _LIBC +- , int flags ++link_stat (const char *dir, size_t dirlen, const char *fname, ++ glob_t *pglob ++# if !defined _LIBC && !HAVE_FSTATAT ++ , int flags + # endif +- ) ++ ) + { + size_t fnamelen = strlen (fname); +- char *fullname = (char *) __alloca (dirlen + 1 + fnamelen + 1); ++ char *fullname = __alloca (dirlen + 1 + fnamelen + 1); + struct stat st; +-# ifndef _LIBC +- struct_stat64 st64; +-# endif + + mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1), + fname, fnamelen + 1); + +-# ifdef _LIBC +- return (*pglob->gl_stat) (fullname, &st) == 0; +-# else +- return ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) +- ? (*pglob->gl_stat) (fullname, &st) +- : __stat64 (fullname, &st64)) == 0); ++# if !defined _LIBC && !HAVE_FSTATAT ++ if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) == 0, 1)) ++ { ++ struct_stat64 st64; ++ return __stat64 (fullname, &st64); ++ } + # endif ++ return (*pglob->gl_stat) (fullname, &st); + } +-# ifdef _LIBC +-# define link_exists_p(dfd, dirname, dirnamelen, fname, pglob, flags) \ +- (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) \ +- ? link_exists2_p (dirname, dirnamelen, fname, pglob) \ +- : ({ struct stat64 st64; \ +- __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0; })) ++ ++/* Return true if DIR/FNAME exists. */ ++static int ++link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname, ++ glob_t *pglob, int flags) ++{ ++ int status; ++# if defined _LIBC || HAVE_FSTATAT ++ if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)) ++ status = link_stat (dir, dirlen, fname, pglob); ++ else ++ { ++ /* dfd cannot be -1 here, because dirfd never returns -1 on ++ glibc, or on hosts that have fstatat. */ ++ struct_stat64 st64; ++ status = __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0); ++ } + # else +-# define link_exists_p(dfd, dirname, dirnamelen, fname, pglob, flags) \ +- link_exists2_p (dirname, dirnamelen, fname, pglob, flags) ++ status = link_stat (dir, dirlen, fname, pglob, flags); + # endif +-#endif +- ++ return status == 0 || errno == EOVERFLOW; ++} + +-/* Like `glob', but PATTERN is a final pathname component, ++/* Like 'glob', but PATTERN is a final pathname component, + and matches are searched for in DIRECTORY. + The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done. + The GLOB_APPEND flag is assumed to be set (always appends). */ +@@ -1478,25 +1438,25 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + { + size_t dirlen = strlen (directory); + void *stream = NULL; +- struct globnames +- { +- struct globnames *next; +- size_t count; +- char *name[64]; +- }; +-#define INITIAL_COUNT sizeof (init_names.name) / sizeof (init_names.name[0]) +- struct globnames init_names; +- struct globnames *names = &init_names; +- struct globnames *names_alloca = &init_names; ++# define GLOBNAMES_MEMBERS(nnames) \ ++ struct globnames *next; size_t count; char *name[nnames]; ++ struct globnames { GLOBNAMES_MEMBERS (FLEXIBLE_ARRAY_MEMBER) }; ++ struct { GLOBNAMES_MEMBERS (64) } init_names_buf; ++ struct globnames *init_names = (struct globnames *) &init_names_buf; ++ struct globnames *names = init_names; ++ struct globnames *names_alloca = init_names; + size_t nfound = 0; + size_t cur = 0; + int meta; + int save; ++ int result; + +- alloca_used += sizeof (init_names); ++ alloca_used += sizeof init_names_buf; + +- init_names.next = NULL; +- init_names.count = INITIAL_COUNT; ++ init_names->next = NULL; ++ init_names->count = ((sizeof init_names_buf ++ - offsetof (struct globnames, name)) ++ / sizeof init_names->name[0]); + + meta = __glob_pattern_type (pattern, !(flags & GLOB_NOESCAPE)); + if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) +@@ -1516,14 +1476,16 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + struct_stat64 st64; + } ust; + size_t patlen = strlen (pattern); +- int alloca_fullname = __libc_use_alloca (alloca_used +- + dirlen + 1 + patlen + 1); ++ size_t fullsize; ++ bool alloca_fullname ++ = (! size_add_wrapv (dirlen + 1, patlen + 1, &fullsize) ++ && glob_use_alloca (alloca_used, fullsize)); + char *fullname; + if (alloca_fullname) +- fullname = alloca_account (dirlen + 1 + patlen + 1, alloca_used); ++ fullname = alloca_account (fullsize, alloca_used); + else + { +- fullname = malloc (dirlen + 1 + patlen + 1); ++ fullname = malloc (fullsize); + if (fullname == NULL) + return GLOB_NOSPACE; + } +@@ -1531,9 +1493,11 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), + "/", 1), + pattern, patlen + 1); +- if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) ++ if (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) + ? (*pglob->gl_stat) (fullname, &ust.st) +- : __stat64 (fullname, &ust.st64)) == 0) ++ : __stat64 (fullname, &ust.st64)) ++ == 0) ++ || errno == EOVERFLOW) + /* We found this file to be existing. Now tell the rest + of the function to copy this name into the result. */ + flags |= GLOB_NOCHECK; +@@ -1555,16 +1519,10 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + } + else + { +-#ifdef _LIBC + int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) + ? -1 : dirfd ((DIR *) stream)); +-#endif + int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) +- | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) +-#if defined _AMIGA || defined VMS +- | FNM_CASEFOLD +-#endif +- ); ++ | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)); + flags |= GLOB_MAGCHAR; + + while (1) +@@ -1584,19 +1542,24 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + } + if (d.name == NULL) + break; +- if (d.skip_entry) ++ if (readdir_result_skip_entry (d)) + continue; + + /* If we shall match only directories use the information + provided by the dirent call if possible. */ +- if ((flags & GLOB_ONLYDIR) && !readdir_result_might_be_dir (d)) +- continue; ++ if (flags & GLOB_ONLYDIR) ++ switch (readdir_result_type (d)) ++ { ++ case DT_DIR: case DT_LNK: case DT_UNKNOWN: break; ++ default: continue; ++ } + + if (fnmatch (pattern, d.name, fnm_flags) == 0) + { + /* If the file we found is a symlink we have to + make sure the target file exists. */ +- if (!readdir_result_might_be_symlink (d) ++ dirent_type type = readdir_result_type (d); ++ if (! (type == DT_LNK || type == DT_UNKNOWN) + || link_exists_p (dfd, directory, dirlen, d.name, + pglob, flags)) + { +@@ -1604,10 +1567,13 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + { + struct globnames *newnames; + size_t count = names->count * 2; +- size_t size = (sizeof (struct globnames) +- + ((count - INITIAL_COUNT) +- * sizeof (char *))); +- if (__libc_use_alloca (alloca_used + size)) ++ size_t nameoff = offsetof (struct globnames, name); ++ size_t size = FLEXSIZEOF (struct globnames, name, ++ count * sizeof (char *)); ++ if ((SIZE_MAX - nameoff) / 2 / sizeof (char *) ++ < names->count) ++ goto memory_error; ++ if (glob_use_alloca (alloca_used, size)) + newnames = names_alloca + = alloca_account (size, alloca_used); + else if ((newnames = malloc (size)) +@@ -1623,6 +1589,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + goto memory_error; + ++cur; + ++nfound; ++ if (SIZE_MAX - pglob->gl_offs <= nfound) ++ goto memory_error; + } + } + } +@@ -1633,29 +1601,27 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + { + size_t len = strlen (pattern); + nfound = 1; +- names->name[cur] = (char *) malloc (len + 1); ++ names->name[cur] = malloc (len + 1); + if (names->name[cur] == NULL) + goto memory_error; + *((char *) mempcpy (names->name[cur++], pattern, len)) = '\0'; + } + +- int result = GLOB_NOMATCH; ++ result = GLOB_NOMATCH; + if (nfound != 0) + { ++ char **new_gl_pathv; + result = 0; + +- if (pglob->gl_pathc > UINTPTR_MAX - pglob->gl_offs +- || pglob->gl_pathc + pglob->gl_offs > UINTPTR_MAX - nfound +- || pglob->gl_pathc + pglob->gl_offs + nfound > UINTPTR_MAX - 1 +- || (pglob->gl_pathc + pglob->gl_offs + nfound + 1 +- > UINTPTR_MAX / sizeof (char *))) ++ if (SIZE_MAX / sizeof (char *) - pglob->gl_pathc ++ < pglob->gl_offs + nfound + 1) + goto memory_error; + +- char **new_gl_pathv; + new_gl_pathv +- = (char **) realloc (pglob->gl_pathv, +- (pglob->gl_pathc + pglob->gl_offs + nfound + 1) +- * sizeof (char *)); ++ = realloc (pglob->gl_pathv, ++ (pglob->gl_pathc + pglob->gl_offs + nfound + 1) ++ * sizeof (char *)); ++ + if (new_gl_pathv == NULL) + { + memory_error: +@@ -1671,7 +1637,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + and this is the block assigned to OLD here. */ + if (names == NULL) + { +- assert (old == &init_names); ++ assert (old == init_names); + break; + } + cur = names->count; +@@ -1697,7 +1663,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, + and this is the block assigned to OLD here. */ + if (names == NULL) + { +- assert (old == &init_names); ++ assert (old == init_names); + break; + } + cur = names->count; +diff --git a/posix/glob64.c b/posix/glob64.c +index 6cb3d654a8..a515a1c12f 100644 +--- a/posix/glob64.c ++++ b/posix/glob64.c +@@ -43,10 +43,4 @@ glob64 (const char *pattern, int flags, + } + libc_hidden_def (glob64) + +-void +-globfree64 (glob64_t *pglob) +-{ +-} +-libc_hidden_def (globfree64) +- + stub_warning (glob64) +diff --git a/posix/glob_internal.h b/posix/glob_internal.h +new file mode 100644 +index 0000000000..12c93660b7 +--- /dev/null ++++ b/posix/glob_internal.h +@@ -0,0 +1,57 @@ ++/* Shared definition for glob and glob_pattern_p. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef GLOB_INTERNAL_H ++# define GLOB_INTERNAL_H ++ ++static inline int ++__glob_pattern_type (const char *pattern, int quote) ++{ ++ const char *p; ++ int ret = 0; ++ ++ for (p = pattern; *p != '\0'; ++p) ++ switch (*p) ++ { ++ case '?': ++ case '*': ++ return 1; ++ ++ case '\\': ++ if (quote) ++ { ++ if (p[1] != '\0') ++ ++p; ++ ret |= 2; ++ } ++ break; ++ ++ case '[': ++ ret |= 4; ++ break; ++ ++ case ']': ++ if (ret & 4) ++ return 1; ++ break; ++ } ++ ++ return ret; ++} ++ ++#endif /* GLOB_INTERNAL_H */ +diff --git a/posix/glob_pattern_p.c b/posix/glob_pattern_p.c +new file mode 100644 +index 0000000000..a17d337182 +--- /dev/null ++++ b/posix/glob_pattern_p.c +@@ -0,0 +1,33 @@ ++/* Return nonzero if PATTERN contains any metacharacters. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef _LIBC ++# include ++#endif ++ ++#include ++#include "glob_internal.h" ++ ++/* Return nonzero if PATTERN contains any metacharacters. ++ Metacharacters can be quoted with backslashes if QUOTE is nonzero. */ ++int ++__glob_pattern_p (const char *pattern, int quote) ++{ ++ return __glob_pattern_type (pattern, quote) == 1; ++} ++weak_alias (__glob_pattern_p, glob_pattern_p) +diff --git a/posix/globfree.c b/posix/globfree.c +new file mode 100644 +index 0000000000..042e29d9b0 +--- /dev/null ++++ b/posix/globfree.c +@@ -0,0 +1,41 @@ ++/* Frees the dynamically allocated storage from an earlier call to glob. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef _LIBC ++# include ++#endif ++ ++#include ++#include ++ ++/* Free storage allocated in PGLOB by a previous `glob' call. */ ++void ++globfree (glob_t *pglob) ++{ ++ if (pglob->gl_pathv != NULL) ++ { ++ size_t i; ++ for (i = 0; i < pglob->gl_pathc; ++i) ++ free (pglob->gl_pathv[pglob->gl_offs + i]); ++ free (pglob->gl_pathv); ++ pglob->gl_pathv = NULL; ++ } ++} ++#ifndef globfree ++libc_hidden_def (globfree) ++#endif +diff --git a/posix/globfree64.c b/posix/globfree64.c +new file mode 100644 +index 0000000000..c9f8908a4e +--- /dev/null ++++ b/posix/globfree64.c +@@ -0,0 +1,31 @@ ++/* Frees the dynamically allocated storage from an earlier call to glob. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#ifndef _LIBC ++# include ++#endif ++ ++#include ++#include ++ ++/* Free storage allocated in PGLOB by a previous `glob' call. */ ++void ++globfree64 (glob64_t *pglob) ++{ ++} ++libc_hidden_def (globfree64) +diff --git a/posix/tst-glob-tilde.c b/posix/tst-glob-tilde.c +new file mode 100644 +index 0000000000..9518b4a6f8 +--- /dev/null ++++ b/posix/tst-glob-tilde.c +@@ -0,0 +1,136 @@ ++/* Check for GLOB_TIDLE heap allocation issues (bug 22320, bug 22325). ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Flag which indicates whether to pass the GLOB_ONLYDIR flag. */ ++static int do_onlydir; ++ ++/* Flag which indicates whether to pass the GLOB_NOCHECK flag. */ ++static int do_nocheck; ++ ++/* Flag which indicates whether to pass the GLOB_MARK flag. */ ++static int do_mark; ++ ++static void ++one_test (const char *prefix, const char *middle, const char *suffix) ++{ ++ char *pattern = xasprintf ("%s%s%s", prefix, middle, suffix); ++ int flags = GLOB_TILDE; ++ if (do_onlydir) ++ flags |= GLOB_ONLYDIR; ++ if (do_nocheck) ++ flags |= GLOB_NOCHECK; ++ if (do_mark) ++ flags |= GLOB_MARK; ++ glob_t gl; ++ /* This glob call might result in crashes or memory leaks. */ ++ if (glob (pattern, flags, NULL, &gl) == 0) ++ globfree (&gl); ++ free (pattern); ++} ++ ++enum ++ { ++ /* The largest base being tested. */ ++ largest_base_size = 500000, ++ ++ /* The actual size is the base size plus a variable whose absolute ++ value is not greater than this. This helps malloc to trigger ++ overflows. */ ++ max_size_skew = 16, ++ ++ /* The maximum string length supported by repeating_string ++ below. */ ++ repeat_size = largest_base_size + max_size_skew, ++ }; ++ ++/* Used to construct strings which repeat a single character 'x'. */ ++static char *repeat; ++ ++/* Return a string of SIZE characters. */ ++const char * ++repeating_string (int size) ++{ ++ TEST_VERIFY (size >= 0); ++ TEST_VERIFY (size <= repeat_size); ++ const char *repeated_shifted = repeat + repeat_size - size; ++ TEST_VERIFY (strlen (repeated_shifted) == size); ++ return repeated_shifted; ++} ++ ++static int ++do_test (void) ++{ ++ /* Avoid network-based NSS modules and initialize nss_files with a ++ dummy lookup. This has to come before mtrace because NSS does ++ not free all memory. */ ++ __nss_configure_lookup ("passwd", "files"); ++ (void) getpwnam ("root"); ++ ++ mtrace (); ++ ++ repeat = xmalloc (repeat_size + 1); ++ memset (repeat, 'x', repeat_size); ++ repeat[repeat_size] = '\0'; ++ ++ /* These numbers control the size of the user name. The values ++ cover the minimum (0), a typical size (8), a large ++ stack-allocated size (100000), and a somewhat large ++ heap-allocated size (largest_base_size). */ ++ static const int base_sizes[] = { 0, 8, 100, 100000, largest_base_size, -1 }; ++ ++ for (do_onlydir = 0; do_onlydir < 2; ++do_onlydir) ++ for (do_nocheck = 0; do_nocheck < 2; ++do_nocheck) ++ for (do_mark = 0; do_mark < 2; ++do_mark) ++ for (int base_idx = 0; base_sizes[base_idx] >= 0; ++base_idx) ++ { ++ for (int size_skew = -max_size_skew; size_skew <= max_size_skew; ++ ++size_skew) ++ { ++ int size = base_sizes[base_idx] + size_skew; ++ if (size < 0) ++ continue; ++ ++ const char *user_name = repeating_string (size); ++ one_test ("~", user_name, "/a/b"); ++ } ++ ++ const char *user_name = repeating_string (base_sizes[base_idx]); ++ one_test ("~", user_name, ""); ++ one_test ("~", user_name, "/"); ++ one_test ("~", user_name, "/a"); ++ one_test ("~", user_name, "/*/*"); ++ one_test ("~", user_name, "\\/"); ++ one_test ("/~", user_name, ""); ++ one_test ("*/~", user_name, "/a/b"); ++ } ++ ++ free (repeat); ++ ++ return 0; ++} ++ ++#include +diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c +index 7cd54ab504..1e85e4f08f 100644 +--- a/resolv/nss_dns/dns-host.c ++++ b/resolv/nss_dns/dns-host.c +@@ -889,19 +889,6 @@ getanswer_r (struct resolv_context *ctx, + /* bind would put multiple PTR records as aliases, but we don't do + that. */ + result->h_name = bp; +- if (have_to_map) +- { +- n = strlen (bp) + 1; /* for the \0 */ +- if (__glibc_unlikely (n >= MAXHOSTNAMELEN)) +- { +- ++had_error; +- break; +- } +- bp += n; +- linebuflen -= n; +- if (map_v4v6_hostent (result, &bp, &linebuflen)) +- goto too_small; +- } + *h_errnop = NETDB_SUCCESS; + return NSS_STATUS_SUCCESS; + case T_A: +diff --git a/resolv/res_init.c b/resolv/res_init.c +index fa46ce7813..4e1f9fe8de 100644 +--- a/resolv/res_init.c ++++ b/resolv/res_init.c +@@ -446,6 +446,11 @@ res_vinit_1 (FILE *fp, struct resolv_conf_parser *parser) + (&parser->nameserver_list); + if (p != NULL) + *p = sa; ++ else ++ { ++ free (sa); ++ return false; ++ } + } + continue; + } +diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c +index f391d30c27..e0f296d02e 100644 +--- a/resolv/resolv_conf.c ++++ b/resolv/resolv_conf.c +@@ -600,10 +600,7 @@ __resolv_conf_attach (struct __res_state *resp, struct resolv_conf *conf) + + struct resolv_conf_global *global_copy = get_locked_global (); + if (global_copy == NULL) +- { +- free (conf); +- return false; +- } ++ return false; + + /* Try to find an unused index in the array. */ + size_t index; +diff --git a/resolv/tst-res_use_inet6.c b/resolv/tst-res_use_inet6.c +index 6f3db08892..d819f921d6 100644 +--- a/resolv/tst-res_use_inet6.c ++++ b/resolv/tst-res_use_inet6.c +@@ -16,21 +16,121 @@ + License along with the GNU C Library; if not, see + . */ + ++#include + #include + #include ++#include ++#include + #include ++#include + #include + #include ++#include + #include + ++/* Handle IPv4 reverse lookup responses. Product a PTR record ++ A-B-C-D.v4.example. */ ++static void ++response_ptr_v4 (const struct resolv_response_context *ctx, ++ struct resolv_response_builder *b, ++ const char *qname, uint16_t qclass, uint16_t qtype) ++{ ++ int bytes[4]; ++ int offset = -1; ++ TEST_VERIFY (sscanf (qname, "%d.%d.%d.%d.in-addr.arpa%n", ++ bytes + 0, bytes + 1, bytes + 2, bytes + 3, ++ &offset) == 4); ++ TEST_VERIFY (offset == strlen (qname)); ++ resolv_response_init (b, (struct resolv_response_flags) {}); ++ resolv_response_add_question (b, qname, qclass, qtype); ++ resolv_response_section (b, ns_s_an); ++ resolv_response_open_record (b, qname, qclass, T_PTR, 0); ++ char *name = xasprintf ("%d-%d-%d-%d.v4.example", ++ bytes[3], bytes[2], bytes[1], bytes[0]); ++ resolv_response_add_name (b, name); ++ free (name); ++ resolv_response_close_record (b); ++} ++ ++/* Handle IPv6 reverse lookup responses. Produce a PTR record ++ <32 hex digits>.v6.example. */ ++static void ++response_ptr_v6 (const struct resolv_response_context *ctx, ++ struct resolv_response_builder *b, ++ const char *qname, uint16_t qclass, uint16_t qtype) ++{ ++ ++ TEST_VERIFY_EXIT (strlen (qname) > 64); ++ ++ char bytes[33]; ++ for (int i = 0; i < 64; ++i) ++ if ((i % 2) == 0) ++ { ++ TEST_VERIFY (isxdigit ((unsigned char) qname[i])); ++ bytes[31 - i / 2] = qname[i]; ++ } ++ else ++ TEST_VERIFY_EXIT (qname[i] == '.'); ++ bytes[32] = '\0'; ++ ++ resolv_response_init (b, (struct resolv_response_flags) {}); ++ resolv_response_add_question (b, qname, qclass, qtype); ++ resolv_response_section (b, ns_s_an); ++ resolv_response_open_record (b, qname, qclass, T_PTR, 0); ++ char *name = xasprintf ("%s.v6.example", bytes); ++ resolv_response_add_name (b, name); ++ free (name); ++ resolv_response_close_record (b); ++} ++ ++/* Produce a response based on QNAME: Certain characters in the first ++ label of QNAME trigger the inclusion of resource records: ++ ++ 'a' A record (IPv4 address) ++ 'q' AAAA record (quad A record, IPv6 address) ++ 'p' PTR record ++ 'm' record type must match QTYPE (no additional records) ++ '6' stop flag processing if QTYPE == AAAA ++ ++ For 'a' and 'q', QTYPE is ignored for record type selection if 'm' ++ is not specified. ++ ++ in-addr.arpa and ip6.arpa queries are handled separately in ++ response_ptr_v4 and response_ptr_v6. */ + static void + response (const struct resolv_response_context *ctx, + struct resolv_response_builder *b, + const char *qname, uint16_t qclass, uint16_t qtype) + { +- bool include_both = strcmp (qname, "both.example") == 0; +- bool include_a = qtype == T_A || include_both; +- bool include_aaaa = qtype == T_AAAA || include_both; ++ if (strstr (qname, ".in-addr.arpa") != NULL) ++ return response_ptr_v4 (ctx, b, qname, qclass, qtype); ++ else if (strstr (qname, ".ip6.arpa") != NULL) ++ return response_ptr_v6 (ctx, b, qname, qclass, qtype); ++ ++ bool include_a = false; ++ bool include_aaaa = false; ++ bool include_match = false; ++ bool include_ptr = false; ++ for (const char *p = qname; *p != '.' && *p != '\0'; ++p) ++ { ++ if (*p == 'a') ++ include_a = true; ++ else if (*p == 'q') ++ include_aaaa = true; ++ else if (*p == 'm') ++ include_match = true; ++ else if (*p == 'p') ++ include_ptr = true; ++ else if (*p == '6' && qtype == T_AAAA) ++ break; ++ } ++ if (include_match) ++ { ++ if (qtype == T_A) ++ include_aaaa = false; ++ else if (qtype == T_AAAA) ++ include_a = false; ++ } + + resolv_response_init (b, (struct resolv_response_flags) {}); + resolv_response_add_question (b, qname, qclass, qtype); +@@ -44,11 +144,17 @@ response (const struct resolv_response_context *ctx, + } + if (include_aaaa) + { +- char ipv6[16] +- = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; +- resolv_response_open_record (b, qname, qclass, T_AAAA, 0); +- resolv_response_add_data (b, &ipv6, sizeof (ipv6)); +- resolv_response_close_record (b); ++ char ipv6[16] ++ = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; ++ resolv_response_open_record (b, qname, qclass, T_AAAA, 0); ++ resolv_response_add_data (b, &ipv6, sizeof (ipv6)); ++ resolv_response_close_record (b); ++ } ++ if (include_ptr) ++ { ++ resolv_response_open_record (b, qname, qclass, T_PTR, 0); ++ resolv_response_add_name (b, "ptr-target.example"); ++ resolv_response_close_record (b); + } + } + +@@ -64,16 +170,21 @@ test_gai (void) + .ai_protocol = IPPROTO_TCP, + }; + struct addrinfo *ai; +- int ret = getaddrinfo ("www1.example", "80", &hints, &ai); +- check_addrinfo ("getaddrinfo AF_UNSPEC www1.example", ai, ret, ++ int ret = getaddrinfo ("qam.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_UNSPEC qam.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 2001:db8::1 80\n"); + if (ret == 0) + freeaddrinfo (ai); +- ret = getaddrinfo ("both.example", "80", &hints, &ai); ++ ret = getaddrinfo ("am.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_UNSPEC am.example", ai, ret, ++ "address: STREAM/TCP 192.0.2.17 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ ret = getaddrinfo ("qa.example", "80", &hints, &ai); + /* Combined A/AAAA responses currently result in address + duplication. */ +- check_addrinfo ("getaddrinfo AF_UNSPEC both.example", ai, ret, ++ check_addrinfo ("getaddrinfo AF_UNSPEC qa.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 2001:db8::1 80\n" +@@ -89,13 +200,18 @@ test_gai (void) + .ai_protocol = IPPROTO_TCP, + }; + struct addrinfo *ai; +- int ret = getaddrinfo ("www1.example", "80", &hints, &ai); +- check_addrinfo ("getaddrinfo AF_INET www1.example", ai, ret, ++ int ret = getaddrinfo ("qam.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_INET qam.example", ai, ret, ++ "address: STREAM/TCP 192.0.2.17 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ ret = getaddrinfo ("am.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_INET am.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n"); + if (ret == 0) + freeaddrinfo (ai); +- ret = getaddrinfo ("both.example", "80", &hints, &ai); +- check_addrinfo ("getaddrinfo AF_INET both.example", ai, ret, ++ ret = getaddrinfo ("qa.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_INET qa.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n"); + if (ret == 0) + freeaddrinfo (ai); +@@ -108,40 +224,196 @@ test_gai (void) + .ai_protocol = IPPROTO_TCP, + }; + struct addrinfo *ai; +- int ret = getaddrinfo ("www1.example", "80", &hints, &ai); ++ int ret = getaddrinfo ("qa.example", "80", &hints, &ai); + check_addrinfo ("getaddrinfo (AF_INET6)", ai, ret, + "address: STREAM/TCP 2001:db8::1 80\n"); + if (ret == 0) + freeaddrinfo (ai); +- ret = getaddrinfo ("both.example", "80", &hints, &ai); +- check_addrinfo ("getaddrinfo AF_INET6 both.example", ai, ret, ++ ret = getaddrinfo ("am.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_INET6 am.example", ai, ret, ++ "error: No address associated with hostname\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ ret = getaddrinfo ("qam.example", "80", &hints, &ai); ++ check_addrinfo ("getaddrinfo AF_INET6 qam.example", ai, ret, + "address: STREAM/TCP 2001:db8::1 80\n"); + if (ret == 0) + freeaddrinfo (ai); + } + } + +-/* Test that gethostbyname2 is not influenced by RES_USE_INET6. */ ++/* Test gethostbyaddr and getnameinfo. The results are independent of ++ RES_USE_INET6. */ + static void +-test_get2 (void) ++test_reverse (void) + { +- check_hostent ("gethostbyname2 AF_INET www1.example", +- gethostbyname2 ("www1.example", AF_INET), +- "name: www1.example\n" ++ { ++ char ipv4[4] = { 192, 0, 2, 17 }; ++ check_hostent ("gethostbyaddr AF_INET", ++ gethostbyaddr (ipv4, sizeof (ipv4), AF_INET), ++ "name: 192-0-2-17.v4.example\n" ++ "address: 192.0.2.17\n"); ++ } ++ { ++ char ipv6[16] ++ = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; ++ check_hostent ("gethostbyaddr AF_INET", ++ gethostbyaddr (ipv6, sizeof (ipv6), AF_INET6), ++ "name: 20010db8000000000000000000000001.v6.example\n" ++ "address: 2001:db8::1\n"); ++ } ++ ++ { ++ struct sockaddr_in addr = ++ { ++ .sin_family = AF_INET, ++ .sin_addr = { .s_addr = htonl (0xc0000211) }, ++ .sin_port = htons (80) ++ }; ++ char host[NI_MAXHOST]; ++ char service[NI_MAXSERV]; ++ int ret = getnameinfo ((struct sockaddr *) &addr, sizeof (addr), ++ host, sizeof (host), service, sizeof (service), ++ NI_NUMERICSERV); ++ TEST_VERIFY (ret == 0); ++ TEST_VERIFY (strcmp (host, "192-0-2-17.v4.example") == 0); ++ TEST_VERIFY (strcmp (service, "80") == 0); ++ } ++ { ++ char ipv6[16] ++ = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; ++ struct sockaddr_in6 addr = ++ { ++ .sin6_family = AF_INET6, ++ .sin6_port = htons (80), ++ }; ++ TEST_VERIFY (sizeof (ipv6) == sizeof (addr.sin6_addr)); ++ memcpy (&addr.sin6_addr, ipv6, sizeof (addr.sin6_addr)); ++ char host[NI_MAXHOST]; ++ char service[NI_MAXSERV]; ++ int ret = getnameinfo ((struct sockaddr *) &addr, sizeof (addr), ++ host, sizeof (host), service, sizeof (service), ++ NI_NUMERICSERV); ++ TEST_VERIFY (ret == 0); ++ TEST_VERIFY ++ (strcmp (host, "20010db8000000000000000000000001.v6.example") == 0); ++ TEST_VERIFY (strcmp (service, "80") == 0); ++ } ++} ++ ++/* Test that gethostbyname2 is mostly not influenced by ++ RES_USE_INET6. */ ++static void ++test_get2_any (void) ++{ ++ check_hostent ("gethostbyname2 AF_INET am.example", ++ gethostbyname2 ("am.example", AF_INET), ++ "name: am.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname2 AF_INET a.example", ++ gethostbyname2 ("a.example", AF_INET), ++ "name: a.example\n" + "address: 192.0.2.17\n"); +- check_hostent ("gethostbyname2 AF_INET both.example", +- gethostbyname2 ("both.example", AF_INET), +- "name: both.example\n" ++ check_hostent ("gethostbyname2 AF_INET qm.example", ++ gethostbyname2 ("qm.example", AF_INET), ++ "error: NO_ADDRESS\n"); ++ check_hostent ("gethostbyname2 AF_INET q.example", ++ gethostbyname2 ("q.example", AF_INET), ++ "error: NO_RECOVERY\n"); ++ check_hostent ("gethostbyname2 AF_INET qam.example", ++ gethostbyname2 ("qam.example", AF_INET), ++ "name: qam.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname2 AF_INET qa.example", ++ gethostbyname2 ("qa.example", AF_INET), ++ "name: qa.example\n" + "address: 192.0.2.17\n"); + +- check_hostent ("gethostbyname2 AF_INET6 www1.example", +- gethostbyname2 ("www1.example", AF_INET6), +- "name: www1.example\n" ++ check_hostent ("gethostbyname2 AF_INET6 qm.example", ++ gethostbyname2 ("qm.example", AF_INET6), ++ "name: qm.example\n" ++ "address: 2001:db8::1\n"); ++ check_hostent ("gethostbyname2 AF_INET6 q.example", ++ gethostbyname2 ("q.example", AF_INET6), ++ "name: q.example\n" ++ "address: 2001:db8::1\n"); ++ check_hostent ("gethostbyname2 AF_INET6 qam.example", ++ gethostbyname2 ("qam.example", AF_INET6), ++ "name: qam.example\n" + "address: 2001:db8::1\n"); +- check_hostent ("gethostbyname2 AF_INET6 both.example", +- gethostbyname2 ("both.example", AF_INET6), +- "name: both.example\n" ++ check_hostent ("gethostbyname2 AF_INET6 qa.example", ++ gethostbyname2 ("qa.example", AF_INET6), ++ "name: qa.example\n" + "address: 2001:db8::1\n"); ++ /* Additional AF_INET6 tests depend on RES_USE_INET6; see below. */ ++ ++ test_reverse (); ++} ++ ++/* gethostbyname2 tests with RES_USE_INET6 disabled. */ ++static void ++test_get2_no_inet6 (void) ++{ ++ test_get2_any (); ++ ++ check_hostent ("gethostbyname2 AF_INET6 am.example", ++ gethostbyname2 ("am.example", AF_INET6), ++ "error: NO_ADDRESS\n"); ++ check_hostent ("gethostbyname2 AF_INET6 a.example", ++ gethostbyname2 ("a.example", AF_INET6), ++ "error: NO_RECOVERY\n"); ++} ++ ++/* gethostbyname2 tests with RES_USE_INET6 enabled. */ ++static void ++test_get2_inet6 (void) ++{ ++ test_get2_any (); ++ ++ check_hostent ("gethostbyname2 AF_INET6 am.example", ++ gethostbyname2 ("am.example", AF_INET6), ++ "name: am.example\n" ++ "address: ::ffff:192.0.2.17\n"); ++ check_hostent ("gethostbyname2 AF_INET6 a.example", ++ gethostbyname2 ("a.example", AF_INET6), ++ "error: NO_RECOVERY\n"); ++} ++ ++/* Collection of tests which assume no RES_USE_INET6 flag. */ ++static void ++test_no_inet6 (void) ++{ ++ check_hostent ("gethostbyname (\"a.example\")", ++ gethostbyname ("a.example"), ++ "name: a.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"qa.example\")", ++ gethostbyname ("qa.example"), ++ "name: qa.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"am.example\")", ++ gethostbyname ("am.example"), ++ "name: am.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"amp.example\")", ++ gethostbyname ("amp.example"), ++ "name: amp.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"qam.example\")", ++ gethostbyname ("qam.example"), ++ "name: qam.example\n" ++ "address: 192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"q.example\")", ++ gethostbyname ("q.example"), ++ "error: NO_RECOVERY\n"); ++ check_hostent ("gethostbyname (\"qm.example\")", ++ gethostbyname ("qm.example"), ++ "error: NO_ADDRESS\n"); ++ test_get2_no_inet6 (); ++ test_get2_no_inet6 (); ++ test_gai (); ++ test_get2_no_inet6 (); ++ test_get2_no_inet6 (); + } + + static void * +@@ -153,28 +425,64 @@ threadfunc (void *ignored) + .response_callback = response + }); + +- check_hostent ("gethostbyname (\"www1.example\")", +- gethostbyname ("www1.example"), +- "name: www1.example\n" +- "address: 192.0.2.17\n"); +- check_hostent ("gethostbyname (\"both.example\")", +- gethostbyname ("both.example"), +- "name: both.example\n" +- "address: 192.0.2.17\n"); +- test_get2 (); +- test_gai (); ++ TEST_VERIFY ((_res.options & RES_USE_INET6) == 0); ++ test_no_inet6 (); + + _res.options |= RES_USE_INET6; +- check_hostent ("gethostbyname (\"www1.example\")", +- gethostbyname ("www1.example"), +- "name: www1.example\n" ++ check_hostent ("gethostbyname (\"a.inet6.example\")", ++ gethostbyname ("a.inet6.example"), ++ "error: NO_RECOVERY\n"); ++ check_hostent ("gethostbyname (\"am.inet6.example\")", ++ gethostbyname ("am.inet6.example"), ++ "name: am.inet6.example\n" ++ "address: ::ffff:192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"qa.inet6.example\")", ++ gethostbyname ("qa.inet6.example"), ++ "name: qa.inet6.example\n" + "address: 2001:db8::1\n"); +- check_hostent ("gethostbyname (\"both.example\")", +- gethostbyname ("both.example"), +- "name: both.example\n" ++ check_hostent ("gethostbyname (\"qam.inet6.example\")", ++ gethostbyname ("qam.inet6.example"), ++ "name: qam.inet6.example\n" + "address: 2001:db8::1\n"); +- test_get2 (); ++ check_hostent ("gethostbyname (\"q.inet6.example\")", ++ gethostbyname ("q.inet6.example"), ++ "name: q.inet6.example\n" ++ "address: 2001:db8::1\n"); ++ check_hostent ("gethostbyname (\"qm.inet6.example\")", ++ gethostbyname ("qm.inet6.example"), ++ "name: qm.inet6.example\n" ++ "address: 2001:db8::1\n"); ++ check_hostent ("gethostbyname (\"amp.inet6.example\")", ++ gethostbyname ("amp.inet6.example"), ++ "error: NO_RECOVERY\n"); ++ check_hostent ("gethostbyname (\"qmp.inet6.example\")", ++ gethostbyname ("qmp.inet6.example"), ++ "name: qmp.inet6.example\n" ++ "address: 2001:db8::1\n"); ++ check_hostent ("gethostbyname (\"ap.inet6.example\")", ++ gethostbyname ("ap.inet6.example"), ++ "error: NO_RECOVERY\n"); ++ check_hostent ("gethostbyname (\"6ap.inet6.example\")", ++ gethostbyname ("6ap.inet6.example"), ++ "name: 6ap.inet6.example\n" ++ "address: ::ffff:192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"am6p.inet6.example\")", ++ gethostbyname ("am6p.inet6.example"), ++ "name: am6p.inet6.example\n" ++ "address: ::ffff:192.0.2.17\n"); ++ check_hostent ("gethostbyname (\"qp.inet6.example\")", ++ gethostbyname ("qp.inet6.example"), ++ "name: qp.inet6.example\n" ++ "address: 2001:db8::1\n"); ++ test_get2_inet6 (); ++ test_get2_inet6 (); + test_gai (); ++ test_get2_inet6 (); ++ test_get2_inet6 (); ++ ++ TEST_VERIFY (_res.options & RES_USE_INET6); ++ _res.options &= ~RES_USE_INET6; ++ test_no_inet6 (); + + resolv_test_end (obj); + +diff --git a/resolv/tst-resolv-basic.c b/resolv/tst-resolv-basic.c +index 64eedbbd81..66a0e8a165 100644 +--- a/resolv/tst-resolv-basic.c ++++ b/resolv/tst-resolv-basic.c +@@ -50,7 +50,7 @@ response (const struct resolv_response_context *ctx, + qname_compare = qname + 2; + else + qname_compare = qname; +- enum {www, alias, nxdomain, long_name} requested_qname; ++ enum {www, alias, nxdomain, long_name, nodata} requested_qname; + if (strcmp (qname_compare, "www.example") == 0) + requested_qname = www; + else if (strcmp (qname_compare, "alias.example") == 0) +@@ -59,6 +59,8 @@ response (const struct resolv_response_context *ctx, + requested_qname = nxdomain; + else if (strcmp (qname_compare, LONG_NAME) == 0) + requested_qname = long_name; ++ else if (strcmp (qname_compare, "nodata.example") == 0) ++ requested_qname = nodata; + else + { + support_record_failure (); +@@ -87,6 +89,8 @@ response (const struct resolv_response_context *ctx, + resolv_response_close_record (b); + resolv_response_open_record (b, "www.example", qclass, qtype, 0); + break; ++ case nodata: ++ return; + case nxdomain: + FAIL_EXIT1 ("unreachable"); + } +@@ -267,6 +271,55 @@ test_bug_21295 (void) + } + } + ++/* Run tests which do not expect any data. */ ++static void ++test_nodata_nxdomain (void) ++{ ++ /* Iterate through different address families. */ ++ int families[] = { AF_UNSPEC, AF_INET, AF_INET6, -1 }; ++ for (int i = 0; families[i] >= 0; ++i) ++ /* If do_tcp, prepend "t." to the name to trigger TCP ++ fallback. */ ++ for (int do_tcp = 0; do_tcp < 2; ++do_tcp) ++ /* If do_nxdomain, trigger an NXDOMAIN error (DNS failure), ++ otherwise use a NODATA response (empty but successful ++ answer). */ ++ for (int do_nxdomain = 0; do_nxdomain < 2; ++do_nxdomain) ++ { ++ int family = families[i]; ++ char *name = xasprintf ("%s%s.example", ++ do_tcp ? "t." : "", ++ do_nxdomain ? "nxdomain" : "nodata"); ++ ++ if (family != AF_UNSPEC) ++ { ++ if (do_nxdomain) ++ check_h (name, family, "error: HOST_NOT_FOUND\n"); ++ else ++ check_h (name, family, "error: NO_ADDRESS\n"); ++ } ++ ++ const char *expected; ++ if (do_nxdomain) ++ expected = "error: Name or service not known\n"; ++ else ++ expected = "error: No address associated with hostname\n"; ++ ++ check_ai (name, "80", family, expected); ++ ++ struct addrinfo hints = ++ { ++ .ai_family = family, ++ .ai_flags = AI_V4MAPPED | AI_ALL, ++ }; ++ check_ai_hints (name, "80", hints, expected); ++ hints.ai_flags |= AI_CANONNAME; ++ check_ai_hints (name, "80", hints, expected); ++ ++ free (name); ++ } ++} ++ + static int + do_test (void) + { +@@ -439,29 +492,8 @@ do_test (void) + "address: DGRAM/UDP 2001:db8::4 80\n" + "address: RAW/IP 2001:db8::4 80\n"); + +- check_h ("nxdomain.example", AF_INET, +- "error: HOST_NOT_FOUND\n"); +- check_h ("nxdomain.example", AF_INET6, +- "error: HOST_NOT_FOUND\n"); +- check_ai ("nxdomain.example", "80", AF_UNSPEC, +- "error: Name or service not known\n"); +- check_ai ("nxdomain.example", "80", AF_INET, +- "error: Name or service not known\n"); +- check_ai ("nxdomain.example", "80", AF_INET6, +- "error: Name or service not known\n"); +- +- check_h ("t.nxdomain.example", AF_INET, +- "error: HOST_NOT_FOUND\n"); +- check_h ("t.nxdomain.example", AF_INET6, +- "error: HOST_NOT_FOUND\n"); +- check_ai ("t.nxdomain.example", "80", AF_UNSPEC, +- "error: Name or service not known\n"); +- check_ai ("t.nxdomain.example", "80", AF_INET, +- "error: Name or service not known\n"); +- check_ai ("t.nxdomain.example", "80", AF_INET6, +- "error: Name or service not known\n"); +- + test_bug_21295 (); ++ test_nodata_nxdomain (); + + resolv_test_end (aux); + +diff --git a/resolv/tst-resolv-qtypes.c b/resolv/tst-resolv-qtypes.c +index 06ea3dbd14..da3325f80c 100644 +--- a/resolv/tst-resolv-qtypes.c ++++ b/resolv/tst-resolv-qtypes.c +@@ -50,7 +50,7 @@ response (const struct resolv_response_context *ctx, + resolv_response_close_record (b); + } + +-static const char * const domain = "www.example.com"; ++static const char domain[] = "www.example.com"; + + static int + wrap_res_query (int type, unsigned char *answer, int answer_length) +diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh +index 7859f613b2..0cde6e8e92 100755 +--- a/scripts/check-local-headers.sh ++++ b/scripts/check-local-headers.sh +@@ -33,7 +33,7 @@ exec ${AWK} -v includedir="$includedir" ' + BEGIN { + status = 0 + exclude = "^" includedir \ +- "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|gd|nss3/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)" ++ "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|gd|nss3/|nspr4?/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)" + } + /^[^ ]/ && $1 ~ /.*:/ { obj = $1 } + { +diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk +index ccdd0c6c71..622199061a 100644 +--- a/scripts/gen-tunables.awk ++++ b/scripts/gen-tunables.awk +@@ -1,6 +1,14 @@ + # Generate dl-tunable-list.h from dl-tunables.list + + BEGIN { ++ min_of["STRING"]="0" ++ max_of["STRING"]="0" ++ min_of["INT_32"]="INT32_MIN" ++ max_of["INT_32"]="INT32_MAX" ++ min_of["UINT_64"]="0" ++ max_of["UINT_64"]="UINT64_MAX" ++ min_of["SIZE_T"]="0" ++ max_of["SIZE_T"]="SIZE_MAX" + tunable="" + ns="" + top_ns="" +@@ -43,10 +51,10 @@ $1 == "}" { + types[top_ns,ns,tunable] = "STRING" + } + if (!minvals[top_ns,ns,tunable]) { +- minvals[top_ns,ns,tunable] = "0" ++ minvals[top_ns,ns,tunable] = min_of[types[top_ns,ns,tunable]] + } + if (!maxvals[top_ns,ns,tunable]) { +- maxvals[top_ns,ns,tunable] = "0" ++ maxvals[top_ns,ns,tunable] = max_of[types[top_ns,ns,tunable]] + } + if (!env_alias[top_ns,ns,tunable]) { + env_alias[top_ns,ns,tunable] = "NULL" +diff --git a/stdlib/getentropy.c b/stdlib/getentropy.c +index a71d4cd8f5..a88bbf8de3 100644 +--- a/stdlib/getentropy.c ++++ b/stdlib/getentropy.c +@@ -21,7 +21,7 @@ + + /* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on + success and -1 on failure. */ +-ssize_t ++int + getentropy (void *buffer, size_t length) + { + __set_errno (ENOSYS); +diff --git a/string/stratcliff.c b/string/stratcliff.c +index e28b0c5058..4320336c9a 100644 +--- a/string/stratcliff.c ++++ b/string/stratcliff.c +@@ -58,8 +58,8 @@ + int + do_test (void) + { +- int size = sysconf (_SC_PAGESIZE); +- int nchars = size / sizeof (CHAR); ++ size_t size = sysconf (_SC_PAGESIZE); ++ size_t nchars = size / sizeof (CHAR); + CHAR *adr; + CHAR *dest; + int result = 0; +@@ -80,7 +80,17 @@ do_test (void) + } + else + { +- int inner, middle, outer; ++ size_t inner, middle, outer, nchars64, max128; ++ ++ if (nchars > 64) ++ nchars64 = nchars - 64; ++ else ++ nchars64 = 0; ++ ++ if (nchars > 128) ++ max128 = nchars - 128; ++ else ++ max128 = 0; + + mprotect (adr, size, PROT_NONE); + mprotect (adr + 2 * nchars, size, PROT_NONE); +@@ -93,59 +103,65 @@ do_test (void) + MEMSET (adr, L('T'), nchars); + + /* strlen/wcslen test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner < nchars; ++inner) + { + adr[inner] = L('\0'); + + if (STRLEN (&adr[outer]) != (size_t) (inner - outer)) + { +- printf ("%s flunked for outer = %d, inner = %d\n", ++ printf ("%s flunked for outer = %zu, inner = %zu\n", + STRINGIFY (STRLEN), outer, inner); + result = 1; + } + + adr[inner] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* strnlen/wcsnlen test */ +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner < nchars; ++inner) + { + adr[inner] = L('\0'); + + if (STRNLEN (&adr[outer], inner - outer + 1) + != (size_t) (inner - outer)) + { +- printf ("%s flunked for outer = %d, inner = %d\n", ++ printf ("%s flunked for outer = %zu, inner = %zu\n", + STRINGIFY (STRNLEN), outer, inner); + result = 1; + } + + adr[inner] = L('T'); + } ++ if (outer == 0) ++ break; + } +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner <= nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner <= nchars; ++inner) + { + if (STRNLEN (&adr[outer], inner - outer) + != (size_t) (inner - outer)) + { +- printf ("%s flunked bounded for outer = %d, inner = %d\n", ++ printf ("%s flunked bounded for outer = %zu, inner = %zu\n", + STRINGIFY (STRNLEN), outer, inner); + result = 1; + } + } ++ if (outer == 0) ++ break; + } + + /* strchr/wcschr test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + for (inner = middle; inner < nchars; ++inner) + { +@@ -158,8 +174,8 @@ do_test (void) + || (inner != middle + && (cp - &adr[outer]) != middle - outer)) + { +- printf ("%s flunked for outer = %d, middle = %d, " +- "inner = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu, " ++ "inner = %zu\n", + STRINGIFY (STRCHR), outer, middle, inner); + result = 1; + } +@@ -168,6 +184,8 @@ do_test (void) + adr[middle] = L('T'); + } + } ++ if (outer == 0) ++ break; + } + + /* Special test. */ +@@ -180,9 +198,9 @@ do_test (void) + } + + /* strrchr/wcsrchr test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + for (inner = middle; inner < nchars; ++inner) + { +@@ -195,8 +213,8 @@ do_test (void) + || (inner != middle + && (cp - &adr[outer]) != middle - outer)) + { +- printf ("%s flunked for outer = %d, middle = %d, " +- "inner = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu, " ++ "inner = %zu\n", + STRINGIFY (STRRCHR), outer, middle, inner); + result = 1; + } +@@ -205,12 +223,14 @@ do_test (void) + adr[middle] = L('T'); + } + } ++ if (outer == 0) ++ break; + } + + /* memchr test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + adr[middle] = L('V'); + +@@ -218,32 +238,36 @@ do_test (void) + + if (cp - &adr[outer] != middle - outer) + { +- printf ("%s flunked for outer = %d, middle = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu\n", + STRINGIFY (MEMCHR), outer, middle); + result = 1; + } + + adr[middle] = L('T'); + } ++ if (outer == 0) ++ break; + } +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { + CHAR *cp = MEMCHR (&adr[outer], L('V'), nchars - outer); + + if (cp != NULL) + { +- printf ("%s flunked for outer = %d\n", ++ printf ("%s flunked for outer = %zu\n", + STRINGIFY (MEMCHR), outer); + result = 1; + } ++ if (outer == 0) ++ break; + } + + /* These functions only exist for single-byte characters. */ + #ifndef WCSTEST + /* rawmemchr test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + adr[middle] = L('V'); + +@@ -251,19 +275,21 @@ do_test (void) + + if (cp - &adr[outer] != middle - outer) + { +- printf ("%s flunked for outer = %d, middle = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu\n", + STRINGIFY (rawmemchr), outer, middle); + result = 1; + } + + adr[middle] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* memrchr test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + adr[middle] = L('V'); + +@@ -271,44 +297,50 @@ do_test (void) + + if (cp - &adr[outer] != middle - outer) + { +- printf ("%s flunked for outer = %d, middle = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu\n", + STRINGIFY (memrchr), outer, middle); + result = 1; + } + + adr[middle] = L('T'); + } ++ if (outer == 0) ++ break; + } +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { + CHAR *cp = memrchr (&adr[outer], L('V'), nchars - outer); + + if (cp != NULL) + { +- printf ("%s flunked for outer = %d\n", ++ printf ("%s flunked for outer = %zu\n", + STRINGIFY (memrchr), outer); + result = 1; + } ++ if (outer == 0) ++ break; + } + #endif + + /* strcpy/wcscpy test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner < nchars; ++inner) + { + adr[inner] = L('\0'); + + if (STRCPY (dest, &adr[outer]) != dest + || STRLEN (dest) != (size_t) (inner - outer)) + { +- printf ("%s flunked for outer = %d, inner = %d\n", ++ printf ("%s flunked for outer = %zu, inner = %zu\n", + STRINGIFY (STRCPY), outer, inner); + result = 1; + } + + adr[inner] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* strcmp/wcscmp tests */ +@@ -322,14 +354,14 @@ do_test (void) + + if (STRCMP (adr + middle, dest + nchars - outer) <= 0) + { +- printf ("%s 1 flunked for outer = %d, middle = %d\n", ++ printf ("%s 1 flunked for outer = %zu, middle = %zu\n", + STRINGIFY (STRCMP), outer, middle); + result = 1; + } + + if (STRCMP (dest + nchars - outer, adr + middle) >= 0) + { +- printf ("%s 2 flunked for outer = %d, middle = %d\n", ++ printf ("%s 2 flunked for outer = %zu, middle = %zu\n", + STRINGIFY (STRCMP), outer, middle); + result = 1; + } +@@ -348,16 +380,16 @@ do_test (void) + { + if (STRNCMP (adr + middle, dest + nchars - outer, inner) != 0) + { +- printf ("%s 1 flunked for outer = %d, middle = %d, " +- "inner = %d\n", ++ printf ("%s 1 flunked for outer = %zu, middle = %zu, " ++ "inner = %zu\n", + STRINGIFY (STRNCMP), outer, middle, inner); + result = 1; + } + + if (STRNCMP (dest + nchars - outer, adr + middle, inner) != 0) + { +- printf ("%s 2 flunked for outer = %d, middle = %d, " +- "inner = %d\n", ++ printf ("%s 2 flunked for outer = %zu, middle = %zu, " ++ "inner = %zu\n", + STRINGIFY (STRNCMP), outer, middle, inner); + result = 1; + } +@@ -365,14 +397,14 @@ do_test (void) + + if (STRNCMP (adr + middle, dest + nchars - outer, outer) >= 0) + { +- printf ("%s 1 flunked for outer = %d, middle = %d, full\n", ++ printf ("%s 1 flunked for outer = %zu, middle = %zu, full\n", + STRINGIFY (STRNCMP), outer, middle); + result = 1; + } + + if (STRNCMP (dest + nchars - outer, adr + middle, outer) <= 0) + { +- printf ("%s 2 flunked for outer = %d, middle = %d, full\n", ++ printf ("%s 2 flunked for outer = %zu, middle = %zu, full\n", + STRINGIFY (STRNCMP), outer, middle); + result = 1; + } +@@ -380,7 +412,7 @@ do_test (void) + + /* strncpy/wcsncpy tests */ + adr[nchars - 1] = L('T'); +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { + size_t len; + +@@ -389,17 +421,19 @@ do_test (void) + if (STRNCPY (dest, &adr[outer], len) != dest + || MEMCMP (dest, &adr[outer], len) != 0) + { +- printf ("outer %s flunked for outer = %d, len = %Zd\n", ++ printf ("outer %s flunked for outer = %zu, len = %zu\n", + STRINGIFY (STRNCPY), outer, len); + result = 1; + } + } ++ if (outer == 0) ++ break; + } + adr[nchars - 1] = L('\0'); + +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner < nchars; ++inner) + { + size_t len; + +@@ -413,8 +447,8 @@ do_test (void) + || (inner - outer < len + && STRLEN (dest) != (inner - outer))) + { +- printf ("%s flunked for outer = %d, inner = %d, " +- "len = %Zd\n", ++ printf ("%s flunked for outer = %zu, inner = %zu, " ++ "len = %zu\n", + STRINGIFY (STRNCPY), outer, inner, len); + result = 1; + } +@@ -424,8 +458,8 @@ do_test (void) + || (inner - outer < len + && STRLEN (dest + 1) != (inner - outer))) + { +- printf ("%s+1 flunked for outer = %d, inner = %d, " +- "len = %Zd\n", ++ printf ("%s+1 flunked for outer = %zu, inner = %zu, " ++ "len = %zu\n", + STRINGIFY (STRNCPY), outer, inner, len); + result = 1; + } +@@ -433,29 +467,33 @@ do_test (void) + + adr[inner] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* stpcpy/wcpcpy test */ +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner) ++ for (inner = MAX (outer, nchars64); inner < nchars; ++inner) + { + adr[inner] = L('\0'); + + if ((STPCPY (dest, &adr[outer]) - dest) != inner - outer) + { +- printf ("%s flunked for outer = %d, inner = %d\n", ++ printf ("%s flunked for outer = %zu, inner = %zu\n", + STRINGIFY (STPCPY), outer, inner); + result = 1; + } + + adr[inner] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* stpncpy/wcpncpy test */ + adr[nchars - 1] = L('T'); +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars; outer >= max128; --outer) + { + size_t len; + +@@ -464,17 +502,19 @@ do_test (void) + if (STPNCPY (dest, &adr[outer], len) != dest + len + || MEMCMP (dest, &adr[outer], len) != 0) + { +- printf ("outer %s flunked for outer = %d, len = %Zd\n", ++ printf ("outer %s flunked for outer = %zu, len = %zu\n", + STRINGIFY (STPNCPY), outer, len); + result = 1; + } + } ++ if (outer == 0) ++ break; + } + adr[nchars - 1] = L('\0'); + +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) ++ for (outer = nchars - 1; outer >= max128; --outer) + { +- for (middle = MAX (outer, nchars - 64); middle < nchars; ++middle) ++ for (middle = MAX (outer, nchars64); middle < nchars; ++middle) + { + adr[middle] = L('\0'); + +@@ -483,8 +523,8 @@ do_test (void) + if ((STPNCPY (dest, &adr[outer], inner) - dest) + != MIN (inner, middle - outer)) + { +- printf ("%s flunked for outer = %d, middle = %d, " +- "inner = %d\n", ++ printf ("%s flunked for outer = %zu, middle = %zu, " ++ "inner = %zu\n", + STRINGIFY (STPNCPY), outer, middle, inner); + result = 1; + } +@@ -492,66 +532,84 @@ do_test (void) + + adr[middle] = L('T'); + } ++ if (outer == 0) ++ break; + } + + /* memcpy/wmemcpy test */ +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) +- for (inner = 0; inner < nchars - outer; ++inner) +- if (MEMCPY (dest, &adr[outer], inner) != dest) +- { +- printf ("%s flunked for outer = %d, inner = %d\n", +- STRINGIFY (MEMCPY), outer, inner); +- result = 1; +- } ++ for (outer = nchars; outer >= max128; --outer) ++ { ++ for (inner = 0; inner < nchars - outer; ++inner) ++ if (MEMCPY (dest, &adr[outer], inner) != dest) ++ { ++ printf ("%s flunked for outer = %zu, inner = %zu\n", ++ STRINGIFY (MEMCPY), outer, inner); ++ result = 1; ++ } ++ if (outer == 0) ++ break; ++ } + + /* mempcpy/wmempcpy test */ +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) +- for (inner = 0; inner < nchars - outer; ++inner) +- if (MEMPCPY (dest, &adr[outer], inner) != dest + inner) +- { +- printf ("%s flunked for outer = %d, inner = %d\n", +- STRINGIFY (MEMPCPY), outer, inner); +- result = 1; +- } ++ for (outer = nchars; outer >= max128; --outer) ++ { ++ for (inner = 0; inner < nchars - outer; ++inner) ++ if (MEMPCPY (dest, &adr[outer], inner) != dest + inner) ++ { ++ printf ("%s flunked for outer = %zu, inner = %zu\n", ++ STRINGIFY (MEMPCPY), outer, inner); ++ result = 1; ++ } ++ if (outer == 0) ++ break; ++ } + + /* This function only exists for single-byte characters. */ + #ifndef WCSTEST + /* memccpy test */ + memset (adr, '\0', nchars); +- for (outer = nchars; outer >= MAX (0, nchars - 128); --outer) +- for (inner = 0; inner < nchars - outer; ++inner) +- if (memccpy (dest, &adr[outer], L('\1'), inner) != NULL) +- { +- printf ("memccpy flunked full copy for outer = %d, inner = %d\n", +- outer, inner); +- result = 1; +- } +- for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer) +- for (middle = 0; middle < nchars - outer; ++middle) +- { +- memset (dest, L('\2'), middle + 1); +- for (inner = 0; inner < middle; ++inner) ++ for (outer = nchars; outer >= max128; --outer) ++ { ++ for (inner = 0; inner < nchars - outer; ++inner) ++ if (memccpy (dest, &adr[outer], L('\1'), inner) != NULL) + { +- adr[outer + inner] = L('\1'); +- +- if (memccpy (dest, &adr[outer], '\1', middle + 128) +- != dest + inner + 1) +- { +- printf ("\ +-memccpy flunked partial copy for outer = %d, middle = %d, inner = %d\n", +- outer, middle, inner); +- result = 1; +- } +- else if (dest[inner + 1] != L('\2')) +- { +- printf ("\ +-memccpy copied too much for outer = %d, middle = %d, inner = %d\n", +- outer, middle, inner); +- result = 1; +- } +- adr[outer + inner] = L('\0'); ++ printf ("memccpy flunked full copy for outer = %zu, inner = %zu\n", ++ outer, inner); ++ result = 1; + } +- } ++ if (outer == 0) ++ break; ++ } ++ for (outer = nchars - 1; outer >= max128; --outer) ++ { ++ for (middle = 0; middle < nchars - outer; ++middle) ++ { ++ memset (dest, L('\2'), middle + 1); ++ for (inner = 0; inner < middle; ++inner) ++ { ++ adr[outer + inner] = L('\1'); ++ ++ if (memccpy (dest, &adr[outer], '\1', middle + 128) ++ != dest + inner + 1) ++ { ++ printf ("\ ++ memccpy flunked partial copy for outer = %zu, middle = %zu, inner = %zu\n", ++ outer, middle, inner); ++ result = 1; ++ } ++ else if (dest[inner + 1] != L('\2')) ++ { ++ printf ("\ ++ memccpy copied too much for outer = %zu, middle = %zu, inner = %zu\n", ++ outer, middle, inner); ++ result = 1; ++ } ++ adr[outer + inner] = L('\0'); ++ } ++ } ++ if (outer == 0) ++ break; ++ } + #endif + } + +diff --git a/support/namespace.h b/support/namespace.h +index 859c2fda3f..9eddb1a0e9 100644 +--- a/support/namespace.h ++++ b/support/namespace.h +@@ -66,7 +66,9 @@ struct support_chroot_configuration + { + /* File contents. The files are not created if the field is + NULL. */ +- const char *resolv_conf; ++ const char *resolv_conf; /* /etc/resolv.conf. */ ++ const char *hosts; /* /etc/hosts. */ ++ const char *host_conf; /* /etc/host.conf. */ + }; + + /* The result of the creation of a chroot. */ +@@ -78,8 +80,11 @@ struct support_chroot + /* Path to the chroot directory. */ + char *path_chroot; + +- /* Path to the /etc/resolv.conf file. */ +- char *path_resolv_conf; ++ /* Paths to files in the chroot. These are absolute and outside of ++ the chroot. */ ++ char *path_resolv_conf; /* /etc/resolv.conf. */ ++ char *path_hosts; /* /etc/hosts. */ ++ char *path_host_conf; /* /etc/host.conf. */ + }; + + /* Create a chroot environment. The returned data should be freed +diff --git a/support/support_chroot.c b/support/support_chroot.c +index c0807b313a..f3ef551b05 100644 +--- a/support/support_chroot.c ++++ b/support/support_chroot.c +@@ -24,6 +24,23 @@ + #include + #include + ++/* If CONTENTS is not NULL, write it to the file at DIRECTORY/RELPATH, ++ and store the name in *ABSPATH. If CONTENTS is NULL, store NULL in ++ *ABSPATH. */ ++static void ++write_file (const char *directory, const char *relpath, const char *contents, ++ char **abspath) ++{ ++ if (contents != NULL) ++ { ++ *abspath = xasprintf ("%s/%s", directory, relpath); ++ add_temp_file (*abspath); ++ support_write_file_string (*abspath, contents); ++ } ++ else ++ *abspath = NULL; ++} ++ + struct support_chroot * + support_chroot_create (struct support_chroot_configuration conf) + { +@@ -39,15 +56,10 @@ support_chroot_create (struct support_chroot_configuration conf) + xmkdir (path_etc, 0777); + add_temp_file (path_etc); + +- if (conf.resolv_conf != NULL) +- { +- /* Create an empty resolv.conf file. */ +- chroot->path_resolv_conf = xasprintf ("%s/resolv.conf", path_etc); +- add_temp_file (chroot->path_resolv_conf); +- support_write_file_string (chroot->path_resolv_conf, conf.resolv_conf); +- } +- else +- chroot->path_resolv_conf = NULL; ++ write_file (path_etc, "resolv.conf", conf.resolv_conf, ++ &chroot->path_resolv_conf); ++ write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts); ++ write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf); + + free (path_etc); + +@@ -67,5 +79,7 @@ support_chroot_free (struct support_chroot *chroot) + { + free (chroot->path_chroot); + free (chroot->path_resolv_conf); ++ free (chroot->path_hosts); ++ free (chroot->path_host_conf); + free (chroot); + } +diff --git a/sysdeps/aarch64/multiarch/Makefile b/sysdeps/aarch64/multiarch/Makefile +index 78d52c717d..9aa1e79a80 100644 +--- a/sysdeps/aarch64/multiarch/Makefile ++++ b/sysdeps/aarch64/multiarch/Makefile +@@ -1,3 +1,4 @@ + ifeq ($(subdir),string) +-sysdep_routines += memcpy_generic memcpy_thunderx ++sysdep_routines += memcpy_generic memcpy_thunderx memcpy_falkor \ ++ memmove_falkor + endif +diff --git a/sysdeps/aarch64/multiarch/ifunc-impl-list.c b/sysdeps/aarch64/multiarch/ifunc-impl-list.c +index 32056bcec3..2cb74d5b43 100644 +--- a/sysdeps/aarch64/multiarch/ifunc-impl-list.c ++++ b/sysdeps/aarch64/multiarch/ifunc-impl-list.c +@@ -25,7 +25,7 @@ + #include + + /* Maximum number of IFUNC implementations. */ +-#define MAX_IFUNC 2 ++#define MAX_IFUNC 3 + + size_t + __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, +@@ -40,9 +40,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, + /* Support sysdeps/aarch64/multiarch/memcpy.c and memmove.c. */ + IFUNC_IMPL (i, name, memcpy, + IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx) ++ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_falkor) + IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_generic)) + IFUNC_IMPL (i, name, memmove, + IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_thunderx) ++ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_falkor) + IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_generic)) + + return i; +diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c +index 9f73efbba7..b395df1c63 100644 +--- a/sysdeps/aarch64/multiarch/memcpy.c ++++ b/sysdeps/aarch64/multiarch/memcpy.c +@@ -30,9 +30,14 @@ extern __typeof (__redirect_memcpy) __libc_memcpy; + + extern __typeof (__redirect_memcpy) __memcpy_generic attribute_hidden; + extern __typeof (__redirect_memcpy) __memcpy_thunderx attribute_hidden; ++extern __typeof (__redirect_memcpy) __memcpy_falkor attribute_hidden; + + libc_ifunc (__libc_memcpy, +- IS_THUNDERX (midr) ? __memcpy_thunderx : __memcpy_generic); ++ (IS_THUNDERX (midr) ++ ? __memcpy_thunderx ++ : (IS_FALKOR (midr) ++ ? __memcpy_falkor ++ : __memcpy_generic))); + + # undef memcpy + strong_alias (__libc_memcpy, memcpy); +diff --git a/sysdeps/aarch64/multiarch/memcpy_falkor.S b/sysdeps/aarch64/multiarch/memcpy_falkor.S +new file mode 100644 +index 0000000000..dea4f225ee +--- /dev/null ++++ b/sysdeps/aarch64/multiarch/memcpy_falkor.S +@@ -0,0 +1,184 @@ ++/* Optimized memcpy for Qualcomm Falkor processor. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#include ++ ++/* Assumptions: ++ ++ ARMv8-a, AArch64, falkor, unaligned accesses. */ ++ ++#define dstin x0 ++#define src x1 ++#define count x2 ++#define dst x3 ++#define srcend x4 ++#define dstend x5 ++#define A_l x6 ++#define A_lw w6 ++#define A_h x7 ++#define A_hw w7 ++#define tmp1 x14 ++ ++/* Copies are split into 3 main cases: ++ ++ 1. Small copies of up to 32 bytes ++ 2. Medium copies of 33..128 bytes which are fully unrolled ++ 3. Large copies of more than 128 bytes. ++ ++ Large copies align the sourceto a quad word and use an unrolled loop ++ processing 64 bytes per iteration. ++ ++ FALKOR-SPECIFIC DESIGN: ++ ++ The smallest copies (32 bytes or less) focus on optimal pipeline usage, ++ which is why the redundant copies of 0-3 bytes have been replaced with ++ conditionals, since the former would unnecessarily break across multiple ++ issue groups. The medium copy group has been enlarged to 128 bytes since ++ bumping up the small copies up to 32 bytes allows us to do that without ++ cost and also allows us to reduce the size of the prep code before loop64. ++ ++ All copies are done only via two registers r6 and r7. This is to ensure ++ that all loads hit a single hardware prefetcher which can get correctly ++ trained to prefetch a single stream. ++ ++ The non-temporal stores help optimize cache utilization. */ ++ ++#if IS_IN (libc) ++ENTRY_ALIGN (__memcpy_falkor, 6) ++ ++ cmp count, 32 ++ add srcend, src, count ++ add dstend, dstin, count ++ b.ls L(copy32) ++ ldp A_l, A_h, [src] ++ cmp count, 128 ++ stp A_l, A_h, [dstin] ++ b.hi L(copy_long) ++ ++ /* Medium copies: 33..128 bytes. */ ++ sub tmp1, count, 1 ++ ldp A_l, A_h, [src, 16] ++ stp A_l, A_h, [dstin, 16] ++ tbz tmp1, 6, 1f ++ ldp A_l, A_h, [src, 32] ++ stp A_l, A_h, [dstin, 32] ++ ldp A_l, A_h, [src, 48] ++ stp A_l, A_h, [dstin, 48] ++ ldp A_l, A_h, [srcend, -64] ++ stp A_l, A_h, [dstend, -64] ++ ldp A_l, A_h, [srcend, -48] ++ stp A_l, A_h, [dstend, -48] ++1: ++ ldp A_l, A_h, [srcend, -32] ++ stp A_l, A_h, [dstend, -32] ++ ldp A_l, A_h, [srcend, -16] ++ stp A_l, A_h, [dstend, -16] ++ ret ++ ++ .p2align 4 ++ /* Small copies: 0..32 bytes. */ ++L(copy32): ++ /* 16-32 */ ++ cmp count, 16 ++ b.lo 1f ++ ldp A_l, A_h, [src] ++ stp A_l, A_h, [dstin] ++ ldp A_l, A_h, [srcend, -16] ++ stp A_l, A_h, [dstend, -16] ++ ret ++ .p2align 4 ++1: ++ /* 8-15 */ ++ tbz count, 3, 1f ++ ldr A_l, [src] ++ str A_l, [dstin] ++ ldr A_l, [srcend, -8] ++ str A_l, [dstend, -8] ++ ret ++ .p2align 4 ++1: ++ /* 4-7 */ ++ tbz count, 2, 1f ++ ldr A_lw, [src] ++ str A_lw, [dstin] ++ ldr A_lw, [srcend, -4] ++ str A_lw, [dstend, -4] ++ ret ++ .p2align 4 ++1: ++ /* 2-3 */ ++ tbz count, 1, 1f ++ ldrh A_lw, [src] ++ strh A_lw, [dstin] ++ ldrh A_lw, [srcend, -2] ++ strh A_lw, [dstend, -2] ++ ret ++ .p2align 4 ++1: ++ /* 0-1 */ ++ tbz count, 0, 1f ++ ldrb A_lw, [src] ++ strb A_lw, [dstin] ++1: ++ ret ++ ++ /* Align SRC to 16 bytes and copy; that way at least one of the ++ accesses is aligned throughout the copy sequence. ++ ++ The count is off by 0 to 15 bytes, but this is OK because we trim ++ off the last 64 bytes to copy off from the end. Due to this the ++ loop never runs out of bounds. */ ++ .p2align 6 ++L(copy_long): ++ sub count, count, 64 + 16 ++ and tmp1, src, 15 ++ bic src, src, 15 ++ sub dst, dstin, tmp1 ++ add count, count, tmp1 ++ ++L(loop64): ++ ldp A_l, A_h, [src, 16]! ++ stnp A_l, A_h, [dst, 16] ++ ldp A_l, A_h, [src, 16]! ++ subs count, count, 64 ++ stnp A_l, A_h, [dst, 32] ++ ldp A_l, A_h, [src, 16]! ++ stnp A_l, A_h, [dst, 48] ++ ldp A_l, A_h, [src, 16]! ++ stnp A_l, A_h, [dst, 64] ++ add dst, dst, 64 ++ b.hi L(loop64) ++ ++ /* Write the last full set of 64 bytes. The remainder is at most 64 ++ bytes, so it is safe to always copy 64 bytes from the end even if ++ there is just 1 byte left. */ ++L(last64): ++ ldp A_l, A_h, [srcend, -64] ++ stnp A_l, A_h, [dstend, -64] ++ ldp A_l, A_h, [srcend, -48] ++ stnp A_l, A_h, [dstend, -48] ++ ldp A_l, A_h, [srcend, -32] ++ stnp A_l, A_h, [dstend, -32] ++ ldp A_l, A_h, [srcend, -16] ++ stnp A_l, A_h, [dstend, -16] ++ ret ++ ++END (__memcpy_falkor) ++libc_hidden_builtin_def (__memcpy_falkor) ++#endif +diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c +index 34c6b29bd5..016f03ee50 100644 +--- a/sysdeps/aarch64/multiarch/memmove.c ++++ b/sysdeps/aarch64/multiarch/memmove.c +@@ -30,9 +30,14 @@ extern __typeof (__redirect_memmove) __libc_memmove; + + extern __typeof (__redirect_memmove) __memmove_generic attribute_hidden; + extern __typeof (__redirect_memmove) __memmove_thunderx attribute_hidden; ++extern __typeof (__redirect_memmove) __memmove_falkor attribute_hidden; + + libc_ifunc (__libc_memmove, +- IS_THUNDERX (midr) ? __memmove_thunderx : __memmove_generic); ++ (IS_THUNDERX (midr) ++ ? __memmove_thunderx ++ : (IS_FALKOR (midr) ++ ? __memmove_falkor ++ : __memmove_generic))); + + # undef memmove + strong_alias (__libc_memmove, memmove); +diff --git a/sysdeps/aarch64/multiarch/memmove_falkor.S b/sysdeps/aarch64/multiarch/memmove_falkor.S +new file mode 100644 +index 0000000000..3a4e6a2a8e +--- /dev/null ++++ b/sysdeps/aarch64/multiarch/memmove_falkor.S +@@ -0,0 +1,232 @@ ++/* Copyright (C) 2017 Free Software Foundation, Inc. ++ ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#include ++ ++/* Assumptions: ARMv8-a, AArch64, falkor, unaligned accesses. */ ++ ++#define dstin x0 ++#define src x1 ++#define count x2 ++#define dstlen x3 ++#define dst x3 ++#define srcend x4 ++#define dstend x5 ++#define A_l x6 ++#define A_lw w6 ++#define A_h x7 ++#define A_hw w7 ++#define B_l x8 ++#define B_lw w8 ++#define B_h x9 ++#define C_l x10 ++#define C_h x11 ++#define D_l x12 ++#define D_h x13 ++#define E_l src ++#define E_h count ++#define F_l srcend ++#define F_h dst ++#define tmp1 x14 ++ ++/* Alias with A_l and A_h to train the prefetcher. */ ++#define Q_l x22 ++#define Q_h x23 ++ ++/* RATIONALE: ++ ++ The copy has 4 distinct parts: ++ * Small copies of 16 bytes and under ++ * Medium sized copies of 17-96 bytes ++ * Large copies where the source address is higher than the destination ++ (forward copies) ++ * Large copies where the destination address is higher than the source ++ (copy backward, or move). ++ ++ We use only two registerpairs x6,x7 and x22,x23 for the copies and copy 32 ++ bytes at a time to correctly train the hardware prefetcher for better ++ throughput. */ ++ENTRY_ALIGN (__memmove_falkor, 6) ++ ++ sub tmp1, dstin, src ++ add srcend, src, count ++ add dstend, dstin, count ++ cmp count, 96 ++ ccmp tmp1, count, 2, hi ++ b.lo L(move_long) ++ ++ cmp count, 16 ++ b.ls L(copy16) ++ cmp count, 96 ++ b.hi L(copy_long) ++ ++ /* Medium copies: 17..96 bytes. */ ++ sub tmp1, count, 1 ++ ldp A_l, A_h, [src] ++ tbnz tmp1, 6, L(copy96) ++ ldp D_l, D_h, [srcend, -16] ++ tbz tmp1, 5, 1f ++ ldp B_l, B_h, [src, 16] ++ ldp C_l, C_h, [srcend, -32] ++ stp B_l, B_h, [dstin, 16] ++ stp C_l, C_h, [dstend, -32] ++1: ++ stp A_l, A_h, [dstin] ++ stp D_l, D_h, [dstend, -16] ++ ret ++ ++ .p2align 4 ++ /* Small copies: 0..16 bytes. */ ++L(copy16): ++ cmp count, 8 ++ b.lo 1f ++ ldr A_l, [src] ++ ldr A_h, [srcend, -8] ++ str A_l, [dstin] ++ str A_h, [dstend, -8] ++ ret ++ .p2align 4 ++1: ++ /* 4-7 */ ++ tbz count, 2, 1f ++ ldr A_lw, [src] ++ ldr A_hw, [srcend, -4] ++ str A_lw, [dstin] ++ str A_hw, [dstend, -4] ++ ret ++ .p2align 4 ++1: ++ /* 2-3 */ ++ tbz count, 1, 1f ++ ldrh A_lw, [src] ++ ldrh A_hw, [srcend, -2] ++ strh A_lw, [dstin] ++ strh A_hw, [dstend, -2] ++ ret ++ .p2align 4 ++1: ++ /* 0-1 */ ++ tbz count, 0, 1f ++ ldrb A_lw, [src] ++ strb A_lw, [dstin] ++1: ret ++ ++ .p2align 4 ++ /* Copy 64..96 bytes. Copy 64 bytes from the start and ++ 32 bytes from the end. */ ++L(copy96): ++ ldp B_l, B_h, [src, 16] ++ ldp C_l, C_h, [src, 32] ++ ldp D_l, D_h, [src, 48] ++ ldp E_l, E_h, [srcend, -32] ++ ldp F_l, F_h, [srcend, -16] ++ stp A_l, A_h, [dstin] ++ stp B_l, B_h, [dstin, 16] ++ stp C_l, C_h, [dstin, 32] ++ stp D_l, D_h, [dstin, 48] ++ stp E_l, E_h, [dstend, -32] ++ stp F_l, F_h, [dstend, -16] ++ ret ++ ++ /* Align SRC to 16 byte alignment so that we don't cross cache line ++ boundaries on both loads and stores. There are at least 96 bytes ++ to copy, so copy 16 bytes unaligned and then align. The loop ++ copies 32 bytes per iteration and prefetches one iteration ahead. */ ++ ++ .p2align 4 ++L(copy_long): ++ sub count, count, 64 + 16 /* Test and readjust count. */ ++ mov B_l, Q_l ++ mov B_h, Q_h ++ ldp A_l, A_h, [src] ++ and tmp1, src, 15 ++ bic src, src, 15 ++ sub dst, dstin, tmp1 ++ add count, count, tmp1 /* Count is now 16 too large. */ ++ ldp Q_l, Q_h, [src, 16]! ++ stp A_l, A_h, [dstin] ++ ldp A_l, A_h, [src, 16]! ++ ++L(loop64): ++ subs count, count, 32 ++ stp Q_l, Q_h, [dst, 16] ++ ldp Q_l, Q_h, [src, 16]! ++ stp A_l, A_h, [dst, 32]! ++ ldp A_l, A_h, [src, 16]! ++ b.hi L(loop64) ++ ++ /* Write the last full set of 32 bytes. The remainder is at most 32 ++ bytes, so it is safe to always copy 32 bytes from the end even if ++ there is just 1 byte left. */ ++L(last64): ++ ldp C_l, C_h, [srcend, -32] ++ stp Q_l, Q_h, [dst, 16] ++ ldp Q_l, Q_h, [srcend, -16] ++ stp A_l, A_h, [dst, 32] ++ stp C_l, C_h, [dstend, -32] ++ stp Q_l, Q_h, [dstend, -16] ++ mov Q_l, B_l ++ mov Q_h, B_h ++ ret ++ ++ .p2align 4 ++L(move_long): ++ cbz tmp1, 3f ++ ++ mov B_l, Q_l ++ mov B_h, Q_h ++ ++ /* Align SRCEND to 16 byte alignment so that we don't cross cache line ++ boundaries on both loads and stores. There are at least 96 bytes ++ to copy, so copy 16 bytes unaligned and then align. The loop ++ copies 32 bytes per iteration and prefetches one iteration ahead. */ ++ ++ ldp A_l, A_h, [srcend, -16] ++ and tmp1, srcend, 15 ++ sub srcend, srcend, tmp1 ++ ldp Q_l, Q_h, [srcend, -16]! ++ stp A_l, A_h, [dstend, -16] ++ sub count, count, tmp1 ++ ldp A_l, A_h, [srcend, -16]! ++ sub dstend, dstend, tmp1 ++ sub count, count, 64 ++ ++1: ++ subs count, count, 32 ++ stp Q_l, Q_h, [dstend, -16] ++ ldp Q_l, Q_h, [srcend, -16]! ++ stp A_l, A_h, [dstend, -32]! ++ ldp A_l, A_h, [srcend, -16]! ++ b.hi 1b ++ ++ /* Write the last full set of 32 bytes. The remainder is at most 32 ++ bytes, so it is safe to always copy 32 bytes from the start even if ++ there is just 1 byte left. */ ++2: ++ ldp C_l, C_h, [src, 16] ++ stp Q_l, Q_h, [dstend, -16] ++ ldp Q_l, Q_h, [src] ++ stp A_l, A_h, [dstend, -32] ++ stp C_l, C_h, [dstin, 16] ++ stp Q_l, Q_h, [dstin] ++ mov Q_l, B_l ++ mov Q_h, B_h ++3: ret ++ ++END (__memmove_falkor) ++libc_hidden_builtin_def (__memmove_falkor) +diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +index d13a75db07..9ab23d0474 100644 +--- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +@@ -45,6 +45,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 ++#define __PTHREAD_MUTEX_USE_UNION 0 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/aarch64/nptl/pthread-offsets.h b/sysdeps/aarch64/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..16c6b0d9fd +--- /dev/null ++++ b/sysdeps/aarch64/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++#define __PTHREAD_MUTEX_KIND_OFFSET 16 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 24 +diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h +index b6f6cb1347..429df10c0c 100644 +--- a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h +@@ -33,6 +33,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 ++#define __PTHREAD_MUTEX_USE_UNION 0 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/alpha/nptl/pthread-offsets.h b/sysdeps/alpha/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..16c6b0d9fd +--- /dev/null ++++ b/sysdeps/alpha/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++#define __PTHREAD_MUTEX_KIND_OFFSET 16 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 24 +diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +index 3f9eca4645..3911c8183d 100644 +--- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +@@ -34,6 +34,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/arm/nptl/pthread-offsets.h b/sysdeps/arm/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/arm/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c +index d1e4e6f0d5..52e97e2f6a 100644 +--- a/sysdeps/gnu/glob64.c ++++ b/sysdeps/gnu/glob64.c +@@ -15,11 +15,8 @@ + #undef __stat + #define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) + +-#define NO_GLOB_PATTERN_P 1 +- + #define COMPILE_GLOB64 1 + + #include + + libc_hidden_def (glob64) +-libc_hidden_def (globfree64) +diff --git a/sysdeps/gnu/globfree64.c b/sysdeps/gnu/globfree64.c +new file mode 100644 +index 0000000000..f092d0bf8b +--- /dev/null ++++ b/sysdeps/gnu/globfree64.c +@@ -0,0 +1,10 @@ ++#include ++#include ++#include ++ ++#define glob_t glob64_t ++#define globfree(pglob) globfree64 (pglob) ++ ++#include ++ ++libc_hidden_def (globfree64) +diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h +index c1585625d1..865a14ee4a 100644 +--- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h +@@ -48,6 +48,8 @@ + pthread_mutex_t is larger than Linuxthreads. */ + #define __PTHREAD_COMPAT_PADDING_END int __reserved[2]; + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16))) + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/hppa/nptl/pthread-offsets.h b/sysdeps/hppa/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..8ae01b9d95 +--- /dev/null ++++ b/sysdeps/hppa/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 32 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 36 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 36 +diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps +index 81dd1a09ea..053f5ec972 100644 +--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps ++++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps +@@ -58,7 +58,7 @@ double: 1 + float128: 2 + idouble: 1 + ifloat128: 2 +-ildouble: 4 ++ildouble: 5 + ldouble: 3 + + Function: "asin": +@@ -1154,8 +1154,8 @@ float128: 4 + idouble: 3 + ifloat: 3 + ifloat128: 4 +-ildouble: 7 +-ldouble: 7 ++ildouble: 8 ++ldouble: 8 + + Function: Imaginary part of "clog10_upward": + double: 1 +@@ -2013,8 +2013,8 @@ double: 3 + float: 4 + idouble: 3 + ifloat: 4 +-ildouble: 5 +-ldouble: 5 ++ildouble: 6 ++ldouble: 6 + + Function: "hypot": + double: 1 +@@ -2205,8 +2205,8 @@ float128: 8 + idouble: 3 + ifloat: 4 + ifloat128: 8 +-ildouble: 5 +-ldouble: 5 ++ildouble: 6 ++ldouble: 6 + + Function: "log": + double: 1 +diff --git a/sysdeps/i386/nptl/pthread-offsets.h b/sysdeps/i386/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/i386/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h +index 631cb33d09..2a3bc75b20 100644 +--- a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h +@@ -33,6 +33,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 ++#define __PTHREAD_MUTEX_USE_UNION 0 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/ia64/nptl/pthread-offsets.h b/sysdeps/ia64/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..16c6b0d9fd +--- /dev/null ++++ b/sysdeps/ia64/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++#define __PTHREAD_MUTEX_KIND_OFFSET 16 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 24 +diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c +index dec0c5d6ee..6e3f8316b1 100644 +--- a/sysdeps/ieee754/dbl-64/s_nearbyint.c ++++ b/sysdeps/ieee754/dbl-64/s_nearbyint.c +@@ -48,7 +48,7 @@ __nearbyint (double x) + if (j0 < 0) + { + libc_feholdexcept (&env); +- w = TWO52[sx] + x; ++ w = TWO52[sx] + math_opt_barrier (x); + t = w - TWO52[sx]; + math_force_eval (t); + libc_fesetenv (&env); +@@ -65,7 +65,7 @@ __nearbyint (double x) + return x; /* x is integral */ + } + libc_feholdexcept (&env); +- w = TWO52[sx] + x; ++ w = TWO52[sx] + math_opt_barrier (x); + t = w - TWO52[sx]; + math_force_eval (t); + libc_fesetenv (&env); +diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c +index 8293819981..7d135b54e4 100644 +--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c ++++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c +@@ -42,9 +42,9 @@ __nearbyint(double x) + if(__builtin_expect(j0<52, 1)) { + if(j0<0) { + libc_feholdexcept (&env); +- double w = TWO52[sx]+x; ++ double w = TWO52[sx] + math_opt_barrier (x); + double t = w-TWO52[sx]; +- math_opt_barrier(t); ++ math_force_eval (t); + libc_fesetenv (&env); + return __copysign (t, x); + } +@@ -53,9 +53,9 @@ __nearbyint(double x) + else return x; /* x is integral */ + } + libc_feholdexcept (&env); +- double w = TWO52[sx]+x; ++ double w = TWO52[sx] + math_opt_barrier (x); + double t = w-TWO52[sx]; +- math_opt_barrier (t); ++ math_force_eval (t); + libc_fesetenv (&env); + return t; + } +diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c +index 5aebefafcf..b06df6b3c8 100644 +--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c ++++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c +@@ -37,7 +37,7 @@ __nearbyintf(float x) + if(j0<23) { + if(j0<0) { + libc_feholdexceptf (&env); +- w = TWO23[sx]+x; ++ w = TWO23[sx] + math_opt_barrier (x); + t = w-TWO23[sx]; + math_force_eval (t); + libc_fesetenvf (&env); +@@ -50,7 +50,7 @@ __nearbyintf(float x) + else return x; /* x is integral */ + } + libc_feholdexceptf (&env); +- w = TWO23[sx]+x; ++ w = TWO23[sx] + math_opt_barrier (x); + t = w-TWO23[sx]; + math_force_eval (t); + libc_fesetenvf (&env); +diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +index bef2601bce..a80c9eaf33 100644 +--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c ++++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +@@ -73,11 +73,7 @@ + #include + + static const _Float128 PIL = L(3.1415926535897932384626433832795028841972E0); +-#if LDBL_MANT_DIG == 106 +-static const _Float128 MAXLGM = L(0x5.d53649e2d469dbc1f01e99fd66p+1012); +-#else + static const _Float128 MAXLGM = L(1.0485738685148938358098967157129705071571E4928); +-#endif + static const _Float128 one = 1; + static const _Float128 huge = LDBL_MAX; + +@@ -777,7 +773,7 @@ __ieee754_lgammal_r (_Float128 x, int *signgamp) + + if (x < 0) + { +- if (x < -2 && x > (LDBL_MANT_DIG == 106 ? -48 : -50)) ++ if (x < -2 && x > -50) + return __lgamma_negl (x, signgamp); + q = -x; + p = __floorl (q); +diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +index 1565a8183f..98a33d24a7 100644 +--- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c ++++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +@@ -45,7 +45,7 @@ _Float128 __nearbyintl(_Float128 x) + if(j0<112) { + if(j0<0) { + feholdexcept (&env); +- w = TWO112[sx]+x; ++ w = TWO112[sx] + math_opt_barrier (x); + t = w-TWO112[sx]; + math_force_eval (t); + fesetenv (&env); +@@ -58,7 +58,7 @@ _Float128 __nearbyintl(_Float128 x) + else return x; /* x is integral */ + } + feholdexcept (&env); +- w = TWO112[sx]+x; ++ w = TWO112[sx] + math_opt_barrier (x); + t = w-TWO112[sx]; + math_force_eval (t); + fesetenv (&env); +diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h +index 7ddb368d26..f756857c03 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h ++++ b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h +@@ -37,5 +37,22 @@ extern int __iscanonicall (long double __x) + conversion, before being discarded; in IBM long double, there are + encodings that are not consistently handled as corresponding to any + particular value of the type, and we return 0 for those. */ +-# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) +-#endif ++# ifndef __cplusplus ++# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) ++# else ++/* In C++ mode, __MATH_TG cannot be used, because it relies on ++ __builtin_types_compatible_p, which is a C-only builtin. On the ++ other hand, overloading provides the means to distinguish between ++ the floating-point types. The overloading resolution will match ++ the correct parameter (regardless of type qualifiers (i.e.: const ++ and volatile)). */ ++extern "C++" { ++inline int iscanonical (float __val) { return __iscanonicalf (__val); } ++inline int iscanonical (double __val) { return __iscanonical (__val); } ++inline int iscanonical (long double __val) { return __iscanonicall (__val); } ++# if __HAVE_DISTINCT_FLOAT128 ++inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } ++# endif ++} ++# endif /* __cplusplus */ ++#endif /* __NO_LONG_DOUBLE_MATH */ +diff --git a/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c +index 10df6bb7d5..9185e7cb5c 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/e_expl.c ++++ b/sysdeps/ieee754/ldbl-128ibm/e_expl.c +@@ -66,10 +66,8 @@ + #include + #include + +-#define _Float128 long double +-#define L(x) x ## L + +-#include ++#include "t_expl.h" + + static const long double C[] = { + /* Smallest integer x for which e^x overflows. */ +diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c +index 00bce29284..0a7fe32354 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c ++++ b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c +@@ -1,5 +1,864 @@ +-/* Looks like we can use ieee854 e_j0l.c as is for IBM extended format. */ +-#define _Float128 long double +-#define L(x) x ## L +-#include ++/* Bessel function of order zero. IBM Extended Precision version. ++ Copyright 2001 by Stephen L. Moshier (moshier@na-net.ornl.gov). + ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see ++ . */ ++ ++/* This file was copied from sysdeps/ieee754/ldbl-128/e_j0l.c. */ ++ ++ ++#include ++#include ++#include ++ ++/* 1 / sqrt(pi) */ ++static const long double ONEOSQPI = 5.6418958354775628694807945156077258584405E-1L; ++/* 2 / pi */ ++static const long double TWOOPI = 6.3661977236758134307553505349005744813784E-1L; ++static const long double zero = 0; ++ ++/* J0(x) = 1 - x^2/4 + x^2 x^2 R(x^2) ++ Peak relative error 3.4e-37 ++ 0 <= x <= 2 */ ++#define NJ0_2N 6 ++static const long double J0_2N[NJ0_2N + 1] = { ++ 3.133239376997663645548490085151484674892E16L, ++ -5.479944965767990821079467311839107722107E14L, ++ 6.290828903904724265980249871997551894090E12L, ++ -3.633750176832769659849028554429106299915E10L, ++ 1.207743757532429576399485415069244807022E8L, ++ -2.107485999925074577174305650549367415465E5L, ++ 1.562826808020631846245296572935547005859E2L, ++}; ++#define NJ0_2D 6 ++static const long double J0_2D[NJ0_2D + 1] = { ++ 2.005273201278504733151033654496928968261E18L, ++ 2.063038558793221244373123294054149790864E16L, ++ 1.053350447931127971406896594022010524994E14L, ++ 3.496556557558702583143527876385508882310E11L, ++ 8.249114511878616075860654484367133976306E8L, ++ 1.402965782449571800199759247964242790589E6L, ++ 1.619910762853439600957801751815074787351E3L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2), ++ 0 <= 1/x <= .0625 ++ Peak relative error 3.3e-36 */ ++#define NP16_IN 9 ++static const long double P16_IN[NP16_IN + 1] = { ++ -1.901689868258117463979611259731176301065E-16L, ++ -1.798743043824071514483008340803573980931E-13L, ++ -6.481746687115262291873324132944647438959E-11L, ++ -1.150651553745409037257197798528294248012E-8L, ++ -1.088408467297401082271185599507222695995E-6L, ++ -5.551996725183495852661022587879817546508E-5L, ++ -1.477286941214245433866838787454880214736E-3L, ++ -1.882877976157714592017345347609200402472E-2L, ++ -9.620983176855405325086530374317855880515E-2L, ++ -1.271468546258855781530458854476627766233E-1L, ++}; ++#define NP16_ID 9 ++static const long double P16_ID[NP16_ID + 1] = { ++ 2.704625590411544837659891569420764475007E-15L, ++ 2.562526347676857624104306349421985403573E-12L, ++ 9.259137589952741054108665570122085036246E-10L, ++ 1.651044705794378365237454962653430805272E-7L, ++ 1.573561544138733044977714063100859136660E-5L, ++ 8.134482112334882274688298469629884804056E-4L, ++ 2.219259239404080863919375103673593571689E-2L, ++ 2.976990606226596289580242451096393862792E-1L, ++ 1.713895630454693931742734911930937246254E0L, ++ 3.231552290717904041465898249160757368855E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ 0.0625 <= 1/x <= 0.125 ++ Peak relative error 2.4e-35 */ ++#define NP8_16N 10 ++static const long double P8_16N[NP8_16N + 1] = { ++ -2.335166846111159458466553806683579003632E-15L, ++ -1.382763674252402720401020004169367089975E-12L, ++ -3.192160804534716696058987967592784857907E-10L, ++ -3.744199606283752333686144670572632116899E-8L, ++ -2.439161236879511162078619292571922772224E-6L, ++ -9.068436986859420951664151060267045346549E-5L, ++ -1.905407090637058116299757292660002697359E-3L, ++ -2.164456143936718388053842376884252978872E-2L, ++ -1.212178415116411222341491717748696499966E-1L, ++ -2.782433626588541494473277445959593334494E-1L, ++ -1.670703190068873186016102289227646035035E-1L, ++}; ++#define NP8_16D 10 ++static const long double P8_16D[NP8_16D + 1] = { ++ 3.321126181135871232648331450082662856743E-14L, ++ 1.971894594837650840586859228510007703641E-11L, ++ 4.571144364787008285981633719513897281690E-9L, ++ 5.396419143536287457142904742849052402103E-7L, ++ 3.551548222385845912370226756036899901549E-5L, ++ 1.342353874566932014705609788054598013516E-3L, ++ 2.899133293006771317589357444614157734385E-2L, ++ 3.455374978185770197704507681491574261545E-1L, ++ 2.116616964297512311314454834712634820514E0L, ++ 5.850768316827915470087758636881584174432E0L, ++ 5.655273858938766830855753983631132928968E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ 0.125 <= 1/x <= 0.1875 ++ Peak relative error 2.7e-35 */ ++#define NP5_8N 10 ++static const long double P5_8N[NP5_8N + 1] = { ++ -1.270478335089770355749591358934012019596E-12L, ++ -4.007588712145412921057254992155810347245E-10L, ++ -4.815187822989597568124520080486652009281E-8L, ++ -2.867070063972764880024598300408284868021E-6L, ++ -9.218742195161302204046454768106063638006E-5L, ++ -1.635746821447052827526320629828043529997E-3L, ++ -1.570376886640308408247709616497261011707E-2L, ++ -7.656484795303305596941813361786219477807E-2L, ++ -1.659371030767513274944805479908858628053E-1L, ++ -1.185340550030955660015841796219919804915E-1L, ++ -8.920026499909994671248893388013790366712E-3L, ++}; ++#define NP5_8D 9 ++static const long double P5_8D[NP5_8D + 1] = { ++ 1.806902521016705225778045904631543990314E-11L, ++ 5.728502760243502431663549179135868966031E-9L, ++ 6.938168504826004255287618819550667978450E-7L, ++ 4.183769964807453250763325026573037785902E-5L, ++ 1.372660678476925468014882230851637878587E-3L, ++ 2.516452105242920335873286419212708961771E-2L, ++ 2.550502712902647803796267951846557316182E-1L, ++ 1.365861559418983216913629123778747617072E0L, ++ 3.523825618308783966723472468855042541407E0L, ++ 3.656365803506136165615111349150536282434E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ Peak relative error 3.5e-35 ++ 0.1875 <= 1/x <= 0.25 */ ++#define NP4_5N 9 ++static const long double P4_5N[NP4_5N + 1] = { ++ -9.791405771694098960254468859195175708252E-10L, ++ -1.917193059944531970421626610188102836352E-7L, ++ -1.393597539508855262243816152893982002084E-5L, ++ -4.881863490846771259880606911667479860077E-4L, ++ -8.946571245022470127331892085881699269853E-3L, ++ -8.707474232568097513415336886103899434251E-2L, ++ -4.362042697474650737898551272505525973766E-1L, ++ -1.032712171267523975431451359962375617386E0L, ++ -9.630502683169895107062182070514713702346E-1L, ++ -2.251804386252969656586810309252357233320E-1L, ++}; ++#define NP4_5D 9 ++static const long double P4_5D[NP4_5D + 1] = { ++ 1.392555487577717669739688337895791213139E-8L, ++ 2.748886559120659027172816051276451376854E-6L, ++ 2.024717710644378047477189849678576659290E-4L, ++ 7.244868609350416002930624752604670292469E-3L, ++ 1.373631762292244371102989739300382152416E-1L, ++ 1.412298581400224267910294815260613240668E0L, ++ 7.742495637843445079276397723849017617210E0L, ++ 2.138429269198406512028307045259503811861E1L, ++ 2.651547684548423476506826951831712762610E1L, ++ 1.167499382465291931571685222882909166935E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ Peak relative error 2.3e-36 ++ 0.25 <= 1/x <= 0.3125 */ ++#define NP3r2_4N 9 ++static const long double P3r2_4N[NP3r2_4N + 1] = { ++ -2.589155123706348361249809342508270121788E-8L, ++ -3.746254369796115441118148490849195516593E-6L, ++ -1.985595497390808544622893738135529701062E-4L, ++ -5.008253705202932091290132760394976551426E-3L, ++ -6.529469780539591572179155511840853077232E-2L, ++ -4.468736064761814602927408833818990271514E-1L, ++ -1.556391252586395038089729428444444823380E0L, ++ -2.533135309840530224072920725976994981638E0L, ++ -1.605509621731068453869408718565392869560E0L, ++ -2.518966692256192789269859830255724429375E-1L, ++}; ++#define NP3r2_4D 9 ++static const long double P3r2_4D[NP3r2_4D + 1] = { ++ 3.682353957237979993646169732962573930237E-7L, ++ 5.386741661883067824698973455566332102029E-5L, ++ 2.906881154171822780345134853794241037053E-3L, ++ 7.545832595801289519475806339863492074126E-2L, ++ 1.029405357245594877344360389469584526654E0L, ++ 7.565706120589873131187989560509757626725E0L, ++ 2.951172890699569545357692207898667665796E1L, ++ 5.785723537170311456298467310529815457536E1L, ++ 5.095621464598267889126015412522773474467E1L, ++ 1.602958484169953109437547474953308401442E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ Peak relative error 1.0e-35 ++ 0.3125 <= 1/x <= 0.375 */ ++#define NP2r7_3r2N 9 ++static const long double P2r7_3r2N[NP2r7_3r2N + 1] = { ++ -1.917322340814391131073820537027234322550E-7L, ++ -1.966595744473227183846019639723259011906E-5L, ++ -7.177081163619679403212623526632690465290E-4L, ++ -1.206467373860974695661544653741899755695E-2L, ++ -1.008656452188539812154551482286328107316E-1L, ++ -4.216016116408810856620947307438823892707E-1L, ++ -8.378631013025721741744285026537009814161E-1L, ++ -6.973895635309960850033762745957946272579E-1L, ++ -1.797864718878320770670740413285763554812E-1L, ++ -4.098025357743657347681137871388402849581E-3L, ++}; ++#define NP2r7_3r2D 8 ++static const long double P2r7_3r2D[NP2r7_3r2D + 1] = { ++ 2.726858489303036441686496086962545034018E-6L, ++ 2.840430827557109238386808968234848081424E-4L, ++ 1.063826772041781947891481054529454088832E-2L, ++ 1.864775537138364773178044431045514405468E-1L, ++ 1.665660052857205170440952607701728254211E0L, ++ 7.723745889544331153080842168958348568395E0L, ++ 1.810726427571829798856428548102077799835E1L, ++ 1.986460672157794440666187503833545388527E1L, ++ 8.645503204552282306364296517220055815488E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ Peak relative error 1.3e-36 ++ 0.3125 <= 1/x <= 0.4375 */ ++#define NP2r3_2r7N 9 ++static const long double P2r3_2r7N[NP2r3_2r7N + 1] = { ++ -1.594642785584856746358609622003310312622E-6L, ++ -1.323238196302221554194031733595194539794E-4L, ++ -3.856087818696874802689922536987100372345E-3L, ++ -5.113241710697777193011470733601522047399E-2L, ++ -3.334229537209911914449990372942022350558E-1L, ++ -1.075703518198127096179198549659283422832E0L, ++ -1.634174803414062725476343124267110981807E0L, ++ -1.030133247434119595616826842367268304880E0L, ++ -1.989811539080358501229347481000707289391E-1L, ++ -3.246859189246653459359775001466924610236E-3L, ++}; ++#define NP2r3_2r7D 8 ++static const long double P2r3_2r7D[NP2r3_2r7D + 1] = { ++ 2.267936634217251403663034189684284173018E-5L, ++ 1.918112982168673386858072491437971732237E-3L, ++ 5.771704085468423159125856786653868219522E-2L, ++ 8.056124451167969333717642810661498890507E-1L, ++ 5.687897967531010276788680634413789328776E0L, ++ 2.072596760717695491085444438270778394421E1L, ++ 3.801722099819929988585197088613160496684E1L, ++ 3.254620235902912339534998592085115836829E1L, ++ 1.104847772130720331801884344645060675036E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J0(x)cosX + Y0(x)sinX = sqrt( 2/(pi x)) P0(x), P0(x) = 1 + 1/x^2 R(1/x^2) ++ Peak relative error 1.2e-35 ++ 0.4375 <= 1/x <= 0.5 */ ++#define NP2_2r3N 8 ++static const long double P2_2r3N[NP2_2r3N + 1] = { ++ -1.001042324337684297465071506097365389123E-4L, ++ -6.289034524673365824853547252689991418981E-3L, ++ -1.346527918018624234373664526930736205806E-1L, ++ -1.268808313614288355444506172560463315102E0L, ++ -5.654126123607146048354132115649177406163E0L, ++ -1.186649511267312652171775803270911971693E1L, ++ -1.094032424931998612551588246779200724257E1L, ++ -3.728792136814520055025256353193674625267E0L, ++ -3.000348318524471807839934764596331810608E-1L, ++}; ++#define NP2_2r3D 8 ++static const long double P2_2r3D[NP2_2r3D + 1] = { ++ 1.423705538269770974803901422532055612980E-3L, ++ 9.171476630091439978533535167485230575894E-2L, ++ 2.049776318166637248868444600215942828537E0L, ++ 2.068970329743769804547326701946144899583E1L, ++ 1.025103500560831035592731539565060347709E2L, ++ 2.528088049697570728252145557167066708284E2L, ++ 2.992160327587558573740271294804830114205E2L, ++ 1.540193761146551025832707739468679973036E2L, ++ 2.779516701986912132637672140709452502650E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 2.2e-35 ++ 0 <= 1/x <= .0625 */ ++#define NQ16_IN 10 ++static const long double Q16_IN[NQ16_IN + 1] = { ++ 2.343640834407975740545326632205999437469E-18L, ++ 2.667978112927811452221176781536278257448E-15L, ++ 1.178415018484555397390098879501969116536E-12L, ++ 2.622049767502719728905924701288614016597E-10L, ++ 3.196908059607618864801313380896308968673E-8L, ++ 2.179466154171673958770030655199434798494E-6L, ++ 8.139959091628545225221976413795645177291E-5L, ++ 1.563900725721039825236927137885747138654E-3L, ++ 1.355172364265825167113562519307194840307E-2L, ++ 3.928058355906967977269780046844768588532E-2L, ++ 1.107891967702173292405380993183694932208E-2L, ++}; ++#define NQ16_ID 9 ++static const long double Q16_ID[NQ16_ID + 1] = { ++ 3.199850952578356211091219295199301766718E-17L, ++ 3.652601488020654842194486058637953363918E-14L, ++ 1.620179741394865258354608590461839031281E-11L, ++ 3.629359209474609630056463248923684371426E-9L, ++ 4.473680923894354600193264347733477363305E-7L, ++ 3.106368086644715743265603656011050476736E-5L, ++ 1.198239259946770604954664925153424252622E-3L, ++ 2.446041004004283102372887804475767568272E-2L, ++ 2.403235525011860603014707768815113698768E-1L, ++ 9.491006790682158612266270665136910927149E-1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++ }; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 5.1e-36 ++ 0.0625 <= 1/x <= 0.125 */ ++#define NQ8_16N 11 ++static const long double Q8_16N[NQ8_16N + 1] = { ++ 1.001954266485599464105669390693597125904E-17L, ++ 7.545499865295034556206475956620160007849E-15L, ++ 2.267838684785673931024792538193202559922E-12L, ++ 3.561909705814420373609574999542459912419E-10L, ++ 3.216201422768092505214730633842924944671E-8L, ++ 1.731194793857907454569364622452058554314E-6L, ++ 5.576944613034537050396518509871004586039E-5L, ++ 1.051787760316848982655967052985391418146E-3L, ++ 1.102852974036687441600678598019883746959E-2L, ++ 5.834647019292460494254225988766702933571E-2L, ++ 1.290281921604364618912425380717127576529E-1L, ++ 7.598886310387075708640370806458926458301E-2L, ++}; ++#define NQ8_16D 11 ++static const long double Q8_16D[NQ8_16D + 1] = { ++ 1.368001558508338469503329967729951830843E-16L, ++ 1.034454121857542147020549303317348297289E-13L, ++ 3.128109209247090744354764050629381674436E-11L, ++ 4.957795214328501986562102573522064468671E-9L, ++ 4.537872468606711261992676606899273588899E-7L, ++ 2.493639207101727713192687060517509774182E-5L, ++ 8.294957278145328349785532236663051405805E-4L, ++ 1.646471258966713577374948205279380115839E-2L, ++ 1.878910092770966718491814497982191447073E-1L, ++ 1.152641605706170353727903052525652504075E0L, ++ 3.383550240669773485412333679367792932235E0L, ++ 3.823875252882035706910024716609908473970E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 3.9e-35 ++ 0.125 <= 1/x <= 0.1875 */ ++#define NQ5_8N 10 ++static const long double Q5_8N[NQ5_8N + 1] = { ++ 1.750399094021293722243426623211733898747E-13L, ++ 6.483426211748008735242909236490115050294E-11L, ++ 9.279430665656575457141747875716899958373E-9L, ++ 6.696634968526907231258534757736576340266E-7L, ++ 2.666560823798895649685231292142838188061E-5L, ++ 6.025087697259436271271562769707550594540E-4L, ++ 7.652807734168613251901945778921336353485E-3L, ++ 5.226269002589406461622551452343519078905E-2L, ++ 1.748390159751117658969324896330142895079E-1L, ++ 2.378188719097006494782174902213083589660E-1L, ++ 8.383984859679804095463699702165659216831E-2L, ++}; ++#define NQ5_8D 10 ++static const long double Q5_8D[NQ5_8D + 1] = { ++ 2.389878229704327939008104855942987615715E-12L, ++ 8.926142817142546018703814194987786425099E-10L, ++ 1.294065862406745901206588525833274399038E-7L, ++ 9.524139899457666250828752185212769682191E-6L, ++ 3.908332488377770886091936221573123353489E-4L, ++ 9.250427033957236609624199884089916836748E-3L, ++ 1.263420066165922645975830877751588421451E-1L, ++ 9.692527053860420229711317379861733180654E-1L, ++ 3.937813834630430172221329298841520707954E0L, ++ 7.603126427436356534498908111445191312181E0L, ++ 5.670677653334105479259958485084550934305E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 3.2e-35 ++ 0.1875 <= 1/x <= 0.25 */ ++#define NQ4_5N 10 ++static const long double Q4_5N[NQ4_5N + 1] = { ++ 2.233870042925895644234072357400122854086E-11L, ++ 5.146223225761993222808463878999151699792E-9L, ++ 4.459114531468296461688753521109797474523E-7L, ++ 1.891397692931537975547242165291668056276E-5L, ++ 4.279519145911541776938964806470674565504E-4L, ++ 5.275239415656560634702073291768904783989E-3L, ++ 3.468698403240744801278238473898432608887E-2L, ++ 1.138773146337708415188856882915457888274E-1L, ++ 1.622717518946443013587108598334636458955E-1L, ++ 7.249040006390586123760992346453034628227E-2L, ++ 1.941595365256460232175236758506411486667E-3L, ++}; ++#define NQ4_5D 9 ++static const long double Q4_5D[NQ4_5D + 1] = { ++ 3.049977232266999249626430127217988047453E-10L, ++ 7.120883230531035857746096928889676144099E-8L, ++ 6.301786064753734446784637919554359588859E-6L, ++ 2.762010530095069598480766869426308077192E-4L, ++ 6.572163250572867859316828886203406361251E-3L, ++ 8.752566114841221958200215255461843397776E-2L, ++ 6.487654992874805093499285311075289932664E-1L, ++ 2.576550017826654579451615283022812801435E0L, ++ 5.056392229924022835364779562707348096036E0L, ++ 4.179770081068251464907531367859072157773E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 1.4e-36 ++ 0.25 <= 1/x <= 0.3125 */ ++#define NQ3r2_4N 10 ++static const long double Q3r2_4N[NQ3r2_4N + 1] = { ++ 6.126167301024815034423262653066023684411E-10L, ++ 1.043969327113173261820028225053598975128E-7L, ++ 6.592927270288697027757438170153763220190E-6L, ++ 2.009103660938497963095652951912071336730E-4L, ++ 3.220543385492643525985862356352195896964E-3L, ++ 2.774405975730545157543417650436941650990E-2L, ++ 1.258114008023826384487378016636555041129E-1L, ++ 2.811724258266902502344701449984698323860E-1L, ++ 2.691837665193548059322831687432415014067E-1L, ++ 7.949087384900985370683770525312735605034E-2L, ++ 1.229509543620976530030153018986910810747E-3L, ++}; ++#define NQ3r2_4D 9 ++static const long double Q3r2_4D[NQ3r2_4D + 1] = { ++ 8.364260446128475461539941389210166156568E-9L, ++ 1.451301850638956578622154585560759862764E-6L, ++ 9.431830010924603664244578867057141839463E-5L, ++ 3.004105101667433434196388593004526182741E-3L, ++ 5.148157397848271739710011717102773780221E-2L, ++ 4.901089301726939576055285374953887874895E-1L, ++ 2.581760991981709901216967665934142240346E0L, ++ 7.257105880775059281391729708630912791847E0L, ++ 1.006014717326362868007913423810737369312E1L, ++ 5.879416600465399514404064187445293212470E0L, ++ /* 1.000000000000000000000000000000000000000E0*/ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 3.8e-36 ++ 0.3125 <= 1/x <= 0.375 */ ++#define NQ2r7_3r2N 9 ++static const long double Q2r7_3r2N[NQ2r7_3r2N + 1] = { ++ 7.584861620402450302063691901886141875454E-8L, ++ 9.300939338814216296064659459966041794591E-6L, ++ 4.112108906197521696032158235392604947895E-4L, ++ 8.515168851578898791897038357239630654431E-3L, ++ 8.971286321017307400142720556749573229058E-2L, ++ 4.885856732902956303343015636331874194498E-1L, ++ 1.334506268733103291656253500506406045846E0L, ++ 1.681207956863028164179042145803851824654E0L, ++ 8.165042692571721959157677701625853772271E-1L, ++ 9.805848115375053300608712721986235900715E-2L, ++}; ++#define NQ2r7_3r2D 9 ++static const long double Q2r7_3r2D[NQ2r7_3r2D + 1] = { ++ 1.035586492113036586458163971239438078160E-6L, ++ 1.301999337731768381683593636500979713689E-4L, ++ 5.993695702564527062553071126719088859654E-3L, ++ 1.321184892887881883489141186815457808785E-1L, ++ 1.528766555485015021144963194165165083312E0L, ++ 9.561463309176490874525827051566494939295E0L, ++ 3.203719484883967351729513662089163356911E1L, ++ 5.497294687660930446641539152123568668447E1L, ++ 4.391158169390578768508675452986948391118E1L, ++ 1.347836630730048077907818943625789418378E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 2.2e-35 ++ 0.375 <= 1/x <= 0.4375 */ ++#define NQ2r3_2r7N 9 ++static const long double Q2r3_2r7N[NQ2r3_2r7N + 1] = { ++ 4.455027774980750211349941766420190722088E-7L, ++ 4.031998274578520170631601850866780366466E-5L, ++ 1.273987274325947007856695677491340636339E-3L, ++ 1.818754543377448509897226554179659122873E-2L, ++ 1.266748858326568264126353051352269875352E-1L, ++ 4.327578594728723821137731555139472880414E-1L, ++ 6.892532471436503074928194969154192615359E-1L, ++ 4.490775818438716873422163588640262036506E-1L, ++ 8.649615949297322440032000346117031581572E-2L, ++ 7.261345286655345047417257611469066147561E-4L, ++}; ++#define NQ2r3_2r7D 8 ++static const long double Q2r3_2r7D[NQ2r3_2r7D + 1] = { ++ 6.082600739680555266312417978064954793142E-6L, ++ 5.693622538165494742945717226571441747567E-4L, ++ 1.901625907009092204458328768129666975975E-2L, ++ 2.958689532697857335456896889409923371570E-1L, ++ 2.343124711045660081603809437993368799568E0L, ++ 9.665894032187458293568704885528192804376E0L, ++ 2.035273104990617136065743426322454881353E1L, ++ 2.044102010478792896815088858740075165531E1L, ++ 8.445937177863155827844146643468706599304E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y0(x)cosX - J0(x)sinX = sqrt( 2/(pi x)) Q0(x), ++ Q0(x) = 1/x (-.125 + 1/x^2 R(1/x^2)) ++ Peak relative error 3.1e-36 ++ 0.4375 <= 1/x <= 0.5 */ ++#define NQ2_2r3N 9 ++static const long double Q2_2r3N[NQ2_2r3N + 1] = { ++ 2.817566786579768804844367382809101929314E-6L, ++ 2.122772176396691634147024348373539744935E-4L, ++ 5.501378031780457828919593905395747517585E-3L, ++ 6.355374424341762686099147452020466524659E-2L, ++ 3.539652320122661637429658698954748337223E-1L, ++ 9.571721066119617436343740541777014319695E-1L, ++ 1.196258777828426399432550698612171955305E0L, ++ 6.069388659458926158392384709893753793967E-1L, ++ 9.026746127269713176512359976978248763621E-2L, ++ 5.317668723070450235320878117210807236375E-4L, ++}; ++#define NQ2_2r3D 8 ++static const long double Q2_2r3D[NQ2_2r3D + 1] = { ++ 3.846924354014260866793741072933159380158E-5L, ++ 3.017562820057704325510067178327449946763E-3L, ++ 8.356305620686867949798885808540444210935E-2L, ++ 1.068314930499906838814019619594424586273E0L, ++ 6.900279623894821067017966573640732685233E0L, ++ 2.307667390886377924509090271780839563141E1L, ++ 3.921043465412723970791036825401273528513E1L, ++ 3.167569478939719383241775717095729233436E1L, ++ 1.051023841699200920276198346301543665909E1L, ++ /* 1.000000000000000000000000000000000000000E0*/ ++}; ++ ++ ++/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++neval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++deval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = x + *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++/* Bessel function of the first kind, order zero. */ ++ ++long double ++__ieee754_j0l (long double x) ++{ ++ long double xx, xinv, z, p, q, c, s, cc, ss; ++ ++ if (! isfinite (x)) ++ { ++ if (x != x) ++ return x + x; ++ else ++ return 0; ++ } ++ if (x == 0) ++ return 1; ++ ++ xx = fabsl (x); ++ if (xx <= 2) ++ { ++ if (xx < 0x1p-57L) ++ return 1; ++ /* 0 <= x <= 2 */ ++ z = xx * xx; ++ p = z * z * neval (z, J0_2N, NJ0_2N) / deval (z, J0_2D, NJ0_2D); ++ p -= 0.25L * z; ++ p += 1; ++ return p; ++ } ++ ++ /* X = x - pi/4 ++ cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4) ++ = 1/sqrt(2) * (cos(x) + sin(x)) ++ sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4) ++ = 1/sqrt(2) * (sin(x) - cos(x)) ++ sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) ++ cf. Fdlibm. */ ++ __sincosl (xx, &s, &c); ++ ss = s - c; ++ cc = s + c; ++ if (xx <= LDBL_MAX / 2) ++ { ++ z = -__cosl (xx + xx); ++ if ((s * c) < 0) ++ cc = z / ss; ++ else ++ ss = z / cc; ++ } ++ ++ if (xx > 0x1p256L) ++ return ONEOSQPI * cc / __ieee754_sqrtl (xx); ++ ++ xinv = 1 / xx; ++ z = xinv * xinv; ++ if (xinv <= 0.25) ++ { ++ if (xinv <= 0.125) ++ { ++ if (xinv <= 0.0625) ++ { ++ p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID); ++ q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID); ++ } ++ else ++ { ++ p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D); ++ q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D); ++ } ++ } ++ else if (xinv <= 0.1875) ++ { ++ p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D); ++ q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D); ++ } ++ else ++ { ++ p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D); ++ q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D); ++ } ++ } /* .25 */ ++ else /* if (xinv <= 0.5) */ ++ { ++ if (xinv <= 0.375) ++ { ++ if (xinv <= 0.3125) ++ { ++ p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D); ++ q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D); ++ } ++ else ++ { ++ p = neval (z, P2r7_3r2N, NP2r7_3r2N) ++ / deval (z, P2r7_3r2D, NP2r7_3r2D); ++ q = neval (z, Q2r7_3r2N, NQ2r7_3r2N) ++ / deval (z, Q2r7_3r2D, NQ2r7_3r2D); ++ } ++ } ++ else if (xinv <= 0.4375) ++ { ++ p = neval (z, P2r3_2r7N, NP2r3_2r7N) ++ / deval (z, P2r3_2r7D, NP2r3_2r7D); ++ q = neval (z, Q2r3_2r7N, NQ2r3_2r7N) ++ / deval (z, Q2r3_2r7D, NQ2r3_2r7D); ++ } ++ else ++ { ++ p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D); ++ q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D); ++ } ++ } ++ p = 1 + z * p; ++ q = z * xinv * q; ++ q = q - 0.125L * xinv; ++ z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx); ++ return z; ++} ++strong_alias (__ieee754_j0l, __j0l_finite) ++ ++ ++/* Y0(x) = 2/pi * log(x) * J0(x) + R(x^2) ++ Peak absolute error 1.7e-36 (relative where Y0 > 1) ++ 0 <= x <= 2 */ ++#define NY0_2N 7 ++static long double Y0_2N[NY0_2N + 1] = { ++ -1.062023609591350692692296993537002558155E19L, ++ 2.542000883190248639104127452714966858866E19L, ++ -1.984190771278515324281415820316054696545E18L, ++ 4.982586044371592942465373274440222033891E16L, ++ -5.529326354780295177243773419090123407550E14L, ++ 3.013431465522152289279088265336861140391E12L, ++ -7.959436160727126750732203098982718347785E9L, ++ 8.230845651379566339707130644134372793322E6L, ++}; ++#define NY0_2D 7 ++static long double Y0_2D[NY0_2D + 1] = { ++ 1.438972634353286978700329883122253752192E20L, ++ 1.856409101981569254247700169486907405500E18L, ++ 1.219693352678218589553725579802986255614E16L, ++ 5.389428943282838648918475915779958097958E13L, ++ 1.774125762108874864433872173544743051653E11L, ++ 4.522104832545149534808218252434693007036E8L, ++ 8.872187401232943927082914504125234454930E5L, ++ 1.251945613186787532055610876304669413955E3L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++static const long double U0 = -7.3804295108687225274343927948483016310862e-02L; ++ ++/* Bessel function of the second kind, order zero. */ ++ ++long double ++ __ieee754_y0l(long double x) ++{ ++ long double xx, xinv, z, p, q, c, s, cc, ss; ++ ++ if (! isfinite (x)) ++ return 1 / (x + x * x); ++ if (x <= 0) ++ { ++ if (x < 0) ++ return (zero / (zero * x)); ++ return -1 / zero; /* -inf and divide by zero exception. */ ++ } ++ xx = fabsl (x); ++ if (xx <= 0x1p-57) ++ return U0 + TWOOPI * __ieee754_logl (x); ++ if (xx <= 2) ++ { ++ /* 0 <= x <= 2 */ ++ z = xx * xx; ++ p = neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D); ++ p = TWOOPI * __ieee754_logl (x) * __ieee754_j0l (x) + p; ++ return p; ++ } ++ ++ /* X = x - pi/4 ++ cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4) ++ = 1/sqrt(2) * (cos(x) + sin(x)) ++ sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4) ++ = 1/sqrt(2) * (sin(x) - cos(x)) ++ sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) ++ cf. Fdlibm. */ ++ __sincosl (x, &s, &c); ++ ss = s - c; ++ cc = s + c; ++ if (xx <= LDBL_MAX / 2) ++ { ++ z = -__cosl (x + x); ++ if ((s * c) < 0) ++ cc = z / ss; ++ else ++ ss = z / cc; ++ } ++ ++ if (xx > 0x1p256L) ++ return ONEOSQPI * ss / __ieee754_sqrtl (x); ++ ++ xinv = 1 / xx; ++ z = xinv * xinv; ++ if (xinv <= 0.25) ++ { ++ if (xinv <= 0.125) ++ { ++ if (xinv <= 0.0625) ++ { ++ p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID); ++ q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID); ++ } ++ else ++ { ++ p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D); ++ q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D); ++ } ++ } ++ else if (xinv <= 0.1875) ++ { ++ p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D); ++ q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D); ++ } ++ else ++ { ++ p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D); ++ q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D); ++ } ++ } /* .25 */ ++ else /* if (xinv <= 0.5) */ ++ { ++ if (xinv <= 0.375) ++ { ++ if (xinv <= 0.3125) ++ { ++ p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D); ++ q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D); ++ } ++ else ++ { ++ p = neval (z, P2r7_3r2N, NP2r7_3r2N) ++ / deval (z, P2r7_3r2D, NP2r7_3r2D); ++ q = neval (z, Q2r7_3r2N, NQ2r7_3r2N) ++ / deval (z, Q2r7_3r2D, NQ2r7_3r2D); ++ } ++ } ++ else if (xinv <= 0.4375) ++ { ++ p = neval (z, P2r3_2r7N, NP2r3_2r7N) ++ / deval (z, P2r3_2r7D, NP2r3_2r7D); ++ q = neval (z, Q2r3_2r7N, NQ2r3_2r7N) ++ / deval (z, Q2r3_2r7D, NQ2r3_2r7D); ++ } ++ else ++ { ++ p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D); ++ q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D); ++ } ++ } ++ p = 1 + z * p; ++ q = z * xinv * q; ++ q = q - 0.125L * xinv; ++ z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (x); ++ return z; ++} ++strong_alias (__ieee754_y0l, __y0l_finite) +diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c +index da9fd9eeca..5956c97b82 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c ++++ b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c +@@ -1,4 +1,884 @@ +-/* Looks like we can use ieee854 e_j1l.c as is for IBM extended format. */ +-#define _Float128 long double +-#define L(x) x ## L +-#include ++/* Bessel function of order one. IBM Extended Precision version. ++ Copyright 2001 by Stephen L. Moshier (moshier@na-net.onrl.gov). ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see ++ . */ ++ ++/* This file was copied from sysdeps/ieee754/ldbl-128/e_j0l.c. */ ++ ++ ++#include ++#include ++#include ++#include ++ ++/* 1 / sqrt(pi) */ ++static const long double ONEOSQPI = 5.6418958354775628694807945156077258584405E-1L; ++/* 2 / pi */ ++static const long double TWOOPI = 6.3661977236758134307553505349005744813784E-1L; ++static const long double zero = 0; ++ ++/* J1(x) = .5x + x x^2 R(x^2) ++ Peak relative error 1.9e-35 ++ 0 <= x <= 2 */ ++#define NJ0_2N 6 ++static const long double J0_2N[NJ0_2N + 1] = { ++ -5.943799577386942855938508697619735179660E16L, ++ 1.812087021305009192259946997014044074711E15L, ++ -2.761698314264509665075127515729146460895E13L, ++ 2.091089497823600978949389109350658815972E11L, ++ -8.546413231387036372945453565654130054307E8L, ++ 1.797229225249742247475464052741320612261E6L, ++ -1.559552840946694171346552770008812083969E3L ++}; ++#define NJ0_2D 6 ++static const long double J0_2D[NJ0_2D + 1] = { ++ 9.510079323819108569501613916191477479397E17L, ++ 1.063193817503280529676423936545854693915E16L, ++ 5.934143516050192600795972192791775226920E13L, ++ 2.168000911950620999091479265214368352883E11L, ++ 5.673775894803172808323058205986256928794E8L, ++ 1.080329960080981204840966206372671147224E6L, ++ 1.411951256636576283942477881535283304912E3L, ++ /* 1.000000000000000000000000000000000000000E0L */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ 0 <= 1/x <= .0625 ++ Peak relative error 3.6e-36 */ ++#define NP16_IN 9 ++static const long double P16_IN[NP16_IN + 1] = { ++ 5.143674369359646114999545149085139822905E-16L, ++ 4.836645664124562546056389268546233577376E-13L, ++ 1.730945562285804805325011561498453013673E-10L, ++ 3.047976856147077889834905908605310585810E-8L, ++ 2.855227609107969710407464739188141162386E-6L, ++ 1.439362407936705484122143713643023998457E-4L, ++ 3.774489768532936551500999699815873422073E-3L, ++ 4.723962172984642566142399678920790598426E-2L, ++ 2.359289678988743939925017240478818248735E-1L, ++ 3.032580002220628812728954785118117124520E-1L, ++}; ++#define NP16_ID 9 ++static const long double P16_ID[NP16_ID + 1] = { ++ 4.389268795186898018132945193912677177553E-15L, ++ 4.132671824807454334388868363256830961655E-12L, ++ 1.482133328179508835835963635130894413136E-9L, ++ 2.618941412861122118906353737117067376236E-7L, ++ 2.467854246740858470815714426201888034270E-5L, ++ 1.257192927368839847825938545925340230490E-3L, ++ 3.362739031941574274949719324644120720341E-2L, ++ 4.384458231338934105875343439265370178858E-1L, ++ 2.412830809841095249170909628197264854651E0L, ++ 4.176078204111348059102962617368214856874E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ 0.0625 <= 1/x <= 0.125 ++ Peak relative error 1.9e-36 */ ++#define NP8_16N 11 ++static const long double P8_16N[NP8_16N + 1] = { ++ 2.984612480763362345647303274082071598135E-16L, ++ 1.923651877544126103941232173085475682334E-13L, ++ 4.881258879388869396043760693256024307743E-11L, ++ 6.368866572475045408480898921866869811889E-9L, ++ 4.684818344104910450523906967821090796737E-7L, ++ 2.005177298271593587095982211091300382796E-5L, ++ 4.979808067163957634120681477207147536182E-4L, ++ 6.946005761642579085284689047091173581127E-3L, ++ 5.074601112955765012750207555985299026204E-2L, ++ 1.698599455896180893191766195194231825379E-1L, ++ 1.957536905259237627737222775573623779638E-1L, ++ 2.991314703282528370270179989044994319374E-2L, ++}; ++#define NP8_16D 10 ++static const long double P8_16D[NP8_16D + 1] = { ++ 2.546869316918069202079580939942463010937E-15L, ++ 1.644650111942455804019788382157745229955E-12L, ++ 4.185430770291694079925607420808011147173E-10L, ++ 5.485331966975218025368698195861074143153E-8L, ++ 4.062884421686912042335466327098932678905E-6L, ++ 1.758139661060905948870523641319556816772E-4L, ++ 4.445143889306356207566032244985607493096E-3L, ++ 6.391901016293512632765621532571159071158E-2L, ++ 4.933040207519900471177016015718145795434E-1L, ++ 1.839144086168947712971630337250761842976E0L, ++ 2.715120873995490920415616716916149586579E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ 0.125 <= 1/x <= 0.1875 ++ Peak relative error 1.3e-36 */ ++#define NP5_8N 10 ++static const long double P5_8N[NP5_8N + 1] = { ++ 2.837678373978003452653763806968237227234E-12L, ++ 9.726641165590364928442128579282742354806E-10L, ++ 1.284408003604131382028112171490633956539E-7L, ++ 8.524624695868291291250573339272194285008E-6L, ++ 3.111516908953172249853673787748841282846E-4L, ++ 6.423175156126364104172801983096596409176E-3L, ++ 7.430220589989104581004416356260692450652E-2L, ++ 4.608315409833682489016656279567605536619E-1L, ++ 1.396870223510964882676225042258855977512E0L, ++ 1.718500293904122365894630460672081526236E0L, ++ 5.465927698800862172307352821870223855365E-1L ++}; ++#define NP5_8D 10 ++static const long double P5_8D[NP5_8D + 1] = { ++ 2.421485545794616609951168511612060482715E-11L, ++ 8.329862750896452929030058039752327232310E-9L, ++ 1.106137992233383429630592081375289010720E-6L, ++ 7.405786153760681090127497796448503306939E-5L, ++ 2.740364785433195322492093333127633465227E-3L, ++ 5.781246470403095224872243564165254652198E-2L, ++ 6.927711353039742469918754111511109983546E-1L, ++ 4.558679283460430281188304515922826156690E0L, ++ 1.534468499844879487013168065728837900009E1L, ++ 2.313927430889218597919624843161569422745E1L, ++ 1.194506341319498844336768473218382828637E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ Peak relative error 1.4e-36 ++ 0.1875 <= 1/x <= 0.25 */ ++#define NP4_5N 10 ++static const long double P4_5N[NP4_5N + 1] = { ++ 1.846029078268368685834261260420933914621E-10L, ++ 3.916295939611376119377869680335444207768E-8L, ++ 3.122158792018920627984597530935323997312E-6L, ++ 1.218073444893078303994045653603392272450E-4L, ++ 2.536420827983485448140477159977981844883E-3L, ++ 2.883011322006690823959367922241169171315E-2L, ++ 1.755255190734902907438042414495469810830E-1L, ++ 5.379317079922628599870898285488723736599E-1L, ++ 7.284904050194300773890303361501726561938E-1L, ++ 3.270110346613085348094396323925000362813E-1L, ++ 1.804473805689725610052078464951722064757E-2L, ++}; ++#define NP4_5D 9 ++static const long double P4_5D[NP4_5D + 1] = { ++ 1.575278146806816970152174364308980863569E-9L, ++ 3.361289173657099516191331123405675054321E-7L, ++ 2.704692281550877810424745289838790693708E-5L, ++ 1.070854930483999749316546199273521063543E-3L, ++ 2.282373093495295842598097265627962125411E-2L, ++ 2.692025460665354148328762368240343249830E-1L, ++ 1.739892942593664447220951225734811133759E0L, ++ 5.890727576752230385342377570386657229324E0L, ++ 9.517442287057841500750256954117735128153E0L, ++ 6.100616353935338240775363403030137736013E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ Peak relative error 3.0e-36 ++ 0.25 <= 1/x <= 0.3125 */ ++#define NP3r2_4N 9 ++static const long double P3r2_4N[NP3r2_4N + 1] = { ++ 8.240803130988044478595580300846665863782E-8L, ++ 1.179418958381961224222969866406483744580E-5L, ++ 6.179787320956386624336959112503824397755E-4L, ++ 1.540270833608687596420595830747166658383E-2L, ++ 1.983904219491512618376375619598837355076E-1L, ++ 1.341465722692038870390470651608301155565E0L, ++ 4.617865326696612898792238245990854646057E0L, ++ 7.435574801812346424460233180412308000587E0L, ++ 4.671327027414635292514599201278557680420E0L, ++ 7.299530852495776936690976966995187714739E-1L, ++}; ++#define NP3r2_4D 9 ++static const long double P3r2_4D[NP3r2_4D + 1] = { ++ 7.032152009675729604487575753279187576521E-7L, ++ 1.015090352324577615777511269928856742848E-4L, ++ 5.394262184808448484302067955186308730620E-3L, ++ 1.375291438480256110455809354836988584325E-1L, ++ 1.836247144461106304788160919310404376670E0L, ++ 1.314378564254376655001094503090935880349E1L, ++ 4.957184590465712006934452500894672343488E1L, ++ 9.287394244300647738855415178790263465398E1L, ++ 7.652563275535900609085229286020552768399E1L, ++ 2.147042473003074533150718117770093209096E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ Peak relative error 1.0e-35 ++ 0.3125 <= 1/x <= 0.375 */ ++#define NP2r7_3r2N 9 ++static const long double P2r7_3r2N[NP2r7_3r2N + 1] = { ++ 4.599033469240421554219816935160627085991E-7L, ++ 4.665724440345003914596647144630893997284E-5L, ++ 1.684348845667764271596142716944374892756E-3L, ++ 2.802446446884455707845985913454440176223E-2L, ++ 2.321937586453963310008279956042545173930E-1L, ++ 9.640277413988055668692438709376437553804E-1L, ++ 1.911021064710270904508663334033003246028E0L, ++ 1.600811610164341450262992138893970224971E0L, ++ 4.266299218652587901171386591543457861138E-1L, ++ 1.316470424456061252962568223251247207325E-2L, ++}; ++#define NP2r7_3r2D 8 ++static const long double P2r7_3r2D[NP2r7_3r2D + 1] = { ++ 3.924508608545520758883457108453520099610E-6L, ++ 4.029707889408829273226495756222078039823E-4L, ++ 1.484629715787703260797886463307469600219E-2L, ++ 2.553136379967180865331706538897231588685E-1L, ++ 2.229457223891676394409880026887106228740E0L, ++ 1.005708903856384091956550845198392117318E1L, ++ 2.277082659664386953166629360352385889558E1L, ++ 2.384726835193630788249826630376533988245E1L, ++ 9.700989749041320895890113781610939632410E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ Peak relative error 1.7e-36 ++ 0.3125 <= 1/x <= 0.4375 */ ++#define NP2r3_2r7N 9 ++static const long double P2r3_2r7N[NP2r3_2r7N + 1] = { ++ 3.916766777108274628543759603786857387402E-6L, ++ 3.212176636756546217390661984304645137013E-4L, ++ 9.255768488524816445220126081207248947118E-3L, ++ 1.214853146369078277453080641911700735354E-1L, ++ 7.855163309847214136198449861311404633665E-1L, ++ 2.520058073282978403655488662066019816540E0L, ++ 3.825136484837545257209234285382183711466E0L, ++ 2.432569427554248006229715163865569506873E0L, ++ 4.877934835018231178495030117729800489743E-1L, ++ 1.109902737860249670981355149101343427885E-2L, ++}; ++#define NP2r3_2r7D 8 ++static const long double P2r3_2r7D[NP2r3_2r7D + 1] = { ++ 3.342307880794065640312646341190547184461E-5L, ++ 2.782182891138893201544978009012096558265E-3L, ++ 8.221304931614200702142049236141249929207E-2L, ++ 1.123728246291165812392918571987858010949E0L, ++ 7.740482453652715577233858317133423434590E0L, ++ 2.737624677567945952953322566311201919139E1L, ++ 4.837181477096062403118304137851260715475E1L, ++ 3.941098643468580791437772701093795299274E1L, ++ 1.245821247166544627558323920382547533630E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* J1(x)cosX + Y1(x)sinX = sqrt( 2/(pi x)) P1(x), P1(x) = 1 + 1/x^2 R(1/x^2), ++ Peak relative error 1.7e-35 ++ 0.4375 <= 1/x <= 0.5 */ ++#define NP2_2r3N 8 ++static const long double P2_2r3N[NP2_2r3N + 1] = { ++ 3.397930802851248553545191160608731940751E-4L, ++ 2.104020902735482418784312825637833698217E-2L, ++ 4.442291771608095963935342749477836181939E-1L, ++ 4.131797328716583282869183304291833754967E0L, ++ 1.819920169779026500146134832455189917589E1L, ++ 3.781779616522937565300309684282401791291E1L, ++ 3.459605449728864218972931220783543410347E1L, ++ 1.173594248397603882049066603238568316561E1L, ++ 9.455702270242780642835086549285560316461E-1L, ++}; ++#define NP2_2r3D 8 ++static const long double P2_2r3D[NP2_2r3D + 1] = { ++ 2.899568897241432883079888249845707400614E-3L, ++ 1.831107138190848460767699919531132426356E-1L, ++ 3.999350044057883839080258832758908825165E0L, ++ 3.929041535867957938340569419874195303712E1L, ++ 1.884245613422523323068802689915538908291E2L, ++ 4.461469948819229734353852978424629815929E2L, ++ 5.004998753999796821224085972610636347903E2L, ++ 2.386342520092608513170837883757163414100E2L, ++ 3.791322528149347975999851588922424189957E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 8.0e-36 ++ 0 <= 1/x <= .0625 */ ++#define NQ16_IN 10 ++static const long double Q16_IN[NQ16_IN + 1] = { ++ -3.917420835712508001321875734030357393421E-18L, ++ -4.440311387483014485304387406538069930457E-15L, ++ -1.951635424076926487780929645954007139616E-12L, ++ -4.318256438421012555040546775651612810513E-10L, ++ -5.231244131926180765270446557146989238020E-8L, ++ -3.540072702902043752460711989234732357653E-6L, ++ -1.311017536555269966928228052917534882984E-4L, ++ -2.495184669674631806622008769674827575088E-3L, ++ -2.141868222987209028118086708697998506716E-2L, ++ -6.184031415202148901863605871197272650090E-2L, ++ -1.922298704033332356899546792898156493887E-2L, ++}; ++#define NQ16_ID 9 ++static const long double Q16_ID[NQ16_ID + 1] = { ++ 3.820418034066293517479619763498400162314E-17L, ++ 4.340702810799239909648911373329149354911E-14L, ++ 1.914985356383416140706179933075303538524E-11L, ++ 4.262333682610888819476498617261895474330E-9L, ++ 5.213481314722233980346462747902942182792E-7L, ++ 3.585741697694069399299005316809954590558E-5L, ++ 1.366513429642842006385029778105539457546E-3L, ++ 2.745282599850704662726337474371355160594E-2L, ++ 2.637644521611867647651200098449903330074E-1L, ++ 1.006953426110765984590782655598680488746E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++ }; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 1.9e-36 ++ 0.0625 <= 1/x <= 0.125 */ ++#define NQ8_16N 11 ++static const long double Q8_16N[NQ8_16N + 1] = { ++ -2.028630366670228670781362543615221542291E-17L, ++ -1.519634620380959966438130374006858864624E-14L, ++ -4.540596528116104986388796594639405114524E-12L, ++ -7.085151756671466559280490913558388648274E-10L, ++ -6.351062671323970823761883833531546885452E-8L, ++ -3.390817171111032905297982523519503522491E-6L, ++ -1.082340897018886970282138836861233213972E-4L, ++ -2.020120801187226444822977006648252379508E-3L, ++ -2.093169910981725694937457070649605557555E-2L, ++ -1.092176538874275712359269481414448063393E-1L, ++ -2.374790947854765809203590474789108718733E-1L, ++ -1.365364204556573800719985118029601401323E-1L, ++}; ++#define NQ8_16D 11 ++static const long double Q8_16D[NQ8_16D + 1] = { ++ 1.978397614733632533581207058069628242280E-16L, ++ 1.487361156806202736877009608336766720560E-13L, ++ 4.468041406888412086042576067133365913456E-11L, ++ 7.027822074821007443672290507210594648877E-9L, ++ 6.375740580686101224127290062867976007374E-7L, ++ 3.466887658320002225888644977076410421940E-5L, ++ 1.138625640905289601186353909213719596986E-3L, ++ 2.224470799470414663443449818235008486439E-2L, ++ 2.487052928527244907490589787691478482358E-1L, ++ 1.483927406564349124649083853892380899217E0L, ++ 4.182773513276056975777258788903489507705E0L, ++ 4.419665392573449746043880892524360870944E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 1.5e-35 ++ 0.125 <= 1/x <= 0.1875 */ ++#define NQ5_8N 10 ++static const long double Q5_8N[NQ5_8N + 1] = { ++ -3.656082407740970534915918390488336879763E-13L, ++ -1.344660308497244804752334556734121771023E-10L, ++ -1.909765035234071738548629788698150760791E-8L, ++ -1.366668038160120210269389551283666716453E-6L, ++ -5.392327355984269366895210704976314135683E-5L, ++ -1.206268245713024564674432357634540343884E-3L, ++ -1.515456784370354374066417703736088291287E-2L, ++ -1.022454301137286306933217746545237098518E-1L, ++ -3.373438906472495080504907858424251082240E-1L, ++ -4.510782522110845697262323973549178453405E-1L, ++ -1.549000892545288676809660828213589804884E-1L, ++}; ++#define NQ5_8D 10 ++static const long double Q5_8D[NQ5_8D + 1] = { ++ 3.565550843359501079050699598913828460036E-12L, ++ 1.321016015556560621591847454285330528045E-9L, ++ 1.897542728662346479999969679234270605975E-7L, ++ 1.381720283068706710298734234287456219474E-5L, ++ 5.599248147286524662305325795203422873725E-4L, ++ 1.305442352653121436697064782499122164843E-2L, ++ 1.750234079626943298160445750078631894985E-1L, ++ 1.311420542073436520965439883806946678491E0L, ++ 5.162757689856842406744504211089724926650E0L, ++ 9.527760296384704425618556332087850581308E0L, ++ 6.604648207463236667912921642545100248584E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 1.3e-35 ++ 0.1875 <= 1/x <= 0.25 */ ++#define NQ4_5N 10 ++static const long double Q4_5N[NQ4_5N + 1] = { ++ -4.079513568708891749424783046520200903755E-11L, ++ -9.326548104106791766891812583019664893311E-9L, ++ -8.016795121318423066292906123815687003356E-7L, ++ -3.372350544043594415609295225664186750995E-5L, ++ -7.566238665947967882207277686375417983917E-4L, ++ -9.248861580055565402130441618521591282617E-3L, ++ -6.033106131055851432267702948850231270338E-2L, ++ -1.966908754799996793730369265431584303447E-1L, ++ -2.791062741179964150755788226623462207560E-1L, ++ -1.255478605849190549914610121863534191666E-1L, ++ -4.320429862021265463213168186061696944062E-3L, ++}; ++#define NQ4_5D 9 ++static const long double Q4_5D[NQ4_5D + 1] = { ++ 3.978497042580921479003851216297330701056E-10L, ++ 9.203304163828145809278568906420772246666E-8L, ++ 8.059685467088175644915010485174545743798E-6L, ++ 3.490187375993956409171098277561669167446E-4L, ++ 8.189109654456872150100501732073810028829E-3L, ++ 1.072572867311023640958725265762483033769E-1L, ++ 7.790606862409960053675717185714576937994E-1L, ++ 3.016049768232011196434185423512777656328E0L, ++ 5.722963851442769787733717162314477949360E0L, ++ 4.510527838428473279647251350931380867663E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 2.1e-35 ++ 0.25 <= 1/x <= 0.3125 */ ++#define NQ3r2_4N 9 ++static const long double Q3r2_4N[NQ3r2_4N + 1] = { ++ -1.087480809271383885936921889040388133627E-8L, ++ -1.690067828697463740906962973479310170932E-6L, ++ -9.608064416995105532790745641974762550982E-5L, ++ -2.594198839156517191858208513873961837410E-3L, ++ -3.610954144421543968160459863048062977822E-2L, ++ -2.629866798251843212210482269563961685666E-1L, ++ -9.709186825881775885917984975685752956660E-1L, ++ -1.667521829918185121727268867619982417317E0L, ++ -1.109255082925540057138766105229900943501E0L, ++ -1.812932453006641348145049323713469043328E-1L, ++}; ++#define NQ3r2_4D 9 ++static const long double Q3r2_4D[NQ3r2_4D + 1] = { ++ 1.060552717496912381388763753841473407026E-7L, ++ 1.676928002024920520786883649102388708024E-5L, ++ 9.803481712245420839301400601140812255737E-4L, ++ 2.765559874262309494758505158089249012930E-2L, ++ 4.117921827792571791298862613287549140706E-1L, ++ 3.323769515244751267093378361930279161413E0L, ++ 1.436602494405814164724810151689705353670E1L, ++ 3.163087869617098638064881410646782408297E1L, ++ 3.198181264977021649489103980298349589419E1L, ++ 1.203649258862068431199471076202897823272E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 1.6e-36 ++ 0.3125 <= 1/x <= 0.375 */ ++#define NQ2r7_3r2N 9 ++static const long double Q2r7_3r2N[NQ2r7_3r2N + 1] = { ++ -1.723405393982209853244278760171643219530E-7L, ++ -2.090508758514655456365709712333460087442E-5L, ++ -9.140104013370974823232873472192719263019E-4L, ++ -1.871349499990714843332742160292474780128E-2L, ++ -1.948930738119938669637865956162512983416E-1L, ++ -1.048764684978978127908439526343174139788E0L, ++ -2.827714929925679500237476105843643064698E0L, ++ -3.508761569156476114276988181329773987314E0L, ++ -1.669332202790211090973255098624488308989E0L, ++ -1.930796319299022954013840684651016077770E-1L, ++}; ++#define NQ2r7_3r2D 9 ++static const long double Q2r7_3r2D[NQ2r7_3r2D + 1] = { ++ 1.680730662300831976234547482334347983474E-6L, ++ 2.084241442440551016475972218719621841120E-4L, ++ 9.445316642108367479043541702688736295579E-3L, ++ 2.044637889456631896650179477133252184672E-1L, ++ 2.316091982244297350829522534435350078205E0L, ++ 1.412031891783015085196708811890448488865E1L, ++ 4.583830154673223384837091077279595496149E1L, ++ 7.549520609270909439885998474045974122261E1L, ++ 5.697605832808113367197494052388203310638E1L, ++ 1.601496240876192444526383314589371686234E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 9.5e-36 ++ 0.375 <= 1/x <= 0.4375 */ ++#define NQ2r3_2r7N 9 ++static const long double Q2r3_2r7N[NQ2r3_2r7N + 1] = { ++ -8.603042076329122085722385914954878953775E-7L, ++ -7.701746260451647874214968882605186675720E-5L, ++ -2.407932004380727587382493696877569654271E-3L, ++ -3.403434217607634279028110636919987224188E-2L, ++ -2.348707332185238159192422084985713102877E-1L, ++ -7.957498841538254916147095255700637463207E-1L, ++ -1.258469078442635106431098063707934348577E0L, ++ -8.162415474676345812459353639449971369890E-1L, ++ -1.581783890269379690141513949609572806898E-1L, ++ -1.890595651683552228232308756569450822905E-3L, ++}; ++#define NQ2r3_2r7D 8 ++static const long double Q2r3_2r7D[NQ2r3_2r7D + 1] = { ++ 8.390017524798316921170710533381568175665E-6L, ++ 7.738148683730826286477254659973968763659E-4L, ++ 2.541480810958665794368759558791634341779E-2L, ++ 3.878879789711276799058486068562386244873E-1L, ++ 3.003783779325811292142957336802456109333E0L, ++ 1.206480374773322029883039064575464497400E1L, ++ 2.458414064785315978408974662900438351782E1L, ++ 2.367237826273668567199042088835448715228E1L, ++ 9.231451197519171090875569102116321676763E0L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), ++ Q1(x) = 1/x (.375 + 1/x^2 R(1/x^2)), ++ Peak relative error 1.4e-36 ++ 0.4375 <= 1/x <= 0.5 */ ++#define NQ2_2r3N 9 ++static const long double Q2_2r3N[NQ2_2r3N + 1] = { ++ -5.552507516089087822166822364590806076174E-6L, ++ -4.135067659799500521040944087433752970297E-4L, ++ -1.059928728869218962607068840646564457980E-2L, ++ -1.212070036005832342565792241385459023801E-1L, ++ -6.688350110633603958684302153362735625156E-1L, ++ -1.793587878197360221340277951304429821582E0L, ++ -2.225407682237197485644647380483725045326E0L, ++ -1.123402135458940189438898496348239744403E0L, ++ -1.679187241566347077204805190763597299805E-1L, ++ -1.458550613639093752909985189067233504148E-3L, ++}; ++#define NQ2_2r3D 8 ++static const long double Q2_2r3D[NQ2_2r3D + 1] = { ++ 5.415024336507980465169023996403597916115E-5L, ++ 4.179246497380453022046357404266022870788E-3L, ++ 1.136306384261959483095442402929502368598E-1L, ++ 1.422640343719842213484515445393284072830E0L, ++ 8.968786703393158374728850922289204805764E0L, ++ 2.914542473339246127533384118781216495934E1L, ++ 4.781605421020380669870197378210457054685E1L, ++ 3.693865837171883152382820584714795072937E1L, ++ 1.153220502744204904763115556224395893076E1L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++ ++/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++neval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++deval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = x + *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++/* Bessel function of the first kind, order one. */ ++ ++long double ++__ieee754_j1l (long double x) ++{ ++ long double xx, xinv, z, p, q, c, s, cc, ss; ++ ++ if (! isfinite (x)) ++ { ++ if (x != x) ++ return x + x; ++ else ++ return 0; ++ } ++ if (x == 0) ++ return x; ++ xx = fabsl (x); ++ if (xx <= 0x1p-58L) ++ { ++ long double ret = x * 0.5L; ++ math_check_force_underflow (ret); ++ if (ret == 0) ++ __set_errno (ERANGE); ++ return ret; ++ } ++ if (xx <= 2) ++ { ++ /* 0 <= x <= 2 */ ++ z = xx * xx; ++ p = xx * z * neval (z, J0_2N, NJ0_2N) / deval (z, J0_2D, NJ0_2D); ++ p += 0.5L * xx; ++ if (x < 0) ++ p = -p; ++ return p; ++ } ++ ++ /* X = x - 3 pi/4 ++ cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4) ++ = 1/sqrt(2) * (-cos(x) + sin(x)) ++ sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4) ++ = -1/sqrt(2) * (sin(x) + cos(x)) ++ cf. Fdlibm. */ ++ __sincosl (xx, &s, &c); ++ ss = -s - c; ++ cc = s - c; ++ if (xx <= LDBL_MAX / 2) ++ { ++ z = __cosl (xx + xx); ++ if ((s * c) > 0) ++ cc = z / ss; ++ else ++ ss = z / cc; ++ } ++ ++ if (xx > 0x1p256L) ++ { ++ z = ONEOSQPI * cc / __ieee754_sqrtl (xx); ++ if (x < 0) ++ z = -z; ++ return z; ++ } ++ ++ xinv = 1 / xx; ++ z = xinv * xinv; ++ if (xinv <= 0.25) ++ { ++ if (xinv <= 0.125) ++ { ++ if (xinv <= 0.0625) ++ { ++ p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID); ++ q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID); ++ } ++ else ++ { ++ p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D); ++ q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D); ++ } ++ } ++ else if (xinv <= 0.1875) ++ { ++ p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D); ++ q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D); ++ } ++ else ++ { ++ p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D); ++ q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D); ++ } ++ } /* .25 */ ++ else /* if (xinv <= 0.5) */ ++ { ++ if (xinv <= 0.375) ++ { ++ if (xinv <= 0.3125) ++ { ++ p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D); ++ q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D); ++ } ++ else ++ { ++ p = neval (z, P2r7_3r2N, NP2r7_3r2N) ++ / deval (z, P2r7_3r2D, NP2r7_3r2D); ++ q = neval (z, Q2r7_3r2N, NQ2r7_3r2N) ++ / deval (z, Q2r7_3r2D, NQ2r7_3r2D); ++ } ++ } ++ else if (xinv <= 0.4375) ++ { ++ p = neval (z, P2r3_2r7N, NP2r3_2r7N) ++ / deval (z, P2r3_2r7D, NP2r3_2r7D); ++ q = neval (z, Q2r3_2r7N, NQ2r3_2r7N) ++ / deval (z, Q2r3_2r7D, NQ2r3_2r7D); ++ } ++ else ++ { ++ p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D); ++ q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D); ++ } ++ } ++ p = 1 + z * p; ++ q = z * q; ++ q = q * xinv + 0.375L * xinv; ++ z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx); ++ if (x < 0) ++ z = -z; ++ return z; ++} ++strong_alias (__ieee754_j1l, __j1l_finite) ++ ++ ++/* Y1(x) = 2/pi * (log(x) * J1(x) - 1/x) + x R(x^2) ++ Peak relative error 6.2e-38 ++ 0 <= x <= 2 */ ++#define NY0_2N 7 ++static long double Y0_2N[NY0_2N + 1] = { ++ -6.804415404830253804408698161694720833249E19L, ++ 1.805450517967019908027153056150465849237E19L, ++ -8.065747497063694098810419456383006737312E17L, ++ 1.401336667383028259295830955439028236299E16L, ++ -1.171654432898137585000399489686629680230E14L, ++ 5.061267920943853732895341125243428129150E11L, ++ -1.096677850566094204586208610960870217970E9L, ++ 9.541172044989995856117187515882879304461E5L, ++}; ++#define NY0_2D 7 ++static long double Y0_2D[NY0_2D + 1] = { ++ 3.470629591820267059538637461549677594549E20L, ++ 4.120796439009916326855848107545425217219E18L, ++ 2.477653371652018249749350657387030814542E16L, ++ 9.954678543353888958177169349272167762797E13L, ++ 2.957927997613630118216218290262851197754E11L, ++ 6.748421382188864486018861197614025972118E8L, ++ 1.173453425218010888004562071020305709319E6L, ++ 1.450335662961034949894009554536003377187E3L, ++ /* 1.000000000000000000000000000000000000000E0 */ ++}; ++ ++ ++/* Bessel function of the second kind, order one. */ ++ ++long double ++__ieee754_y1l (long double x) ++{ ++ long double xx, xinv, z, p, q, c, s, cc, ss; ++ ++ if (! isfinite (x)) ++ return 1 / (x + x * x); ++ if (x <= 0) ++ { ++ if (x < 0) ++ return (zero / (zero * x)); ++ return -1 / zero; /* -inf and divide by zero exception. */ ++ } ++ xx = fabsl (x); ++ if (xx <= 0x1p-114) ++ { ++ z = -TWOOPI / x; ++ if (isinf (z)) ++ __set_errno (ERANGE); ++ return z; ++ } ++ if (xx <= 2) ++ { ++ /* 0 <= x <= 2 */ ++ SET_RESTORE_ROUNDL (FE_TONEAREST); ++ z = xx * xx; ++ p = xx * neval (z, Y0_2N, NY0_2N) / deval (z, Y0_2D, NY0_2D); ++ p = -TWOOPI / xx + p; ++ p = TWOOPI * __ieee754_logl (x) * __ieee754_j1l (x) + p; ++ return p; ++ } ++ ++ /* X = x - 3 pi/4 ++ cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4) ++ = 1/sqrt(2) * (-cos(x) + sin(x)) ++ sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4) ++ = -1/sqrt(2) * (sin(x) + cos(x)) ++ cf. Fdlibm. */ ++ __sincosl (xx, &s, &c); ++ ss = -s - c; ++ cc = s - c; ++ if (xx <= LDBL_MAX / 2) ++ { ++ z = __cosl (xx + xx); ++ if ((s * c) > 0) ++ cc = z / ss; ++ else ++ ss = z / cc; ++ } ++ ++ if (xx > 0x1p256L) ++ return ONEOSQPI * ss / __ieee754_sqrtl (xx); ++ ++ xinv = 1 / xx; ++ z = xinv * xinv; ++ if (xinv <= 0.25) ++ { ++ if (xinv <= 0.125) ++ { ++ if (xinv <= 0.0625) ++ { ++ p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID); ++ q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID); ++ } ++ else ++ { ++ p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D); ++ q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D); ++ } ++ } ++ else if (xinv <= 0.1875) ++ { ++ p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D); ++ q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D); ++ } ++ else ++ { ++ p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D); ++ q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D); ++ } ++ } /* .25 */ ++ else /* if (xinv <= 0.5) */ ++ { ++ if (xinv <= 0.375) ++ { ++ if (xinv <= 0.3125) ++ { ++ p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D); ++ q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D); ++ } ++ else ++ { ++ p = neval (z, P2r7_3r2N, NP2r7_3r2N) ++ / deval (z, P2r7_3r2D, NP2r7_3r2D); ++ q = neval (z, Q2r7_3r2N, NQ2r7_3r2N) ++ / deval (z, Q2r7_3r2D, NQ2r7_3r2D); ++ } ++ } ++ else if (xinv <= 0.4375) ++ { ++ p = neval (z, P2r3_2r7N, NP2r3_2r7N) ++ / deval (z, P2r3_2r7D, NP2r3_2r7D); ++ q = neval (z, Q2r3_2r7N, NQ2r3_2r7N) ++ / deval (z, Q2r3_2r7D, NQ2r3_2r7D); ++ } ++ else ++ { ++ p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D); ++ q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D); ++ } ++ } ++ p = 1 + z * p; ++ q = z * q; ++ q = q * xinv + 0.375L * xinv; ++ z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (xx); ++ return z; ++} ++strong_alias (__ieee754_y1l, __y1l_finite) +diff --git a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c +index 8ac8283bd8..f881b8c0a4 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c ++++ b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c +@@ -1,5 +1,992 @@ +-/* Looks like we can use ieee854 e_lgammal_r.c as is for IBM extended format. */ +-#define _Float128 long double +-#define L(x) x ## L +-#include ++/* Natural logarithm of gamma function. IBM Extended Precision version. ++ Copyright 2001 by Stephen L. Moshier + ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see ++ . */ ++ ++/* This file was copied from sysdeps/ieee754/ldbl-128/e_lgammal_r.c. */ ++ ++ ++#include ++#include ++#include ++ ++static const long double PIL = 3.1415926535897932384626433832795028841972E0L; ++static const long double MAXLGM = 0x5.d53649e2d469dbc1f01e99fd66p+1012L; ++static const long double one = 1; ++static const long double huge = LDBL_MAX; ++ ++/* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2) ++ 1/x <= 0.0741 (x >= 13.495...) ++ Peak relative error 1.5e-36 */ ++static const long double ls2pi = 9.1893853320467274178032973640561763986140E-1L; ++#define NRASY 12 ++static const long double RASY[NRASY + 1] = ++{ ++ 8.333333333333333333333333333310437112111E-2L, ++ -2.777777777777777777777774789556228296902E-3L, ++ 7.936507936507936507795933938448586499183E-4L, ++ -5.952380952380952041799269756378148574045E-4L, ++ 8.417508417507928904209891117498524452523E-4L, ++ -1.917526917481263997778542329739806086290E-3L, ++ 6.410256381217852504446848671499409919280E-3L, ++ -2.955064066900961649768101034477363301626E-2L, ++ 1.796402955865634243663453415388336954675E-1L, ++ -1.391522089007758553455753477688592767741E0L, ++ 1.326130089598399157988112385013829305510E1L, ++ -1.420412699593782497803472576479997819149E2L, ++ 1.218058922427762808938869872528846787020E3L ++}; ++ ++ ++/* log gamma(x+13) = log gamma(13) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 12.5 <= x+13 <= 13.5 ++ Peak relative error 1.1e-36 */ ++static const long double lgam13a = 1.9987213134765625E1L; ++static const long double lgam13b = 1.3608962611495173623870550785125024484248E-6L; ++#define NRN13 7 ++static const long double RN13[NRN13 + 1] = ++{ ++ 8.591478354823578150238226576156275285700E11L, ++ 2.347931159756482741018258864137297157668E11L, ++ 2.555408396679352028680662433943000804616E10L, ++ 1.408581709264464345480765758902967123937E9L, ++ 4.126759849752613822953004114044451046321E7L, ++ 6.133298899622688505854211579222889943778E5L, ++ 3.929248056293651597987893340755876578072E3L, ++ 6.850783280018706668924952057996075215223E0L ++}; ++#define NRD13 6 ++static const long double RD13[NRD13 + 1] = ++{ ++ 3.401225382297342302296607039352935541669E11L, ++ 8.756765276918037910363513243563234551784E10L, ++ 8.873913342866613213078554180987647243903E9L, ++ 4.483797255342763263361893016049310017973E8L, ++ 1.178186288833066430952276702931512870676E7L, ++ 1.519928623743264797939103740132278337476E5L, ++ 7.989298844938119228411117593338850892311E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+12) = log gamma(12) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 11.5 <= x+12 <= 12.5 ++ Peak relative error 4.1e-36 */ ++static const long double lgam12a = 1.75023040771484375E1L; ++static const long double lgam12b = 3.7687254483392876529072161996717039575982E-6L; ++#define NRN12 7 ++static const long double RN12[NRN12 + 1] = ++{ ++ 4.709859662695606986110997348630997559137E11L, ++ 1.398713878079497115037857470168777995230E11L, ++ 1.654654931821564315970930093932954900867E10L, ++ 9.916279414876676861193649489207282144036E8L, ++ 3.159604070526036074112008954113411389879E7L, ++ 5.109099197547205212294747623977502492861E5L, ++ 3.563054878276102790183396740969279826988E3L, ++ 6.769610657004672719224614163196946862747E0L ++}; ++#define NRD12 6 ++static const long double RD12[NRD12 + 1] = ++{ ++ 1.928167007860968063912467318985802726613E11L, ++ 5.383198282277806237247492369072266389233E10L, ++ 5.915693215338294477444809323037871058363E9L, ++ 3.241438287570196713148310560147925781342E8L, ++ 9.236680081763754597872713592701048455890E6L, ++ 1.292246897881650919242713651166596478850E5L, ++ 7.366532445427159272584194816076600211171E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+11) = log gamma(11) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 10.5 <= x+11 <= 11.5 ++ Peak relative error 1.8e-35 */ ++static const long double lgam11a = 1.5104400634765625E1L; ++static const long double lgam11b = 1.1938309890295225709329251070371882250744E-5L; ++#define NRN11 7 ++static const long double RN11[NRN11 + 1] = ++{ ++ 2.446960438029415837384622675816736622795E11L, ++ 7.955444974446413315803799763901729640350E10L, ++ 1.030555327949159293591618473447420338444E10L, ++ 6.765022131195302709153994345470493334946E8L, ++ 2.361892792609204855279723576041468347494E7L, ++ 4.186623629779479136428005806072176490125E5L, ++ 3.202506022088912768601325534149383594049E3L, ++ 6.681356101133728289358838690666225691363E0L ++}; ++#define NRD11 6 ++static const long double RD11[NRD11 + 1] = ++{ ++ 1.040483786179428590683912396379079477432E11L, ++ 3.172251138489229497223696648369823779729E10L, ++ 3.806961885984850433709295832245848084614E9L, ++ 2.278070344022934913730015420611609620171E8L, ++ 7.089478198662651683977290023829391596481E6L, ++ 1.083246385105903533237139380509590158658E5L, ++ 6.744420991491385145885727942219463243597E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+10) = log gamma(10) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 9.5 <= x+10 <= 10.5 ++ Peak relative error 5.4e-37 */ ++static const long double lgam10a = 1.280181884765625E1L; ++static const long double lgam10b = 8.6324252196112077178745667061642811492557E-6L; ++#define NRN10 7 ++static const long double RN10[NRN10 + 1] = ++{ ++ -1.239059737177249934158597996648808363783E14L, ++ -4.725899566371458992365624673357356908719E13L, ++ -7.283906268647083312042059082837754850808E12L, ++ -5.802855515464011422171165179767478794637E11L, ++ -2.532349691157548788382820303182745897298E10L, ++ -5.884260178023777312587193693477072061820E8L, ++ -6.437774864512125749845840472131829114906E6L, ++ -2.350975266781548931856017239843273049384E4L ++}; ++#define NRD10 7 ++static const long double RD10[NRD10 + 1] = ++{ ++ -5.502645997581822567468347817182347679552E13L, ++ -1.970266640239849804162284805400136473801E13L, ++ -2.819677689615038489384974042561531409392E12L, ++ -2.056105863694742752589691183194061265094E11L, ++ -8.053670086493258693186307810815819662078E9L, ++ -1.632090155573373286153427982504851867131E8L, ++ -1.483575879240631280658077826889223634921E6L, ++ -4.002806669713232271615885826373550502510E3L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+9) = log gamma(9) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 8.5 <= x+9 <= 9.5 ++ Peak relative error 3.6e-36 */ ++static const long double lgam9a = 1.06045989990234375E1L; ++static const long double lgam9b = 3.9037218127284172274007216547549861681400E-6L; ++#define NRN9 7 ++static const long double RN9[NRN9 + 1] = ++{ ++ -4.936332264202687973364500998984608306189E13L, ++ -2.101372682623700967335206138517766274855E13L, ++ -3.615893404644823888655732817505129444195E12L, ++ -3.217104993800878891194322691860075472926E11L, ++ -1.568465330337375725685439173603032921399E10L, ++ -4.073317518162025744377629219101510217761E8L, ++ -4.983232096406156139324846656819246974500E6L, ++ -2.036280038903695980912289722995505277253E4L ++}; ++#define NRD9 7 ++static const long double RD9[NRD9 + 1] = ++{ ++ -2.306006080437656357167128541231915480393E13L, ++ -9.183606842453274924895648863832233799950E12L, ++ -1.461857965935942962087907301194381010380E12L, ++ -1.185728254682789754150068652663124298303E11L, ++ -5.166285094703468567389566085480783070037E9L, ++ -1.164573656694603024184768200787835094317E8L, ++ -1.177343939483908678474886454113163527909E6L, ++ -3.529391059783109732159524500029157638736E3L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+8) = log gamma(8) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 7.5 <= x+8 <= 8.5 ++ Peak relative error 2.4e-37 */ ++static const long double lgam8a = 8.525146484375E0L; ++static const long double lgam8b = 1.4876690414300165531036347125050759667737E-5L; ++#define NRN8 8 ++static const long double RN8[NRN8 + 1] = ++{ ++ 6.600775438203423546565361176829139703289E11L, ++ 3.406361267593790705240802723914281025800E11L, ++ 7.222460928505293914746983300555538432830E10L, ++ 8.102984106025088123058747466840656458342E9L, ++ 5.157620015986282905232150979772409345927E8L, ++ 1.851445288272645829028129389609068641517E7L, ++ 3.489261702223124354745894067468953756656E5L, ++ 2.892095396706665774434217489775617756014E3L, ++ 6.596977510622195827183948478627058738034E0L ++}; ++#define NRD8 7 ++static const long double RD8[NRD8 + 1] = ++{ ++ 3.274776546520735414638114828622673016920E11L, ++ 1.581811207929065544043963828487733970107E11L, ++ 3.108725655667825188135393076860104546416E10L, ++ 3.193055010502912617128480163681842165730E9L, ++ 1.830871482669835106357529710116211541839E8L, ++ 5.790862854275238129848491555068073485086E6L, ++ 9.305213264307921522842678835618803553589E4L, ++ 6.216974105861848386918949336819572333622E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+7) = log gamma(7) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 6.5 <= x+7 <= 7.5 ++ Peak relative error 3.2e-36 */ ++static const long double lgam7a = 6.5792388916015625E0L; ++static const long double lgam7b = 1.2320408538495060178292903945321122583007E-5L; ++#define NRN7 8 ++static const long double RN7[NRN7 + 1] = ++{ ++ 2.065019306969459407636744543358209942213E11L, ++ 1.226919919023736909889724951708796532847E11L, ++ 2.996157990374348596472241776917953749106E10L, ++ 3.873001919306801037344727168434909521030E9L, ++ 2.841575255593761593270885753992732145094E8L, ++ 1.176342515359431913664715324652399565551E7L, ++ 2.558097039684188723597519300356028511547E5L, ++ 2.448525238332609439023786244782810774702E3L, ++ 6.460280377802030953041566617300902020435E0L ++}; ++#define NRD7 7 ++static const long double RD7[NRD7 + 1] = ++{ ++ 1.102646614598516998880874785339049304483E11L, ++ 6.099297512712715445879759589407189290040E10L, ++ 1.372898136289611312713283201112060238351E10L, ++ 1.615306270420293159907951633566635172343E9L, ++ 1.061114435798489135996614242842561967459E8L, ++ 3.845638971184305248268608902030718674691E6L, ++ 7.081730675423444975703917836972720495507E4L, ++ 5.423122582741398226693137276201344096370E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+6) = log gamma(6) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 5.5 <= x+6 <= 6.5 ++ Peak relative error 6.2e-37 */ ++static const long double lgam6a = 4.7874908447265625E0L; ++static const long double lgam6b = 8.9805548349424770093452324304839959231517E-7L; ++#define NRN6 8 ++static const long double RN6[NRN6 + 1] = ++{ ++ -3.538412754670746879119162116819571823643E13L, ++ -2.613432593406849155765698121483394257148E13L, ++ -8.020670732770461579558867891923784753062E12L, ++ -1.322227822931250045347591780332435433420E12L, ++ -1.262809382777272476572558806855377129513E11L, ++ -7.015006277027660872284922325741197022467E9L, ++ -2.149320689089020841076532186783055727299E8L, ++ -3.167210585700002703820077565539658995316E6L, ++ -1.576834867378554185210279285358586385266E4L ++}; ++#define NRD6 8 ++static const long double RD6[NRD6 + 1] = ++{ ++ -2.073955870771283609792355579558899389085E13L, ++ -1.421592856111673959642750863283919318175E13L, ++ -4.012134994918353924219048850264207074949E12L, ++ -6.013361045800992316498238470888523722431E11L, ++ -5.145382510136622274784240527039643430628E10L, ++ -2.510575820013409711678540476918249524123E9L, ++ -6.564058379709759600836745035871373240904E7L, ++ -7.861511116647120540275354855221373571536E5L, ++ -2.821943442729620524365661338459579270561E3L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+5) = log gamma(5) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 4.5 <= x+5 <= 5.5 ++ Peak relative error 3.4e-37 */ ++static const long double lgam5a = 3.17803955078125E0L; ++static const long double lgam5b = 1.4279566695619646941601297055408873990961E-5L; ++#define NRN5 9 ++static const long double RN5[NRN5 + 1] = ++{ ++ 2.010952885441805899580403215533972172098E11L, ++ 1.916132681242540921354921906708215338584E11L, ++ 7.679102403710581712903937970163206882492E10L, ++ 1.680514903671382470108010973615268125169E10L, ++ 2.181011222911537259440775283277711588410E9L, ++ 1.705361119398837808244780667539728356096E8L, ++ 7.792391565652481864976147945997033946360E6L, ++ 1.910741381027985291688667214472560023819E5L, ++ 2.088138241893612679762260077783794329559E3L, ++ 6.330318119566998299106803922739066556550E0L ++}; ++#define NRD5 8 ++static const long double RD5[NRD5 + 1] = ++{ ++ 1.335189758138651840605141370223112376176E11L, ++ 1.174130445739492885895466097516530211283E11L, ++ 4.308006619274572338118732154886328519910E10L, ++ 8.547402888692578655814445003283720677468E9L, ++ 9.934628078575618309542580800421370730906E8L, ++ 6.847107420092173812998096295422311820672E7L, ++ 2.698552646016599923609773122139463150403E6L, ++ 5.526516251532464176412113632726150253215E4L, ++ 4.772343321713697385780533022595450486932E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+4) = log gamma(4) + x P(x)/Q(x) ++ -0.5 <= x <= 0.5 ++ 3.5 <= x+4 <= 4.5 ++ Peak relative error 6.7e-37 */ ++static const long double lgam4a = 1.791748046875E0L; ++static const long double lgam4b = 1.1422353055000812477358380702272722990692E-5L; ++#define NRN4 9 ++static const long double RN4[NRN4 + 1] = ++{ ++ -1.026583408246155508572442242188887829208E13L, ++ -1.306476685384622809290193031208776258809E13L, ++ -7.051088602207062164232806511992978915508E12L, ++ -2.100849457735620004967624442027793656108E12L, ++ -3.767473790774546963588549871673843260569E11L, ++ -4.156387497364909963498394522336575984206E10L, ++ -2.764021460668011732047778992419118757746E9L, ++ -1.036617204107109779944986471142938641399E8L, ++ -1.895730886640349026257780896972598305443E6L, ++ -1.180509051468390914200720003907727988201E4L ++}; ++#define NRD4 9 ++static const long double RD4[NRD4 + 1] = ++{ ++ -8.172669122056002077809119378047536240889E12L, ++ -9.477592426087986751343695251801814226960E12L, ++ -4.629448850139318158743900253637212801682E12L, ++ -1.237965465892012573255370078308035272942E12L, ++ -1.971624313506929845158062177061297598956E11L, ++ -1.905434843346570533229942397763361493610E10L, ++ -1.089409357680461419743730978512856675984E9L, ++ -3.416703082301143192939774401370222822430E7L, ++ -4.981791914177103793218433195857635265295E5L, ++ -2.192507743896742751483055798411231453733E3L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+3) = log gamma(3) + x P(x)/Q(x) ++ -0.25 <= x <= 0.5 ++ 2.75 <= x+3 <= 3.5 ++ Peak relative error 6.0e-37 */ ++static const long double lgam3a = 6.93145751953125E-1L; ++static const long double lgam3b = 1.4286068203094172321214581765680755001344E-6L; ++ ++#define NRN3 9 ++static const long double RN3[NRN3 + 1] = ++{ ++ -4.813901815114776281494823863935820876670E11L, ++ -8.425592975288250400493910291066881992620E11L, ++ -6.228685507402467503655405482985516909157E11L, ++ -2.531972054436786351403749276956707260499E11L, ++ -6.170200796658926701311867484296426831687E10L, ++ -9.211477458528156048231908798456365081135E9L, ++ -8.251806236175037114064561038908691305583E8L, ++ -4.147886355917831049939930101151160447495E7L, ++ -1.010851868928346082547075956946476932162E6L, ++ -8.333374463411801009783402800801201603736E3L ++}; ++#define NRD3 9 ++static const long double RD3[NRD3 + 1] = ++{ ++ -5.216713843111675050627304523368029262450E11L, ++ -8.014292925418308759369583419234079164391E11L, ++ -5.180106858220030014546267824392678611990E11L, ++ -1.830406975497439003897734969120997840011E11L, ++ -3.845274631904879621945745960119924118925E10L, ++ -4.891033385370523863288908070309417710903E9L, ++ -3.670172254411328640353855768698287474282E8L, ++ -1.505316381525727713026364396635522516989E7L, ++ -2.856327162923716881454613540575964890347E5L, ++ -1.622140448015769906847567212766206894547E3L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+2.5) = log gamma(2.5) + x P(x)/Q(x) ++ -0.125 <= x <= 0.25 ++ 2.375 <= x+2.5 <= 2.75 */ ++static const long double lgam2r5a = 2.8466796875E-1L; ++static const long double lgam2r5b = 1.4901722919159632494669682701924320137696E-5L; ++#define NRN2r5 8 ++static const long double RN2r5[NRN2r5 + 1] = ++{ ++ -4.676454313888335499356699817678862233205E9L, ++ -9.361888347911187924389905984624216340639E9L, ++ -7.695353600835685037920815799526540237703E9L, ++ -3.364370100981509060441853085968900734521E9L, ++ -8.449902011848163568670361316804900559863E8L, ++ -1.225249050950801905108001246436783022179E8L, ++ -9.732972931077110161639900388121650470926E6L, ++ -3.695711763932153505623248207576425983573E5L, ++ -4.717341584067827676530426007495274711306E3L ++}; ++#define NRD2r5 8 ++static const long double RD2r5[NRD2r5 + 1] = ++{ ++ -6.650657966618993679456019224416926875619E9L, ++ -1.099511409330635807899718829033488771623E10L, ++ -7.482546968307837168164311101447116903148E9L, ++ -2.702967190056506495988922973755870557217E9L, ++ -5.570008176482922704972943389590409280950E8L, ++ -6.536934032192792470926310043166993233231E7L, ++ -4.101991193844953082400035444146067511725E6L, ++ -1.174082735875715802334430481065526664020E5L, ++ -9.932840389994157592102947657277692978511E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+2) = x P(x)/Q(x) ++ -0.125 <= x <= +0.375 ++ 1.875 <= x+2 <= 2.375 ++ Peak relative error 4.6e-36 */ ++#define NRN2 9 ++static const long double RN2[NRN2 + 1] = ++{ ++ -3.716661929737318153526921358113793421524E9L, ++ -1.138816715030710406922819131397532331321E10L, ++ -1.421017419363526524544402598734013569950E10L, ++ -9.510432842542519665483662502132010331451E9L, ++ -3.747528562099410197957514973274474767329E9L, ++ -8.923565763363912474488712255317033616626E8L, ++ -1.261396653700237624185350402781338231697E8L, ++ -9.918402520255661797735331317081425749014E6L, ++ -3.753996255897143855113273724233104768831E5L, ++ -4.778761333044147141559311805999540765612E3L ++}; ++#define NRD2 9 ++static const long double RD2[NRD2 + 1] = ++{ ++ -8.790916836764308497770359421351673950111E9L, ++ -2.023108608053212516399197678553737477486E10L, ++ -1.958067901852022239294231785363504458367E10L, ++ -1.035515043621003101254252481625188704529E10L, ++ -3.253884432621336737640841276619272224476E9L, ++ -6.186383531162456814954947669274235815544E8L, ++ -6.932557847749518463038934953605969951466E7L, ++ -4.240731768287359608773351626528479703758E6L, ++ -1.197343995089189188078944689846348116630E5L, ++ -1.004622911670588064824904487064114090920E3L ++/* 1.0E0 */ ++}; ++ ++ ++/* log gamma(x+1.75) = log gamma(1.75) + x P(x)/Q(x) ++ -0.125 <= x <= +0.125 ++ 1.625 <= x+1.75 <= 1.875 ++ Peak relative error 9.2e-37 */ ++static const long double lgam1r75a = -8.441162109375E-2L; ++static const long double lgam1r75b = 1.0500073264444042213965868602268256157604E-5L; ++#define NRN1r75 8 ++static const long double RN1r75[NRN1r75 + 1] = ++{ ++ -5.221061693929833937710891646275798251513E7L, ++ -2.052466337474314812817883030472496436993E8L, ++ -2.952718275974940270675670705084125640069E8L, ++ -2.132294039648116684922965964126389017840E8L, ++ -8.554103077186505960591321962207519908489E7L, ++ -1.940250901348870867323943119132071960050E7L, ++ -2.379394147112756860769336400290402208435E6L, ++ -1.384060879999526222029386539622255797389E5L, ++ -2.698453601378319296159355612094598695530E3L ++}; ++#define NRD1r75 8 ++static const long double RD1r75[NRD1r75 + 1] = ++{ ++ -2.109754689501705828789976311354395393605E8L, ++ -5.036651829232895725959911504899241062286E8L, ++ -4.954234699418689764943486770327295098084E8L, ++ -2.589558042412676610775157783898195339410E8L, ++ -7.731476117252958268044969614034776883031E7L, ++ -1.316721702252481296030801191240867486965E7L, ++ -1.201296501404876774861190604303728810836E6L, ++ -5.007966406976106636109459072523610273928E4L, ++ -6.155817990560743422008969155276229018209E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+x0) = y0 + x^2 P(x)/Q(x) ++ -0.0867 <= x <= +0.1634 ++ 1.374932... <= x+x0 <= 1.625032... ++ Peak relative error 4.0e-36 */ ++static const long double x0a = 1.4616241455078125L; ++static const long double x0b = 7.9994605498412626595423257213002588621246E-6L; ++static const long double y0a = -1.21490478515625E-1L; ++static const long double y0b = 4.1879797753919044854428223084178486438269E-6L; ++#define NRN1r5 8 ++static const long double RN1r5[NRN1r5 + 1] = ++{ ++ 6.827103657233705798067415468881313128066E5L, ++ 1.910041815932269464714909706705242148108E6L, ++ 2.194344176925978377083808566251427771951E6L, ++ 1.332921400100891472195055269688876427962E6L, ++ 4.589080973377307211815655093824787123508E5L, ++ 8.900334161263456942727083580232613796141E4L, ++ 9.053840838306019753209127312097612455236E3L, ++ 4.053367147553353374151852319743594873771E2L, ++ 5.040631576303952022968949605613514584950E0L ++}; ++#define NRD1r5 8 ++static const long double RD1r5[NRD1r5 + 1] = ++{ ++ 1.411036368843183477558773688484699813355E6L, ++ 4.378121767236251950226362443134306184849E6L, ++ 5.682322855631723455425929877581697918168E6L, ++ 3.999065731556977782435009349967042222375E6L, ++ 1.653651390456781293163585493620758410333E6L, ++ 4.067774359067489605179546964969435858311E5L, ++ 5.741463295366557346748361781768833633256E4L, ++ 4.226404539738182992856094681115746692030E3L, ++ 1.316980975410327975566999780608618774469E2L, ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x+1.25) = log gamma(1.25) + x P(x)/Q(x) ++ -.125 <= x <= +.125 ++ 1.125 <= x+1.25 <= 1.375 ++ Peak relative error = 4.9e-36 */ ++static const long double lgam1r25a = -9.82818603515625E-2L; ++static const long double lgam1r25b = 1.0023929749338536146197303364159774377296E-5L; ++#define NRN1r25 9 ++static const long double RN1r25[NRN1r25 + 1] = ++{ ++ -9.054787275312026472896002240379580536760E4L, ++ -8.685076892989927640126560802094680794471E4L, ++ 2.797898965448019916967849727279076547109E5L, ++ 6.175520827134342734546868356396008898299E5L, ++ 5.179626599589134831538516906517372619641E5L, ++ 2.253076616239043944538380039205558242161E5L, ++ 5.312653119599957228630544772499197307195E4L, ++ 6.434329437514083776052669599834938898255E3L, ++ 3.385414416983114598582554037612347549220E2L, ++ 4.907821957946273805080625052510832015792E0L ++}; ++#define NRD1r25 8 ++static const long double RD1r25[NRD1r25 + 1] = ++{ ++ 3.980939377333448005389084785896660309000E5L, ++ 1.429634893085231519692365775184490465542E6L, ++ 2.145438946455476062850151428438668234336E6L, ++ 1.743786661358280837020848127465970357893E6L, ++ 8.316364251289743923178092656080441655273E5L, ++ 2.355732939106812496699621491135458324294E5L, ++ 3.822267399625696880571810137601310855419E4L, ++ 3.228463206479133236028576845538387620856E3L, ++ 1.152133170470059555646301189220117965514E2L ++ /* 1.0E0L */ ++}; ++ ++ ++/* log gamma(x + 1) = x P(x)/Q(x) ++ 0.0 <= x <= +0.125 ++ 1.0 <= x+1 <= 1.125 ++ Peak relative error 1.1e-35 */ ++#define NRN1 8 ++static const long double RN1[NRN1 + 1] = ++{ ++ -9.987560186094800756471055681088744738818E3L, ++ -2.506039379419574361949680225279376329742E4L, ++ -1.386770737662176516403363873617457652991E4L, ++ 1.439445846078103202928677244188837130744E4L, ++ 2.159612048879650471489449668295139990693E4L, ++ 1.047439813638144485276023138173676047079E4L, ++ 2.250316398054332592560412486630769139961E3L, ++ 1.958510425467720733041971651126443864041E2L, ++ 4.516830313569454663374271993200291219855E0L ++}; ++#define NRD1 7 ++static const long double RD1[NRD1 + 1] = ++{ ++ 1.730299573175751778863269333703788214547E4L, ++ 6.807080914851328611903744668028014678148E4L, ++ 1.090071629101496938655806063184092302439E5L, ++ 9.124354356415154289343303999616003884080E4L, ++ 4.262071638655772404431164427024003253954E4L, ++ 1.096981664067373953673982635805821283581E4L, ++ 1.431229503796575892151252708527595787588E3L, ++ 7.734110684303689320830401788262295992921E1L ++ /* 1.0E0 */ ++}; ++ ++ ++/* log gamma(x + 1) = x P(x)/Q(x) ++ -0.125 <= x <= 0 ++ 0.875 <= x+1 <= 1.0 ++ Peak relative error 7.0e-37 */ ++#define NRNr9 8 ++static const long double RNr9[NRNr9 + 1] = ++{ ++ 4.441379198241760069548832023257571176884E5L, ++ 1.273072988367176540909122090089580368732E6L, ++ 9.732422305818501557502584486510048387724E5L, ++ -5.040539994443998275271644292272870348684E5L, ++ -1.208719055525609446357448132109723786736E6L, ++ -7.434275365370936547146540554419058907156E5L, ++ -2.075642969983377738209203358199008185741E5L, ++ -2.565534860781128618589288075109372218042E4L, ++ -1.032901669542994124131223797515913955938E3L, ++}; ++#define NRDr9 8 ++static const long double RDr9[NRDr9 + 1] = ++{ ++ -7.694488331323118759486182246005193998007E5L, ++ -3.301918855321234414232308938454112213751E6L, ++ -5.856830900232338906742924836032279404702E6L, ++ -5.540672519616151584486240871424021377540E6L, ++ -3.006530901041386626148342989181721176919E6L, ++ -9.350378280513062139466966374330795935163E5L, ++ -1.566179100031063346901755685375732739511E5L, ++ -1.205016539620260779274902967231510804992E4L, ++ -2.724583156305709733221564484006088794284E2L ++/* 1.0E0 */ ++}; ++ ++ ++/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++neval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ ++ ++static long double ++deval (long double x, const long double *p, int n) ++{ ++ long double y; ++ ++ p += n; ++ y = x + *p--; ++ do ++ { ++ y = y * x + *p--; ++ } ++ while (--n > 0); ++ return y; ++} ++ ++ ++long double ++__ieee754_lgammal_r (long double x, int *signgamp) ++{ ++ long double p, q, w, z, nx; ++ int i, nn; ++ ++ *signgamp = 1; ++ ++ if (! isfinite (x)) ++ return x * x; ++ ++ if (x == 0) ++ { ++ if (signbit (x)) ++ *signgamp = -1; ++ } ++ ++ if (x < 0) ++ { ++ if (x < -2 && x > -48) ++ return __lgamma_negl (x, signgamp); ++ q = -x; ++ p = __floorl (q); ++ if (p == q) ++ return (one / __fabsl (p - p)); ++ long double halfp = p * 0.5L; ++ if (halfp == __floorl (halfp)) ++ *signgamp = -1; ++ else ++ *signgamp = 1; ++ if (q < 0x1p-120L) ++ return -__logl (q); ++ z = q - p; ++ if (z > 0.5L) ++ { ++ p += 1; ++ z = p - q; ++ } ++ z = q * __sinl (PIL * z); ++ w = __ieee754_lgammal_r (q, &i); ++ z = __logl (PIL / z) - w; ++ return (z); ++ } ++ ++ if (x < 13.5L) ++ { ++ p = 0; ++ nx = __floorl (x + 0.5L); ++ nn = nx; ++ switch (nn) ++ { ++ case 0: ++ /* log gamma (x + 1) = log(x) + log gamma(x) */ ++ if (x < 0x1p-120L) ++ return -__logl (x); ++ else if (x <= 0.125) ++ { ++ p = x * neval (x, RN1, NRN1) / deval (x, RD1, NRD1); ++ } ++ else if (x <= 0.375) ++ { ++ z = x - 0.25L; ++ p = z * neval (z, RN1r25, NRN1r25) / deval (z, RD1r25, NRD1r25); ++ p += lgam1r25b; ++ p += lgam1r25a; ++ } ++ else if (x <= 0.625) ++ { ++ z = x + (1 - x0a); ++ z = z - x0b; ++ p = neval (z, RN1r5, NRN1r5) / deval (z, RD1r5, NRD1r5); ++ p = p * z * z; ++ p = p + y0b; ++ p = p + y0a; ++ } ++ else if (x <= 0.875) ++ { ++ z = x - 0.75L; ++ p = z * neval (z, RN1r75, NRN1r75) / deval (z, RD1r75, NRD1r75); ++ p += lgam1r75b; ++ p += lgam1r75a; ++ } ++ else ++ { ++ z = x - 1; ++ p = z * neval (z, RN2, NRN2) / deval (z, RD2, NRD2); ++ } ++ p = p - __logl (x); ++ break; ++ ++ case 1: ++ if (x < 0.875L) ++ { ++ if (x <= 0.625) ++ { ++ z = x + (1 - x0a); ++ z = z - x0b; ++ p = neval (z, RN1r5, NRN1r5) / deval (z, RD1r5, NRD1r5); ++ p = p * z * z; ++ p = p + y0b; ++ p = p + y0a; ++ } ++ else if (x <= 0.875) ++ { ++ z = x - 0.75L; ++ p = z * neval (z, RN1r75, NRN1r75) ++ / deval (z, RD1r75, NRD1r75); ++ p += lgam1r75b; ++ p += lgam1r75a; ++ } ++ else ++ { ++ z = x - 1; ++ p = z * neval (z, RN2, NRN2) / deval (z, RD2, NRD2); ++ } ++ p = p - __logl (x); ++ } ++ else if (x < 1) ++ { ++ z = x - 1; ++ p = z * neval (z, RNr9, NRNr9) / deval (z, RDr9, NRDr9); ++ } ++ else if (x == 1) ++ p = 0; ++ else if (x <= 1.125L) ++ { ++ z = x - 1; ++ p = z * neval (z, RN1, NRN1) / deval (z, RD1, NRD1); ++ } ++ else if (x <= 1.375) ++ { ++ z = x - 1.25L; ++ p = z * neval (z, RN1r25, NRN1r25) / deval (z, RD1r25, NRD1r25); ++ p += lgam1r25b; ++ p += lgam1r25a; ++ } ++ else ++ { ++ /* 1.375 <= x+x0 <= 1.625 */ ++ z = x - x0a; ++ z = z - x0b; ++ p = neval (z, RN1r5, NRN1r5) / deval (z, RD1r5, NRD1r5); ++ p = p * z * z; ++ p = p + y0b; ++ p = p + y0a; ++ } ++ break; ++ ++ case 2: ++ if (x < 1.625L) ++ { ++ z = x - x0a; ++ z = z - x0b; ++ p = neval (z, RN1r5, NRN1r5) / deval (z, RD1r5, NRD1r5); ++ p = p * z * z; ++ p = p + y0b; ++ p = p + y0a; ++ } ++ else if (x < 1.875L) ++ { ++ z = x - 1.75L; ++ p = z * neval (z, RN1r75, NRN1r75) / deval (z, RD1r75, NRD1r75); ++ p += lgam1r75b; ++ p += lgam1r75a; ++ } ++ else if (x == 2) ++ p = 0; ++ else if (x < 2.375L) ++ { ++ z = x - 2; ++ p = z * neval (z, RN2, NRN2) / deval (z, RD2, NRD2); ++ } ++ else ++ { ++ z = x - 2.5L; ++ p = z * neval (z, RN2r5, NRN2r5) / deval (z, RD2r5, NRD2r5); ++ p += lgam2r5b; ++ p += lgam2r5a; ++ } ++ break; ++ ++ case 3: ++ if (x < 2.75) ++ { ++ z = x - 2.5L; ++ p = z * neval (z, RN2r5, NRN2r5) / deval (z, RD2r5, NRD2r5); ++ p += lgam2r5b; ++ p += lgam2r5a; ++ } ++ else ++ { ++ z = x - 3; ++ p = z * neval (z, RN3, NRN3) / deval (z, RD3, NRD3); ++ p += lgam3b; ++ p += lgam3a; ++ } ++ break; ++ ++ case 4: ++ z = x - 4; ++ p = z * neval (z, RN4, NRN4) / deval (z, RD4, NRD4); ++ p += lgam4b; ++ p += lgam4a; ++ break; ++ ++ case 5: ++ z = x - 5; ++ p = z * neval (z, RN5, NRN5) / deval (z, RD5, NRD5); ++ p += lgam5b; ++ p += lgam5a; ++ break; ++ ++ case 6: ++ z = x - 6; ++ p = z * neval (z, RN6, NRN6) / deval (z, RD6, NRD6); ++ p += lgam6b; ++ p += lgam6a; ++ break; ++ ++ case 7: ++ z = x - 7; ++ p = z * neval (z, RN7, NRN7) / deval (z, RD7, NRD7); ++ p += lgam7b; ++ p += lgam7a; ++ break; ++ ++ case 8: ++ z = x - 8; ++ p = z * neval (z, RN8, NRN8) / deval (z, RD8, NRD8); ++ p += lgam8b; ++ p += lgam8a; ++ break; ++ ++ case 9: ++ z = x - 9; ++ p = z * neval (z, RN9, NRN9) / deval (z, RD9, NRD9); ++ p += lgam9b; ++ p += lgam9a; ++ break; ++ ++ case 10: ++ z = x - 10; ++ p = z * neval (z, RN10, NRN10) / deval (z, RD10, NRD10); ++ p += lgam10b; ++ p += lgam10a; ++ break; ++ ++ case 11: ++ z = x - 11; ++ p = z * neval (z, RN11, NRN11) / deval (z, RD11, NRD11); ++ p += lgam11b; ++ p += lgam11a; ++ break; ++ ++ case 12: ++ z = x - 12; ++ p = z * neval (z, RN12, NRN12) / deval (z, RD12, NRD12); ++ p += lgam12b; ++ p += lgam12a; ++ break; ++ ++ case 13: ++ z = x - 13; ++ p = z * neval (z, RN13, NRN13) / deval (z, RD13, NRD13); ++ p += lgam13b; ++ p += lgam13a; ++ break; ++ } ++ return p; ++ } ++ ++ if (x > MAXLGM) ++ return (*signgamp * huge * huge); ++ ++ if (x > 0x1p120L) ++ return x * (__logl (x) - 1); ++ q = ls2pi - x; ++ q = (x - 0.5L) * __logl (x) + q; ++ if (x > 1.0e18L) ++ return (q); ++ ++ p = 1 / (x * x); ++ q += neval (p, RASY, NRASY) / x; ++ return (q); ++} ++strong_alias (__ieee754_lgammal_r, __lgammal_r_finite) +diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c +index 64bfc46414..317d238057 100644 +--- a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c ++++ b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c +@@ -1,10 +1,102 @@ +-/* Looks like we can use ieee854 s_cbrtl.c as is for IBM extended format. */ ++/* Implementation of cbrtl. IBM Extended Precision version. ++ Cephes Math Library Release 2.2: January, 1991 ++ Copyright 1984, 1991 by Stephen L. Moshier ++ Adapted for glibc October, 2001. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see ++ . */ ++ ++/* This file was copied from sysdeps/ieee754/ldbl-128/e_j0l.c. */ ++ ++ + #include +-#undef weak_alias +-#define weak_alias(n,a) ++#include ++#include ++ ++static const long double CBRT2 = 1.259921049894873164767210607278228350570251L; ++static const long double CBRT4 = 1.587401051968199474751705639272308260391493L; ++static const long double CBRT2I = 0.7937005259840997373758528196361541301957467L; ++static const long double CBRT4I = 0.6299605249474365823836053036391141752851257L; ++ ++ ++long double ++__cbrtl (long double x) ++{ ++ int e, rem, sign; ++ long double z; ++ ++ if (!isfinite (x)) ++ return x + x; ++ ++ if (x == 0) ++ return (x); ++ ++ if (x > 0) ++ sign = 1; ++ else ++ { ++ sign = -1; ++ x = -x; ++ } ++ ++ z = x; ++ /* extract power of 2, leaving mantissa between 0.5 and 1 */ ++ x = __frexpl (x, &e); ++ ++ /* Approximate cube root of number between .5 and 1, ++ peak relative error = 1.2e-6 */ ++ x = ((((1.3584464340920900529734e-1L * x ++ - 6.3986917220457538402318e-1L) * x ++ + 1.2875551670318751538055e0L) * x ++ - 1.4897083391357284957891e0L) * x ++ + 1.3304961236013647092521e0L) * x + 3.7568280825958912391243e-1L; ++ ++ /* exponent divided by 3 */ ++ if (e >= 0) ++ { ++ rem = e; ++ e /= 3; ++ rem -= 3 * e; ++ if (rem == 1) ++ x *= CBRT2; ++ else if (rem == 2) ++ x *= CBRT4; ++ } ++ else ++ { /* argument less than 1 */ ++ e = -e; ++ rem = e; ++ e /= 3; ++ rem -= 3 * e; ++ if (rem == 1) ++ x *= CBRT2I; ++ else if (rem == 2) ++ x *= CBRT4I; ++ e = -e; ++ } ++ ++ /* multiply by power of 2 */ ++ x = __ldexpl (x, e); ++ ++ /* Newton iteration */ ++ x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; ++ x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; ++ x -= (x - (z / (x * x))) * 0.3333333333333333333333333333333333333333L; + +-#define _Float128 long double +-#define L(x) x ## L ++ if (sign < 0) ++ x = -x; ++ return (x); ++} + +-#include + long_double_symbol (libm, __cbrtl, cbrtl); +diff --git a/sysdeps/ieee754/ldbl-128ibm/t_expl.h b/sysdeps/ieee754/ldbl-128ibm/t_expl.h +new file mode 100644 +index 0000000000..e2fe4dd2ef +--- /dev/null ++++ b/sysdeps/ieee754/ldbl-128ibm/t_expl.h +@@ -0,0 +1,970 @@ ++/* Accurate table for expl(). ++ Copyright (C) 1999-2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* __expl_table basically consists of four tables, T_EXPL_ARG{1,2} and ++ T_EXPL_RES{1,2}. All tables use positive and negative indexes, the 0 points ++ are marked by T_EXPL_* defines. ++ For ARG1 and RES1 tables lets B be 89 and S 256.0, for ARG2 and RES2 B is 65 ++ and S 32768.0. ++ These table have the property that, for all integers -B <= i <= B ++ expl(__expl_table[T_EXPL_ARGN+2*i]+__expl_table[T_EXPL_ARGN+2*i+1]+r) == ++ __expl_table[T_EXPL_RESN+i], __expl_table[T_EXPL_RESN+i] is some exact number ++ with the low 58 bits of the mantissa 0, ++ __expl_table[T_EXPL_ARGN+2*i] == i/S+s ++ where absl(s) <= 2^-54 and absl(r) <= 2^-212. */ ++ ++ ++static const long double __expl_table [] = { ++ -3.47656250000000000584188889839535373E-01L, /* bffd640000000000002b1b04213cf000 */ ++ 6.90417668990715641167244540876988960E-32L, /* 3f97667c3fdb588a6ae1af8748357a17 */ ++ -3.43749999999999981853132895957607418E-01L, /* bffd5ffffffffffffac4ff5f4050b000 */ ++ -7.16021898043268093462818380603370350E-33L, /* bf94296c8219427edc1431ac2498583e */ ++ -3.39843750000000013418643523138766329E-01L, /* bffd5c000000000003de1f027a30e000 */ ++ 8.16920774283317801641347327589583265E-32L, /* 3f97a82b65774bdca1b4440d749ed8d3 */ ++ -3.35937500000000014998092453039303051E-01L, /* bffd5800000000000452a9f4d8857000 */ ++ -6.55865578425428447938248396879359670E-32L, /* bf97548b7d240f3d034b395e6eecfac8 */ ++ -3.32031250000000000981984049529998541E-01L, /* bffd540000000000004875277cda5000 */ ++ 6.91213046334032232108944519541512737E-32L, /* 3f9766e5f925338a19045c94443b66e1 */ ++ -3.28124999999999986646017645350399708E-01L, /* bffd4ffffffffffffc26a667bf44d000 */ ++ -6.16281060996110316602421505683742661E-32L, /* bf973ffdcdcffb6fbffc86b2b8d42f5d */ ++ -3.24218749999999991645717430645867963E-01L, /* bffd4bfffffffffffd97901063e48000 */ ++ -7.90797211087760527593856542417304137E-32L, /* bf979a9afaaca1ada6a8ed1c80584d60 */ ++ -3.20312499999999998918211610690789652E-01L, /* bffd47ffffffffffffb02d9856d71000 */ ++ 8.64024799457616856987630373786503376E-32L, /* 3f97c0a098623f95579d5d9b2b67342d */ ++ -3.16406249999999998153974811017181883E-01L, /* bffd43ffffffffffff77c991f1076000 */ ++ -2.73176610180696076418536105483668404E-32L, /* bf961baeccb32f9b1fcbb8e60468e95a */ ++ -3.12500000000000011420976192575972779E-01L, /* bffd400000000000034ab8240483d000 */ ++ 7.16573502812389453744433792609989420E-32L, /* 3f977410f4c2cfc4335f28446c0fb363 */ ++ -3.08593750000000001735496343854851414E-01L, /* bffd3c000000000000800e995c176000 */ ++ -1.56292999645122272621237565671593071E-32L, /* bf95449b9cbdaff6ac1246adb2c826ac */ ++ -3.04687499999999982592401295899221626E-01L, /* bffd37fffffffffffafb8bc1e061a000 */ ++ 6.48993208584888904958594509625158417E-32L, /* 3f9750f9fe8366d82d77afa0031a92e1 */ ++ -3.00781249999999999230616898937763959E-01L, /* bffd33ffffffffffffc73ac39da54000 */ ++ 6.57082437496961397305801409357792029E-32L, /* 3f97552d3cb598ea80135cf3feb27ec4 */ ++ -2.96874999999999998788769281703245722E-01L, /* bffd2fffffffffffffa6a07fa5021000 */ ++ -3.26588297198283968096426564544269170E-32L, /* bf9653260fc1802f46b629aee171809b */ ++ -2.92968750000000015318089182805941695E-01L, /* bffd2c0000000000046a468614bd6000 */ ++ -1.73291974845198589684358727559290718E-32L, /* bf9567e9d158f52e483c8d8dcb5961dd */ ++ -2.89062500000000007736778942676309681E-01L, /* bffd280000000000023adf9f4c3d3000 */ ++ -6.83629745986675744404029225571026236E-32L, /* bf9762f5face6281c1daf1c6aedbdb45 */ ++ -2.85156250000000001367091555763661937E-01L, /* bffd2400000000000064dfa11e3fb000 */ ++ -5.44898442619766878281110054067026237E-32L, /* bf971aed6d2db9f542986a785edae072 */ ++ -2.81249999999999986958718100227029406E-01L, /* bffd1ffffffffffffc3db9265ca9d000 */ ++ 1.13007318374506125723591889451107046E-32L, /* 3f94d569fe387f456a97902907ac3856 */ ++ -2.77343750000000000356078829380495179E-01L, /* bffd1c0000000000001a462390083000 */ ++ -4.98979365468978332358409063436543102E-32L, /* bf970315bbf3e0d14b5c94c900702d4c */ ++ -2.73437499999999990276993957508540484E-01L, /* bffd17fffffffffffd32919bcdc94000 */ ++ -8.79390484115892344533724650295100871E-32L, /* bf97c89b0b89cc19c3ab2b60da9bbbc3 */ ++ -2.69531250000000002434203866460082225E-01L, /* bffd14000000000000b39ccf9e130000 */ ++ 9.44060754687026590886751809927191596E-32L, /* 3f97ea2f32cfecca5c64a26137a9210f */ ++ -2.65624999999999997296320716986257179E-01L, /* bffd0fffffffffffff3880f13a2bc000 */ ++ 2.07142664067265697791007875348396921E-32L, /* 3f95ae37ee685b9122fbe377bd205ee4 */ ++ -2.61718750000000010237478733739017956E-01L, /* bffd0c000000000002f3648179d40000 */ ++ -6.10552936159265665298996309192680256E-32L, /* bf973d0467d31e407515a3cca0f3b4e2 */ ++ -2.57812500000000011948220522778370303E-01L, /* bffd08000000000003719f81275bd000 */ ++ 6.72477169058908902499239631466443836E-32L, /* 3f975d2b8c475d3160cf72d227d8e6f9 */ ++ -2.53906249999999991822993360536596860E-01L, /* bffd03fffffffffffda4a4b62f818000 */ ++ -2.44868296623215865054704392917190994E-32L, /* bf95fc92516c6d057d29fc2528855976 */ ++ -2.49999999999999986862019457428548084E-01L, /* bffcfffffffffffff86d2d20d5ff4000 */ ++ -3.85302898949105073614122724961613078E-32L, /* bf96901f147cb7d643af71b6129ce929 */ ++ -2.46093750000000000237554160737318435E-01L, /* bffcf8000000000000230e8ade26b000 */ ++ -1.52823675242678363494345369284988589E-32L, /* bf953d6700c5f3fc303f79d0ec8c680a */ ++ -2.42187500000000003023380963205457065E-01L, /* bffcf0000000000001be2c1a78bb0000 */ ++ -7.78402037952209709489481182714311699E-34L, /* bf9102ab1f3998e887f0ee4cf940faa5 */ ++ -2.38281249999999995309623303145485725E-01L, /* bffce7fffffffffffd4bd2940f43f000 */ ++ -3.54307216794236899443913216397197696E-32L, /* bf966fef03ab69c3f289436205b21d02 */ ++ -2.34374999999999998425804947623207526E-01L, /* bffcdfffffffffffff17b097a6092000 */ ++ -2.86038428948386602859761879407549696E-32L, /* bf96290a0eba0131efe3a05fe188f2e3 */ ++ -2.30468749999999993822207406785200832E-01L, /* bffcd7fffffffffffc70519834eae000 */ ++ -2.54339521031747516806893838749365762E-32L, /* bf96081f0ad7f9107ae6cddb32c178ab */ ++ -2.26562499999999997823524030344489884E-01L, /* bffccffffffffffffebecf10093df000 */ ++ 4.31904611473158635644635628922959401E-32L, /* 3f96c083f0b1faa7c4c686193e38d67c */ ++ -2.22656250000000004835132405125162742E-01L, /* bffcc8000000000002c98a233f19f000 */ ++ 2.54709791629335691650310168420597566E-33L, /* 3f92a735903f5eed07a716ab931e20d9 */ ++ -2.18749999999999988969454021829236626E-01L, /* bffcbffffffffffff9a42dc14ce36000 */ ++ -3.77236096429336082213752014054909454E-32L, /* bf9687be8e5b2fca54d3e81157eac660 */ ++ -2.14843750000000010613256919115758495E-01L, /* bffcb80000000000061e3d828ecac000 */ ++ -4.55194148712216691177097854305964738E-32L, /* bf96d8b35c776aa3e1a4768271380503 */ ++ -2.10937499999999993204656148110447201E-01L, /* bffcaffffffffffffc152f2aea118000 */ ++ -2.95044199165561453749332254271716417E-32L, /* bf96326433b00b2439094d9bef22ddd1 */ ++ -2.07031250000000012233944895423355677E-01L, /* bffca80000000000070d695ee0e94000 */ ++ 1.93146788688385419095981415411012357E-32L, /* 3f959126729135a5e390d4bb802a0bde */ ++ -2.03125000000000008030983633336321863E-01L, /* bffca0000000000004a129fbc51af000 */ ++ 2.37361904671826193563212931215900137E-32L, /* 3f95ecfb3c4ba1b97ea3ad45cbb1e68a */ ++ -1.99218750000000001763815712796132779E-01L, /* bffc98000000000001044b12d9950000 */ ++ -3.63171243370923753295192486732883239E-33L, /* bf932db5fb3f27c38e0fa7bbcfc64f55 */ ++ -1.95312500000000004883660234506677272E-01L, /* bffc90000000000002d0b3779d1f9000 */ ++ -3.19989507343607877747980892249711601E-33L, /* bf9309d63de96bb3ef744c865f22f1bd */ ++ -1.91406250000000013720152363227519348E-01L, /* bffc88000000000007e8bcb387121000 */ ++ -1.89295754093147174148371614722178860E-32L, /* bf958926e2e67dfe812c508290add2e7 */ ++ -1.87500000000000000182342082774432620E-01L, /* bffc800000000000001ae8b06a39f000 */ ++ -2.96812835183184815200854214892983927E-32L, /* bf96343a62d156bbe71f55d14ca4b6e5 */ ++ -1.83593750000000012410147185883290345E-01L, /* bffc78000000000007276a1adda8d000 */ ++ -2.02191931237489669058466239995304587E-32L, /* bf95a3efab92d26ec2df90df036a117f */ ++ -1.79687499999999997439177363346082917E-01L, /* bffc6ffffffffffffe8616db2927d000 */ ++ -9.92752326937775530007399526834009465E-33L, /* bf949c5f88ed17041e1a3f1829d543cd */ ++ -1.75781249999999995824373974504785174E-01L, /* bffc67fffffffffffd97c94f13ea3000 */ ++ 1.44184772065335613487885714828816178E-32L, /* 3f952b75c63476e7fcc2f5841c27bcce */ ++ -1.71874999999999986685050259043077809E-01L, /* bffc5ffffffffffff8530f6bc531a000 */ ++ -3.49007014971241147689894940544402482E-32L, /* bf966a6dfaa012aea8ffe6d90b02330f */ ++ -1.67968749999999997316058782350439701E-01L, /* bffc57fffffffffffe73eb914f2aa000 */ ++ 3.34025733574205019081305778794376391E-32L, /* 3f965adf4572561fd5456a6c13d8babf */ ++ -1.64062499999999993322730602128318480E-01L, /* bffc4ffffffffffffc269be4f68f3000 */ ++ -1.83345916769684984022099095506340635E-32L, /* bf957ccb69026cb2f6024c211576d5f4 */ ++ -1.60156249999999992419000744447607979E-01L, /* bffc47fffffffffffba13df21784a000 */ ++ 2.73442789798110494773517431626534726E-32L, /* 3f961bf58ff22c9b30f1e2b39f26d7d5 */ ++ -1.56249999999999987665010524130393080E-01L, /* bffc3ffffffffffff8e3ad45e7508000 */ ++ 2.02695576464836145806428118889332191E-32L, /* 3f95a4fb7435a4a2f71de81eb8ae75d1 */ ++ -1.52343749999999989905291167951491803E-01L, /* bffc37fffffffffffa2e48aecfc24000 */ ++ -3.61436631548815190395331054871041524E-32L, /* bf967756567ebd108075ae527cc2e7f0 */ ++ -1.48437500000000006686107754967759751E-01L, /* bffc30000000000003dab20261b3c000 */ ++ -2.15524270159131591469319477922198390E-32L, /* bf95bfa05b82ef3a708c4f0395e9fcf6 */ ++ -1.44531250000000005132889939177166485E-01L, /* bffc28000000000002f57b1969e7b000 */ ++ 2.74741116529653547935086189244019604E-32L, /* 3f961d4eb77c1185d34fe1b04a3f3cf5 */ ++ -1.40625000000000000707469094533647325E-01L, /* bffc2000000000000068676d3d5c4000 */ ++ 4.40607097220049957013547629906723266E-33L, /* 3f936e0ac425daf795b42913cf0ef881 */ ++ -1.36718749999999995713752139187543306E-01L, /* bffc17fffffffffffd87762255991000 */ ++ -3.73751317180116492404578048203389108E-32L, /* bf9684202491e9cbb7ceb67d9ff7e0c9 */ ++ -1.32812500000000007198453630478482191E-01L, /* bffc10000000000004264de3a4379000 */ ++ -3.97050085179660203884930593717220728E-32L, /* bf969c52048de14be3c9c1971e50869c */ ++ -1.28906250000000006070486371645733082E-01L, /* bffc080000000000037fd87db2cb0000 */ ++ 3.59610068058504988294019521946586131E-32L, /* 3f967570c10687cb8e9ebd0b280abf5a */ ++ -1.25000000000000003700729208608337966E-01L, /* bffc00000000000002222198bbc74000 */ ++ 3.23464851393124362331846965931995969E-33L, /* 3f930cb95da3bfc847e593716c91d57a */ ++ -1.21093750000000013729038501177102555E-01L, /* bffbf000000000000fd418d1f5fda000 */ ++ 2.45242487730722066611358741283977619E-32L, /* 3f95fd5945ad86a464292e26ac192a84 */ ++ -1.17187499999999999765305306880205578E-01L, /* bffbdfffffffffffffbabaf869845000 */ ++ -1.14557520298960389903199646350205537E-32L, /* bf94dbda735322179d9bcf392e1dd06d */ ++ -1.13281250000000009579647893740755690E-01L, /* bffbd000000000000b0b69bae7ab9000 */ ++ 2.37873962873837390105423621772752350E-32L, /* 3f95ee0b7e0bd5ac1f6fab1e2a71abc3 */ ++ -1.09375000000000008981153004560108539E-01L, /* bffbc000000000000a5ac4bc1d2c3000 */ ++ 1.53152444860014076105003555837231015E-32L, /* 3f953e15ce931e12ef9a152522e32bdd */ ++ -1.05468749999999992399063850363228723E-01L, /* bffbaffffffffffff73c998091408000 */ ++ -8.75920903597804862471749360196688834E-33L, /* bf946bd7e310a01bae5687ebdc47fcc5 */ ++ -1.01562500000000007685885179918350550E-01L, /* bffba0000000000008dc7910a648c000 */ ++ -4.63820993797174451904075397785059501E-33L, /* bf938153d0e54001a472da180fb5e8aa */ ++ -9.76562499999999887262211517861331814E-02L, /* bffb8ffffffffffff300915aa6fd6000 */ ++ -2.63767025974952608658936466715705903E-33L, /* bf92b64215bb8d520be5404620d38088 */ ++ -9.37499999999999939650246024457439795E-02L, /* bffb7ffffffffffff90aca26bd0fc000 */ ++ -1.72047822349322956713582039121348377E-32L, /* bf9565545015c5b9b56d02cfefca2c7d */ ++ -8.98437500000000033088896383977486369E-02L, /* bffb70000000000003d09ca1e3cbe000 */ ++ 3.04831994420989436248526129869697270E-33L, /* 3f92fa7d30d2ed90e7ebbd6231fd08b1 */ ++ -8.59374999999999947312400115121319225E-02L, /* bffb5ffffffffffff9ecefc03376e000 */ ++ 1.50416954438393392150792422537312281E-32L, /* 3f9538675ee99bd722fad0023c09c915 */ ++ -8.20312500000000054182280847004695514E-02L, /* bffb500000000000063f2dbd40200000 */ ++ 2.68399664523430004488075638997207289E-33L, /* 3f92bdf49766629882c49a3da88928ed */ ++ -7.81250000000000114767533968079748798E-02L, /* bffb4000000000000d3b56f81ba70000 */ ++ 1.72318124201659121296305402819694281E-32L, /* 3f9565e407aaabfb359e8a567d760de3 */ ++ -7.42187500000000035531829472486812869E-02L, /* bffb3000000000000418b6e9b5388000 */ ++ 2.09401756478514117051383998628099655E-32L, /* 3f95b2e91221fcd74be0a86d8ad658d2 */ ++ -7.03124999999999987474933134860732535E-02L, /* bffb1ffffffffffffe8e53453d2ac000 */ ++ 2.28515798224350800271565551341211666E-32L, /* 3f95da9bd6adf00894f05b5cc5530125 */ ++ -6.64062500000000042267533361089054159E-02L, /* bffb10000000000004df8473dbcf2000 */ ++ 1.97576478800281368377376002585430031E-32L, /* 3f959a59acbddb2f53bd3096b66370e9 */ ++ -6.25000000000000066329769382774201686E-02L, /* bffb00000000000007a5b5914e336000 */ ++ -1.46422615813786836245343723048221678E-33L, /* bf91e69295f069fc0c4a9db181ea25a3 */ ++ -5.85937500000000002823707957982406053E-02L, /* bffae0000000000000a6aeab10592000 */ ++ 9.25637741701318872896718218457555829E-33L, /* 3f94807eb021f1f40a37d4015b1eb76b */ ++ -5.46875000000000081586888005226044448E-02L, /* bffac0000000000012d00a3171e3a000 */ ++ -4.87144542459404765480424673678105050E-33L, /* bf9394b42faba6b7036fe7b36269daf3 */ ++ -5.07812499999999927720348253140567013E-02L, /* bffa9fffffffffffef555cc8dd914000 */ ++ -3.01901021987395945826043649523451725E-33L, /* bf92f59e7e3025691f290f8f67277faf */ ++ -4.68749999999999935349476738962633103E-02L, /* bffa7ffffffffffff117b4ea2b876000 */ ++ 1.21521638219189777347767475937119750E-32L, /* 3f94f8c7f88c5b56674b94d984ac8ecb */ ++ -4.29687500000000056305562847814228219E-02L, /* bffa6000000000000cfbb19be30c0000 */ ++ -1.18643699217679276275559592978275214E-32L, /* bf94ecd39f0833a876550e83eb012b99 */ ++ -3.90624999999999962692914526031373542E-02L, /* bffa3ffffffffffff765c743922f9000 */ ++ -4.91277156857520035712509544689973679E-33L, /* bf939823189996193872e58ac0dececb */ ++ -3.51562500000000108152468207687602886E-02L, /* bffa20000000000018f031e41177f000 */ ++ 1.18599806302656253755207072755609820E-32L, /* 3f94eca4f23e787fab73ce8f6b9b8d64 */ ++ -3.12500000000000077376981036742289578E-02L, /* bffa00000000000011d787e0b386f000 */ ++ 9.97730386477005171963635210799577079E-33L, /* 3f949e70e498c46a0173ac0d46c699fc */ ++ -2.73437500000000139436129596418623235E-02L, /* bff9c00000000000404db66e70a08000 */ ++ 2.25755321633070123579875157841633859E-33L, /* 3f927719b1a93074bdf9f3c2cb784785 */ ++ -2.34375000000000088003629211828324876E-02L, /* bff98000000000002895a27d45feb000 */ ++ 2.84374279216848803102126617873942975E-33L, /* 3f92d87f70e749d6da6c260b68dc210b */ ++ -1.95312500000000107408831063404855424E-02L, /* bff9400000000000318898ba69f71000 */ ++ 2.47348089686935458989103979140011912E-33L, /* 3f929afa3de45086fe909fdddb41edce */ ++ -1.56250000000000081443917555362290635E-02L, /* bff9000000000000258f335e9cdd6000 */ ++ -2.43379314483517422161458863218426254E-33L, /* bf9294621c8a9ccacf2b020ec19cad27 */ ++ -1.17187500000000051490597418161403184E-02L, /* bff88000000000002f7ddfa26221f000 */ ++ 1.83405297208145390679150568810924707E-33L, /* 3f9230bbfc5d5fe1b534fbcda0465bb9 */ ++ -7.81249999999999715861805208310174953E-03L, /* bff7ffffffffffffcb95f3fff157d000 */ ++ 3.51548384878710915171654413641872451E-34L, /* 3f8fd349b76c22966f77a39fc37ed704 */ ++ -3.90625000000000309326013918295097128E-03L, /* bff7000000000000390f820c8e153000 */ ++ 6.38058004651791109324060099097251911E-36L, /* 3f8a0f665d3ac25a1ac94d688273dbcd */ ++#define T_EXPL_ARG1 (2*89) ++ 0.00000000000000000000000000000000000E+00L, /* 00000000000000000000000000000000 */ ++ 0.00000000000000000000000000000000000E+00L, /* 00000000000000000000000000000000 */ ++ 3.90625000000000245479958859972588985E-03L, /* 3ff70000000000002d48769ac9874000 */ ++ -6.58439598384342854976169982902779828E-36L, /* bf8a1811b923e6c626b07ef29761482a */ ++ 7.81250000000001311374391093664996358E-03L, /* 3ff800000000000078f3f3cd89111000 */ ++ 2.60265650555493781464273319671555602E-33L, /* 3f92b070c3b635b87af426735a71fc87 */ ++ 1.17187500000000269581156218247101912E-02L, /* 3ff8800000000000f8a50d02fe20d000 */ ++ 1.00961747974945520631836275894919326E-33L, /* 3f914f80c1a4f8042044fe3b757b030b */ ++ 1.56249999999999797878275270751825475E-02L, /* 3ff8ffffffffffff45935b69da62e000 */ ++ 2.03174577741375590087897353146748580E-33L, /* 3f925194e863496e0f6e91cbf6b22e26 */ ++ 1.95312499999999760319884511789111533E-02L, /* 3ff93fffffffffff917790ff9a8f4000 */ ++ 4.62788519658803722282100289809515007E-33L, /* 3f9380783ba81295feeb3e4879d7d52d */ ++ 2.34374999999999822953909016349145918E-02L, /* 3ff97fffffffffffae5a163bd3cd5000 */ ++ -3.19499956304699705390404384504876533E-33L, /* bf93096e2037ced8194cf344c692f8d6 */ ++ 2.73437500000000137220327275871555682E-02L, /* 3ff9c000000000003f481dea5dd51000 */ ++ -2.25757776523031994464630107442723424E-33L, /* bf92771abcf988a02b414bf2614e3734 */ ++ 3.12499999999999790857640618332718621E-02L, /* 3ff9ffffffffffff9f8cd40b51509000 */ ++ -4.22479470489989916319395454536511458E-33L, /* bf935efb7245612f371deca17cb7b30c */ ++ 3.51562499999999840753382405747597346E-02L, /* 3ffa1fffffffffffdb47bd275f722000 */ ++ 1.08459658374118041980976756063083500E-34L, /* 3f8e2055d18b7117c9db1c318b1e889b */ ++ 3.90624999999999989384433621470426757E-02L, /* 3ffa3ffffffffffffd8d5e18b042e000 */ ++ -7.41674226146122000759491297811091830E-33L, /* bf94341454e48029e5b0205d91baffdc */ ++ 4.29687500000000107505739500500200462E-02L, /* 3ffa60000000000018ca04cd9085c000 */ ++ -4.74689012756713017494437969420919847E-34L, /* bf903b7c268103c6f7fbaaa24142e287 */ ++ 4.68749999999999978700749928325717352E-02L, /* 3ffa7ffffffffffffb16b6d5479e3000 */ ++ -1.06208165308448830117773486334902917E-32L, /* bf94b92be4b3b5b5a596a0a5187cc955 */ ++ 5.07812499999999815072625435955786253E-02L, /* 3ffa9fffffffffffd55bd086d5cbc000 */ ++ -9.37038897148383660401929567549111394E-33L, /* bf94853b111b0175b491c80d00419416 */ ++ 5.46874999999999809511553152189867394E-02L, /* 3ffabfffffffffffd4138bfa74a61000 */ ++ 1.06642963074562437340498606682822123E-32L, /* 3f94bafa3fe991b39255d563dfa05d89 */ ++ 5.85937500000000184331996330905145551E-02L, /* 3ffae000000000002a810a5f2f8bf000 */ ++ -1.76639977694797200820296641773791945E-34L, /* bf8ed596f07ce4408f1705c8ec16864c */ ++ 6.25000000000000021544696744852045001E-02L, /* 3ffb000000000000027be32045e2b000 */ ++ 1.68616371995798354366633034788947149E-32L, /* 3f955e33d7440794d8a1b25233d086ab */ ++ 6.64062499999999965563110718495802889E-02L, /* 3ffb0ffffffffffffc079a38a3fed000 */ ++ -1.82463217667830160048872113565316215E-32L, /* bf957af6163bcdb97cefab44a942482a */ ++ 7.03124999999999759989183341261898222E-02L, /* 3ffb1fffffffffffe454218acea05000 */ ++ -1.07843770101525495515646940862541503E-32L, /* bf94bff72aada26d94e76e71c07e0580 */ ++ 7.42187499999999898968873730710101412E-02L, /* 3ffb2ffffffffffff45a166496dc1000 */ ++ 1.28629441689592874462780757154138223E-32L, /* 3f950b2724597b8b93ce1e9d1cf4d035 */ ++ 7.81249999999999957198938523510804668E-02L, /* 3ffb3ffffffffffffb10bc52adbc5000 */ ++ 1.13297573459968118467100063135856856E-33L, /* 3f91787eea895b3c245899cf34ad0abd */ ++ 8.20312500000000199911640621145851159E-02L, /* 3ffb500000000000170c59a661a89000 */ ++ -1.51161335208135146756554123073528707E-32L, /* bf9539f326c5ca84e7db5401566f3775 */ ++ 8.59375000000000134175373433347670743E-02L, /* 3ffb6000000000000f78287547af0000 */ ++ 1.09763629458404270323909815379924900E-32L, /* 3f94c7f0b61b6e3e27d44b9f5bbc7e9d */ ++ 8.98437500000000036533922600308306335E-02L, /* 3ffb70000000000004364a83b7a14000 */ ++ 3.11459653680110433194288029777718358E-33L, /* 3f9302c0248136d65cebeab69488d949 */ ++ 9.37500000000000184977946245216914691E-02L, /* 3ffb800000000000155395d870b17000 */ ++ -4.66656154468277949130395786965043927E-33L, /* bf9383aec9b993b6db492b1ede786d8a */ ++ 9.76562500000000237839723100419376084E-02L, /* 3ffb9000000000001b6bca237f6c4000 */ ++ -1.03028043424658760249140747856831301E-32L, /* bf94abf6352e3d2bb398e47919a343fb */ ++ 1.01562500000000012345545575236836572E-01L, /* 3ffba000000000000e3bc30cd9a1f000 */ ++ 2.15755372310795701322789783729456319E-32L, /* 3f95c01b3b819edd9d07548fafd61550 */ ++ 1.05468749999999976493840484471911438E-01L, /* 3ffbafffffffffffe4e634cd77985000 */ ++ 1.78771847038773333029677216592309083E-32L, /* 3f95734b6ae650f33dd43c49a1df9fc0 */ ++ 1.09375000000000002267015055992785402E-01L, /* 3ffbc00000000000029d1ad08de7b000 */ ++ 6.23263106693943817730045115112427717E-33L, /* 3f9402e4b39ce2198a45e1d045868cd6 */ ++ 1.13281250000000022354208618429577398E-01L, /* 3ffbd0000000000019c5cc3f9d2b5000 */ ++ 5.40514416644786448581426756221178868E-33L, /* 3f93c10ab4021472c662f69435de9269 */ ++ 1.17187500000000013252367133076817603E-01L, /* 3ffbe000000000000f47688cc561b000 */ ++ -7.12412585457324989451327215568641325E-33L, /* bf9427ecb343a8d1758990565fcfbf45 */ ++ 1.21093750000000020759863992944300792E-01L, /* 3ffbf0000000000017ef3af97bf04000 */ ++ 6.26591408357572503875647872077266444E-33L, /* 3f940446a09a2da771b45fc075514d12 */ ++ 1.25000000000000004739659392396765618E-01L, /* 3ffc00000000000002bb7344ecd89000 */ ++ -1.55611398459729463981000080101758830E-32L, /* bf95433135febefa9e6aa4db39e263d2 */ ++ 1.28906249999999982360888081057894783E-01L, /* 3ffc07fffffffffff5d4ed3154361000 */ ++ -1.77531518652835570781208599686606474E-32L, /* bf9570b7f225ea076f97f418d11359c1 */ ++ 1.32812500000000010568583998727400436E-01L, /* 3ffc1000000000000617a5d09526a000 */ ++ 2.12104021624990594668286391598300893E-32L, /* 3f95b885d767a1048d93055927a27adc */ ++ 1.36718749999999998434125157367005292E-01L, /* 3ffc17ffffffffffff18eaebc7970000 */ ++ 2.50454798592543203967309921276955297E-32L, /* 3f9604164e5598528a76faff26cd1c97 */ ++ 1.40625000000000015550032422969330356E-01L, /* 3ffc20000000000008f6c79d8928c000 */ ++ 7.80972982879849783680252962992639832E-33L, /* 3f9444674acf2b3225c7647e0d95edf3 */ ++ 1.44531250000000012402535562111122522E-01L, /* 3ffc28000000000007264a8bc1ff1000 */ ++ 2.79662468716455159585514763921671876E-32L, /* 3f96226b095bd78aa650faf95a221993 */ ++ 1.48437500000000007761020440087419948E-01L, /* 3ffc3000000000000479530ff8fe3000 */ ++ 2.15518492972728435680556239996258527E-32L, /* 3f95bf9d49295e73a957906a029768cb */ ++ 1.52343750000000001733189947520484032E-01L, /* 3ffc38000000000000ffc6109f71f000 */ ++ 8.34032236093545825619420380704500188E-33L, /* 3f945a71851226a1d0ce5e656693153e */ ++ 1.56249999999999988073295321246958484E-01L, /* 3ffc3ffffffffffff91fedd62ae0f000 */ ++ 2.44119337150624789345260194989620908E-32L, /* 3f95fb041a57bc1c1280680ac1620bea */ ++ 1.60156250000000002076894210913572460E-01L, /* 3ffc48000000000001327ed84a199000 */ ++ -7.36124501128859978061216696286151753E-33L, /* bf9431c62f01e59d2c1e00f195a0037f */ ++ 1.64062500000000000950861276373482172E-01L, /* 3ffc500000000000008c5285fba85000 */ ++ -4.80566184447001164583855800470217373E-33L, /* bf938f3d1fcafd390f22f80e6c19421f */ ++ 1.67968749999999989878071706155265999E-01L, /* 3ffc57fffffffffffa2a445c548c5000 */ ++ -4.42154428718618459799673088733365064E-32L, /* bf96cb28cf1c1b28006d53ffe633b22a */ ++ 1.71874999999999999459734108403218175E-01L, /* 3ffc5fffffffffffffb04554e9dd4000 */ ++ -3.29736288190321377985697972236270628E-32L, /* bf96566af0ebc852e84be12859b24a31 */ ++ 1.75781249999999997987525759778901845E-01L, /* 3ffc67fffffffffffed702df6ffff000 */ ++ -1.28800728638468399687523924685844352E-32L, /* bf950b8236b88ca0c1b739dc91a7e3fc */ ++ 1.79687500000000004929565820437175783E-01L, /* 3ffc70000000000002d779bb32d2e000 */ ++ 1.60624461317978482424582320675174225E-32L, /* 3f954d9a9cc0c963fd081f3dc922d04e */ ++ 1.83593750000000016873727045739708856E-01L, /* 3ffc78000000000009ba1f6263c9a000 */ ++ -3.83390389582056606880506003118452558E-32L, /* bf968e22a5d826f77f19ee788474df22 */ ++ 1.87500000000000013443068740761666872E-01L, /* 3ffc80000000000007bfd8c72a1bf000 */ ++ -2.74141662712926256150154726565203091E-32L, /* bf961caf5ac59c7f941f928e324c2cc1 */ ++ 1.91406249999999981494101786848611970E-01L, /* 3ffc87fffffffffff55502eeae001000 */ ++ 3.68992437075565165346469517256118001E-32L, /* 3f967f2f03f9096793372a27b92ad79d */ ++ 1.95312499999999989069921848800501648E-01L, /* 3ffc8ffffffffffff9b3015280394000 */ ++ 3.69712249337856518452988332367785220E-32L, /* 3f967fee5fdb5bd501ff93516999faa0 */ ++ 1.99218750000000021148042946919300804E-01L, /* 3ffc9800000000000c30e67939095000 */ ++ 2.50142536781142175091322844848566649E-32L, /* 3f9603c34ae58e10b300b07137ee618a */ ++ 2.03124999999999977732559198825437141E-01L, /* 3ffc9ffffffffffff329e7df079e4000 */ ++ -2.41951877287895024779300892731537816E-32L, /* bf95f683aefe6965f080df8f59dd34a1 */ ++ 2.07031249999999996744030653771913124E-01L, /* 3ffca7fffffffffffe1f80f4b73ca000 */ ++ -1.94346475904454000031592792989765585E-32L, /* bf9593a44f87870a3d100d498501ecc7 */ ++ 2.10937500000000000251399259834392298E-01L, /* 3ffcb000000000000025199873310000 */ ++ -1.33528748788094249098998693871759411E-33L, /* bf91bbb9b25c813668d6103d08acac35 */ ++ 2.14843749999999993936323609611875097E-01L, /* 3ffcb7fffffffffffc8128c866236000 */ ++ 1.14839877977014974625242788556545292E-32L, /* 3f94dd06b4655c9b83a1305b240e7a42 */ ++ 2.18750000000000015181732784749663837E-01L, /* 3ffcc0000000000008c06da5fff24000 */ ++ 1.42689085313142539755499441881408391E-32L, /* 3f95285a87dfa7ea7dad5b3be8c669f4 */ ++ 2.22656249999999992172647770539596569E-01L, /* 3ffcc7fffffffffffb7ce2fe531f6000 */ ++ -3.34421462850496887359128610229650547E-32L, /* bf965b487962b5c2d9056ca6ac0c2e5c */ ++ 2.26562499999999989595607223847082419E-01L, /* 3ffccffffffffffffa0095277be5c000 */ ++ -3.08983588107248752517344356508205569E-32L, /* bf9640dded57157f8eded311213bdbcd */ ++ 2.30468749999999979130462438434567117E-01L, /* 3ffcd7fffffffffff3f8332996560000 */ ++ -3.01407539802851697849105682795217019E-32L, /* bf9638ffde35dbdfe1a1ffe45185de5d */ ++ 2.34375000000000012194252337217891971E-01L, /* 3ffce0000000000007078dd402c86000 */ ++ -8.46879710915628592284714319904522657E-33L, /* bf945fc7b29a2ac6c9eff9eb258a510f */ ++ 2.38281249999999982991877076137149870E-01L, /* 3ffce7fffffffffff6320b486eece000 */ ++ -2.93563878880439245627127095245798544E-32L, /* bf9630daaa4f40ff05caf29ace2ea7d4 */ ++ 2.42187499999999981447559841442773990E-01L, /* 3ffceffffffffffff54e24a09a8d5000 */ ++ -4.56766746558806021264215486909850481E-32L, /* bf96da556dee11f3113e5a3467b908e6 */ ++ 2.46093749999999991067720539980207318E-01L, /* 3ffcf7fffffffffffad9d405dcb5d000 */ ++ 2.14033004219908074003010247652128251E-32L, /* 3f95bc8776e8f9ae098884aa664cc3df */ ++ 2.50000000000000016613825838126835953E-01L, /* 3ffd00000000000004c9e24c12bb3000 */ ++ 2.57617532593749185996714235009382870E-32L, /* 3f960b867cc01178c0ec68226c6cb47d */ ++ 2.53906250000000013372004437827044321E-01L, /* 3ffd04000000000003daae05b3168000 */ ++ 7.20177123439204414298152646284640101E-32L, /* 3f9775eff59ddad7e7530b83934af87f */ ++ 2.57812499999999995765234725413886085E-01L, /* 3ffd07fffffffffffec7878bad9d5000 */ ++ 6.51253187532920882777046064603770602E-32L, /* 3f975226659ca241402e71c2011583b0 */ ++ 2.61718750000000007647689994011222248E-01L, /* 3ffd0c000000000002344cc793a0f000 */ ++ 3.02370610028725823590045201871491395E-32L, /* 3f9639ffe55fa2fa011674448b4e5b96 */ ++ 2.65624999999999986893899042596554269E-01L, /* 3ffd0ffffffffffffc38f0c0a1e9f000 */ ++ -2.07683715950724761146070082510569258E-32L, /* bf95af579a92e872fef81abfdf06bae8 */ ++ 2.69531249999999979842788204900639327E-01L, /* 3ffd13fffffffffffa30a908d67db000 */ ++ 8.71465252506557329027658736641075706E-32L, /* 3f97c47d99e19830447a42b1c0ffac61 */ ++ 2.73437500000000006712165837793818271E-01L, /* 3ffd18000000000001ef453a58edb000 */ ++ -6.62704045767568912140550474455810301E-32L, /* bf9758187a204dcb06ece46588aeeaba */ ++ 2.77343749999999994411329302988535617E-01L, /* 3ffd1bfffffffffffe63a0fec9c9e000 */ ++ -4.87273466291944117406493607771338767E-32L, /* bf96fa0381b0844a0be46bac2d673f0c */ ++ 2.81250000000000012677892447379453135E-01L, /* 3ffd20000000000003a7769e125d6000 */ ++ -8.55871796664700790726282049552906783E-32L, /* bf97bc64e01332cf7616b0091b8dff2c */ ++ 2.85156249999999998558643013736363981E-01L, /* 3ffd23ffffffffffff95a5894bccf000 */ ++ -1.33068334720606220176455289635046875E-32L, /* bf95145f43290ecf5b7adcb24697bc73 */ ++ 2.89062500000000008831431235621753924E-01L, /* 3ffd280000000000028ba504fac59000 */ ++ -9.34157398616814623985483776710704237E-32L, /* bf97e50ad1115b941fcb5f0c88a428f7 */ ++ 2.92968750000000019840235286110877063E-01L, /* 3ffd2c000000000005b7f372d184f000 */ ++ 4.99302093775173155906059132992249671E-33L, /* 3f939ecdcfb97bad3f8dbec5df5ec67d */ ++ 2.96875000000000015867911730971630513E-01L, /* 3ffd3000000000000492d860c79db000 */ ++ 7.86107787827057767235127454590866211E-33L, /* 3f944689517ee8f16cdb97d6a6938f32 */ ++ 3.00781250000000015814100002286124758E-01L, /* 3ffd340000000000048edfe73a17d000 */ ++ -1.65419431293024229981937172317171504E-32L, /* bf9557900e3efca16c89646b57f68dc0 */ ++ 3.04687499999999985213157159965287195E-01L, /* 3ffd37fffffffffffbbcec6f99b36000 */ ++ 9.68753602893894024018934325652944198E-32L, /* 3f97f70170e5458660c33a7e8d43d049 */ ++ 3.08593749999999989969324338045156215E-01L, /* 3ffd3bfffffffffffd1bdde4d0fb1000 */ ++ 7.10268609610294706092252562643261106E-32L, /* 3f9770cae45cdf615010401a4b37d8d4 */ ++ 3.12500000000000002971606591018488854E-01L, /* 3ffd40000000000000db440fbc06b000 */ ++ 6.38924218802905979887732294952782964E-32L, /* 3f974bbf988bb5622bd8fbaa46e8b811 */ ++ 3.16406250000000006594921047402056305E-01L, /* 3ffd44000000000001e69e8954814000 */ ++ 3.96079878754651470094149874444850097E-32L, /* 3f969b5017b9fa7a1e86975258c73d3d */ ++ 3.20312500000000006713799366908329147E-01L, /* 3ffd48000000000001ef64159c065000 */ ++ -1.86401314975634286055150437995880517E-32L, /* bf958323f0434911794e5fb8bfe136ba */ ++ 3.24218749999999987061246567584951210E-01L, /* 3ffd4bfffffffffffc4549db9b928000 */ ++ -3.18643523744758601387071062700407431E-32L, /* bf964ae5fa7e26c2c3981bed12e14372 */ ++ 3.28124999999999991782776266707412953E-01L, /* 3ffd4ffffffffffffda1ad0840ca8000 */ ++ -4.46964199751314296839915534813144652E-32L, /* bf96d0277729ffd74727150df6d15547 */ ++ 3.32031250000000000393816557756032682E-01L, /* 3ffd540000000000001d0efc04fad000 */ ++ -9.03246333902065439930373230002688649E-33L, /* bf947731a008748cc6dee948839ef7ae */ ++ 3.35937499999999983810482995064392173E-01L, /* 3ffd57fffffffffffb556cab8ae61000 */ ++ 5.27742727066129518825981597650621794E-32L, /* 3f9712050a6ddbf1cabf1b971f4b5d0b */ ++ 3.39843750000000004310441349760912471E-01L, /* 3ffd5c0000000000013e0def5ddc4000 */ ++ -3.85927263474732591932884416445586106E-32L, /* bf9690c51088ef3db9ca000829c450c2 */ ++ 3.43749999999999990248130003997484364E-01L, /* 3ffd5ffffffffffffd3070624a0af000 */ ++ 9.62005170171527308106468341512327487E-34L, /* 3f913fae595cea84432eb01430817fca */ ++ 3.47656250000000004085726414568625697E-01L, /* 3ffd640000000000012d79309e291000 */ ++ -6.59664093705705297250259434519072507E-32L, /* bf97568465eafb0e662e64a5dbfaf35f */ ++ ++ -1.98364257812501251077851763965418372E-03L, /* bff6040000000001cd90f658cf0b1000 */ ++ -3.71984513103117734260309047540278737E-34L, /* bf8fee73c54483194782aac4a6154d11 */ ++ -1.95312500000000378520649630233891879E-03L, /* bff60000000000008ba643bb5e2e8000 */ ++ -1.12194202736719050440745599339855038E-34L, /* bf8e2a436aeff7bc529873354f47a3f5 */ ++ -1.92260742187499397430259771221991482E-03L, /* bff5f7fffffffffe4361cb51170da000 */ ++ -2.30068299876822157331268484824540848E-34L, /* bf8f31d02f85cfe8c0cc02276ce0f437 */ ++ -1.89208984375001137424603270262074989E-03L, /* bff5f0000000000347456ed490c23000 */ ++ -1.15012507244426243338260435466985403E-34L, /* bf8e31c174d5677a937a34ad8d2a70b4 */ ++ -1.86157226562500172319250342061336738E-03L, /* bff5e800000000007f262fa3617b4000 */ ++ -3.12438344643346437509767736937785561E-34L, /* bf8f9f4d426a2457c273d34ef7d9bde9 */ ++ -1.83105468749999505256246872355430379E-03L, /* bff5dffffffffffe92f18c1c2b6fa000 */ ++ -5.91130415288336591179087455220308942E-35L, /* bf8d3a4c80b42dc036bae446c9807f78 */ ++ -1.80053710937499445182387245573120522E-03L, /* bff5d7fffffffffe669dea82b4a4c000 */ ++ -1.92396289352411531324908916321392100E-34L, /* bf8eff7a2123fb573ba9778550d669bd */ ++ -1.77001953125000387737631542516323906E-03L, /* bff5d000000000011e19915c3ddb7000 */ ++ 7.91101758977203355387806553469731354E-36L, /* 3f8a507f5a70faaccf469e3461873dea */ ++ -1.73950195312500034854670281415554486E-03L, /* bff5c8000000000019b7dc6ef97bd000 */ ++ 1.55906551582436824067407021178835755E-34L, /* 3f8e9e7880333e34955aebcde3cfb053 */ ++ -1.70898437499998955782591472611429852E-03L, /* bff5bffffffffffcfd80e88aa6b96000 */ ++ 8.22951661962611381718215899498500357E-35L, /* 3f8db58e6031a779b59f6ece191de7cc */ ++ -1.67846679687500586652037711131708544E-03L, /* bff5b80000000001b0df6fd21c133000 */ ++ -8.96642618848426299713145894522897419E-35L, /* bf8ddcbcab46d531801bfae4121f2f8a */ ++ -1.64794921875000109499161354039904782E-03L, /* bff5b0000000000050cbce8915575000 */ ++ -2.88077905394253859590587789680486639E-34L, /* bf8f7eebd4dd860ef73b674d5e707959 */ ++ -1.61743164062501133830507079150388351E-03L, /* bff5a80000000003449e8700c3e82000 */ ++ -3.68271725851639066312899986829350273E-34L, /* bf8fe9845fe20a5fe74059e0cae185d6 */ ++ -1.58691406249999015546015764131101956E-03L, /* bff59ffffffffffd2999e668cdd28000 */ ++ 8.48197657099957029953716507898788812E-35L, /* 3f8dc2faaebb97392e451b07b28c4b12 */ ++ -1.55639648437500317366570219290722587E-03L, /* bff5980000000000ea2cd9a40d256000 */ ++ -3.45156704719737676412949957712570373E-36L, /* bf8925a079505516c8e317ac1ff53255 */ ++ -1.52587890625000568759013197767046039E-03L, /* bff5900000000001a3ab8a3f6b698000 */ ++ -1.01902948542497496574967177677556729E-34L, /* bf8e0ee78d94d9b5ad3d63ae35c9b554 */ ++ -1.49536132812500945889014955936485340E-03L, /* bff5880000000002b9f1621b57743000 */ ++ -3.32264697086631598830366079048117140E-34L, /* bf8fb9a7d14c32289204fbb0c9eb20e0 */ ++ -1.46484374999999931883259902869504725E-03L, /* bff57fffffffffffcdbd1c90e1b4a000 */ ++ -1.76487524793892929381101031660811433E-34L, /* bf8ed52f2f724bc1ae870b18356337b4 */ ++ -1.43432617187498876325946983333888768E-03L, /* bff577fffffffffcc2dff8faa5570000 */ ++ -3.54550084538495708816233114576143814E-34L, /* bf8fd74724576915868c1e8ce9f430f1 */ ++ -1.40380859374999215367421282192718062E-03L, /* bff56ffffffffffdbd0b18aac65ed000 */ ++ -1.90585907028351204486765167064669639E-34L, /* bf8efaaa0c0e23e50c11b2120348054f */ ++ -1.37329101562499692341771212945644892E-03L, /* bff567ffffffffff1cfd00f1b0577000 */ ++ -3.59631150411372589637918252836880320E-34L, /* bf8fde08239ac74942a46298ea4fb715 */ ++ -1.34277343749999137467356674296739172E-03L, /* bff55ffffffffffd839030b05d53d000 */ ++ -1.49571076125940368185068762485268117E-35L, /* bf8b3e1a3d5c684b27a9f835b1d8d3c9 */ ++ -1.31225585937499247038404301859788734E-03L, /* bff557fffffffffdd469936e691e3000 */ ++ 3.10375845385355395586146533282311300E-34L, /* 3f8f9c8f6d63b7a4145716ffd92491fb */ ++ -1.28173828124999024755581675764821898E-03L, /* bff54ffffffffffd306589b0ab21d000 */ ++ -1.98541096105909793397376077900810019E-34L, /* bf8f07e808bbb1e35106c294ffbb9687 */ ++ -1.25122070312500340204619591143332523E-03L, /* bff5480000000000fb06d5f16ad2c000 */ ++ 3.62884195935761446237911443317457521E-34L, /* 3f8fe25b17d623178a386a6fa6c5afb2 */ ++ -1.22070312499999591578388993012071279E-03L, /* bff53ffffffffffed2a356c440074000 */ ++ -2.96756662615653130862526710937493307E-35L, /* bf8c3b90d8ff2a991e5bd16718fb0645 */ ++ -1.19018554687498821966212632349422735E-03L, /* bff537fffffffffc9ac3b585dda89000 */ ++ 1.44659971891167323357060028901142644E-34L, /* 3f8e809279ab249edf1dad9fe13fb0bf */ ++ -1.15966796875000160938908064907298384E-03L, /* bff530000000000076c0800db9639000 */ ++ 2.50088010538742402346270685365928513E-34L, /* 3f8f4c6c8a483b60201d30c1a83c3cb7 */ ++ -1.12915039062500267151512523291939657E-03L, /* bff5280000000000c51f7e7315137000 */ ++ 7.56402096465615210500092443924888831E-35L, /* 3f8d922c1e485d99aea2668ed32b55a6 */ ++ -1.09863281249998665006360103291051571E-03L, /* bff51ffffffffffc26f2d4c9ce2ba000 */ ++ 1.43982174467233642713619821353592061E-34L, /* 3f8e7ec530b3d92b6303bec1c81214d1 */ ++ -1.06811523437500522742248711752028025E-03L, /* bff518000000000181b7380f10446000 */ ++ 5.41265133745862349181293024531133174E-35L, /* 3f8d1fc9313d018b30e790e06b6be723 */ ++ -1.03759765624999980942114138999770552E-03L, /* bff50ffffffffffff1f01130490e1000 */ ++ 1.21525139612685854366189534669623436E-34L, /* 3f8e4311b96b6fcde412caf3f0d86fb9 */ ++ -1.00708007812499602697537601515759439E-03L, /* bff507fffffffffedad7afcce7051000 */ ++ 1.00020246351201558505328236381833392E-34L, /* 3f8e09e640992512b1300744a7e984ed */ ++ -9.76562499999992592487302113340463694E-04L, /* bff4fffffffffffbbad8151f8adf6000 */ ++ -1.64984406575162932060422892046851002E-34L, /* bf8eb69a919986e8054b86fc34300f24 */ ++ -9.46044921874989085824996924138179594E-04L, /* bff4effffffffff9b55a204fd9792000 */ ++ -9.29539174108308550334255350011347171E-35L, /* bf8dee3a50ed896b4656fa577a1df3d7 */ ++ -9.15527343750013735214860599791540029E-04L, /* bff4e00000000007eaf5bf103f82d000 */ ++ 3.07557018309280519949818825519490586E-35L, /* 3f8c470cfbef77d32c74cb8042f6ee81 */ ++ -8.85009765625012292294986105781516428E-04L, /* bff4d000000000071605c65403b97000 */ ++ 4.77499983783821950338363358545463558E-35L, /* 3f8cfbc3dc18884c4c4f9e07d90d7bd3 */ ++ -8.54492187499986941239470706817188192E-04L, /* bff4bffffffffff878ddf9cab264a000 */ ++ -1.60128240346239526958630011447901568E-34L, /* bf8ea9b1a21e19e2d5bd84b0fbffcf95 */ ++ -8.23974609374996290174598690241743810E-04L, /* bff4affffffffffddc86c249ebe06000 */ ++ 1.61677540391961912631535763471935882E-34L, /* 3f8eadd00841366b0dc2bc262c2c8c36 */ ++ -7.93457031249988696952538334288757473E-04L, /* bff49ffffffffff97bf6f0aa85a5f000 */ ++ 1.22318577008381887076634753347515709E-34L, /* 3f8e452db5b5d250878f71040da06d14 */ ++ -7.62939453124996723316499040007097041E-04L, /* bff48ffffffffffe1c7265b431108000 */ ++ -1.03845161748762410745671891558398468E-34L, /* bf8e14115ad884c96d1a820c73647220 */ ++ -7.32421874999998242520117923997325794E-04L, /* bff47ffffffffffefca4498b7aa8a000 */ ++ 5.64005211953031009549514026639438083E-35L, /* 3f8d2be06950f68f1a6d8ff829a6928e */ ++ -7.01904296874999772890934814265622012E-04L, /* bff46fffffffffffde7c0fe5d8041000 */ ++ 5.90245467325173644235991233229525762E-35L, /* 3f8d39d40cc49002189243c194b1db0e */ ++ -6.71386718750008699269643939210658742E-04L, /* bff460000000000503c91d798b60c000 */ ++ -5.20515801723324452151498579012322191E-35L, /* bf8d14c0f08a6a9285b32b8bda003eb5 */ ++ -6.40869140625005499535275057463709988E-04L, /* bff45000000000032b969184e9751000 */ ++ -6.69469163285461870099846471658294534E-35L, /* bf8d63f36bab7b24d936c9380e3d3fa6 */ ++ -6.10351562499999293780097329596079841E-04L, /* bff43fffffffffff97c7c433e35ed000 */ ++ -1.16941808547394177991845382085515086E-34L, /* bf8e36e27886f10b234a7dd8fc588bf0 */ ++ -5.79833984375000068291972326409994795E-04L, /* bff43000000000000a13ff6dcf2bf000 */ ++ 1.17885044988246219185041488459766001E-34L, /* 3f8e3964677e001a00412aab52790842 */ ++ -5.49316406249990904622170867910987793E-04L, /* bff41ffffffffffac1c25739c716b000 */ ++ -3.31875702128137033065075734368960972E-35L, /* bf8c60e928d8982c3c99aef4f885a121 */ ++ -5.18798828125011293653756992177727236E-04L, /* bff410000000000682a62cff36775000 */ ++ -5.69971237642088463334239430962628187E-35L, /* bf8d2f0c76f8757d61cd1abc7ea7d066 */ ++ -4.88281249999990512232251384917893121E-04L, /* bff3fffffffffff50fb48992320df000 */ ++ 1.02144616714408655325510171265051108E-35L, /* 3f8ab279a3626612710b9b3ac71734ac */ ++ -4.57763671874997554564967307956493434E-04L, /* bff3dffffffffffd2e3c272e3cca9000 */ ++ -8.25484058867957231164162481843653503E-35L, /* bf8db6e71158e7bf93e2e683f07aa841 */ ++ -4.27246093749991203999790346349633286E-04L, /* bff3bffffffffff5dbe103cba0eb2000 */ ++ -3.51191203319375193921924105905691755E-35L, /* bf8c757356d0f3dd7fbefc0dd419ab50 */ ++ -3.96728515624986649402960638705483281E-04L, /* bff39ffffffffff09b996882706ec000 */ ++ -5.51925962073095883016589497244931171E-36L, /* bf89d586d49f22289cfc860bebb99056 */ ++ -3.66210937499999945095511981300980754E-04L, /* bff37fffffffffffefcb88bfc7df6000 */ ++ -2.11696465278144529364423332249588595E-35L, /* bf8bc23a84d28e5496c874ef9833be25 */ ++ -3.35693359374992480958458008559640163E-04L, /* bff35ffffffffff754c548a8798f2000 */ ++ -8.58941791799705081104736787493668352E-35L, /* bf8dc8b1192fb7c3662826d43acb7c68 */ ++ -3.05175781250009811036303273640122156E-04L, /* bff340000000000b4fb4f1aad1c76000 */ ++ -8.61173897858769926480551302277426632E-35L, /* bf8dc9e0eabb1c0b33051011b64769fa */ ++ -2.74658203124987298321920308390303850E-04L, /* bff31ffffffffff15b2056ac252fd000 */ ++ 3.35152809454778381053519808988046631E-37L, /* 3f85c82fb59ff8d7c80d44e635420ab1 */ ++ -2.44140624999999992770514819575735516E-04L, /* bff2fffffffffffffbbb82d6a7636000 */ ++ 3.54445837111124472730013879165516908E-35L, /* 3f8c78e955b01378be647b1c92aa9a77 */ ++ -2.13623046875012756463165168672749438E-04L, /* bff2c0000000001d6a1635fea6bbf000 */ ++ 1.50050816288650121729916777279129473E-35L, /* 3f8b3f1f6f616a61129a58e131cbd31d */ ++ -1.83105468749991323078784464300306893E-04L, /* bff27fffffffffebfe0cbd0c82399000 */ ++ -9.14919506501448661140572099029756008E-37L, /* bf873754bacaa9d9513b6127e791eb47 */ ++ -1.52587890625013337032336300236461546E-04L, /* bff240000000001ec0cb57f2cc995000 */ ++ 2.84906084373176180870418394956384516E-35L, /* 3f8c2ef6d03a7e6ab087c4f099e4de89 */ ++ -1.22070312499990746786116828458007518E-04L, /* bff1ffffffffffd553bbb49f35a34000 */ ++ 6.71618008964968339584520728412444537E-36L, /* 3f8a1dacb99c60071fc9cd2349495bf0 */ ++ -9.15527343750029275602791047595142231E-05L, /* bff180000000000d8040cd6ecde28000 */ ++ -1.95753652091078750312541716951402172E-35L, /* bf8ba0526cfb24d8d59122f1c7a09a14 */ ++ -6.10351562499913258461494008080572701E-05L, /* bff0ffffffffffaffebbb92d7f6a9000 */ ++ 5.69868489273961111703398456218119973E-36L, /* 3f89e4ca5df09ef4a4386dd5b3bf0331 */ ++ -3.05175781250092882818419203884960853E-05L, /* bff0000000000055ab55de88fac1d000 */ ++ 9.03341100018476837609128961872915953E-36L, /* 3f8a803d229fa3a0e834a63abb06662b */ ++#define T_EXPL_ARG2 (2*T_EXPL_ARG1 + 2 + 2*65) ++ 0.00000000000000000000000000000000000E+00L, /* 00000000000000000000000000000000 */ ++ 0.00000000000000000000000000000000000E+00L, /* 00000000000000000000000000000000 */ ++ 3.05175781249814607084128277672749162E-05L, /* 3feffffffffffeaa02abb9102f499000 */ ++ 1.00271855391179733380665816525889949E-36L, /* 3f8755351afa042ac3f58114824d4c10 */ ++ 6.10351562500179243748093427073421439E-05L, /* 3ff1000000000052a95de07a4c26d000 */ ++ 1.67231624299180373502350811501181670E-36L, /* 3f881c87a53691cae9d77f4e40d66616 */ ++ 9.15527343749970728685313252158399200E-05L, /* 3ff17ffffffffff28040cc2acde28000 */ ++ 2.43665747834893104318707597514407880E-36L, /* 3f889e9366c7c6c6a2ecb78dc9b0509e */ ++ 1.22070312500027751961838150070880064E-04L, /* 3ff200000000003ffddde6c153b53000 */ ++ -1.73322146370624186623546452226755405E-35L, /* bf8b709d8d658ed5dbbe943de56ee84e */ ++ 1.52587890624995916105682628143179430E-04L, /* 3ff23ffffffffff6954b56e285d23000 */ ++ 1.23580432650945898349135528000443828E-35L, /* 3f8b06d396601dde16de7d7bc27346e6 */ ++ 1.83105468750008670314358488289621794E-04L, /* 3ff2800000000013fe0cdc8c823b7000 */ ++ 4.30446229148833293310207915930740796E-35L, /* 3f8cc9ba9bfe554a4f7f2fece291eb23 */ ++ 2.13623046875005741337455947623248132E-04L, /* 3ff2c0000000000d3d1662de21a3f000 */ ++ -3.96110759869520786681660669615255057E-35L, /* bf8ca5379b04ff4a31aab0ceacc917e6 */ ++ 2.44140624999981493573336463433440506E-04L, /* 3ff2ffffffffffd553bbdf48e0534000 */ ++ -1.39617373942387888957350179316792928E-35L, /* bf8b28eeedc286015802b63f96b8c5cd */ ++ 2.74658203124984920706309918754626834E-04L, /* 3ff31fffffffffee9d60c8439ec1d000 */ ++ -3.16168080483901830349738314447356223E-36L, /* bf890cf74f81c77a611abc1243812444 */ ++ 3.05175781250008648918265055410966055E-04L, /* 3ff3400000000009f8b5c9a346636000 */ ++ 8.54421306185008998867856704677221443E-35L, /* 3f8dc649cd40922fc08adc6b6b20ead0 */ ++ 3.35693359374988945462612499316774515E-04L, /* 3ff35ffffffffff34146c540f15b2000 */ ++ 7.96443137431639500475160850431097078E-35L, /* 3f8da77638ed3148fc4d99d1c9e13446 */ ++ 3.66210937500027690542093987739604535E-04L, /* 3ff380000000001fecce34bea89c4000 */ ++ 2.14507323877752361258862577769090367E-35L, /* 3f8bc834e554d38894cf91957b0253d3 */ ++ 3.96728515625003928083564943615052121E-04L, /* 3ff3a00000000004875d9a4acf6ab000 */ ++ 4.88358523466632050664019922448605508E-35L, /* 3f8d03a7eaeef1a9f78c71a12c44dd28 */ ++ 4.27246093750017799227172345607351585E-04L, /* 3ff3c00000000014856794c3ee850000 */ ++ 6.66520494592631402182216588784828935E-35L, /* 3f8d6262118fcdb59b8f16108f5f1a6c */ ++ 4.57763671875002108342364320152138181E-04L, /* 3ff3e000000000026e45d855410b9000 */ ++ 7.21799615960261390920033272189522298E-35L, /* 3f8d7fc645cff8879462296af975c9fd */ ++ 4.88281249999999768797631616370963356E-04L, /* 3ff3ffffffffffffbbc2d7cc004df000 */ ++ -5.30564629906905979452258114088325361E-35L, /* bf8d1a18b71929a30d67a217a27ae851 */ ++ 5.18798828124997339054881383202487041E-04L, /* 3ff40ffffffffffe775055eea5851000 */ ++ -4.03682911253647925867848180522846377E-35L, /* bf8cad44f0f3e5199d8a589d9332acad */ ++ 5.49316406249980511907933706754958501E-04L, /* 3ff41ffffffffff4c410b29bb62fb000 */ ++ -2.08166843948323917121806956728438051E-35L, /* bf8bbab8cf691403249fe5b699e25143 */ ++ 5.79833984374989593561576568548497165E-04L, /* 3ff42ffffffffffa0047df328d817000 */ ++ -1.72745033420153042445343706432627539E-34L, /* bf8ecb3c2d7d3a9e6e960576be901fdf */ ++ 6.10351562500008540711511259540838154E-04L, /* 3ff4400000000004ec62f54f8c271000 */ ++ 7.41889382604319545724663095428976499E-35L, /* 3f8d8a74c002c81a47c93b8e05d15f8e */ ++ 6.40869140625020444702875407535884986E-04L, /* 3ff450000000000bc91b09718515d000 */ ++ -4.47321009727305792048065440180490107E-35L, /* bf8cdbac5c8fe70822081d8993eb5cb6 */ ++ 6.71386718750007531635964622352684074E-04L, /* 3ff460000000000457792973db05c000 */ ++ 5.13698959677949336513874456684462092E-35L, /* 3f8d112114436949c5ef38d8049004ab */ ++ 7.01904296875006634673332887754430334E-04L, /* 3ff4700000000003d31adf2cb8b1d000 */ ++ -8.25665755717729437292989870760751482E-35L, /* bf8db6ffcc8ef71f8e648e3a8b160f5a */ ++ 7.32421874999998244664170215504673504E-04L, /* 3ff47ffffffffffefcf5498bd5c8a000 */ ++ -5.64005234937832153139057628112753364E-35L, /* bf8d2be06a1dfe90e7bf90fba7c12a98 */ ++ 7.62939453125017456345986752604096408E-04L, /* 3ff490000000000a101a1b093d4a8000 */ ++ -1.11084094120417622468550608896588329E-34L, /* bf8e274feabd2d94f6694507a46accb1 */ ++ 7.93457031249987558617598988993908016E-04L, /* 3ff49ffffffffff8d3f9dcab74bbf000 */ ++ -1.22966480225449015129079129940978828E-34L, /* bf8e46e6a65eef8fa9e42eddf3da305e */ ++ 8.23974609374997378723747633335135819E-04L, /* 3ff4affffffffffe7d2afbaa55b26000 */ ++ -1.62270010016794279091906973366704963E-34L, /* bf8eaf633f057ebdb664a34566401c4e */ ++ 8.54492187500023938282350821569920958E-04L, /* 3ff4c0000000000dccaabce399e59000 */ ++ -1.39076361712838158775374263169606160E-34L, /* bf8e71ba779364b3bbdba7841f2c4ca1 */ ++ 8.85009765624987932362186815286691297E-04L, /* 3ff4cffffffffff90b218886edc2a000 */ ++ 4.07328275060905585228261577392403980E-35L, /* 3f8cb1254dbb6ea4b8cfa5ed4cf28d24 */ ++ 9.15527343749975579461305518559161974E-04L, /* 3ff4dffffffffff1ec2a21f25df33000 */ ++ 1.16855112459192484947855553716334015E-35L, /* 3f8af10bf319e9f5270cf249eeffbe5c */ ++ 9.46044921875016761584725882821122521E-04L, /* 3ff4f00000000009a992c46c16d71000 */ ++ 9.51660680007524262741115611071680436E-35L, /* 3f8df9fd56e81f8edf133843910ee831 */ ++ 9.76562499999974118878133088548272636E-04L, /* 3ff4fffffffffff1149edc46a6df6000 */ ++ -5.65271128977550656964071208289181661E-36L, /* bf89e0e12689dd721aa2314c81eb6429 */ ++ 1.00708007812498671732140389760347830E-03L, /* 3ff507fffffffffc2be94b90ed091000 */ ++ -1.43355074891483635310132767255371379E-34L, /* bf8e7d1a688c247b16022daab1316d55 */ ++ 1.03759765625002637786192745235343007E-03L, /* 3ff51000000000079a57b966bc158000 */ ++ 2.95905815240957629366749917020106928E-34L, /* 3f8f895387fc73bb38f8a1b254c01a60 */ ++ 1.06811523437500860568717813047520763E-03L, /* 3ff51800000000027afcd5b35f5e6000 */ ++ -5.98328495358586628195372356742878314E-35L, /* bf8d3e204130013bf6328f1b70ff8c76 */ ++ 1.09863281250001439958487251556220070E-03L, /* 3ff5200000000004268077c6c66bd000 */ ++ 2.41371837889426603334113000868144760E-34L, /* 3f8f40d6948edf864054ccf151f9815e */ ++ 1.12915039062501298413451613770002366E-03L, /* 3ff5280000000003be0f5dd8fe81b000 */ ++ -1.28815268997394164973472617519705703E-34L, /* bf8e567321172ea089dce4bc8354ecb7 */ ++ 1.15966796874997272036339054191407232E-03L, /* 3ff52ffffffffff8231e3bcfff1e8000 */ ++ 1.02996064554316248496839462594377804E-34L, /* 3f8e11cf7d402789244f68e2d4f985b1 */ ++ 1.19018554687502744121802585360546796E-03L, /* 3ff5380000000007e8cdf3f8f6c20000 */ ++ -1.43453217726255628994625761307322163E-34L, /* bf8e7d5d3370d85a374f5f4802fc517a */ ++ 1.22070312499997743541996266398850614E-03L, /* 3ff53ffffffffff97f0722561f454000 */ ++ -1.41086259180534339713692694428211646E-34L, /* bf8e77125519ff76244dfec5fbd58402 */ ++ 1.25122070312501024092560690174507039E-03L, /* 3ff5480000000002f3a59d8820691000 */ ++ 3.84102646020099293168698506729765213E-34L, /* 3f8ffe8f5b86f9c3569c8f26e19b1f50 */ ++ 1.28173828124997986521442660131425390E-03L, /* 3ff54ffffffffffa3250a764439d9000 */ ++ 1.44644589735033114377952806106652650E-34L, /* 3f8e808801b80dcf38323cdbfdca2549 */ ++ 1.31225585937501665804856968749058137E-03L, /* 3ff5580000000004cd25a414c6d62000 */ ++ 1.67474574742200577294563576414361377E-34L, /* 3f8ebd394a151dbda4f81d5d83c0f1e9 */ ++ 1.34277343749997290265837386401818888E-03L, /* 3ff55ffffffffff83091b042cfd59000 */ ++ -1.55650565030381326742591837551559103E-34L, /* bf8e9dca490d7fecfadba9625ffb91c5 */ ++ 1.37329101562497720784949380297774268E-03L, /* 3ff567fffffffff96e3c7312f5ccf000 */ ++ 1.65279335325630026116581677369221748E-34L, /* 3f8eb763496f5bd7404f2298b402074f */ ++ 1.40380859374999099958354100336136647E-03L, /* 3ff56ffffffffffd67e2f09f2a381000 */ ++ 1.89919944388961890195706641264717076E-34L, /* 3f8ef8e4d0ffdfeba982aa8829501389 */ ++ 1.43432617187497484122173130998160625E-03L, /* 3ff577fffffffff8bf9c1d71af8a8000 */ ++ 2.57638517142061429772064578590009568E-34L, /* 3f8f5675d82c1cc4ada70fd3a957b89a */ ++ 1.46484374999999929342158925502052945E-03L, /* 3ff57fffffffffffcbdd1c7671b46000 */ ++ 1.76487201934184070490166772482073801E-34L, /* 3f8ed52ef732458f6e4c5c07504f33cc */ ++ 1.49536132812502318451070466256902933E-03L, /* 3ff5880000000006aeb7066c8ad43000 */ ++ 2.38068367275295804321313550609246656E-34L, /* 3f8f3c7277ae6fc390ace5e06c0b025b */ ++ 1.52587890625000448053340248672949543E-03L, /* 3ff59000000000014a9ae2104b3bc000 */ ++ 1.01174455568392813258454590274740959E-34L, /* 3f8e0cf7c434762991bb38e12acee215 */ ++ 1.55639648437501113499837053523090913E-03L, /* 3ff5980000000003359e2c204355e000 */ ++ -2.82398418808099749023517211651363693E-35L, /* bf8c2c4c2971d88caa95e15fb1ccb1a1 */ ++ 1.58691406249999937955142588308171026E-03L, /* 3ff59fffffffffffd2380ecbc87c2000 */ ++ -1.27361695572422741562701199136538047E-34L, /* bf8e5295e0e206dfb0f0266c07225448 */ ++ 1.61743164062498000531048954475329309E-03L, /* 3ff5a7fffffffffa3ca6fe61ed94c000 */ ++ -1.22606548862580061633942923016222044E-34L, /* bf8e45f1b17bb61039d21a351bb207b8 */ ++ 1.64794921875001835451453858682255576E-03L, /* 3ff5b000000000054a52fa20f6565000 */ ++ 1.39132339594152335892305491425264583E-34L, /* 3f8e71e0904c5449b414ee49b191cef2 */ ++ 1.67846679687501263995029340691547953E-03L, /* 3ff5b80000000003a4a9e912c910b000 */ ++ 6.67245854693585315412242764786197029E-35L, /* 3f8d62c4ccac1e7511a617d469468ccd */ ++ 1.70898437500002646861403514115369655E-03L, /* 3ff5c00000000007a109fbaa7e015000 */ ++ 6.87367172354719289559624829652240928E-36L, /* 3f8a245fa835eceb42bae8128d9336db */ ++ 1.73950195312501174308226096992992128E-03L, /* 3ff5c80000000003627c8d637a005000 */ ++ -2.20824271875474985927385878948759352E-34L, /* bf8f25869b1cbefb25e735992f232f57 */ ++ 1.77001953124997491747605207736194513E-03L, /* 3ff5cffffffffff8c53c84b6883b8000 */ ++ 3.43123048533596296514343180408963705E-34L, /* 3f8fc816b91d173ddadbbf09b1287906 */ ++ 1.80053710937497698911127570705069398E-03L, /* 3ff5d7fffffffff95e1899f4a8430000 */ ++ 3.99231237340890073475077494556136100E-35L, /* 3f8ca889148f62fa854da5674df41279 */ ++ 1.83105468750002267094899598630423914E-03L, /* 3ff5e0000000000688d21e62ba674000 */ ++ -3.22274595655810623999007524769365273E-34L, /* bf8fac605cb9ae01eb719675ced25560 */ ++ 1.86157226562500499224728040579690330E-03L, /* 3ff5e80000000001705ce28a6d89e000 */ ++ 3.07094985075881613489605622068441083E-34L, /* 3f8f98330225ec7e2c8f3c0d1c432b91 */ ++ 1.89208984374998234666824993196980949E-03L, /* 3ff5effffffffffae969fdc7cd8cf000 */ ++ -3.06287628722973914692165056776495733E-34L, /* bf8f9720477d9cfa10e464df7f91020c */ ++ 1.92260742187501225343755557292811682E-03L, /* 3ff5f800000000038824e428ed49a000 */ ++ 6.30049124729794620592961282769623368E-35L, /* 3f8d4efdd7cd4336d88a6aa49e1e96bc */ ++ 1.95312499999998514894032051116231258E-03L, /* 3ff5fffffffffffbb82f6a04f1ae0000 */ ++ -6.14610057507500948543216998736262902E-35L, /* bf8d46c862d39255370e7974d48daa7e */ ++ 1.98364257812501222021119324146882732E-03L, /* 3ff6040000000001c2d8a1aa5188d000 */ ++ 3.71942298418113774118754986159801984E-34L, /* 3f8fee6567d9940495519ffe62cbc9a4 */ ++ ++ 7.06341639425619532977052017486130353E-01L, /* 3ffe69a59c8245a9ac00000000000000 */ ++ 7.09106182437398424589503065362805501E-01L, /* 3ffe6b0ff72deb89d000000000000000 */ ++ 7.11881545564596485142772053222870454E-01L, /* 3ffe6c7bbce9a6d93000000000000000 */ ++ 7.14667771155948150507697391731198877E-01L, /* 3ffe6de8ef213d71e000000000000000 */ ++ 7.17464901725936049503573599395167548E-01L, /* 3ffe6f578f41e1a9e400000000000000 */ ++ 7.20272979955439790478166628417966422E-01L, /* 3ffe70c79eba33c06c00000000000000 */ ++ 7.23092048692387218133958981525211129E-01L, /* 3ffe72391efa434c7400000000000000 */ ++ 7.25922150952408251622927082280511968E-01L, /* 3ffe73ac117390acd800000000000000 */ ++ 7.28763329919491220643124052003258839E-01L, /* 3ffe752077990e79d000000000000000 */ ++ 7.31615628946641782803794740175362676E-01L, /* 3ffe769652df22f7e000000000000000 */ ++ 7.34479091556544505525749855223693885E-01L, /* 3ffe780da4bba98c4800000000000000 */ ++ 7.37353761442226890432394270646909717E-01L, /* 3ffe79866ea5f432d400000000000000 */ ++ 7.40239682467726090031590047146892175E-01L, /* 3ffe7b00b216ccf53000000000000000 */ ++ 7.43136898668758316688354170764796436E-01L, /* 3ffe7c7c70887763c000000000000000 */ ++ 7.46045454253390638577059235103661194E-01L, /* 3ffe7df9ab76b20fd000000000000000 */ ++ 7.48965393602715662213498148958024103E-01L, /* 3ffe7f78645eb8076400000000000000 */ ++ 7.51896761271528629722027403659012634E-01L, /* 3ffe80f89cbf42526400000000000000 */ ++ 7.54839601989007347171423134568613023E-01L, /* 3ffe827a561889716000000000000000 */ ++ 7.57793960659394638668118204805068672E-01L, /* 3ffe83fd91ec46ddc000000000000000 */ ++ 7.60759882362683631518152083117456641E-01L, /* 3ffe858251bdb68b8c00000000000000 */ ++ 7.63737412355305483879774897104653064E-01L, /* 3ffe87089711986c9400000000000000 */ ++ 7.66726596070820082262642358728044201E-01L, /* 3ffe8890636e31f54400000000000000 */ ++ 7.69727479120609181517664865168626420E-01L, /* 3ffe8a19b85b4fa2d800000000000000 */ ++ 7.72740107294572486917871856348938309E-01L, /* 3ffe8ba4976246833800000000000000 */ ++ 7.75764526561826289752232810315035749E-01L, /* 3ffe8d31020df5be4400000000000000 */ ++ 7.78800783071404878477039801509818062E-01L, /* 3ffe8ebef9eac820b000000000000000 */ ++ 7.81848923152964780936002853195532225E-01L, /* 3ffe904e8086b5a87800000000000000 */ ++ 7.84908993317491698871180005880887620E-01L, /* 3ffe91df97714512d800000000000000 */ ++ 7.87981040258010162480317717381694820E-01L, /* 3ffe9372403b8d6bcc00000000000000 */ ++ 7.91065110850296016042904057030682452E-01L, /* 3ffe95067c78379f2800000000000000 */ ++ 7.94161252153591734614934694036492147E-01L, /* 3ffe969c4dbb800b4800000000000000 */ ++ 7.97269511411324433014513601847284008E-01L, /* 3ffe9833b59b38154400000000000000 */ ++ 8.00389936051826789142893403550260700E-01L, /* 3ffe99ccb5aec7bec800000000000000 */ ++ 8.03522573689060742863077280162542593E-01L, /* 3ffe9b674f8f2f3d7c00000000000000 */ ++ 8.06667472123343942680406826184480451E-01L, /* 3ffe9d0384d70893f800000000000000 */ ++ 8.09824679342079301047618855591281317E-01L, /* 3ffe9ea15722892c7800000000000000 */ ++ 8.12994243520486992160556383169023320E-01L, /* 3ffea040c80f8374f000000000000000 */ ++ 8.16176213022339780422953481320291758E-01L, /* 3ffea1e1d93d687d0000000000000000 */ ++ 8.19370636400700819157449927843117621E-01L, /* 3ffea3848c4d49954c00000000000000 */ ++ 8.22577562398664585696650419777142815E-01L, /* 3ffea528e2e1d9f09800000000000000 */ ++ 8.25797039950100647542896581398963463E-01L, /* 3ffea6cede9f70467c00000000000000 */ ++ 8.29029118180400342863478613253391813E-01L, /* 3ffea876812c0877bc00000000000000 */ ++ 8.32273846407226292054559735333896242E-01L, /* 3ffeaa1fcc2f45343800000000000000 */ ++ 8.35531274141265073440720811959181447E-01L, /* 3ffeabcac15271a2a400000000000000 */ ++ 8.38801451086982535754188461396552157E-01L, /* 3ffead7762408309bc00000000000000 */ ++ 8.42084427143382358016410194068157580E-01L, /* 3ffeaf25b0a61a7b4c00000000000000 */ ++ 8.45380252404767357221615498019673396E-01L, /* 3ffeb0d5ae318680c400000000000000 */ ++ 8.48688977161503960155997106085123960E-01L, /* 3ffeb2875c92c4c99400000000000000 */ ++ 8.52010651900789478530029441571969073E-01L, /* 3ffeb43abd7b83db1c00000000000000 */ ++ 8.55345327307422548246407245642330963E-01L, /* 3ffeb5efd29f24c26400000000000000 */ ++ 8.58693054264576483003423845730139874E-01L, /* 3ffeb7a69db2bcc77800000000000000 */ ++ 8.62053883854575708767242758767679334E-01L, /* 3ffeb95f206d17228000000000000000 */ ++ 8.65427867359675251357487013592617586E-01L, /* 3ffebb195c86b6b29000000000000000 */ ++ 8.68815056262843166123843730019871145E-01L, /* 3ffebcd553b9d7b62000000000000000 */ ++ 8.72215502248546159513864495238522068E-01L, /* 3ffebe9307c271855000000000000000 */ ++ 8.75629257203538208242932228131394368E-01L, /* 3ffec0527a5e384ddc00000000000000 */ ++ 8.79056373217652342599848225290770642E-01L, /* 3ffec213ad4c9ed0d800000000000000 */ ++ 8.82496902584595399599010079327854328E-01L, /* 3ffec3d6a24ed8221800000000000000 */ ++ 8.85950897802745995779361010136199184E-01L, /* 3ffec59b5b27d9696800000000000000 */ ++ 8.89418411575955636383383762222365476E-01L, /* 3ffec761d99c5ba58800000000000000 */ ++ 8.92899496814352794382685374330321793E-01L, /* 3ffec92a1f72dd70d400000000000000 */ ++ 8.96394206635150403439382671422208659E-01L, /* 3ffecaf42e73a4c7d800000000000000 */ ++ 8.99902594363456265202927397695020773E-01L, /* 3ffeccc00868c0d18800000000000000 */ ++ 9.03424713533086704009278378180169966E-01L, /* 3ffece8daf1e0ba94c00000000000000 */ ++ 9.06960617887383580004723171441582963E-01L, /* 3ffed05d24612c2af000000000000000 */ ++ 9.10510361380034133338412516422977205E-01L, /* 3ffed22e6a0197c02c00000000000000 */ ++ 9.14073998175894436579724811053893063E-01L, /* 3ffed40181d094303400000000000000 */ ++ 9.17651582651815816982221463149471674E-01L, /* 3ffed5d66da13970f400000000000000 */ ++ 9.21243169397474526149949269893113524E-01L, /* 3ffed7ad2f48737a2000000000000000 */ ++ 9.24848813216204823639543519675498828E-01L, /* 3ffed985c89d041a3000000000000000 */ ++ 9.28468569125835141431224428743007593E-01L, /* 3ffedb603b7784cd1800000000000000 */ ++ 9.32102492359527579068867453315760940E-01L, /* 3ffedd3c89b26894e000000000000000 */ ++ 9.35750638366620729469147477175283711E-01L, /* 3ffedf1ab529fdd41c00000000000000 */ ++ 9.39413062813475779888605643463961314E-01L, /* 3ffee0fabfbc702a3c00000000000000 */ ++ 9.43089821584325888048638830696290825E-01L, /* 3ffee2dcab49ca51b400000000000000 */ ++ 9.46780970782128888929563004239753354E-01L, /* 3ffee4c079b3f8000400000000000000 */ ++ 9.50486566729423443256052905780961737E-01L, /* 3ffee6a62cdec7c7b000000000000000 */ ++ 9.54206665969188322362626308859034907E-01L, /* 3ffee88dc6afecfbfc00000000000000 */ ++ 9.57941325265705301283958306157728657E-01L, /* 3ffeea77490f0196b000000000000000 */ ++ 9.61690601605425299247542625380447134E-01L, /* 3ffeec62b5e5881fb000000000000000 */ ++ 9.65454552197837823079851204965962097E-01L, /* 3ffeee500f1eed967000000000000000 */ ++ 9.69233234476344074348475032820715569E-01L, /* 3ffef03f56a88b5d7800000000000000 */ ++ 9.73026706099133165128733935489435680E-01L, /* 3ffef2308e71a927a800000000000000 */ ++ 9.76835024950062025261843245971249416E-01L, /* 3ffef423b86b7ee79000000000000000 */ ++ 9.80658249139538557015427500118676107E-01L, /* 3ffef618d68936c09c00000000000000 */ ++ 9.84496437005408397968864164795377292E-01L, /* 3ffef80feabfeefa4800000000000000 */ ++ 9.88349647113845042323276857132441364E-01L, /* 3ffefa08f706bbf53800000000000000 */ ++ 9.92217938260243514925207364285597578E-01L, /* 3ffefc03fd56aa225000000000000000 */ ++ 9.96101369470117486981664001177705359E-01L, /* 3ffefe00ffaabffbbc00000000000000 */ ++#define T_EXPL_RES1 (T_EXPL_ARG2 + 2 + 2*65 + 89) ++ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */ ++ 1.00391388933834757590801700644078664E+00L, /* 3fff0100802ab5577800000000000000 */ ++ 1.00784309720644799091004983893071767E+00L, /* 3fff0202015600445c00000000000000 */ ++ 1.01178768355933151879000320150225889E+00L, /* 3fff0304848362076c00000000000000 */ ++ 1.01574770858668572692806719715008512E+00L, /* 3fff04080ab55de39000000000000000 */ ++ 1.01972323271377413034244341361045372E+00L, /* 3fff050c94ef7a206c00000000000000 */ ++ 1.02371431660235789884438872832106426E+00L, /* 3fff06122436410dd000000000000000 */ ++ 1.02772102115162167201845022646011785E+00L, /* 3fff0718b98f42085000000000000000 */ ++ 1.03174340749910264936062276319717057E+00L, /* 3fff08205601127ec800000000000000 */ ++ 1.03578153702162378824169763902318664E+00L, /* 3fff0928fa934ef90800000000000000 */ ++ 1.03983547133622999947277776300325058E+00L, /* 3fff0a32a84e9c1f5800000000000000 */ ++ 1.04390527230112850620713516036630608E+00L, /* 3fff0b3d603ca7c32800000000000000 */ ++ 1.04799100201663270004459604933799710E+00L, /* 3fff0c49236829e8bc00000000000000 */ ++ 1.05209272282610977189420964350574650E+00L, /* 3fff0d55f2dce5d1e800000000000000 */ ++ 1.05621049731693195106174698594259098E+00L, /* 3fff0e63cfa7ab09d000000000000000 */ ++ 1.06034438832143151909548350886325352E+00L, /* 3fff0f72bad65671b800000000000000 */ ++ 1.06449445891785943185681162503897212E+00L, /* 3fff1082b577d34ed800000000000000 */ ++ 1.06866077243134810492719566354935523E+00L, /* 3fff1193c09c1c595c00000000000000 */ ++ 1.07284339243487741866189821848820429E+00L, /* 3fff12a5dd543ccc4c00000000000000 */ ++ 1.07704238275024494209120007326419000E+00L, /* 3fff13b90cb25176a400000000000000 */ ++ 1.08125780744903959851299646288680378E+00L, /* 3fff14cd4fc989cd6400000000000000 */ ++ 1.08548973085361949442173568058933597E+00L, /* 3fff15e2a7ae28fecc00000000000000 */ ++ 1.08973821753809324563988525369495619E+00L, /* 3fff16f9157587069400000000000000 */ ++ 1.09400333232930546678574046381982043E+00L, /* 3fff18109a3611c35000000000000000 */ ++ 1.09828514030782586896606289883493446E+00L, /* 3fff192937074e0cd800000000000000 */ ++ 1.10258370680894224324930519287590869E+00L, /* 3fff1a42ed01d8cbc800000000000000 */ ++ 1.10689909742365749645287564817408565E+00L, /* 3fff1b5dbd3f68122400000000000000 */ ++ 1.11123137799969046168868658241990488E+00L, /* 3fff1c79a8dacc350c00000000000000 */ ++ 1.11558061464248076122274255794764031E+00L, /* 3fff1d96b0eff0e79400000000000000 */ ++ 1.11994687371619722204840741142106708E+00L, /* 3fff1eb4d69bde569c00000000000000 */ ++ 1.12433022184475073235176978414529003E+00L, /* 3fff1fd41afcba45e800000000000000 */ ++ 1.12873072591281087273529237791080959E+00L, /* 3fff20f47f31c92e4800000000000000 */ ++ 1.13314845306682632219974493636982515E+00L, /* 3fff2216045b6f5cd000000000000000 */ ++ 1.13758347071604959399593326452304609E+00L, /* 3fff2338ab9b32134800000000000000 */ ++ 1.14203584653356560174586320499656722E+00L, /* 3fff245c7613b8a9b000000000000000 */ ++ 1.14650564845732405583333957110880874E+00L, /* 3fff258164e8cdb0d800000000000000 */ ++ 1.15099294469117646722011727433709893E+00L, /* 3fff26a7793f60164400000000000000 */ ++ 1.15549780370591653744227755851170514E+00L, /* 3fff27ceb43d84490400000000000000 */ ++ 1.16002029424032515603215642840950750E+00L, /* 3fff28f7170a755fd800000000000000 */ ++ 1.16456048530221917269855680387991015E+00L, /* 3fff2a20a2ce96406400000000000000 */ ++ 1.16911844616950438835445424956560601E+00L, /* 3fff2b4b58b372c79400000000000000 */ ++ 1.17369424639123270948104504896036815E+00L, /* 3fff2c7739e3c0f32c00000000000000 */ ++ 1.17828795578866324378353169777255971E+00L, /* 3fff2da4478b620c7400000000000000 */ ++ 1.18289964445632783673900689791480545E+00L, /* 3fff2ed282d763d42400000000000000 */ ++ 1.18752938276310060494722620205720887E+00L, /* 3fff3001ecf601af7000000000000000 */ ++ 1.19217724135327157730657177125976887E+00L, /* 3fff31328716a5d63c00000000000000 */ ++ 1.19684329114762477708211463323095813E+00L, /* 3fff32645269ea829000000000000000 */ ++ 1.20152760334452030077656559114984702E+00L, /* 3fff339750219b212c00000000000000 */ ++ 1.20623024942098072687102217059873510E+00L, /* 3fff34cb8170b5835400000000000000 */ ++ 1.21095130113378179892436037334846333E+00L, /* 3fff3600e78b6b11d000000000000000 */ ++ 1.21569083052054743854242246925423387E+00L, /* 3fff373783a722012400000000000000 */ ++ 1.22044890990084875515009343871497549E+00L, /* 3fff386f56fa7686e800000000000000 */ ++ 1.22522561187730755216662714701669756E+00L, /* 3fff39a862bd3c106400000000000000 */ ++ 1.23002100933670455162882717559114099E+00L, /* 3fff3ae2a8287e7a8000000000000000 */ ++ 1.23483517545109100499445276000187732E+00L, /* 3fff3c1e2876834aa800000000000000 */ ++ 1.23966818367890557750499169742397498E+00L, /* 3fff3d5ae4e2cae92c00000000000000 */ ++ 1.24452010776609517384017067342938390E+00L, /* 3fff3e98deaa11dcbc00000000000000 */ ++ 1.24939102174724003813111039562500082E+00L, /* 3fff3fd8170a52071800000000000000 */ ++ 1.25428099994668373895478907797951251E+00L, /* 3fff41188f42c3e32000000000000000 */ ++ 1.25919011697966698459794088194030337E+00L, /* 3fff425a4893dfc3f800000000000000 */ ++ 1.26411844775346637881341393949696794E+00L, /* 3fff439d443f5f159000000000000000 */ ++ 1.26906606746853711786826579555054195E+00L, /* 3fff44e183883d9e4800000000000000 */ ++ 1.27403305161966090564007458851847332E+00L, /* 3fff462707b2bac20c00000000000000 */ ++ 1.27901947599709753244923149395617656E+00L, /* 3fff476dd2045ac67800000000000000 */ ++ 1.28402541668774150540599521264084615E+00L, /* 3fff48b5e3c3e8186800000000000000 */ ++ 1.28905095007628295311619126550795045E+00L, /* 3fff49ff3e397492bc00000000000000 */ ++ 1.29409615284637330434591717676084954E+00L, /* 3fff4b49e2ae5ac67400000000000000 */ ++ 1.29916110198179535206719492634874769E+00L, /* 3fff4c95d26d3f440800000000000000 */ ++ 1.30424587476763775839572190307080746E+00L, /* 3fff4de30ec211e60000000000000000 */ ++ 1.30935054879147461104338390214252286E+00L, /* 3fff4f3198fa0f1cf800000000000000 */ ++ 1.31447520194454914310711046709911898E+00L, /* 3fff50817263c13cd000000000000000 */ ++ 1.31961991242296217130558488861424848E+00L, /* 3fff51d29c4f01cb3000000000000000 */ ++ 1.32478475872886558573071624778094701E+00L, /* 3fff5325180cfacf7800000000000000 */ ++ 1.32996981967165983640200010995613411E+00L, /* 3fff5478e6f02823d000000000000000 */ ++ 1.33517517436919680440254865061433520E+00L, /* 3fff55ce0a4c58c7bc00000000000000 */ ++ 1.34040090224898678084031189428060316E+00L, /* 3fff57248376b033d800000000000000 */ ++ 1.34564708304941055283521222918352578E+00L, /* 3fff587c53c5a7af0400000000000000 */ ++ 1.35091379682093615244298234756570309E+00L, /* 3fff59d57c910fa4e000000000000000 */ ++ 1.35620112392734021300455538039386738E+00L, /* 3fff5b2fff3210fd9400000000000000 */ ++ 1.36150914504693443252136830778908916E+00L, /* 3fff5c8bdd032e770800000000000000 */ ++ 1.36683794117379636690046140756749082E+00L, /* 3fff5de9176045ff5400000000000000 */ ++ 1.37218759361900544124779344201670028E+00L, /* 3fff5f47afa69210a800000000000000 */ ++ 1.37755818401188367960941150158760138E+00L, /* 3fff60a7a734ab0e8800000000000000 */ ++ 1.38294979430124120867162673675920814E+00L, /* 3fff6208ff6a88a46000000000000000 */ ++ 1.38836250675662681297595213436579797E+00L, /* 3fff636bb9a983258400000000000000 */ ++ 1.39379640396958309755959248832368758E+00L, /* 3fff64cfd75454ee7c00000000000000 */ ++ 1.39925156885490681313299887733592186E+00L, /* 3fff663559cf1bc7c400000000000000 */ ++ 1.40472808465191417726103395580139477E+00L, /* 3fff679c427f5a49f400000000000000 */ ++ 1.41022603492571069194738697660795879E+00L, /* 3fff690492cbf9432c00000000000000 */ ++ 1.41574550356846662335641440222389065E+00L, /* 3fff6a6e4c1d491e1800000000000000 */ ++ ++ 9.98018323540573404351050612604012713E-01L, /* 3ffefefc41f8d4bdb000000000000000 */ ++ 9.98048781107475468932221929208026268E-01L, /* 3ffeff003ff556aa8800000000000000 */ ++ 9.98079239603882895082165305211674422E-01L, /* 3ffeff043df9d4986000000000000000 */ ++ 9.98109699029824021243584297735651489E-01L, /* 3ffeff083c064e972c00000000000000 */ ++ 9.98140159385327269125909310787392315E-01L, /* 3ffeff0c3a1ac4b6ec00000000000000 */ ++ 9.98170620670420977171843901487591211E-01L, /* 3ffeff10383737079400000000000000 */ ++ 9.98201082885133511579667242585856002E-01L, /* 3ffeff14365ba5991c00000000000000 */ ++ 9.98231546029493238547658506831794512E-01L, /* 3ffeff183488107b7c00000000000000 */ ++ 9.98262010103528552029672482603928074E-01L, /* 3ffeff1c32bc77beb000000000000000 */ ++ 9.98292475107267818223988342651864514E-01L, /* 3ffeff2030f8db72b000000000000000 */ ++ 9.98322941040739375573309644096298143E-01L, /* 3ffeff242f3d3ba77000000000000000 */ ++ 9.98353407903971645787066790944663808E-01L, /* 3ffeff282d89986cf000000000000000 */ ++ 9.98383875696992967307963340317655820E-01L, /* 3ffeff2c2bddf1d32400000000000000 */ ++ 9.98414344419831761845429696222709026E-01L, /* 3ffeff302a3a47ea0c00000000000000 */ ++ 9.98444814072516340086593800151604228E-01L, /* 3ffeff34289e9ac19800000000000000 */ ++ 9.98475284655075123740886056111776270E-01L, /* 3ffeff38270aea69c800000000000000 */ ++ 9.98505756167536479006585636852832977E-01L, /* 3ffeff3c257f36f29400000000000000 */ ++ 9.98536228609928799837547330753295682E-01L, /* 3ffeff4023fb806bf800000000000000 */ ++ 9.98566701982280452432050310562772211E-01L, /* 3ffeff44227fc6e5ec00000000000000 */ ++ 9.98597176284619802988373749030870385E-01L, /* 3ffeff48210c0a706800000000000000 */ ++ 9.98627651516975245460372434536111541E-01L, /* 3ffeff4c1fa04b1b6800000000000000 */ ++ 9.98658127679375173801901155457017012E-01L, /* 3ffeff501e3c88f6e800000000000000 */ ++ 9.98688604771847954211239084543194622E-01L, /* 3ffeff541ce0c412e000000000000000 */ ++ 9.98719082794421980642241010173165705E-01L, /* 3ffeff581b8cfc7f4c00000000000000 */ ++ 9.98749561747125619293186105096538085E-01L, /* 3ffeff5c1a41324c2400000000000000 */ ++ 9.98780041629987291873504773320746608E-01L, /* 3ffeff6018fd65896800000000000000 */ ++ 9.98810522443035364581476187595399097E-01L, /* 3ffeff6417c196471000000000000000 */ ++ 9.98841004186298203615379520670103375E-01L, /* 3ffeff68168dc4951400000000000000 */ ++ 9.98871486859804230684645176552294288E-01L, /* 3ffeff6c1561f0837400000000000000 */ ++ 9.98901970463581839743127943620493170E-01L, /* 3ffeff70143e1a222c00000000000000 */ ++ 9.98932454997659369233531378995394334E-01L, /* 3ffeff74132241813000000000000000 */ ++ 9.98962940462065268620861502313346136E-01L, /* 3ffeff78120e66b08400000000000000 */ ++ 9.98993426856827904103397486323956400E-01L, /* 3ffeff7c110289c02000000000000000 */ ++ 9.99023914181975669634994119405746460E-01L, /* 3ffeff800ffeaac00000000000000000 */ ++ 9.99054402437536959169506189937237650E-01L, /* 3ffeff840f02c9c02000000000000000 */ ++ 9.99084891623540138905212870668037795E-01L, /* 3ffeff880e0ee6d07800000000000000 */ ++ 9.99115381740013658307120181234495249E-01L, /* 3ffeff8c0d2302010c00000000000000 */ ++ 9.99145872786985911329082910015131347E-01L, /* 3ffeff900c3f1b61d800000000000000 */ ++ 9.99176364764485236413804614130640402E-01L, /* 3ffeff940b633302d000000000000000 */ ++ 9.99206857672540083026291313217370771E-01L, /* 3ffeff980a8f48f3f800000000000000 */ ++ 9.99237351511178817364822180024930276E-01L, /* 3ffeff9c09c35d454800000000000000 */ ++ 9.99267846280429861138827618560753763E-01L, /* 3ffeffa008ff7006c000000000000000 */ ++ 9.99298341980321608302162417203362565E-01L, /* 3ffeffa4084381485c00000000000000 */ ++ 9.99328838610882452808681364331278019E-01L, /* 3ffeffa8078f911a1800000000000000 */ ++ 9.99359336172140816367814863951934967E-01L, /* 3ffeffac06e39f8bf400000000000000 */ ++ 9.99389834664125092933417704443854745E-01L, /* 3ffeffb0063facadec00000000000000 */ ++ 9.99420334086863676459344674185558688E-01L, /* 3ffeffb405a3b88ffc00000000000000 */ ++ 9.99450834440384988655026177184481639E-01L, /* 3ffeffb8050fc3422400000000000000 */ ++ 9.99481335724717395718741386190231424E-01L, /* 3ffeffbc0483ccd45c00000000000000 */ ++ 9.99511837939889374871071936468069907E-01L, /* 3ffeffc003ffd556ac00000000000000 */ ++ 9.99542341085929264554721385138691403E-01L, /* 3ffeffc40383dcd90800000000000000 */ ++ 9.99572845162865514234695751838444266E-01L, /* 3ffeffc8030fe36b7400000000000000 */ ++ 9.99603350170726517864849824945849832E-01L, /* 3ffeffcc02a3e91dec00000000000000 */ ++ 9.99633856109540669399038392839429434E-01L, /* 3ffeffd0023fee006c00000000000000 */ ++ 9.99664362979336418302267475155531429E-01L, /* 3ffeffd401e3f222f800000000000000 */ ++ 9.99694870780142130772816244643763639E-01L, /* 3ffeffd8018ff5958800000000000000 */ ++ 9.99725379511986284031266336569387931E-01L, /* 3ffeffdc0143f8682400000000000000 */ ++ 9.99755889174897216520321308053098619E-01L, /* 3ffeffe000fffaaac000000000000000 */ ++ 9.99786399768903377704987178731244057E-01L, /* 3ffeffe400c3fc6d6000000000000000 */ ++ 9.99816911294033217050269968240172602E-01L, /* 3ffeffe8008ffdc00800000000000000 */ ++ 9.99847423750315072998873233700578567E-01L, /* 3ffeffec0063feb2ac00000000000000 */ ++ 9.99877937137777450526954226006637327E-01L, /* 3ffefff0003fff555800000000000000 */ ++ 9.99908451456448688077216502279043198E-01L, /* 3ffefff40023ffb80000000000000000 */ ++ 9.99938966706357262870241697783058044E-01L, /* 3ffefff8000fffeaac00000000000000 */ ++ 9.99969482887531541104308985268289689E-01L, /* 3ffefffc0003fffd5400000000000000 */ ++#define T_EXPL_RES2 (T_EXPL_RES1 + 1 + 89 + 65) ++ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */ ++ 1.00003051804379100575559391472779680E+00L, /* 3fff0002000200015400000000000000 */ ++ 1.00006103701893306334724798034585547E+00L, /* 3fff00040008000aac00000000000000 */ ++ 1.00009155692545448346209013834595680E+00L, /* 3fff0006001200240000000000000000 */ ++ 1.00012207776338379883185325525118969E+00L, /* 3fff0008002000555800000000000000 */ ++ 1.00015259953274932014366527255333494E+00L, /* 3fff000a003200a6ac00000000000000 */ ++ 1.00018312223357958012925905677548144E+00L, /* 3fff000c004801200400000000000000 */ ++ 1.00021364586590294498691378066723701E+00L, /* 3fff000e006201c95c00000000000000 */ ++ 1.00024417042974783642605984823603649E+00L, /* 3fff0010008002aab400000000000000 */ ++ 1.00027469592514273166727889474714175E+00L, /* 3fff001200a203cc1000000000000000 */ ++ 1.00030522235211605242000132420798764E+00L, /* 3fff001400c805357000000000000000 */ ++ 1.00033574971069616488250630936818197E+00L, /* 3fff001600f206eed000000000000000 */ ++ 1.00036627800091160178652671675081365E+00L, /* 3fff0018012009003800000000000000 */ ++ 1.00039680722279067381919048784766346E+00L, /* 3fff001a01520b71a000000000000000 */ ++ 1.00042733737636191371223048918182030E+00L, /* 3fff001c01880e4b1000000000000000 */ ++ 1.00045786846165368766392589350289200E+00L, /* 3fff001e01c211948400000000000000 */ ++ 1.00048840047869447289485833607614040E+00L, /* 3fff0020020015560000000000000000 */ ++ 1.00051893342751269111445822090900037E+00L, /* 3fff0022024219978400000000000000 */ ++ 1.00054946730813676403215595200890675E+00L, /* 3fff002402881e611000000000000000 */ ++ 1.00058000212059516886853316464112140E+00L, /* 3fff002602d223baa800000000000000 */ ++ 1.00061053786491632733302026281307917E+00L, /* 3fff0028032029ac4c00000000000000 */ ++ 1.00064107454112866113504765053221490E+00L, /* 3fff002a0372303dfc00000000000000 */ ++ 1.00067161214926059198404573180596344E+00L, /* 3fff002c03c83777b800000000000000 */ ++ 1.00070215068934059710059614189958666E+00L, /* 3fff002e04223f618400000000000000 */ ++ 1.00073269016139709819412928482051939E+00L, /* 3fff0030048048036000000000000000 */ ++ 1.00076323056545857248522679583402351E+00L, /* 3fff003204e251655000000000000000 */ ++ 1.00079377190155338617216784768970683E+00L, /* 3fff003405485b8f5000000000000000 */ ++ 1.00082431416971007198668530691065826E+00L, /* 3fff003605b266896800000000000000 */ ++ 1.00085485736995705163820957750431262E+00L, /* 3fff00380620725b9800000000000000 */ ++ 1.00088540150232269132501983222027775E+00L, /* 3fff003a06927f0ddc00000000000000 */ ++ 1.00091594656683552377884893758164253E+00L, /* 3fff003c07088ca83c00000000000000 */ ++ 1.00094649256352402622027852885366883E+00L, /* 3fff003e07829b32bc00000000000000 */ ++ 1.00097703949241650933643654752813745E+00L, /* 3fff00400800aab55400000000000000 */ ++ 1.00100758735354156137020709138596430E+00L, /* 3fff00420882bb381000000000000000 */ ++ 1.00103813614692760403102056443458423E+00L, /* 3fff00440908ccc2f000000000000000 */ ++ 1.00106868587260300351715613942360505E+00L, /* 3fff00460992df5df000000000000000 */ ++ 1.00109923653059629256034668287611566E+00L, /* 3fff00480a20f3111800000000000000 */ ++ 1.00112978812093589287002259879955091E+00L, /* 3fff004a0ab307e46800000000000000 */ ++ 1.00116034064365022615561429120134562E+00L, /* 3fff004c0b491ddfe000000000000000 */ ++ 1.00119089409876788066000585786241572E+00L, /* 3fff004e0be3350b8c00000000000000 */ ++ 1.00122144848631711155917400901671499E+00L, /* 3fff00500c814d6f6000000000000000 */ ++ 1.00125200380632656260715407370298635E+00L, /* 3fff00520d2367136c00000000000000 */ ++ 1.00128256005882454449107399341301061E+00L, /* 3fff00540dc981ffa800000000000000 */ ++ 1.00131311724383964545381786592770368E+00L, /* 3fff00560e739e3c2000000000000000 */ ++ 1.00134367536140017618251363273884635E+00L, /* 3fff00580f21bbd0cc00000000000000 */ ++ 1.00137423441153472492004539162735455E+00L, /* 3fff005a0fd3dac5b800000000000000 */ ++ 1.00140479439427171337584354660066310E+00L, /* 3fff005c1089fb22e400000000000000 */ ++ 1.00143535530963956325933850166620687E+00L, /* 3fff005e11441cf05000000000000000 */ ++ 1.00146591715766680730226312334707472E+00L, /* 3fff0060120240360400000000000000 */ ++ 1.00149647993838186721404781565070152E+00L, /* 3fff006212c464fc0000000000000000 */ ++ 1.00152704365181316470412298258452211E+00L, /* 3fff0064138a8b4a4400000000000000 */ ++ 1.00155760829798923250422149067162536E+00L, /* 3fff00661454b328d800000000000000 */ ++ 1.00158817387693849232377374391944613E+00L, /* 3fff00681522dc9fbc00000000000000 */ ++ 1.00161874038868942138336137759324629E+00L, /* 3fff006a15f507b6f400000000000000 */ ++ 1.00164930783327055241471725821611471E+00L, /* 3fff006c16cb34768800000000000000 */ ++ 1.00167987621071025161612055853765924E+00L, /* 3fff006e17a562e67400000000000000 */ ++ 1.00171044552103705171930414508096874E+00L, /* 3fff00701883930ec000000000000000 */ ++ 1.00174101576427937443369842185347807E+00L, /* 3fff00721965c4f76c00000000000000 */ ++ 1.00177158694046569697988502412044909E+00L, /* 3fff00741a4bf8a87c00000000000000 */ ++ 1.00180215904962455208959681840497069E+00L, /* 3fff00761b362e29f800000000000000 */ ++ 1.00183273209178441698341543997230474E+00L, /* 3fff00781c246583e400000000000000 */ ++ 1.00186330606697365785962006157205906E+00L, /* 3fff007a1d169ebe3c00000000000000 */ ++ 1.00189388097522080744994354972732253E+00L, /* 3fff007c1e0cd9e10800000000000000 */ ++ 1.00192445681655439848611877096118405E+00L, /* 3fff007e1f0716f45000000000000000 */ ++ 1.00195503359100279716642489802325144E+00L, /* 3fff0080200556001000000000000000 */ ++ 1.00198561129859459173374602869444061E+00L, /* 3fff00822107970c5400000000000000 */ ++}; +diff --git a/sysdeps/ieee754/ldbl-96/bits/iscanonical.h b/sysdeps/ieee754/ldbl-96/bits/iscanonical.h +index 4a4f4ad024..cfa36a0c2a 100644 +--- a/sysdeps/ieee754/ldbl-96/bits/iscanonical.h ++++ b/sysdeps/ieee754/ldbl-96/bits/iscanonical.h +@@ -34,4 +34,21 @@ extern int __iscanonicall (long double __x) + conversion, before being discarded; in extended precision, there + are encodings that are not consistently handled as corresponding to + any particular value of the type, and we return 0 for those. */ +-#define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) ++#ifndef __cplusplus ++# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) ++#else ++/* In C++ mode, __MATH_TG cannot be used, because it relies on ++ __builtin_types_compatible_p, which is a C-only builtin. On the ++ other hand, overloading provides the means to distinguish between ++ the floating-point types. The overloading resolution will match ++ the correct parameter (regardless of type qualifiers (i.e.: const ++ and volatile)). */ ++extern "C++" { ++inline int iscanonical (float __val) { return __iscanonicalf (__val); } ++inline int iscanonical (double __val) { return __iscanonical (__val); } ++inline int iscanonical (long double __val) { return __iscanonicall (__val); } ++# if __HAVE_DISTINCT_FLOAT128 ++inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } ++# endif ++} ++#endif /* __cplusplus */ +diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +index 845b9e6c2b..966cc7569f 100644 +--- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +@@ -35,6 +35,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4))) + #define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4))) +diff --git a/sysdeps/m68k/nptl/pthread-offsets.h b/sysdeps/m68k/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/m68k/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +index d687e2c076..e44f2dcb6a 100644 +--- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +@@ -35,6 +35,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/microblaze/nptl/pthread-offsets.h b/sysdeps/microblaze/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/microblaze/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/mips/bits/long-double.h b/sysdeps/mips/ieee754/bits/long-double.h +similarity index 100% +rename from sysdeps/mips/bits/long-double.h +rename to sysdeps/mips/ieee754/bits/long-double.h +diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +index 6aa1bda172..f03389acc6 100644 +--- a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +@@ -42,6 +42,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (_MIPS_SIM != _ABI64) ++#define __PTHREAD_MUTEX_USE_UNION (_MIPS_SIM != _ABI64) + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/mips/nptl/pthread-offsets.h b/sysdeps/mips/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..0ac3eda3fb +--- /dev/null ++++ b/sysdeps/mips/nptl/pthread-offsets.h +@@ -0,0 +1,13 @@ ++#if _MIPS_SIM == _ABI64 ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++# define __PTHREAD_MUTEX_KIND_OFFSET 16 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 24 ++#else ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++# define __PTHREAD_MUTEX_KIND_OFFSET 12 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 20 ++#endif +diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h +index e2732f9771..83f8684604 100644 +--- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h +@@ -35,6 +35,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/nios2/nptl/pthread-offsets.h b/sysdeps/nios2/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/nios2/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h +index 68b82b6bd6..da4358a965 100644 +--- a/sysdeps/nptl/bits/thread-shared-types.h ++++ b/sysdeps/nptl/bits/thread-shared-types.h +@@ -42,6 +42,25 @@ + the internal structure. + __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock + elision or 0 otherwise. ++ __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The ++ preferred value for new architectures ++ is 0. ++ __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and ++ __list will be place inside a union for ++ linuxthreads compatibility. ++ The preferred value for new architectures ++ is 0. ++ ++ For a new port the preferred values for the required defines are: ++ ++ #define __PTHREAD_COMPAT_PADDING_MID ++ #define __PTHREAD_COMPAT_PADDING_END ++ #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++ #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 ++ #define __PTHREAD_MUTEX_USE_UNION 0 ++ ++ __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to ++ eventually support lock elision using transactional memory. + + The additional macro defines any constraint for the lock alignment + inside the thread structures: +@@ -59,7 +78,7 @@ + + /* Common definition of pthread_mutex_t. */ + +-#if __WORDSIZE == 64 ++#if !__PTHREAD_MUTEX_USE_UNION + typedef struct __pthread_internal_list + { + struct __pthread_internal_list *__prev; +@@ -74,7 +93,7 @@ typedef struct __pthread_internal_slist + + /* Lock elision support. */ + #if __PTHREAD_MUTEX_LOCK_ELISION +-# if __WORDSIZE == 64 ++# if !__PTHREAD_MUTEX_USE_UNION + # define __PTHREAD_SPINS_DATA \ + short __spins; \ + short __elision +@@ -101,24 +120,27 @@ struct __pthread_mutex_s + int __lock __LOCK_ALIGNMENT; + unsigned int __count; + int __owner; +-#if __WORDSIZE == 64 ++#if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND + unsigned int __nusers; + #endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; + __PTHREAD_COMPAT_PADDING_MID +-#if __WORDSIZE == 64 ++#if __PTHREAD_MUTEX_NUSERS_AFTER_KIND ++ unsigned int __nusers; ++#endif ++#if !__PTHREAD_MUTEX_USE_UNION + __PTHREAD_SPINS_DATA; + __pthread_list_t __list; + # define __PTHREAD_MUTEX_HAVE_PREV 1 + #else +- unsigned int __nusers; + __extension__ union + { + __PTHREAD_SPINS_DATA; + __pthread_slist_t __list; + }; ++# define __PTHREAD_MUTEX_HAVE_PREV 0 + #endif + __PTHREAD_COMPAT_PADDING_END + }; +diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c +index 4bb87e2331..48676c2f48 100644 +--- a/sysdeps/nptl/fork.c ++++ b/sysdeps/nptl/fork.c +@@ -166,7 +166,7 @@ __libc_fork (void) + inherit the correct value from the parent. We do not need to clear + the pending operation because it must have been zero when fork was + called. */ +-# ifdef __PTHREAD_MUTEX_HAVE_PREV ++# if __PTHREAD_MUTEX_HAVE_PREV + self->robust_prev = &self->robust_head; + # endif + self->robust_head.list = &self->robust_head; +diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h +index 632ea7bc36..2b2b386ab3 100644 +--- a/sysdeps/nptl/pthread.h ++++ b/sysdeps/nptl/pthread.h +@@ -83,7 +83,7 @@ enum + #endif + + +-#ifdef __PTHREAD_MUTEX_HAVE_PREV ++#if __PTHREAD_MUTEX_HAVE_PREV + # define PTHREAD_MUTEX_INITIALIZER \ + { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } } + # ifdef __USE_GNU +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index efa7118498..2c4b6d6793 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -241,46 +241,43 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, + + #define gethosts(_family, _type) \ + { \ +- int herrno; \ + struct hostent th; \ +- struct hostent *h; \ + char *localcanon = NULL; \ + no_data = 0; \ +- while (1) { \ +- rc = 0; \ +- status = DL_CALL_FCT (fct, (name, _family, &th, \ +- tmpbuf->data, tmpbuf->length, \ +- &rc, &herrno, NULL, &localcanon)); \ +- if (rc != ERANGE || herrno != NETDB_INTERNAL) \ +- break; \ +- if (!scratch_buffer_grow (tmpbuf)) \ +- { \ +- result = -EAI_MEMORY; \ +- goto free_and_return; \ +- } \ +- } \ +- if (status == NSS_STATUS_SUCCESS && rc == 0) \ +- h = &th; \ +- else \ +- h = NULL; \ +- if (rc != 0) \ ++ while (1) \ + { \ +- if (herrno == NETDB_INTERNAL) \ ++ status = DL_CALL_FCT (fct, (name, _family, &th, \ ++ tmpbuf->data, tmpbuf->length, \ ++ &errno, &h_errno, NULL, &localcanon)); \ ++ if (status != NSS_STATUS_TRYAGAIN || h_errno != NETDB_INTERNAL \ ++ || errno != ERANGE) \ ++ break; \ ++ if (!scratch_buffer_grow (tmpbuf)) \ ++ { \ ++ __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \ ++ __resolv_context_put (res_ctx); \ ++ result = -EAI_MEMORY; \ ++ goto free_and_return; \ ++ } \ ++ } \ ++ if (status == NSS_STATUS_NOTFOUND \ ++ || status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL) \ ++ { \ ++ if (h_errno == NETDB_INTERNAL) \ + { \ +- __set_h_errno (herrno); \ + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \ + __resolv_context_put (res_ctx); \ + result = -EAI_SYSTEM; \ + goto free_and_return; \ + } \ +- if (herrno == TRY_AGAIN) \ ++ if (h_errno == TRY_AGAIN) \ + no_data = EAI_AGAIN; \ + else \ +- no_data = herrno == NO_DATA; \ ++ no_data = h_errno == NO_DATA; \ + } \ +- else if (h != NULL) \ ++ else if (status == NSS_STATUS_SUCCESS) \ + { \ +- if (!convert_hostent_to_gaih_addrtuple (req, _family,h, &addrmem)) \ ++ if (!convert_hostent_to_gaih_addrtuple (req, _family, &th, &addrmem)) \ + { \ + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \ + __resolv_context_put (res_ctx); \ +@@ -332,10 +329,8 @@ getcanonname (service_user *nip, struct gaih_addrtuple *at, const char *name) + if (cfct != NULL) + { + char buf[256]; +- int herrno; +- int rc; + if (DL_CALL_FCT (cfct, (at->name ?: name, buf, sizeof (buf), +- &s, &rc, &herrno)) != NSS_STATUS_SUCCESS) ++ &s, &errno, &h_errno)) != NSS_STATUS_SUCCESS) + /* If the canonical name cannot be determined, use the passed + string. */ + s = (char *) name; +@@ -351,7 +346,6 @@ gaih_inet (const char *name, const struct gaih_service *service, + const struct gaih_typeproto *tp = gaih_inet_typeproto; + struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; + struct gaih_addrtuple *at = NULL; +- int rc; + bool got_ipv6 = false; + const char *canon = NULL; + const char *orig_name = name; +@@ -393,7 +387,8 @@ gaih_inet (const char *name, const struct gaih_service *service, + st = (struct gaih_servtuple *) + alloca_account (sizeof (struct gaih_servtuple), alloca_used); + +- if ((rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf))) ++ int rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf); ++ if (__glibc_unlikely (rc != 0)) + return rc; + } + else +@@ -418,13 +413,9 @@ gaih_inet (const char *name, const struct gaih_service *service, + alloca_account (sizeof (struct gaih_servtuple), + alloca_used); + +- if ((rc = gaih_inet_serv (service->name, +- tp, req, newp, tmpbuf))) +- { +- if (rc) +- continue; +- return rc; +- } ++ if (gaih_inet_serv (service->name, ++ tp, req, newp, tmpbuf) != 0) ++ continue; + + *pst = newp; + pst = &(newp->next); +@@ -497,7 +488,7 @@ gaih_inet (const char *name, const struct gaih_service *service, + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + + char *p = NULL; +- rc = __idna_to_ascii_lz (name, &p, idn_flags); ++ int rc = __idna_to_ascii_lz (name, &p, idn_flags); + if (rc != IDNA_SUCCESS) + { + /* No need to jump to free_and_return here. */ +@@ -598,14 +589,13 @@ gaih_inet (const char *name, const struct gaih_service *service, + int rc; + struct hostent th; + struct hostent *h; +- int herrno; + + while (1) + { + rc = __gethostbyname2_r (name, AF_INET, &th, + tmpbuf->data, tmpbuf->length, +- &h, &herrno); +- if (rc != ERANGE || herrno != NETDB_INTERNAL) ++ &h, &h_errno); ++ if (rc != ERANGE || h_errno != NETDB_INTERNAL) + break; + if (!scratch_buffer_grow (tmpbuf)) + { +@@ -627,15 +617,20 @@ gaih_inet (const char *name, const struct gaih_service *service, + } + *pat = addrmem; + } ++ else ++ { ++ if (h_errno == NO_DATA) ++ result = -EAI_NODATA; ++ else ++ result = -EAI_NONAME; ++ goto free_and_return; ++ } + } + else + { +- if (herrno == NETDB_INTERNAL) +- { +- __set_h_errno (herrno); +- result = -EAI_SYSTEM; +- } +- else if (herrno == TRY_AGAIN) ++ if (h_errno == NETDB_INTERNAL) ++ result = -EAI_SYSTEM; ++ else if (h_errno == TRY_AGAIN) + result = -EAI_AGAIN; + else + /* We made requests but they turned out no data. +@@ -658,8 +653,7 @@ gaih_inet (const char *name, const struct gaih_service *service, + { + /* Try to use nscd. */ + struct nscd_ai_result *air = NULL; +- int herrno; +- int err = __nscd_getai (name, &air, &herrno); ++ int err = __nscd_getai (name, &air, &h_errno); + if (air != NULL) + { + /* Transform into gaih_addrtuple list. */ +@@ -750,9 +744,9 @@ gaih_inet (const char *name, const struct gaih_service *service, + goto free_and_return; + else if (__nss_not_use_nscd_hosts == 0) + { +- if (herrno == NETDB_INTERNAL && errno == ENOMEM) ++ if (h_errno == NETDB_INTERNAL && errno == ENOMEM) + result = -EAI_MEMORY; +- else if (herrno == TRY_AGAIN) ++ else if (h_errno == TRY_AGAIN) + result = -EAI_AGAIN; + else + result = -EAI_SYSTEM; +@@ -791,24 +785,21 @@ gaih_inet (const char *name, const struct gaih_service *service, + + if (fct4 != NULL) + { +- int herrno; +- + while (1) + { +- rc = 0; + status = DL_CALL_FCT (fct4, (name, pat, + tmpbuf->data, tmpbuf->length, +- &rc, &herrno, ++ &errno, &h_errno, + NULL)); + if (status == NSS_STATUS_SUCCESS) + break; + if (status != NSS_STATUS_TRYAGAIN +- || rc != ERANGE || herrno != NETDB_INTERNAL) ++ || errno != ERANGE || h_errno != NETDB_INTERNAL) + { +- if (herrno == TRY_AGAIN) ++ if (h_errno == TRY_AGAIN) + no_data = EAI_AGAIN; + else +- no_data = herrno == NO_DATA; ++ no_data = h_errno == NO_DATA; + break; + } + +@@ -938,13 +929,17 @@ gaih_inet (const char *name, const struct gaih_service *service, + } + else + { ++ /* Could not locate any of the lookup functions. ++ The NSS lookup code does not consistently set ++ errno, so we need to supply our own error ++ code here. The root cause could either be a ++ resource allocation failure, or a missing ++ service function in the DSO (so it should not ++ be listed in /etc/nsswitch.conf). Assume the ++ former, and return EBUSY. */ + status = NSS_STATUS_UNAVAIL; +- /* Could not load any of the lookup functions. Indicate +- an internal error if the failure was due to a system +- error other than the file not being found. We use the +- errno from the last failed callback. */ +- if (errno != 0 && errno != ENOENT) +- __set_h_errno (NETDB_INTERNAL); ++ __set_h_errno (NETDB_INTERNAL); ++ __set_errno (EBUSY); + } + } + +@@ -960,7 +955,10 @@ gaih_inet (const char *name, const struct gaih_service *service, + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); + __resolv_context_put (res_ctx); + +- if (h_errno == NETDB_INTERNAL) ++ /* If we have a failure which sets errno, report it using ++ EAI_SYSTEM. */ ++ if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL) ++ && h_errno == NETDB_INTERNAL) + { + result = -EAI_SYSTEM; + goto free_and_return; +diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c +index 2a7cf11e27..d27f7028ed 100644 +--- a/sysdeps/posix/preadv2.c ++++ b/sysdeps/posix/preadv2.c +@@ -28,7 +28,7 @@ preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset, + { + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + +diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c +index e084f3f9e1..ce7cb40bf2 100644 +--- a/sysdeps/posix/preadv64v2.c ++++ b/sysdeps/posix/preadv64v2.c +@@ -25,7 +25,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset, + { + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + +diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c +index 5b7650c4fc..7ec8cbc407 100644 +--- a/sysdeps/posix/pwritev2.c ++++ b/sysdeps/posix/pwritev2.c +@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset, + { + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + +diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c +index 0f2f9ef863..be98aeed9d 100644 +--- a/sysdeps/posix/pwritev64v2.c ++++ b/sysdeps/posix/pwritev64v2.c +@@ -26,7 +26,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset, + { + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + +diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c +index a95e1b3f05..254f87c437 100644 +--- a/sysdeps/posix/sysconf.c ++++ b/sysdeps/posix/sysconf.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + + #define NEED_SPEC_ARRAY 0 +diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile +index 0d9206bec4..6aa683b03f 100644 +--- a/sysdeps/powerpc/Makefile ++++ b/sysdeps/powerpc/Makefile +@@ -8,9 +8,11 @@ sysdep-dl-routines += dl-machine hwcapinfo + sysdep_routines += dl-machine hwcapinfo + # extra shared linker files to link only into dl-allobjs.so + sysdep-rtld-routines += dl-machine hwcapinfo +-# Don't optimize GD tls sequence to LE. +-LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize ++ ++modules-names += mod-tlsopt-powerpc ++mod-tlsopt-powerpc.so-no-z-defs = yes + tests += tst-tlsopt-powerpc ++$(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so + + ifneq (no,$(multi-arch)) + tests-static += tst-tlsifunc-static +diff --git a/sysdeps/powerpc/bits/hwcap.h b/sysdeps/powerpc/bits/hwcap.h +index dfc71c29bb..0668ca041e 100644 +--- a/sysdeps/powerpc/bits/hwcap.h ++++ b/sysdeps/powerpc/bits/hwcap.h +@@ -72,3 +72,5 @@ + 128-bit */ + #define PPC_FEATURE2_DARN 0x00200000 /* darn instruction. */ + #define PPC_FEATURE2_SCV 0x00100000 /* scv syscall. */ ++#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended ++ state. */ +diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h +index d8fd4923ac..396fd0562e 100644 +--- a/sysdeps/powerpc/fpu/math_private.h ++++ b/sysdeps/powerpc/fpu/math_private.h +@@ -30,7 +30,7 @@ extern __always_inline _Float128 + __ieee754_sqrtf128 (_Float128 __x) + { + _Float128 __z; +- asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x)); ++ asm ("xssqrtqp %0,%1" : "=v" (__z) : "v" (__x)); + return __z; + } + #endif +diff --git a/sysdeps/powerpc/mod-tlsopt-powerpc.c b/sysdeps/powerpc/mod-tlsopt-powerpc.c +new file mode 100644 +index 0000000000..ee0db12a73 +--- /dev/null ++++ b/sysdeps/powerpc/mod-tlsopt-powerpc.c +@@ -0,0 +1,49 @@ ++/* shared library to test for __tls_get_addr optimization. */ ++#include ++ ++#include "../../elf/tls-macros.h" ++#include "dl-tls.h" ++ ++/* common 'int' variable in TLS. */ ++COMMON_INT_DEF(foo); ++ ++ ++int ++tls_get_addr_opt_test (void) ++{ ++ int result = 0; ++ ++ /* Get variable using general dynamic model. */ ++ int *ap = TLS_GD (foo); ++ if (*ap != 0) ++ { ++ printf ("foo = %d\n", *ap); ++ result = 1; ++ } ++ ++ tls_index *tls_arg; ++#ifdef __powerpc64__ ++ register unsigned long thread_pointer __asm__ ("r13"); ++ asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg)); ++#else ++ register unsigned long thread_pointer __asm__ ("r2"); ++ asm ("bcl 20,31,1f\n1:\t" ++ "mflr %0\n\t" ++ "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" ++ "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" ++ "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg)); ++#endif ++ ++ if (tls_arg->ti_module != 0) ++ { ++ printf ("tls_index not optimized, binutils too old?\n"); ++ result = 1; ++ } ++ else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap) ++ { ++ printf ("tls_index->ti_offset wrong value\n"); ++ result = 1; ++ } ++ ++ return result; ++} +diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h +index f29119b794..8158cb5abd 100644 +--- a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h +@@ -42,6 +42,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 1 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) ++#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/powerpc/nptl/pthread-offsets.h b/sysdeps/powerpc/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..bdda1f197e +--- /dev/null ++++ b/sysdeps/powerpc/nptl/pthread-offsets.h +@@ -0,0 +1,15 @@ ++#include ++ ++#if __WORDSIZE == 64 ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++# define __PTHREAD_MUTEX_KIND_OFFSET 16 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 24 ++#else ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++# define __PTHREAD_MUTEX_KIND_OFFSET 12 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 20 ++#endif +diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h +index 1f8437ed9c..c19b3b7a16 100644 +--- a/sysdeps/powerpc/powerpc32/dl-machine.h ++++ b/sysdeps/powerpc/powerpc32/dl-machine.h +@@ -310,7 +310,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + against local symbols. */ + if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0) + && sym->st_shndx != SHN_UNDEF) +- value = map->l_addr; ++ { ++ sym_map = map; ++ value = map->l_addr; ++ } + else + { + sym_map = RESOLVE_MAP (&sym, version, r_type); +diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c +index a5ec36b72f..7efc84b56a 100644 +--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c ++++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c +@@ -17,8 +17,16 @@ + . */ + + #define __finite __redirect___finite ++ ++/* The following definitions, although not related to the 'double' ++ version of 'finite', are required to guarantee macro expansions ++ (e.g.: from __finitef to __redirect_finitef) in include/math.h, thus ++ compensating for the unintended macro expansions in ++ math/bits/mathcalls-helper-functions.h. */ + #define __finitef __redirect___finitef + #define __finitel __redirect___finitel ++#define __finitef128 __redirect___finitef128 ++ + #include + #include + #include +@@ -30,6 +38,7 @@ extern __typeof (__finite) __finite_power8 attribute_hidden; + #undef __finite + #undef __finitef + #undef __finitel ++#undef __finitef128 + + libc_ifunc_redirected (__redirect___finite, __finite, + (hwcap2 & PPC_FEATURE2_ARCH_2_07) +diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c +index 9c6789c7bd..b79bdd5edd 100644 +--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c ++++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c +@@ -17,8 +17,16 @@ + . */ + + #define __isinf __redirect___isinf ++ ++/* The following definitions, although not related to the 'double' ++ version of 'isinf', are required to guarantee macro expansions ++ (e.g.: from __isinff to __redirect_isinff) in include/math.h, thus ++ compensating for the unintended macro expansions in ++ math/bits/mathcalls-helper-functions.h. */ + #define __isinff __redirect___isinff + #define __isinfl __redirect___isinfl ++#define __isinff128 __redirect___isinff128 ++ + #include + #include + #include +@@ -30,6 +38,7 @@ extern __typeof (__isinf) __isinf_power8 attribute_hidden; + #undef __isinf + #undef __isinff + #undef __isinfl ++#undef __isinff128 + + libc_ifunc_redirected (__redirect___isinf, __isinf, + (hwcap2 & PPC_FEATURE2_ARCH_2_07) +diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c +index 3cfe1793da..a8127e89f7 100644 +--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c ++++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c +@@ -17,8 +17,16 @@ + . */ + + #define __isnan __redirect___isnan ++ ++/* The following definitions, although not related to the 'double' ++ version of 'isnan', are required to guarantee macro expansions ++ (e.g.: from __isnanf to __redirect_isnanf) in include/math.h, thus ++ compensating for the unintended macro expansions in ++ math/bits/mathcalls-helper-functions.h. */ + #define __isnanf __redirect___isnanf + #define __isnanl __redirect___isnanl ++#define __isnanf128 __redirect___isnanf128 ++ + #include + #include + #include +@@ -33,6 +41,7 @@ extern __typeof (__isnan) __isnan_power8 attribute_hidden; + #undef __isnan + #undef __isnanf + #undef __isnanl ++#undef __isnanf128 + + libc_ifunc_redirected (__redirect___isnan, __isnan, + (hwcap2 & PPC_FEATURE2_ARCH_2_07) +diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/power7/memcpy.S +index 641c7e2118..c9b6507d1b 100644 +--- a/sysdeps/powerpc/powerpc64/power7/memcpy.S ++++ b/sysdeps/powerpc/powerpc64/power7/memcpy.S +@@ -91,63 +91,63 @@ L(aligned_copy): + srdi 12,cnt,7 + cmpdi 12,0 + beq L(aligned_tail) +- lxvd2x 6,0,src +- lxvd2x 7,src,6 ++ lvx 6,0,src ++ lvx 7,src,6 + mtctr 12 + b L(aligned_128loop) + + .align 4 + L(aligned_128head): + /* for the 2nd + iteration of this loop. */ +- lxvd2x 6,0,src +- lxvd2x 7,src,6 ++ lvx 6,0,src ++ lvx 7,src,6 + L(aligned_128loop): +- lxvd2x 8,src,7 +- lxvd2x 9,src,8 +- stxvd2x 6,0,dst ++ lvx 8,src,7 ++ lvx 9,src,8 ++ stvx 6,0,dst + addi src,src,64 +- stxvd2x 7,dst,6 +- stxvd2x 8,dst,7 +- stxvd2x 9,dst,8 +- lxvd2x 6,0,src +- lxvd2x 7,src,6 ++ stvx 7,dst,6 ++ stvx 8,dst,7 ++ stvx 9,dst,8 ++ lvx 6,0,src ++ lvx 7,src,6 + addi dst,dst,64 +- lxvd2x 8,src,7 +- lxvd2x 9,src,8 ++ lvx 8,src,7 ++ lvx 9,src,8 + addi src,src,64 +- stxvd2x 6,0,dst +- stxvd2x 7,dst,6 +- stxvd2x 8,dst,7 +- stxvd2x 9,dst,8 ++ stvx 6,0,dst ++ stvx 7,dst,6 ++ stvx 8,dst,7 ++ stvx 9,dst,8 + addi dst,dst,64 + bdnz L(aligned_128head) + + L(aligned_tail): + mtocrf 0x01,cnt + bf 25,32f +- lxvd2x 6,0,src +- lxvd2x 7,src,6 +- lxvd2x 8,src,7 +- lxvd2x 9,src,8 ++ lvx 6,0,src ++ lvx 7,src,6 ++ lvx 8,src,7 ++ lvx 9,src,8 + addi src,src,64 +- stxvd2x 6,0,dst +- stxvd2x 7,dst,6 +- stxvd2x 8,dst,7 +- stxvd2x 9,dst,8 ++ stvx 6,0,dst ++ stvx 7,dst,6 ++ stvx 8,dst,7 ++ stvx 9,dst,8 + addi dst,dst,64 + 32: + bf 26,16f +- lxvd2x 6,0,src +- lxvd2x 7,src,6 ++ lvx 6,0,src ++ lvx 7,src,6 + addi src,src,32 +- stxvd2x 6,0,dst +- stxvd2x 7,dst,6 ++ stvx 6,0,dst ++ stvx 7,dst,6 + addi dst,dst,32 + 16: + bf 27,8f +- lxvd2x 6,0,src ++ lvx 6,0,src + addi src,src,16 +- stxvd2x 6,0,dst ++ stvx 6,0,dst + addi dst,dst,16 + 8: + bf 28,4f +diff --git a/sysdeps/powerpc/powerpc64/power7/memmove.S b/sysdeps/powerpc/powerpc64/power7/memmove.S +index 93baa69ee2..667c6e2092 100644 +--- a/sysdeps/powerpc/powerpc64/power7/memmove.S ++++ b/sysdeps/powerpc/powerpc64/power7/memmove.S +@@ -92,63 +92,63 @@ L(aligned_copy): + srdi 12,r5,7 + cmpdi 12,0 + beq L(aligned_tail) +- lxvd2x 6,0,r4 +- lxvd2x 7,r4,6 ++ lvx 6,0,r4 ++ lvx 7,r4,6 + mtctr 12 + b L(aligned_128loop) + + .align 4 + L(aligned_128head): + /* for the 2nd + iteration of this loop. */ +- lxvd2x 6,0,r4 +- lxvd2x 7,r4,6 ++ lvx 6,0,r4 ++ lvx 7,r4,6 + L(aligned_128loop): +- lxvd2x 8,r4,7 +- lxvd2x 9,r4,8 +- stxvd2x 6,0,r11 ++ lvx 8,r4,7 ++ lvx 9,r4,8 ++ stvx 6,0,r11 + addi r4,r4,64 +- stxvd2x 7,r11,6 +- stxvd2x 8,r11,7 +- stxvd2x 9,r11,8 +- lxvd2x 6,0,r4 +- lxvd2x 7,r4,6 ++ stvx 7,r11,6 ++ stvx 8,r11,7 ++ stvx 9,r11,8 ++ lvx 6,0,r4 ++ lvx 7,r4,6 + addi r11,r11,64 +- lxvd2x 8,r4,7 +- lxvd2x 9,r4,8 ++ lvx 8,r4,7 ++ lvx 9,r4,8 + addi r4,r4,64 +- stxvd2x 6,0,r11 +- stxvd2x 7,r11,6 +- stxvd2x 8,r11,7 +- stxvd2x 9,r11,8 ++ stvx 6,0,r11 ++ stvx 7,r11,6 ++ stvx 8,r11,7 ++ stvx 9,r11,8 + addi r11,r11,64 + bdnz L(aligned_128head) + + L(aligned_tail): + mtocrf 0x01,r5 + bf 25,32f +- lxvd2x 6,0,r4 +- lxvd2x 7,r4,6 +- lxvd2x 8,r4,7 +- lxvd2x 9,r4,8 ++ lvx 6,0,r4 ++ lvx 7,r4,6 ++ lvx 8,r4,7 ++ lvx 9,r4,8 + addi r4,r4,64 +- stxvd2x 6,0,r11 +- stxvd2x 7,r11,6 +- stxvd2x 8,r11,7 +- stxvd2x 9,r11,8 ++ stvx 6,0,r11 ++ stvx 7,r11,6 ++ stvx 8,r11,7 ++ stvx 9,r11,8 + addi r11,r11,64 + 32: + bf 26,16f +- lxvd2x 6,0,r4 +- lxvd2x 7,r4,6 ++ lvx 6,0,r4 ++ lvx 7,r4,6 + addi r4,r4,32 +- stxvd2x 6,0,r11 +- stxvd2x 7,r11,6 ++ stvx 6,0,r11 ++ stvx 7,r11,6 + addi r11,r11,32 + 16: + bf 27,8f +- lxvd2x 6,0,r4 ++ lvx 6,0,r4 + addi r4,r4,16 +- stxvd2x 6,0,r11 ++ stvx 6,0,r11 + addi r11,r11,16 + 8: + bf 28,4f +@@ -488,63 +488,63 @@ L(aligned_copy_bwd): + srdi r12,r5,7 + cmpdi r12,0 + beq L(aligned_tail_bwd) +- lxvd2x v6,r4,r6 +- lxvd2x v7,r4,r7 ++ lvx v6,r4,r6 ++ lvx v7,r4,r7 + mtctr 12 + b L(aligned_128loop_bwd) + + .align 4 + L(aligned_128head_bwd): + /* for the 2nd + iteration of this loop. */ +- lxvd2x v6,r4,r6 +- lxvd2x v7,r4,r7 ++ lvx v6,r4,r6 ++ lvx v7,r4,r7 + L(aligned_128loop_bwd): +- lxvd2x v8,r4,r8 +- lxvd2x v9,r4,r9 +- stxvd2x v6,r11,r6 ++ lvx v8,r4,r8 ++ lvx v9,r4,r9 ++ stvx v6,r11,r6 + subi r4,r4,64 +- stxvd2x v7,r11,r7 +- stxvd2x v8,r11,r8 +- stxvd2x v9,r11,r9 +- lxvd2x v6,r4,r6 +- lxvd2x v7,r4,7 ++ stvx v7,r11,r7 ++ stvx v8,r11,r8 ++ stvx v9,r11,r9 ++ lvx v6,r4,r6 ++ lvx v7,r4,7 + subi r11,r11,64 +- lxvd2x v8,r4,r8 +- lxvd2x v9,r4,r9 ++ lvx v8,r4,r8 ++ lvx v9,r4,r9 + subi r4,r4,64 +- stxvd2x v6,r11,r6 +- stxvd2x v7,r11,r7 +- stxvd2x v8,r11,r8 +- stxvd2x v9,r11,r9 ++ stvx v6,r11,r6 ++ stvx v7,r11,r7 ++ stvx v8,r11,r8 ++ stvx v9,r11,r9 + subi r11,r11,64 + bdnz L(aligned_128head_bwd) + + L(aligned_tail_bwd): + mtocrf 0x01,r5 + bf 25,32f +- lxvd2x v6,r4,r6 +- lxvd2x v7,r4,r7 +- lxvd2x v8,r4,r8 +- lxvd2x v9,r4,r9 ++ lvx v6,r4,r6 ++ lvx v7,r4,r7 ++ lvx v8,r4,r8 ++ lvx v9,r4,r9 + subi r4,r4,64 +- stxvd2x v6,r11,r6 +- stxvd2x v7,r11,r7 +- stxvd2x v8,r11,r8 +- stxvd2x v9,r11,r9 ++ stvx v6,r11,r6 ++ stvx v7,r11,r7 ++ stvx v8,r11,r8 ++ stvx v9,r11,r9 + subi r11,r11,64 + 32: + bf 26,16f +- lxvd2x v6,r4,r6 +- lxvd2x v7,r4,r7 ++ lvx v6,r4,r6 ++ lvx v7,r4,r7 + subi r4,r4,32 +- stxvd2x v6,r11,r6 +- stxvd2x v7,r11,r7 ++ stvx v6,r11,r6 ++ stvx v7,r11,r7 + subi r11,r11,32 + 16: + bf 27,8f +- lxvd2x v6,r4,r6 ++ lvx v6,r4,r6 + subi r4,r4,16 +- stxvd2x v6,r11,r6 ++ stvx v6,r11,r6 + subi r11,r11,16 + 8: + bf 28,4f +diff --git a/sysdeps/powerpc/powerpc64/tls-macros.h b/sysdeps/powerpc/powerpc64/tls-macros.h +index 42a95ec5c1..79a0b2579c 100644 +--- a/sysdeps/powerpc/powerpc64/tls-macros.h ++++ b/sysdeps/powerpc/powerpc64/tls-macros.h +@@ -18,13 +18,11 @@ + __result; \ + }) + +-#define __TLS_GET_ADDR "__tls_get_addr" +- + /* PowerPC64 Local Dynamic TLS access. */ + #define TLS_LD(x) \ + ({ int * __result; \ + asm ("addi 3,2," #x "@got@tlsld\n\t" \ +- "bl " __TLS_GET_ADDR "\n\t" \ ++ "bl __tls_get_addr\n\t" \ + "nop \n\t" \ + "addis %0,3," #x "@dtprel@ha\n\t" \ + "addi %0,%0," #x "@dtprel@l" \ +@@ -36,7 +34,7 @@ + #define TLS_GD(x) \ + ({ register int *__result __asm__ ("r3"); \ + asm ("addi 3,2," #x "@got@tlsgd\n\t" \ +- "bl " __TLS_GET_ADDR "\n\t" \ ++ "bl __tls_get_addr\n\t" \ + "nop " \ + : "=r" (__result) : \ + : __TLS_CALL_CLOBBERS); \ +diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile +index 77617b670a..f554a791b7 100644 +--- a/sysdeps/powerpc/powerpc64le/Makefile ++++ b/sysdeps/powerpc/powerpc64le/Makefile +@@ -16,7 +16,10 @@ $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128 + $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128 + $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128 + CFLAGS-libm-test-support-float128.c += -mfloat128 +-$(objpfx)test-float128% $(objpfx)test-ifloat128%: \ ++CFLAGS-test-math-iscanonical.cc += -mfloat128 ++CFLAGS-test-math-issignaling.cc += -mfloat128 ++CFLAGS-test-math-iszero.cc += -mfloat128 ++$(objpfx)test-float128% $(objpfx)test-ifloat128% $(objpfx)test-math-iszero: \ + gnulib-tests += $(f128-loader-link) + endif + +@@ -31,12 +34,15 @@ CFLAGS-bug-strtod.c += -mfloat128 + CFLAGS-bug-strtod2.c += -mfloat128 + CFLAGS-tst-strtod-round.c += -mfloat128 + CFLAGS-tst-wcstod-round.c += -mfloat128 ++CFLAGS-tst-strtod-nan-locale.c += -mfloat128 ++CFLAGS-tst-wcstod-nan-locale.c += -mfloat128 + CFLAGS-tst-strtod6.c += -mfloat128 + CFLAGS-tst-strfrom.c += -mfloat128 + CFLAGS-tst-strfrom-locale.c += -mfloat128 + CFLAGS-strfrom-skeleton.c += -mfloat128 + $(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \ + tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \ ++tst-strtod-nan-locale tst-wcstod-nan-locale \ + strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link) + + # When building glibc with support for _Float128, the powers of ten tables in +diff --git a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c +index 769d3f8922..59fd8269f5 100644 +--- a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c ++++ b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c +@@ -30,7 +30,7 @@ __float128 + __ieee754_sqrtf128 (__float128 a) + { + __float128 z; +- asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a)); ++ asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a)); + return z; + } + strong_alias (__ieee754_sqrtf128, __sqrtf128_finite) +diff --git a/sysdeps/powerpc/tst-tlsopt-powerpc.c b/sysdeps/powerpc/tst-tlsopt-powerpc.c +index 8ae928a3f4..cc682b2ed0 100644 +--- a/sysdeps/powerpc/tst-tlsopt-powerpc.c ++++ b/sysdeps/powerpc/tst-tlsopt-powerpc.c +@@ -1,51 +1,11 @@ + /* glibc test for __tls_get_addr optimization. */ +-#include +- +-#include "../../elf/tls-macros.h" +-#include "dl-tls.h" +- +-/* common 'int' variable in TLS. */ +-COMMON_INT_DEF(foo); +- + + static int + do_test (void) + { +- int result = 0; +- +- /* Get variable using general dynamic model. */ +- int *ap = TLS_GD (foo); +- if (*ap != 0) +- { +- printf ("foo = %d\n", *ap); +- result = 1; +- } +- +- tls_index *tls_arg; +-#ifdef __powerpc64__ +- register unsigned long thread_pointer __asm__ ("r13"); +- asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg)); +-#else +- register unsigned long thread_pointer __asm__ ("r2"); +- asm ("bcl 20,31,1f\n1:\t" +- "mflr %0\n\t" +- "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" +- "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" +- "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg)); +-#endif +- +- if (tls_arg->ti_module != 0) +- { +- printf ("tls_index not optimized, binutils too old?\n"); +- result = 1; +- } +- else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap) +- { +- printf ("tls_index->ti_offset wrong value\n"); +- result = 1; +- } ++ extern int tls_get_addr_opt_test (void); + +- return result; ++ return tls_get_addr_opt_test (); + } + + #include +diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h +index 3a9ac57625..1ae277367d 100644 +--- a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h +@@ -45,6 +45,8 @@ + #else + #define __PTHREAD_MUTEX_LOCK_ELISION 0 + #endif ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) ++#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/s390/nptl/pthread-offsets.h b/sysdeps/s390/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..bdda1f197e +--- /dev/null ++++ b/sysdeps/s390/nptl/pthread-offsets.h +@@ -0,0 +1,15 @@ ++#include ++ ++#if __WORDSIZE == 64 ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++# define __PTHREAD_MUTEX_KIND_OFFSET 16 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 24 ++#else ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++# define __PTHREAD_MUTEX_KIND_OFFSET 12 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 20 ++#endif +diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +index b2615fe314..e707751aa6 100644 +--- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +@@ -34,6 +34,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++#define __PTHREAD_MUTEX_USE_UNION 1 + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/sh/nptl/pthread-offsets.h b/sysdeps/sh/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..9617354dc7 +--- /dev/null ++++ b/sysdeps/sh/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++#define __PTHREAD_MUTEX_KIND_OFFSET 12 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 20 +diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h +index 1e188cf91f..0f96f3711e 100644 +--- a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h +@@ -43,6 +43,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) ++#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/sparc/nptl/pthread-offsets.h b/sysdeps/sparc/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..bdda1f197e +--- /dev/null ++++ b/sysdeps/sparc/nptl/pthread-offsets.h +@@ -0,0 +1,15 @@ ++#include ++ ++#if __WORDSIZE == 64 ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++# define __PTHREAD_MUTEX_KIND_OFFSET 16 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 24 ++#else ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++# define __PTHREAD_MUTEX_KIND_OFFSET 12 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 20 ++#endif +diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h +index 436e4e6cc3..debf67bd1b 100644 +--- a/sysdeps/sparc/sparc32/dl-machine.h ++++ b/sysdeps/sparc/sparc32/dl-machine.h +@@ -376,6 +376,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0) + && sym->st_shndx != SHN_UNDEF) + { ++ sym_map = map; + value = map->l_addr; + } + else +diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h +index c2871dca3a..e1ec7a532c 100644 +--- a/sysdeps/sparc/sparc64/dl-machine.h ++++ b/sysdeps/sparc/sparc64/dl-machine.h +@@ -403,6 +403,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, + if (__builtin_expect (ELF64_ST_BIND (sym->st_info) == STB_LOCAL, 0) + && sym->st_shndx != SHN_UNDEF) + { ++ sym_map = map; + value = map->l_addr; + } + else +diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h +index 145ee42ddb..054474f770 100644 +--- a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h +@@ -43,6 +43,8 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 ++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) ++#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/tile/nptl/pthread-offsets.h b/sysdeps/tile/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..bdda1f197e +--- /dev/null ++++ b/sysdeps/tile/nptl/pthread-offsets.h +@@ -0,0 +1,15 @@ ++#include ++ ++#if __WORDSIZE == 64 ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++# define __PTHREAD_MUTEX_KIND_OFFSET 16 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 24 ++#else ++# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 ++# define __PTHREAD_MUTEX_KIND_OFFSET 12 ++# define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++# define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++# define __PTHREAD_MUTEX_LIST_OFFSET 20 ++#endif +diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile +index 9d6a2de870..dbe6a36c57 100644 +--- a/sysdeps/unix/sysv/linux/Makefile ++++ b/sysdeps/unix/sysv/linux/Makefile +@@ -50,7 +50,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ + bits/siginfo-arch.h bits/siginfo-consts-arch.h + + tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ +- tst-quota tst-sync_file_range test-errno-linux ++ tst-quota tst-sync_file_range test-errno-linux tst-sysconf-iov_max + + # Generate the list of SYS_* macros for the system calls (__NR_* macros). + +@@ -120,7 +120,11 @@ ifndef no_deps + -include $(objpfx)bits/syscall.d + endif + generated += bits/syscall.h bits/syscall.d +-endif ++ ++# Separate object file for access to the constant from the UAPI header. ++$(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o ++ ++endif # $(subdir) == misc + + ifeq ($(subdir),time) + sysdep_headers += sys/timex.h bits/timex.h +@@ -162,7 +166,7 @@ endif + ifeq ($(subdir),posix) + sysdep_headers += bits/initspin.h + +-sysdep_routines += sched_getcpu ++sysdep_routines += sched_getcpu oldglob + + tests += tst-affinity tst-affinity-pid + +diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +index 0275d11c7f..0c7e13f4fa 100644 +--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c ++++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +@@ -28,6 +28,7 @@ struct cpu_list + }; + + static struct cpu_list cpu_list[] = { ++ {"falkor", 0x510FC000}, + {"thunderxt88", 0x430F0A10}, + {"generic", 0x0} + }; +@@ -36,7 +37,7 @@ static uint64_t + get_midr_from_mcpu (const char *mcpu) + { + for (int i = 0; i < sizeof (cpu_list) / sizeof (struct cpu_list); i++) +- if (tunable_is_name (mcpu, cpu_list[i].name) == 0) ++ if (strcmp (mcpu, cpu_list[i].name) == 0) + return cpu_list[i].midr; + + return UINT64_MAX; +diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +index c92b650984..73cb53da9a 100644 +--- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h ++++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +@@ -41,6 +41,9 @@ + #define IS_THUNDERX(midr) (MIDR_IMPLEMENTOR(midr) == 'C' \ + && MIDR_PARTNUM(midr) == 0x0a1) + ++#define IS_FALKOR(midr) (MIDR_IMPLEMENTOR(midr) == 'Q' \ ++ && MIDR_PARTNUM(midr) == 0xc00) ++ + struct cpu_features + { + uint64_t midr_el1; +diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile +index 47bd189f94..50f4fb1183 100644 +--- a/sysdeps/unix/sysv/linux/alpha/Makefile ++++ b/sysdeps/unix/sysv/linux/alpha/Makefile +@@ -1,7 +1,3 @@ +-ifeq ($(subdir),posix) +-sysdep_routines += oldglob +-endif +- + ifeq ($(subdir),stdlib) + gen-as-const-headers += ucontext-offsets.sym + endif +diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/alpha/glob.c +index 2d7d287a25..1b813c1cfd 100644 +--- a/sysdeps/unix/sysv/linux/alpha/glob.c ++++ b/sysdeps/unix/sysv/linux/alpha/glob.c +@@ -42,10 +42,6 @@ extern void __new_globfree (glob_t *__pglob); + #undef globfree64 + + versioned_symbol (libc, __new_glob, glob, GLIBC_2_1); +-versioned_symbol (libc, __new_globfree, globfree, GLIBC_2_1); + libc_hidden_ver (__new_glob, glob) +-libc_hidden_ver (__new_globfree, globfree) + + weak_alias (__new_glob, glob64) +-weak_alias (__new_globfree, globfree64) +-libc_hidden_ver (__new_globfree, globfree64) +diff --git a/sysdeps/unix/sysv/linux/alpha/globfree.c b/sysdeps/unix/sysv/linux/alpha/globfree.c +new file mode 100644 +index 0000000000..98cf1c200b +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/alpha/globfree.c +@@ -0,0 +1,37 @@ ++/* Compat globfree. Linux/alpha version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library. If not, see ++ . */ ++ ++#define globfree64 __no_globfree64_decl ++#include ++#include ++#include ++ ++#define globfree(pglob) \ ++ __new_globfree (pglob) ++ ++extern void __new_globfree (glob_t *__pglob); ++ ++#include ++ ++#undef globfree64 ++ ++versioned_symbol (libc, __new_globfree, globfree, GLIBC_2_1); ++libc_hidden_ver (__new_globfree, globfree) ++ ++weak_alias (__new_globfree, globfree64) ++libc_hidden_ver (__new_globfree, globfree64) +diff --git a/sysdeps/unix/sysv/linux/arm/glob64.c b/sysdeps/unix/sysv/linux/arm/glob64.c +deleted file mode 100644 +index 82a9a296a7..0000000000 +--- a/sysdeps/unix/sysv/linux/arm/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include +diff --git a/sysdeps/unix/sysv/linux/glob.c b/sysdeps/unix/sysv/linux/glob.c +new file mode 100644 +index 0000000000..057ae7fe25 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/glob.c +@@ -0,0 +1,28 @@ ++/* Find pathnames matching a pattern. Linux version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++#define glob64 __no_glob64_decl ++#include ++#undef glob64 ++ ++#if XSTAT_IS_XSTAT64 ++weak_alias (glob, glob64) ++#endif +diff --git a/sysdeps/unix/sysv/linux/glob64.c b/sysdeps/unix/sysv/linux/glob64.c +new file mode 100644 +index 0000000000..428bbacb11 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/glob64.c +@@ -0,0 +1,51 @@ ++/* Find pathnames matching a pattern. Linux version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++#if !XSTAT_IS_XSTAT64 ++# include ++# include ++# include ++ ++# define dirent dirent64 ++# define __readdir(dirp) __readdir64 (dirp) ++ ++# define glob_t glob64_t ++# define glob(pattern, flags, errfunc, pglob) \ ++ __glob64 (pattern, flags, errfunc, pglob) ++# define globfree(pglob) globfree64 (pglob) ++ ++# undef stat ++# define stat stat64 ++ ++# define COMPILE_GLOB64 1 ++ ++# include ++ ++# include "shlib-compat.h" ++ ++# ifdef GLOB_NO_OLD_VERSION ++strong_alias (__glob64, glob64) ++libc_hidden_def (glob64) ++# else ++versioned_symbol (libc, __glob64, glob64, GLIBC_2_2); ++libc_hidden_ver (__glob64, glob64) ++# endif ++#endif /* XSTAT_IS_XSTAT64 */ +diff --git a/sysdeps/unix/sysv/linux/globfree.c b/sysdeps/unix/sysv/linux/globfree.c +new file mode 100644 +index 0000000000..48d4aec332 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/globfree.c +@@ -0,0 +1,30 @@ ++/* Frees the dynamically allocated storage from an earlier call to glob. ++ Linux version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++#define globfree64 __no_globfree64_decl ++#include ++#undef globfree64 ++ ++#if XSTAT_IS_XSTAT64 ++weak_alias (globfree, globfree64) ++libc_hidden_ver (globfree, globfree64) ++#endif +diff --git a/sysdeps/unix/sysv/linux/globfree64.c b/sysdeps/unix/sysv/linux/globfree64.c +new file mode 100644 +index 0000000000..0020466372 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/globfree64.c +@@ -0,0 +1,36 @@ ++/* Frees the dynamically allocated storage from an earlier call to glob. ++ Linux version. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++#if !XSTAT_IS_XSTAT64 ++ ++# include ++ ++# define glob_t glob64_t ++# define globfree(pglob) globfree64 (pglob) ++ ++# undef stat ++# define stat stat64 ++ ++# include ++ ++libc_hidden_def (globfree64) ++#endif +diff --git a/sysdeps/unix/sysv/linux/i386/alphasort64.c b/sysdeps/unix/sysv/linux/i386/alphasort64.c +index d5fd47a9ae..04b29b6e0e 100644 +--- a/sysdeps/unix/sysv/linux/i386/alphasort64.c ++++ b/sysdeps/unix/sysv/linux/i386/alphasort64.c +@@ -30,7 +30,7 @@ versioned_symbol (libc, __alphasort64, alphasort64, GLIBC_2_2); + + #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) + +-#include ++#include + + int + __old_alphasort64 (const struct __old_dirent64 **a, +diff --git a/sysdeps/unix/sysv/linux/i386/getdents64.c b/sysdeps/unix/sysv/linux/i386/getdents64.c +index e8b257f059..2010bbf8df 100644 +--- a/sysdeps/unix/sysv/linux/i386/getdents64.c ++++ b/sysdeps/unix/sysv/linux/i386/getdents64.c +@@ -28,7 +28,7 @@ + + #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) + +-#include ++#include + + #define __GETDENTS __old_getdents64 + #define DIRENT_TYPE struct __old_dirent64 +diff --git a/sysdeps/unix/sysv/linux/i386/glob64.c b/sysdeps/unix/sysv/linux/i386/glob64.c +deleted file mode 100644 +index f68195137e..0000000000 +--- a/sysdeps/unix/sysv/linux/i386/glob64.c ++++ /dev/null +@@ -1,76 +0,0 @@ +-/* Two glob variants with 64-bit support, for dirent64 and __olddirent64. +- Copyright (C) 1998-2017 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, see +- . */ +- +-#include +-#include +-#include +- +-#define dirent dirent64 +-#define __readdir(dirp) __readdir64 (dirp) +- +-#define glob_t glob64_t +-#define glob(pattern, flags, errfunc, pglob) \ +- __glob64 (pattern, flags, errfunc, pglob) +-#define globfree(pglob) globfree64 (pglob) +- +-#undef stat +-#define stat stat64 +-#undef __stat +-#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) +- +-#define NO_GLOB_PATTERN_P 1 +- +-#define COMPILE_GLOB64 1 +- +-#include +- +-#include "shlib-compat.h" +- +-libc_hidden_def (globfree64) +- +-versioned_symbol (libc, __glob64, glob64, GLIBC_2_2); +-libc_hidden_ver (__glob64, glob64) +- +-#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) +- +-#include +- +-int __old_glob64 (const char *__pattern, int __flags, +- int (*__errfunc) (const char *, int), +- glob64_t *__pglob); +- +-#undef dirent +-#define dirent __old_dirent64 +-#undef GL_READDIR +-# define GL_READDIR(pglob, stream) \ +- ((struct __old_dirent64 *) (pglob)->gl_readdir (stream)) +-#undef __readdir +-#define __readdir(dirp) __old_readdir64 (dirp) +-#undef glob +-#define glob(pattern, flags, errfunc, pglob) \ +- __old_glob64 (pattern, flags, errfunc, pglob) +-#define convert_dirent __old_convert_dirent +-#define glob_in_dir __old_glob_in_dir +-#define GLOB_ATTRIBUTE attribute_compat_text_section +- +-#define GLOB_ONLY_P 1 +- +-#include +- +-compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1); +-#endif +diff --git a/sysdeps/unix/sysv/linux/i386/readdir64.c b/sysdeps/unix/sysv/linux/i386/readdir64.c +index f80b6a7ba2..bd2375f9a6 100644 +--- a/sysdeps/unix/sysv/linux/i386/readdir64.c ++++ b/sysdeps/unix/sysv/linux/i386/readdir64.c +@@ -31,7 +31,7 @@ versioned_symbol (libc, __readdir64, readdir64, GLIBC_2_2); + + #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) + +-#include ++#include + + #define __READDIR attribute_compat_text_section __old_readdir64 + #define __GETDENTS __old_getdents64 +diff --git a/sysdeps/unix/sysv/linux/i386/readdir64_r.c b/sysdeps/unix/sysv/linux/i386/readdir64_r.c +index 344fd53d02..8c0262d1dc 100644 +--- a/sysdeps/unix/sysv/linux/i386/readdir64_r.c ++++ b/sysdeps/unix/sysv/linux/i386/readdir64_r.c +@@ -31,7 +31,7 @@ versioned_symbol (libc, __readdir64_r, readdir64_r, GLIBC_2_2); + + #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) + +-#include ++#include + + #define __READDIR_R attribute_compat_text_section __old_readdir64_r + #define __GETDENTS __old_getdents64 +diff --git a/sysdeps/unix/sysv/linux/i386/versionsort64.c b/sysdeps/unix/sysv/linux/i386/versionsort64.c +index 3e1c6ea35b..87f2f9578d 100644 +--- a/sysdeps/unix/sysv/linux/i386/versionsort64.c ++++ b/sysdeps/unix/sysv/linux/i386/versionsort64.c +@@ -30,7 +30,7 @@ versioned_symbol (libc, __versionsort64, versionsort64, GLIBC_2_2); + + #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) + +-#include ++#include + + int + __old_versionsort64 (const struct __old_dirent64 **a, +diff --git a/sysdeps/unix/sysv/linux/m68k/glob64.c b/sysdeps/unix/sysv/linux/m68k/glob64.c +deleted file mode 100644 +index 82a9a296a7..0000000000 +--- a/sysdeps/unix/sysv/linux/m68k/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include +diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c +deleted file mode 100644 +index 33918ea6a5..0000000000 +--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-/* glob64 is in glob.c */ +diff --git a/sysdeps/unix/sysv/linux/i386/olddirent.h b/sysdeps/unix/sysv/linux/olddirent.h +similarity index 100% +rename from sysdeps/unix/sysv/linux/i386/olddirent.h +rename to sysdeps/unix/sysv/linux/olddirent.h +diff --git a/sysdeps/unix/sysv/linux/oldglob.c b/sysdeps/unix/sysv/linux/oldglob.c +new file mode 100644 +index 0000000000..5402450f55 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/oldglob.c +@@ -0,0 +1,43 @@ ++#include ++ ++#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) \ ++ && !defined(GLOB_NO_OLD_VERSION) ++ ++#include ++#include ++#include ++ ++#include ++ ++int __old_glob64 (const char *__pattern, int __flags, ++ int (*__errfunc) (const char *, int), ++ glob64_t *__pglob); ++libc_hidden_proto (__old_glob64); ++ ++#define dirent __old_dirent64 ++#define GL_READDIR(pglob, stream) \ ++ ((struct __old_dirent64 *) (pglob)->gl_readdir (stream)) ++#undef __readdir ++#define __readdir(dirp) __old_readdir64 (dirp) ++ ++#define glob_t glob64_t ++#define glob(pattern, flags, errfunc, pglob) \ ++ __old_glob64 (pattern, flags, errfunc, pglob) ++#define globfree(pglob) globfree64(pglob) ++ ++#define convert_dirent __old_convert_dirent ++#define glob_in_dir __old_glob_in_dir ++ ++#undef stat ++#define stat stat64 ++#undef __stat ++#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf) ++ ++#define GLOB_ATTRIBUTE attribute_compat_text_section ++ ++#include ++ ++libc_hidden_def (__old_glob64); ++ ++compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1); ++#endif +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c +deleted file mode 100644 +index 82a9a296a7..0000000000 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include +diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c +index 11fe85eaa8..137e2dd791 100644 +--- a/sysdeps/unix/sysv/linux/preadv2.c ++++ b/sysdeps/unix/sysv/linux/preadv2.c +@@ -32,7 +32,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset, + # ifdef __NR_preadv2 + ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count, + LO_HI_LONG (offset), flags); +- if (result >= 0 || errno != ENOSYS) ++ if (result >= 0) + return result; + # endif + /* Trying to emulate the preadv2 syscall flags is troublesome: +@@ -46,7 +46,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset, + + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + return preadv (fd, vector, count, offset); +diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c +index 9d7f8c9893..8f413253f4 100644 +--- a/sysdeps/unix/sysv/linux/preadv64v2.c ++++ b/sysdeps/unix/sysv/linux/preadv64v2.c +@@ -30,7 +30,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + #ifdef __NR_preadv64v2 + ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count, + LO_HI_LONG (offset), flags); +- if (result >= 0 || errno != ENOSYS) ++ if (result >= 0) + return result; + #endif + /* Trying to emulate the preadv2 syscall flags is troublesome: +@@ -44,7 +44,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + return preadv64 (fd, vector, count, offset); +diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c +index 72f0471f96..8e5032fe2f 100644 +--- a/sysdeps/unix/sysv/linux/pwritev2.c ++++ b/sysdeps/unix/sysv/linux/pwritev2.c +@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset, + # ifdef __NR_pwritev2 + ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count, + LO_HI_LONG (offset), flags); +- if (result >= 0 || errno != ENOSYS) ++ if (result >= 0) + return result; + # endif + /* Trying to emulate the pwritev2 syscall flags is troublesome: +@@ -42,7 +42,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset, + + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + return pwritev (fd, vector, count, offset); +diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c +index def9a0bc57..d2800c6657 100644 +--- a/sysdeps/unix/sysv/linux/pwritev64v2.c ++++ b/sysdeps/unix/sysv/linux/pwritev64v2.c +@@ -30,7 +30,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + #ifdef __NR_pwritev64v2 + ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count, + LO_HI_LONG (offset), flags); +- if (result >= 0 || errno != ENOSYS) ++ if (result >= 0) + return result; + #endif + /* Trying to emulate the pwritev2 syscall flags is troublesome: +@@ -44,7 +44,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset, + + if (flags != 0) + { +- __set_errno (EOPNOTSUPP); ++ __set_errno (ENOTSUP); + return -1; + } + return pwritev64 (fd, vector, count, offset); +diff --git a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c +index d324237edd..0221ac2cf5 100644 +--- a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c ++++ b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c +@@ -26,8 +26,8 @@ + /* In glibc release 2.19 new versions of longjmp-functions were introduced, + but were reverted before 2.20. Thus both versions are the same function. */ + +-strong_alias (longjmp_ifunc, __v2longjmp) ++strong_alias (longjmp_alias, __v2longjmp) + compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19); +-strong_alias (siglongjmp_ifunc, __v2siglongjmp) ++strong_alias (siglongjmp_alias, __v2siglongjmp) + compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19); + #endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20)) */ +diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c b/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c +new file mode 100644 +index 0000000000..d220e22e30 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c +@@ -0,0 +1,2 @@ ++#define GLOB_NO_OLD_VERSION ++#include +diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c b/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c +new file mode 100644 +index 0000000000..56d7d12ea6 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c +@@ -0,0 +1,2 @@ ++#define GLOB_NO_OLD_VERSION ++#include +diff --git a/sysdeps/unix/sysv/linux/sparc/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h +similarity index 100% +rename from sysdeps/unix/sysv/linux/sparc/bits/long-double.h +rename to sysdeps/unix/sysv/linux/sparc/sparc32/bits/long-double.h +diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c b/sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c +deleted file mode 100644 +index 82a9a296a7..0000000000 +--- a/sysdeps/unix/sysv/linux/sparc/sparc32/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include +diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h +new file mode 100644 +index 0000000000..094e05124b +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/long-double.h +@@ -0,0 +1,26 @@ ++/* Properties of long double type. SPARC version. ++ Copyright (C) 2016-2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++#if !defined __NO_LONG_DOUBLE_MATH && __WORDSIZE == 32 ++# define __LONG_DOUBLE_MATH_OPTIONAL 1 ++# ifndef __LONG_DOUBLE_128__ ++# define __NO_LONG_DOUBLE_MATH 1 ++# endif ++#endif +diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c +index c56f894a82..7d23df84d2 100644 +--- a/sysdeps/unix/sysv/linux/spawni.c ++++ b/sysdeps/unix/sysv/linux/spawni.c +@@ -17,7 +17,6 @@ + . */ + + #include +-#include + #include + #include + #include +@@ -268,7 +267,6 @@ __spawni_child (void *arguments) + __sigprocmask (SIG_SETMASK, (attr->__flags & POSIX_SPAWN_SETSIGMASK) + ? &attr->__ss : &args->oldmask, 0); + +- args->err = 0; + args->exec (args->file, args->argv, args->envp); + + /* This is compatibility function required to enable posix_spawn run +@@ -339,7 +337,7 @@ __spawnix (pid_t * pid, const char *file, + + /* Child must set args.err to something non-negative - we rely on + the parent and child sharing VM. */ +- args.err = -1; ++ args.err = 0; + args.file = file; + args.exec = exec; + args.fa = file_actions; +@@ -362,12 +360,26 @@ __spawnix (pid_t * pid, const char *file, + new_pid = CLONE (__spawni_child, STACK (stack, stack_size), stack_size, + CLONE_VM | CLONE_VFORK | SIGCHLD, &args); + ++ /* It needs to collect the case where the auxiliary process was created ++ but failed to execute the file (due either any preparation step or ++ for execve itself). */ + if (new_pid > 0) + { ++ /* Also, it handles the unlikely case where the auxiliary process was ++ terminated before calling execve as if it was successfully. The ++ args.err is set to 0 as default and changed to a positive value ++ only in case of failure, so in case of premature termination ++ due a signal args.err will remain zeroed and it will be up to ++ caller to actually collect it. */ + ec = args.err; +- assert (ec >= 0); +- if (ec != 0) +- __waitpid (new_pid, NULL, 0); ++ if (ec > 0) ++ /* There still an unlikely case where the child is cancelled after ++ setting args.err, due to a positive error value. Also there is ++ possible pid reuse race (where the kernel allocated the same pid ++ to an unrelated process). Unfortunately due synchronization ++ issues where the kernel might not have the process collected ++ the waitpid below can not use WNOHANG. */ ++ __waitpid (new_pid, NULL, 0); + } + else + ec = -new_pid; +diff --git a/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c +new file mode 100644 +index 0000000000..1240b846e6 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c +@@ -0,0 +1,27 @@ ++/* Check IOV_MAX definition: Helper function to capture UAPI header value. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Use a separate function to avoid header compatibility issues. */ ++ ++#include ++ ++long ++uio_maxiov_value (void) ++{ ++ return UIO_MAXIOV; ++} +diff --git a/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c +new file mode 100644 +index 0000000000..dfdf3da484 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c +@@ -0,0 +1,40 @@ ++/* Check IOV_MAX definition for consistency (bug 22321). ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Defined in tst-sysconf-iov_max-uapi.c. */ ++long uio_maxiov_value (void); ++ ++ ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ TEST_VERIFY (_XOPEN_IOV_MAX == 16); /* Value required by POSIX. */ ++ TEST_VERIFY (uio_maxiov_value () >= _XOPEN_IOV_MAX); ++ TEST_VERIFY (IOV_MAX == uio_maxiov_value ()); ++ TEST_VERIFY (UIO_MAXIOV == uio_maxiov_value ()); ++ TEST_VERIFY (sysconf (_SC_UIO_MAXIOV) == uio_maxiov_value ()); ++ TEST_VERIFY (sysconf (_SC_IOV_MAX) == uio_maxiov_value ()); ++ return 0; ++} ++ ++#include +diff --git a/sysdeps/unix/sysv/linux/wordsize-64/glob64.c b/sysdeps/unix/sysv/linux/wordsize-64/glob64.c +deleted file mode 100644 +index eab7703d5c..0000000000 +--- a/sysdeps/unix/sysv/linux/wordsize-64/glob64.c ++++ /dev/null +@@ -1,2 +0,0 @@ +-/* This file is here so sysdeps/gnu/glob64.c doesn't take precedence. */ +-#include +diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/glob.c b/sysdeps/unix/sysv/linux/x86_64/x32/glob.c +deleted file mode 100644 +index e5427475f6..0000000000 +--- a/sysdeps/unix/sysv/linux/x86_64/x32/glob.c ++++ /dev/null +@@ -1 +0,0 @@ +-#include +diff --git a/sysdeps/wordsize-64/glob.c b/sysdeps/wordsize-64/glob.c +deleted file mode 100644 +index 082faf1c70..0000000000 +--- a/sysdeps/wordsize-64/glob.c ++++ /dev/null +@@ -1,8 +0,0 @@ +-#define glob64 __no_glob64_decl +-#define globfree64 __no_globfree64_decl +-#include +-#undef glob64 +-#undef globfree64 +-weak_alias (glob, glob64) +-weak_alias (globfree, globfree64) +-libc_hidden_ver (globfree, globfree64) +diff --git a/sysdeps/wordsize-64/glob64.c b/sysdeps/wordsize-64/glob64.c +deleted file mode 100644 +index 33918ea6a5..0000000000 +--- a/sysdeps/wordsize-64/glob64.c ++++ /dev/null +@@ -1 +0,0 @@ +-/* glob64 is in glob.c */ +diff --git a/sysdeps/x86/cpu-features-offsets.sym b/sysdeps/x86/cpu-features-offsets.sym +index f6739fae81..33dd094e37 100644 +--- a/sysdeps/x86/cpu-features-offsets.sym ++++ b/sysdeps/x86/cpu-features-offsets.sym +@@ -15,6 +15,7 @@ CPUID_ECX_OFFSET offsetof (struct cpuid_registers, ecx) + CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx) + FAMILY_OFFSET offsetof (struct cpu_features, family) + MODEL_OFFSET offsetof (struct cpu_features, model) ++XSAVE_STATE_SIZE_OFFSET offsetof (struct cpu_features, xsave_state_size) + FEATURE_OFFSET offsetof (struct cpu_features, feature) + FEATURE_SIZE sizeof (unsigned int) + +diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c +index 1d087ea732..87aaa8683c 100644 +--- a/sysdeps/x86/cpu-features.c ++++ b/sysdeps/x86/cpu-features.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #if HAVE_TUNABLES + # define TUNABLE_NAMESPACE tune +@@ -103,6 +104,76 @@ get_common_indeces (struct cpu_features *cpu_features, + } + } + } ++ ++ /* For _dl_runtime_resolve, set xsave_state_size to xsave area ++ size + integer register save size and align it to 64 bytes. */ ++ if (cpu_features->max_cpuid >= 0xd) ++ { ++ unsigned int eax, ebx, ecx, edx; ++ ++ __cpuid_count (0xd, 0, eax, ebx, ecx, edx); ++ if (ebx != 0) ++ { ++ unsigned int xsave_state_full_size ++ = ALIGN_UP (ebx + STATE_SAVE_OFFSET, 64); ++ ++ cpu_features->xsave_state_size ++ = xsave_state_full_size; ++ cpu_features->xsave_state_full_size ++ = xsave_state_full_size; ++ ++ __cpuid_count (0xd, 1, eax, ebx, ecx, edx); ++ ++ /* Check if XSAVEC is available. */ ++ if ((eax & (1 << 1)) != 0) ++ { ++ unsigned int xstate_comp_offsets[32]; ++ unsigned int xstate_comp_sizes[32]; ++ unsigned int i; ++ ++ xstate_comp_offsets[0] = 0; ++ xstate_comp_offsets[1] = 160; ++ xstate_comp_offsets[2] = 576; ++ xstate_comp_sizes[0] = 160; ++ xstate_comp_sizes[1] = 256; ++ ++ for (i = 2; i < 32; i++) ++ { ++ if ((STATE_SAVE_MASK & (1 << i)) != 0) ++ { ++ __cpuid_count (0xd, i, eax, ebx, ecx, edx); ++ xstate_comp_sizes[i] = eax; ++ } ++ else ++ { ++ ecx = 0; ++ xstate_comp_sizes[i] = 0; ++ } ++ ++ if (i > 2) ++ { ++ xstate_comp_offsets[i] ++ = (xstate_comp_offsets[i - 1] ++ + xstate_comp_sizes[i -1]); ++ if ((ecx & (1 << 1)) != 0) ++ xstate_comp_offsets[i] ++ = ALIGN_UP (xstate_comp_offsets[i], 64); ++ } ++ } ++ ++ /* Use XSAVEC. */ ++ unsigned int size ++ = xstate_comp_offsets[31] + xstate_comp_sizes[31]; ++ if (size) ++ { ++ cpu_features->xsave_state_size ++ = ALIGN_UP (size + STATE_SAVE_OFFSET, 64); ++ cpu_features->feature[index_arch_XSAVEC_Usable] ++ |= bit_arch_XSAVEC_Usable; ++ } ++ } ++ } ++ } + } + } + +@@ -242,20 +313,6 @@ init_cpu_features (struct cpu_features *cpu_features) + else + cpu_features->feature[index_arch_Prefer_No_AVX512] + |= bit_arch_Prefer_No_AVX512; +- +- /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow. +- If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */ +- cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow] +- |= bit_arch_Use_dl_runtime_resolve_slow; +- if (cpu_features->max_cpuid >= 0xd) +- { +- unsigned int eax; +- +- __cpuid_count (0xd, 1, eax, ebx, ecx, edx); +- if ((eax & (1 << 2)) != 0) +- cpu_features->feature[index_arch_Use_dl_runtime_resolve_opt] +- |= bit_arch_Use_dl_runtime_resolve_opt; +- } + } + /* This spells out "AuthenticAMD". */ + else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65) +@@ -332,8 +389,6 @@ no_cpuid: + #endif + + /* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. */ +- GLRO(dl_platform) = NULL; +- GLRO(dl_hwcap) = 0; + #if !HAVE_TUNABLES && defined SHARED + /* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do + this. */ +@@ -341,15 +396,18 @@ no_cpuid: + #endif + + #ifdef __x86_64__ ++ GLRO(dl_hwcap) = HWCAP_X86_64; + if (cpu_features->kind == arch_kind_intel) + { ++ const char *platform = NULL; ++ + if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) + && CPU_FEATURES_CPU_P (cpu_features, AVX512CD)) + { + if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER)) + { + if (CPU_FEATURES_CPU_P (cpu_features, AVX512PF)) +- GLRO(dl_platform) = "xeon_phi"; ++ platform = "xeon_phi"; + } + else + { +@@ -360,7 +418,7 @@ no_cpuid: + } + } + +- if (GLRO(dl_platform) == NULL ++ if (platform == NULL + && CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable) + && CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable) + && CPU_FEATURES_CPU_P (cpu_features, BMI1) +@@ -368,9 +426,13 @@ no_cpuid: + && CPU_FEATURES_CPU_P (cpu_features, LZCNT) + && CPU_FEATURES_CPU_P (cpu_features, MOVBE) + && CPU_FEATURES_CPU_P (cpu_features, POPCNT)) +- GLRO(dl_platform) = "haswell"; ++ platform = "haswell"; ++ ++ if (platform != NULL) ++ GLRO(dl_platform) = platform; + } + #else ++ GLRO(dl_hwcap) = 0; + if (CPU_FEATURES_CPU_P (cpu_features, SSE2)) + GLRO(dl_hwcap) |= HWCAP_X86_SSE2; + +diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h +index 3ed67f5800..1d88f7a68c 100644 +--- a/sysdeps/x86/cpu-features.h ++++ b/sysdeps/x86/cpu-features.h +@@ -37,9 +37,8 @@ + #define bit_arch_Prefer_No_VZEROUPPER (1 << 17) + #define bit_arch_Fast_Unaligned_Copy (1 << 18) + #define bit_arch_Prefer_ERMS (1 << 19) +-#define bit_arch_Use_dl_runtime_resolve_opt (1 << 20) +-#define bit_arch_Use_dl_runtime_resolve_slow (1 << 21) +-#define bit_arch_Prefer_No_AVX512 (1 << 22) ++#define bit_arch_Prefer_No_AVX512 (1 << 20) ++#define bit_arch_XSAVEC_Usable (1 << 21) + + /* CPUID Feature flags. */ + +@@ -88,6 +87,15 @@ + /* The current maximum size of the feature integer bit array. */ + #define FEATURE_INDEX_MAX 1 + ++/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need ++ space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be ++ aligned to 16 bytes for fxsave and 64 bytes for xsave. */ ++#define STATE_SAVE_OFFSET (8 * 7 + 8) ++ ++/* Save SSE, AVX, AVX512, mask and bound registers. */ ++#define STATE_SAVE_MASK \ ++ ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7)) ++ + #ifdef __ASSEMBLER__ + + # include +@@ -123,8 +131,6 @@ + # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1*FEATURE_SIZE + # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1*FEATURE_SIZE + # define index_arch_Prefer_ERMS FEATURE_INDEX_1*FEATURE_SIZE +-# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1*FEATURE_SIZE +-# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1*FEATURE_SIZE + # define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1*FEATURE_SIZE + + +@@ -214,6 +220,18 @@ struct cpu_features + } cpuid[COMMON_CPUID_INDEX_MAX]; + unsigned int family; + unsigned int model; ++ /* The state size for XSAVEC or XSAVE. The type must be unsigned long ++ int so that we use ++ ++ sub xsave_state_size_offset(%rip) %RSP_LP ++ ++ in _dl_runtime_resolve. */ ++ unsigned long int xsave_state_size; ++ /* The full state size for XSAVE when XSAVEC is disabled by ++ ++ GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable ++ */ ++ unsigned int xsave_state_full_size; + unsigned int feature[FEATURE_INDEX_MAX]; + /* Data cache size for use in memory and string routines, typically + L1 size. */ +@@ -326,9 +344,8 @@ extern const struct cpu_features *__get_cpu_features (void) + # define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1 + # define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1 + # define index_arch_Prefer_ERMS FEATURE_INDEX_1 +-# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1 +-# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1 + # define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1 ++# define index_arch_XSAVEC_Usable FEATURE_INDEX_1 + + #endif /* !__ASSEMBLER__ */ + +diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-tunables.c +index 872dd1267f..0488f03d32 100644 +--- a/sysdeps/x86/cpu-tunables.c ++++ b/sysdeps/x86/cpu-tunables.c +@@ -240,6 +240,16 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) + Slow_SSE4_2, SSE4_2, + disable, 11); + break; ++ case 13: ++ if (disable) ++ { ++ /* Update xsave_state_size to XSAVE state size. */ ++ cpu_features->xsave_state_size ++ = cpu_features->xsave_state_full_size; ++ CHECK_GLIBC_IFUNC_ARCH_OFF (n, cpu_features, ++ XSAVEC_Usable, 13); ++ } ++ break; + case 14: + if (disable) + { +@@ -308,13 +318,6 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) + disable, 26); + } + break; +- case 27: +- { +- CHECK_GLIBC_IFUNC_ARCH_BOTH (n, cpu_features, +- Use_dl_runtime_resolve_slow, +- disable, 27); +- } +- break; + } + p += len + 1; + } +diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h +index c95668415a..38627e9eef 100644 +--- a/sysdeps/x86/dl-hwcap.h ++++ b/sysdeps/x86/dl-hwcap.h +@@ -24,15 +24,16 @@ + # define HWCAP_PLATFORMS_START 0 + # define HWCAP_PLATFORMS_COUNT 4 + # define HWCAP_START 0 +-# define HWCAP_COUNT 2 +-# define HWCAP_IMPORTANT (HWCAP_X86_SSE2 | HWCAP_X86_AVX512_1) ++# define HWCAP_COUNT 3 ++# define HWCAP_IMPORTANT \ ++ (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1) + #elif defined __x86_64__ + /* For 64 bit, only cover x86-64 platforms and capabilities. */ + # define HWCAP_PLATFORMS_START 2 + # define HWCAP_PLATFORMS_COUNT 4 + # define HWCAP_START 1 +-# define HWCAP_COUNT 2 +-# define HWCAP_IMPORTANT (HWCAP_X86_AVX512_1) ++# define HWCAP_COUNT 3 ++# define HWCAP_IMPORTANT (HWCAP_X86_64 | HWCAP_X86_AVX512_1) + #else + /* For 32 bit, only cover i586, i686 and SSE2. */ + # define HWCAP_PLATFORMS_START 0 +@@ -45,7 +46,8 @@ + enum + { + HWCAP_X86_SSE2 = 1 << 0, +- HWCAP_X86_AVX512_1 = 1 << 1 ++ HWCAP_X86_64 = 1 << 1, ++ HWCAP_X86_AVX512_1 = 1 << 2 + }; + + static inline const char * +diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c +index 43ab8fe25b..0192feb850 100644 +--- a/sysdeps/x86/dl-procinfo.c ++++ b/sysdeps/x86/dl-procinfo.c +@@ -58,11 +58,11 @@ PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features + #if !defined PROCINFO_DECL && defined SHARED + ._dl_x86_hwcap_flags + #else +-PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][9] ++PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9] + #endif + #ifndef PROCINFO_DECL + = { +- "sse2", "avx512_1" ++ "sse2", "x86_64", "avx512_1" + } + #endif + #if !defined SHARED || defined PROCINFO_DECL +diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h +index fd86806800..74d5f6d6e8 100644 +--- a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h ++++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h +@@ -51,6 +51,13 @@ + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 1 ++#ifdef __x86_64__ ++# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 ++# define __PTHREAD_MUTEX_USE_UNION 0 ++#else ++# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 ++# define __PTHREAD_MUTEX_USE_UNION 1 ++#endif + + #define __LOCK_ALIGNMENT + #define __ONCE_ALIGNMENT +diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile +index 132470d9cb..a7e26ac485 100644 +--- a/sysdeps/x86_64/Makefile ++++ b/sysdeps/x86_64/Makefile +@@ -52,6 +52,31 @@ $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o + CFLAGS-tst-quad1pie.c = $(PIE-ccflag) + CFLAGS-tst-quad2pie.c = $(PIE-ccflag) + ++tests += tst-x86_64-1 ++modules-names += x86_64/tst-x86_64mod-1 ++LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so ++ifneq (no,$(have-tunables)) ++# Test the state size for XSAVE when XSAVEC is disabled. ++tst-x86_64-1-ENV = GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable ++endif ++ ++$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so ++ ++ifneq (no,$(have-tunables)) ++tests += tst-platform-1 ++modules-names += tst-platformmod-1 x86_64/tst-platformmod-2 ++CFLAGS-tst-platform-1.c = -mno-avx ++CFLAGS-tst-platformmod-1.c = -mno-avx ++CFLAGS-tst-platformmod-2.c = -mno-avx ++LDFLAGS-tst-platformmod-2.so = -Wl,-soname,tst-platformmod-2.so ++$(objpfx)tst-platform-1: $(objpfx)tst-platformmod-1.so ++$(objpfx)tst-platform-1.out: $(objpfx)x86_64/tst-platformmod-2.so ++# Turn off AVX512F_Usable and AVX2_Usable so that GLRO(dl_platform) is ++# always set to x86_64. ++tst-platform-1-ENV = LD_PRELOAD=$(objpfx)\$$PLATFORM/tst-platformmod-2.so \ ++ GLIBC_TUNABLES=glibc.tune.hwcaps=-AVX512F_Usable,-AVX2_Usable ++endif ++ + tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \ + tst-audit10 tst-sse tst-avx tst-avx512 + test-extras += tst-audit4-aux tst-audit10-aux \ +@@ -122,3 +147,19 @@ endif + ifeq ($(subdir),csu) + gen-as-const-headers += tlsdesc.sym rtld-offsets.sym + endif ++ ++$(objpfx)x86_64/tst-x86_64mod-1.os: $(objpfx)tst-x86_64mod-1.os ++ $(make-target-directory) ++ rm -f $@ ++ ln $< $@ ++ ++do-tests-clean common-mostlyclean: tst-x86_64-1-clean ++ ++.PHONY: tst-x86_64-1-clean ++tst-x86_64-1-clean: ++ -rm -rf $(objpfx)x86_64 ++ ++$(objpfx)x86_64/tst-platformmod-2.os: $(objpfx)tst-platformmod-2.os ++ $(make-target-directory) ++ rm -f $@ ++ ln $< $@ +diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h +index 6a04cbcdc9..905a37a5cc 100644 +--- a/sysdeps/x86_64/dl-machine.h ++++ b/sysdeps/x86_64/dl-machine.h +@@ -66,12 +66,9 @@ static inline int __attribute__ ((unused, always_inline)) + elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) + { + Elf64_Addr *got; +- extern void _dl_runtime_resolve_sse (ElfW(Word)) attribute_hidden; +- extern void _dl_runtime_resolve_avx (ElfW(Word)) attribute_hidden; +- extern void _dl_runtime_resolve_avx_slow (ElfW(Word)) attribute_hidden; +- extern void _dl_runtime_resolve_avx_opt (ElfW(Word)) attribute_hidden; +- extern void _dl_runtime_resolve_avx512 (ElfW(Word)) attribute_hidden; +- extern void _dl_runtime_resolve_avx512_opt (ElfW(Word)) attribute_hidden; ++ extern void _dl_runtime_resolve_fxsave (ElfW(Word)) attribute_hidden; ++ extern void _dl_runtime_resolve_xsave (ElfW(Word)) attribute_hidden; ++ extern void _dl_runtime_resolve_xsavec (ElfW(Word)) attribute_hidden; + extern void _dl_runtime_profile_sse (ElfW(Word)) attribute_hidden; + extern void _dl_runtime_profile_avx (ElfW(Word)) attribute_hidden; + extern void _dl_runtime_profile_avx512 (ElfW(Word)) attribute_hidden; +@@ -120,29 +117,14 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) + /* This function will get called to fix up the GOT entry + indicated by the offset on the stack, and then jump to + the resolved address. */ +- if (HAS_ARCH_FEATURE (AVX512F_Usable)) +- { +- if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) +- *(ElfW(Addr) *) (got + 2) +- = (ElfW(Addr)) &_dl_runtime_resolve_avx512_opt; +- else +- *(ElfW(Addr) *) (got + 2) +- = (ElfW(Addr)) &_dl_runtime_resolve_avx512; +- } +- else if (HAS_ARCH_FEATURE (AVX_Usable)) +- { +- if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt)) +- *(ElfW(Addr) *) (got + 2) +- = (ElfW(Addr)) &_dl_runtime_resolve_avx_opt; +- else if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_slow)) +- *(ElfW(Addr) *) (got + 2) +- = (ElfW(Addr)) &_dl_runtime_resolve_avx_slow; +- else +- *(ElfW(Addr) *) (got + 2) +- = (ElfW(Addr)) &_dl_runtime_resolve_avx; +- } ++ if (GLRO(dl_x86_cpu_features).xsave_state_size != 0) ++ *(ElfW(Addr) *) (got + 2) ++ = (HAS_ARCH_FEATURE (XSAVEC_Usable) ++ ? (ElfW(Addr)) &_dl_runtime_resolve_xsavec ++ : (ElfW(Addr)) &_dl_runtime_resolve_xsave); + else +- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_sse; ++ *(ElfW(Addr) *) (got + 2) ++ = (ElfW(Addr)) &_dl_runtime_resolve_fxsave; + } + } + +diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S +index c14c61aa58..a645572e44 100644 +--- a/sysdeps/x86_64/dl-trampoline.S ++++ b/sysdeps/x86_64/dl-trampoline.S +@@ -34,41 +34,24 @@ + # define DL_STACK_ALIGNMENT 8 + #endif + +-#ifndef DL_RUNTIME_UNALIGNED_VEC_SIZE +-/* The maximum size in bytes of unaligned vector load and store in the +- dynamic linker. Since SSE optimized memory/string functions with +- aligned SSE register load and store are used in the dynamic linker, +- we must set this to 8 so that _dl_runtime_resolve_sse will align the +- stack before calling _dl_fixup. */ +-# define DL_RUNTIME_UNALIGNED_VEC_SIZE 8 +-#endif +- +-/* True if _dl_runtime_resolve should align stack to VEC_SIZE bytes. */ ++/* True if _dl_runtime_resolve should align stack for STATE_SAVE or align ++ stack to 16 bytes before calling _dl_fixup. */ + #define DL_RUNTIME_RESOLVE_REALIGN_STACK \ +- (VEC_SIZE > DL_STACK_ALIGNMENT \ +- && VEC_SIZE > DL_RUNTIME_UNALIGNED_VEC_SIZE) +- +-/* Align vector register save area to 16 bytes. */ +-#define REGISTER_SAVE_VEC_OFF 0 ++ (STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \ ++ || 16 > DL_STACK_ALIGNMENT) + + /* Area on stack to save and restore registers used for parameter + passing when calling _dl_fixup. */ + #ifdef __ILP32__ +-# define REGISTER_SAVE_RAX (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 8) + # define PRESERVE_BND_REGS_PREFIX + #else +-/* Align bound register save area to 16 bytes. */ +-# define REGISTER_SAVE_BND0 (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 8) +-# define REGISTER_SAVE_BND1 (REGISTER_SAVE_BND0 + 16) +-# define REGISTER_SAVE_BND2 (REGISTER_SAVE_BND1 + 16) +-# define REGISTER_SAVE_BND3 (REGISTER_SAVE_BND2 + 16) +-# define REGISTER_SAVE_RAX (REGISTER_SAVE_BND3 + 16) + # ifdef HAVE_MPX_SUPPORT + # define PRESERVE_BND_REGS_PREFIX bnd + # else + # define PRESERVE_BND_REGS_PREFIX .byte 0xf2 + # endif + #endif ++#define REGISTER_SAVE_RAX 0 + #define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8) + #define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8) + #define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8) +@@ -80,68 +63,56 @@ + + #define VEC_SIZE 64 + #define VMOVA vmovdqa64 +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT +-# define VMOV vmovdqa64 +-#else +-# define VMOV vmovdqu64 +-#endif + #define VEC(i) zmm##i +-#define _dl_runtime_resolve _dl_runtime_resolve_avx512 + #define _dl_runtime_profile _dl_runtime_profile_avx512 + #include "dl-trampoline.h" +-#undef _dl_runtime_resolve + #undef _dl_runtime_profile + #undef VEC +-#undef VMOV + #undef VMOVA + #undef VEC_SIZE + + #define VEC_SIZE 32 + #define VMOVA vmovdqa +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT +-# define VMOV vmovdqa +-#else +-# define VMOV vmovdqu +-#endif + #define VEC(i) ymm##i +-#define _dl_runtime_resolve _dl_runtime_resolve_avx +-#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx_opt + #define _dl_runtime_profile _dl_runtime_profile_avx + #include "dl-trampoline.h" +-#undef _dl_runtime_resolve +-#undef _dl_runtime_resolve_opt + #undef _dl_runtime_profile + #undef VEC +-#undef VMOV + #undef VMOVA + #undef VEC_SIZE + + /* movaps/movups is 1-byte shorter. */ + #define VEC_SIZE 16 + #define VMOVA movaps +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT +-# define VMOV movaps +-#else +-# define VMOV movups +-#endif + #define VEC(i) xmm##i +-#define _dl_runtime_resolve _dl_runtime_resolve_sse + #define _dl_runtime_profile _dl_runtime_profile_sse + #undef RESTORE_AVX + #include "dl-trampoline.h" +-#undef _dl_runtime_resolve + #undef _dl_runtime_profile +-#undef VMOV ++#undef VEC + #undef VMOVA ++#undef VEC_SIZE + +-/* Used by _dl_runtime_resolve_avx_opt/_dl_runtime_resolve_avx512_opt +- to preserve the full vector registers with zero upper bits. */ +-#define VMOVA vmovdqa +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT +-# define VMOV vmovdqa +-#else +-# define VMOV vmovdqu +-#endif +-#define _dl_runtime_resolve _dl_runtime_resolve_sse_vex +-#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt ++#define USE_FXSAVE ++#define STATE_SAVE_ALIGNMENT 16 ++#define _dl_runtime_resolve _dl_runtime_resolve_fxsave ++#include "dl-trampoline.h" ++#undef _dl_runtime_resolve ++#undef USE_FXSAVE ++#undef STATE_SAVE_ALIGNMENT ++ ++#define USE_XSAVE ++#define STATE_SAVE_ALIGNMENT 64 ++#define _dl_runtime_resolve _dl_runtime_resolve_xsave ++#include "dl-trampoline.h" ++#undef _dl_runtime_resolve ++#undef USE_XSAVE ++#undef STATE_SAVE_ALIGNMENT ++ ++#define USE_XSAVEC ++#define STATE_SAVE_ALIGNMENT 64 ++#define _dl_runtime_resolve _dl_runtime_resolve_xsavec + #include "dl-trampoline.h" ++#undef _dl_runtime_resolve ++#undef USE_XSAVEC ++#undef STATE_SAVE_ALIGNMENT +diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h +index 8db24c16ac..9ddaafee17 100644 +--- a/sysdeps/x86_64/dl-trampoline.h ++++ b/sysdeps/x86_64/dl-trampoline.h +@@ -16,140 +16,47 @@ + License along with the GNU C Library; if not, see + . */ + +-#undef REGISTER_SAVE_AREA_RAW +-#ifdef __ILP32__ +-/* X32 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as VEC0 to +- VEC7. */ +-# define REGISTER_SAVE_AREA_RAW (8 * 7 + VEC_SIZE * 8) +-#else +-/* X86-64 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as +- BND0, BND1, BND2, BND3 and VEC0 to VEC7. */ +-# define REGISTER_SAVE_AREA_RAW (8 * 7 + 16 * 4 + VEC_SIZE * 8) +-#endif ++ .text ++#ifdef _dl_runtime_resolve + +-#undef REGISTER_SAVE_AREA +-#undef LOCAL_STORAGE_AREA +-#undef BASE +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK +-# define REGISTER_SAVE_AREA (REGISTER_SAVE_AREA_RAW + 8) +-/* Local stack area before jumping to function address: RBX. */ +-# define LOCAL_STORAGE_AREA 8 +-# define BASE rbx +-# if (REGISTER_SAVE_AREA % VEC_SIZE) != 0 +-# error REGISTER_SAVE_AREA must be multples of VEC_SIZE +-# endif +-#else +-# define REGISTER_SAVE_AREA REGISTER_SAVE_AREA_RAW +-/* Local stack area before jumping to function address: All saved +- registers. */ +-# define LOCAL_STORAGE_AREA REGISTER_SAVE_AREA +-# define BASE rsp +-# if (REGISTER_SAVE_AREA % 16) != 8 +-# error REGISTER_SAVE_AREA must be odd multples of 8 ++# undef REGISTER_SAVE_AREA ++# undef LOCAL_STORAGE_AREA ++# undef BASE ++ ++# if (STATE_SAVE_ALIGNMENT % 16) != 0 ++# error STATE_SAVE_ALIGNMENT must be multples of 16 + # endif +-#endif + +- .text +-#ifdef _dl_runtime_resolve_opt +-/* Use the smallest vector registers to preserve the full YMM/ZMM +- registers to avoid SSE transition penalty. */ +- +-# if VEC_SIZE == 32 +-/* Check if the upper 128 bits in %ymm0 - %ymm7 registers are non-zero +- and preserve %xmm0 - %xmm7 registers with the zero upper bits. Since +- there is no SSE transition penalty on AVX512 processors which don't +- support XGETBV with ECX == 1, _dl_runtime_resolve_avx512_slow isn't +- provided. */ +- .globl _dl_runtime_resolve_avx_slow +- .hidden _dl_runtime_resolve_avx_slow +- .type _dl_runtime_resolve_avx_slow, @function +- .align 16 +-_dl_runtime_resolve_avx_slow: +- cfi_startproc +- cfi_adjust_cfa_offset(16) # Incorporate PLT +- vorpd %ymm0, %ymm1, %ymm8 +- vorpd %ymm2, %ymm3, %ymm9 +- vorpd %ymm4, %ymm5, %ymm10 +- vorpd %ymm6, %ymm7, %ymm11 +- vorpd %ymm8, %ymm9, %ymm9 +- vorpd %ymm10, %ymm11, %ymm10 +- vpcmpeqd %xmm8, %xmm8, %xmm8 +- vorpd %ymm9, %ymm10, %ymm10 +- vptest %ymm10, %ymm8 +- # Preserve %ymm0 - %ymm7 registers if the upper 128 bits of any +- # %ymm0 - %ymm7 registers aren't zero. +- PRESERVE_BND_REGS_PREFIX +- jnc _dl_runtime_resolve_avx +- # Use vzeroupper to avoid SSE transition penalty. +- vzeroupper +- # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits +- # when the upper 128 bits of %ymm0 - %ymm7 registers are zero. +- PRESERVE_BND_REGS_PREFIX +- jmp _dl_runtime_resolve_sse_vex +- cfi_adjust_cfa_offset(-16) # Restore PLT adjustment +- cfi_endproc +- .size _dl_runtime_resolve_avx_slow, .-_dl_runtime_resolve_avx_slow ++# if (STATE_SAVE_OFFSET % STATE_SAVE_ALIGNMENT) != 0 ++# error STATE_SAVE_OFFSET must be multples of STATE_SAVE_ALIGNMENT + # endif + +-/* Use XGETBV with ECX == 1 to check which bits in vector registers are +- non-zero and only preserve the non-zero lower bits with zero upper +- bits. */ +- .globl _dl_runtime_resolve_opt +- .hidden _dl_runtime_resolve_opt +- .type _dl_runtime_resolve_opt, @function +- .align 16 +-_dl_runtime_resolve_opt: +- cfi_startproc +- cfi_adjust_cfa_offset(16) # Incorporate PLT +- pushq %rax +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%rax, 0) +- pushq %rcx +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%rcx, 0) +- pushq %rdx +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%rdx, 0) +- movl $1, %ecx +- xgetbv +- movl %eax, %r11d +- popq %rdx +- cfi_adjust_cfa_offset(-8) +- cfi_restore (%rdx) +- popq %rcx +- cfi_adjust_cfa_offset(-8) +- cfi_restore (%rcx) +- popq %rax +- cfi_adjust_cfa_offset(-8) +- cfi_restore (%rax) +-# if VEC_SIZE == 32 +- # For YMM registers, check if YMM state is in use. +- andl $bit_YMM_state, %r11d +- # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits if +- # YMM state isn't in use. +- PRESERVE_BND_REGS_PREFIX +- jz _dl_runtime_resolve_sse_vex +-# elif VEC_SIZE == 16 +- # For ZMM registers, check if YMM state and ZMM state are in +- # use. +- andl $(bit_YMM_state | bit_ZMM0_15_state), %r11d +- cmpl $bit_YMM_state, %r11d +- # Preserve %zmm0 - %zmm7 registers if ZMM state is in use. +- PRESERVE_BND_REGS_PREFIX +- jg _dl_runtime_resolve_avx512 +- # Preserve %ymm0 - %ymm7 registers with the zero upper 256 bits if +- # ZMM state isn't in use. +- PRESERVE_BND_REGS_PREFIX +- je _dl_runtime_resolve_avx +- # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if +- # neither YMM state nor ZMM state are in use. ++# if DL_RUNTIME_RESOLVE_REALIGN_STACK ++/* Local stack area before jumping to function address: RBX. */ ++# define LOCAL_STORAGE_AREA 8 ++# define BASE rbx ++# ifdef USE_FXSAVE ++/* Use fxsave to save XMM registers. */ ++# define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET) ++# if (REGISTER_SAVE_AREA % 16) != 0 ++# error REGISTER_SAVE_AREA must be multples of 16 ++# endif ++# endif + # else +-# error Unsupported VEC_SIZE! ++# ifndef USE_FXSAVE ++# error USE_FXSAVE must be defined ++# endif ++/* Use fxsave to save XMM registers. */ ++# define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET + 8) ++/* Local stack area before jumping to function address: All saved ++ registers. */ ++# define LOCAL_STORAGE_AREA REGISTER_SAVE_AREA ++# define BASE rsp ++# if (REGISTER_SAVE_AREA % 16) != 8 ++# error REGISTER_SAVE_AREA must be odd multples of 8 ++# endif + # endif +- cfi_adjust_cfa_offset(-16) # Restore PLT adjustment +- cfi_endproc +- .size _dl_runtime_resolve_opt, .-_dl_runtime_resolve_opt +-#endif ++ + .globl _dl_runtime_resolve + .hidden _dl_runtime_resolve + .type _dl_runtime_resolve, @function +@@ -157,21 +64,30 @@ _dl_runtime_resolve_opt: + cfi_startproc + _dl_runtime_resolve: + cfi_adjust_cfa_offset(16) # Incorporate PLT +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK +-# if LOCAL_STORAGE_AREA != 8 +-# error LOCAL_STORAGE_AREA must be 8 +-# endif ++# if DL_RUNTIME_RESOLVE_REALIGN_STACK ++# if LOCAL_STORAGE_AREA != 8 ++# error LOCAL_STORAGE_AREA must be 8 ++# endif + pushq %rbx # push subtracts stack by 8. + cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rbx, 0) + mov %RSP_LP, %RBX_LP + cfi_def_cfa_register(%rbx) +- and $-VEC_SIZE, %RSP_LP +-#endif ++ and $-STATE_SAVE_ALIGNMENT, %RSP_LP ++# endif ++# ifdef REGISTER_SAVE_AREA + sub $REGISTER_SAVE_AREA, %RSP_LP +-#if !DL_RUNTIME_RESOLVE_REALIGN_STACK ++# if !DL_RUNTIME_RESOLVE_REALIGN_STACK + cfi_adjust_cfa_offset(REGISTER_SAVE_AREA) +-#endif ++# endif ++# else ++ # Allocate stack space of the required size to save the state. ++# if IS_IN (rtld) ++ sub _rtld_local_ro+RTLD_GLOBAL_RO_DL_X86_CPU_FEATURES_OFFSET+XSAVE_STATE_SIZE_OFFSET(%rip), %RSP_LP ++# else ++ sub _dl_x86_cpu_features+XSAVE_STATE_SIZE_OFFSET(%rip), %RSP_LP ++# endif ++# endif + # Preserve registers otherwise clobbered. + movq %rax, REGISTER_SAVE_RAX(%rsp) + movq %rcx, REGISTER_SAVE_RCX(%rsp) +@@ -180,59 +96,42 @@ _dl_runtime_resolve: + movq %rdi, REGISTER_SAVE_RDI(%rsp) + movq %r8, REGISTER_SAVE_R8(%rsp) + movq %r9, REGISTER_SAVE_R9(%rsp) +- VMOV %VEC(0), (REGISTER_SAVE_VEC_OFF)(%rsp) +- VMOV %VEC(1), (REGISTER_SAVE_VEC_OFF + VEC_SIZE)(%rsp) +- VMOV %VEC(2), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 2)(%rsp) +- VMOV %VEC(3), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 3)(%rsp) +- VMOV %VEC(4), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 4)(%rsp) +- VMOV %VEC(5), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 5)(%rsp) +- VMOV %VEC(6), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 6)(%rsp) +- VMOV %VEC(7), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 7)(%rsp) +-#ifndef __ILP32__ +- # We also have to preserve bound registers. These are nops if +- # Intel MPX isn't available or disabled. +-# ifdef HAVE_MPX_SUPPORT +- bndmov %bnd0, REGISTER_SAVE_BND0(%rsp) +- bndmov %bnd1, REGISTER_SAVE_BND1(%rsp) +- bndmov %bnd2, REGISTER_SAVE_BND2(%rsp) +- bndmov %bnd3, REGISTER_SAVE_BND3(%rsp) ++# ifdef USE_FXSAVE ++ fxsave STATE_SAVE_OFFSET(%rsp) + # else +-# if REGISTER_SAVE_BND0 == 0 +- .byte 0x66,0x0f,0x1b,0x04,0x24 ++ movl $STATE_SAVE_MASK, %eax ++ xorl %edx, %edx ++ # Clear the XSAVE Header. ++# ifdef USE_XSAVE ++ movq %rdx, (STATE_SAVE_OFFSET + 512)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8)(%rsp) ++# endif ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 2)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 3)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 4)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 5)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 6)(%rsp) ++ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 7)(%rsp) ++# ifdef USE_XSAVE ++ xsave STATE_SAVE_OFFSET(%rsp) + # else +- .byte 0x66,0x0f,0x1b,0x44,0x24,REGISTER_SAVE_BND0 ++ xsavec STATE_SAVE_OFFSET(%rsp) + # endif +- .byte 0x66,0x0f,0x1b,0x4c,0x24,REGISTER_SAVE_BND1 +- .byte 0x66,0x0f,0x1b,0x54,0x24,REGISTER_SAVE_BND2 +- .byte 0x66,0x0f,0x1b,0x5c,0x24,REGISTER_SAVE_BND3 + # endif +-#endif + # Copy args pushed by PLT in register. + # %rdi: link_map, %rsi: reloc_index + mov (LOCAL_STORAGE_AREA + 8)(%BASE), %RSI_LP + mov LOCAL_STORAGE_AREA(%BASE), %RDI_LP + call _dl_fixup # Call resolver. + mov %RAX_LP, %R11_LP # Save return value +-#ifndef __ILP32__ +- # Restore bound registers. These are nops if Intel MPX isn't +- # avaiable or disabled. +-# ifdef HAVE_MPX_SUPPORT +- bndmov REGISTER_SAVE_BND3(%rsp), %bnd3 +- bndmov REGISTER_SAVE_BND2(%rsp), %bnd2 +- bndmov REGISTER_SAVE_BND1(%rsp), %bnd1 +- bndmov REGISTER_SAVE_BND0(%rsp), %bnd0 ++ # Get register content back. ++# ifdef USE_FXSAVE ++ fxrstor STATE_SAVE_OFFSET(%rsp) + # else +- .byte 0x66,0x0f,0x1a,0x5c,0x24,REGISTER_SAVE_BND3 +- .byte 0x66,0x0f,0x1a,0x54,0x24,REGISTER_SAVE_BND2 +- .byte 0x66,0x0f,0x1a,0x4c,0x24,REGISTER_SAVE_BND1 +-# if REGISTER_SAVE_BND0 == 0 +- .byte 0x66,0x0f,0x1a,0x04,0x24 +-# else +- .byte 0x66,0x0f,0x1a,0x44,0x24,REGISTER_SAVE_BND0 +-# endif ++ movl $STATE_SAVE_MASK, %eax ++ xorl %edx, %edx ++ xrstor STATE_SAVE_OFFSET(%rsp) + # endif +-#endif +- # Get register content back. + movq REGISTER_SAVE_R9(%rsp), %r9 + movq REGISTER_SAVE_R8(%rsp), %r8 + movq REGISTER_SAVE_RDI(%rsp), %rdi +@@ -240,20 +139,12 @@ _dl_runtime_resolve: + movq REGISTER_SAVE_RDX(%rsp), %rdx + movq REGISTER_SAVE_RCX(%rsp), %rcx + movq REGISTER_SAVE_RAX(%rsp), %rax +- VMOV (REGISTER_SAVE_VEC_OFF)(%rsp), %VEC(0) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE)(%rsp), %VEC(1) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 2)(%rsp), %VEC(2) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 3)(%rsp), %VEC(3) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 4)(%rsp), %VEC(4) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 5)(%rsp), %VEC(5) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 6)(%rsp), %VEC(6) +- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 7)(%rsp), %VEC(7) +-#if DL_RUNTIME_RESOLVE_REALIGN_STACK ++# if DL_RUNTIME_RESOLVE_REALIGN_STACK + mov %RBX_LP, %RSP_LP + cfi_def_cfa_register(%rsp) + movq (%rsp), %rbx + cfi_restore(%rbx) +-#endif ++# endif + # Adjust stack(PLT did 2 pushes) + add $(LOCAL_STORAGE_AREA + 16), %RSP_LP + cfi_adjust_cfa_offset(-(LOCAL_STORAGE_AREA + 16)) +@@ -262,11 +153,9 @@ _dl_runtime_resolve: + jmp *%r11 # Jump to function address. + cfi_endproc + .size _dl_runtime_resolve, .-_dl_runtime_resolve ++#endif + + +-/* To preserve %xmm0 - %xmm7 registers, dl-trampoline.h is included +- twice, for _dl_runtime_resolve_sse and _dl_runtime_resolve_sse_vex. +- But we don't need another _dl_runtime_profile for XMM registers. */ + #if !defined PROF && defined _dl_runtime_profile + # if (LR_VECTOR_OFFSET % VEC_SIZE) != 0 + # error LR_VECTOR_OFFSET must be multples of VEC_SIZE +diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps +index c347642044..e7ec433b7b 100644 +--- a/sysdeps/x86_64/fpu/libm-test-ulps ++++ b/sysdeps/x86_64/fpu/libm-test-ulps +@@ -1305,7 +1305,7 @@ Function: "cos_vlen4_avx2": + double: 2 + + Function: "cos_vlen8": +-double: 1 ++double: 2 + float: 1 + + Function: "cos_vlen8_avx2": +@@ -1733,10 +1733,10 @@ ldouble: 3 + + Function: Imaginary part of "ctan_upward": + double: 2 +-float: 1 ++float: 2 + float128: 5 + idouble: 2 +-ifloat: 1 ++ifloat: 2 + ifloat128: 5 + ildouble: 3 + ldouble: 3 +@@ -2645,7 +2645,7 @@ Function: "sincos_vlen4_avx2": + double: 2 + + Function: "sincos_vlen8": +-double: 1 ++double: 2 + float: 1 + + Function: "sincos_vlen8_avx2": +diff --git a/sysdeps/x86_64/nptl/pthread-offsets.h b/sysdeps/x86_64/nptl/pthread-offsets.h +new file mode 100644 +index 0000000000..16c6b0d9fd +--- /dev/null ++++ b/sysdeps/x86_64/nptl/pthread-offsets.h +@@ -0,0 +1,5 @@ ++#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 ++#define __PTHREAD_MUTEX_KIND_OFFSET 16 ++#define __PTHREAD_MUTEX_SPINS_OFFSET 20 ++#define __PTHREAD_MUTEX_ELISION_OFFSET 22 ++#define __PTHREAD_MUTEX_LIST_OFFSET 24 +diff --git a/sysdeps/x86_64/tst-platform-1.c b/sysdeps/x86_64/tst-platform-1.c +new file mode 100644 +index 0000000000..76a02e4b6d +--- /dev/null ++++ b/sysdeps/x86_64/tst-platform-1.c +@@ -0,0 +1,29 @@ ++/* Test PRELOAD with $PLATFORM. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++extern int preload (void); ++ ++static int ++do_test (void) ++{ ++ return preload () == 0x1234 ? EXIT_SUCCESS : EXIT_FAILURE; ++} ++ ++#include +diff --git a/sysdeps/x86_64/tst-platformmod-1.c b/sysdeps/x86_64/tst-platformmod-1.c +new file mode 100644 +index 0000000000..9ef5e2b5be +--- /dev/null ++++ b/sysdeps/x86_64/tst-platformmod-1.c +@@ -0,0 +1,23 @@ ++/* Test PRELOAD with $PLATFORM. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++int ++preload (void) ++{ ++ return 0; ++} +diff --git a/sysdeps/x86_64/tst-platformmod-2.c b/sysdeps/x86_64/tst-platformmod-2.c +new file mode 100644 +index 0000000000..d0e5103892 +--- /dev/null ++++ b/sysdeps/x86_64/tst-platformmod-2.c +@@ -0,0 +1,23 @@ ++/* Test PRELOAD with $PLATFORM. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++int ++preload (void) ++{ ++ return 0x1234; ++} +diff --git a/sysdeps/x86_64/tst-x86_64-1.c b/sysdeps/x86_64/tst-x86_64-1.c +new file mode 100644 +index 0000000000..ba1a55cdaf +--- /dev/null ++++ b/sysdeps/x86_64/tst-x86_64-1.c +@@ -0,0 +1,26 @@ ++/* Test searching the "x86_64" directory for shared libraries. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++extern void foo (void); ++ ++int ++main (void) ++{ ++ foo (); ++ return 0; ++} +diff --git a/sysdeps/x86_64/tst-x86_64mod-1.c b/sysdeps/x86_64/tst-x86_64mod-1.c +new file mode 100644 +index 0000000000..83dfafb5a8 +--- /dev/null ++++ b/sysdeps/x86_64/tst-x86_64mod-1.c +@@ -0,0 +1,22 @@ ++/* Test searching the "x86_64" directory for shared libraries. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++void ++foo (void) ++{ ++} diff --git a/glibc/glibc-2.20-multilib-dirs.patch b/glibc/glibc-multilib-dirs.patch similarity index 100% rename from glibc/glibc-2.20-multilib-dirs.patch rename to glibc/glibc-multilib-dirs.patch