brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.1 KiB · 81dd5b1 Raw
173 lines · c
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___CXX03___CONFIGURATION_ABI_H11#define _LIBCPP___CXX03___CONFIGURATION_ABI_H12 13#include <__cxx03/__configuration/compiler.h>14#include <__cxx03/__configuration/config_site_shim.h>15#include <__cxx03/__configuration/platform.h>16 17#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER18#  pragma GCC system_header19#endif20 21#if _LIBCPP_ABI_VERSION >= 222// Change short string representation so that string data starts at offset 0,23// improving its alignment in some cases.24#  define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT25// Fix deque iterator type in order to support incomplete types.26#  define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE27// Fix undefined behavior in how std::list stores its linked nodes.28#  define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB29// Fix undefined behavior in  how __tree stores its end and parent nodes.30#  define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB31// Fix undefined behavior in how __hash_table stores its pointer types.32#  define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB33#  define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB34#  define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE35// Override the default return value of exception::what() for bad_function_call::what()36// with a string that is specific to bad_function_call (see http://wg21.link/LWG2233).37// This is an ABI break on platforms that sign and authenticate vtable function pointers38// because it changes the mangling of the virtual function located in the vtable, which39// changes how it gets signed.40#  define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE41// Enable optimized version of __do_get_(un)signed which avoids redundant copies.42#  define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET43// Give reverse_iterator<T> one data member of type T, not two.44// Also, in C++17 and later, don't derive iterator types from std::iterator.45#  define _LIBCPP_ABI_NO_ITERATOR_BASES46// Use the smallest possible integer type to represent the index of the variant.47// Previously libc++ used "unsigned int" exclusively.48#  define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION49// Unstable attempt to provide a more optimized std::function50#  define _LIBCPP_ABI_OPTIMIZED_FUNCTION51// All the regex constants must be distinct and nonzero.52#  define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO53// Re-worked external template instantiations for std::string with a focus on54// performance and fast-path inlining.55#  define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION56// Enable clang::trivial_abi on std::unique_ptr.57#  define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI58// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr59#  define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI60// std::random_device holds some state when it uses an implementation that gets61// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this62// implementation to another one on a platform that has already shipped63// std::random_device, one needs to retain the same object layout to remain ABI64// compatible. This switch removes these workarounds for platforms that don't care65// about ABI compatibility.66#  define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT67// Don't export the legacy __basic_string_common class and its methods from the built library.68#  define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON69// Don't export the legacy __vector_base_common class and its methods from the built library.70#  define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON71// According to the Standard, `bitset::operator[] const` returns bool72#  define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL73// Fix the implementation of CityHash used for std::hash<fundamental-type>.74// This is an ABI break because `std::hash` will return a different result,75// which means that hashing the same object in translation units built against76// different versions of libc++ can return inconsistent results. This is especially77// tricky since std::hash is used in the implementation of unordered containers.78//79// The incorrect implementation of CityHash has the problem that it drops some80// bits on the floor.81#  define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION82// Remove the base 10 implementation of std::to_chars from the dylib.83// The implementation moved to the header, but we still export the symbols from84// the dylib for backwards compatibility.85#  define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_1086// Define std::array/std::string_view iterators to be __wrap_iters instead of raw87// pointers, which prevents people from relying on a non-portable implementation88// detail. This is especially useful because enabling bounded iterators hardening89// requires code not to make these assumptions.90#  define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY91#  define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW92// Dont' add an inline namespace for `std::filesystem`93#  define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE94// std::basic_ios uses WEOF to indicate that the fill value is95// uninitialized. However, on platforms where the size of char_type is96// equal to or greater than the size of int_type and char_type is unsigned,97// std::char_traits<char_type>::eq_int_type() cannot distinguish between WEOF98// and WCHAR_MAX. This ABI setting determines whether we should instead track whether the fill99// value has been initialized using a separate boolean, which changes the ABI.100#  define _LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE101// Make a std::pair of trivially copyable types trivially copyable.102// While this technically doesn't change the layout of pair itself, other types may decide to programatically change103// their representation based on whether something is trivially copyable.104#  define _LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR105#elif _LIBCPP_ABI_VERSION == 1106#  if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))107// Enable compiling copies of now inline methods into the dylib to support108// applications compiled against older libraries. This is unnecessary with109// COFF dllexport semantics, since dllexport forces a non-inline definition110// of inline functions to be emitted anyway. Our own non-inline copy would111// conflict with the dllexport-emitted copy, so we disable it. For XCOFF,112// the linker will take issue with the symbols in the shared object if the113// weak inline methods get visibility (such as from -fvisibility-inlines-hidden),114// so disable it.115#    define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS116#  endif117// Feature macros for disabling pre ABI v1 features. All of these options118// are deprecated.119#  if defined(__FreeBSD__)120#    define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR121#  endif122#endif123 124// We had some bugs where we use [[no_unique_address]] together with construct_at,125// which causes UB as the call on construct_at could write to overlapping subobjects126//127// https://github.com/llvm/llvm-project/issues/70506128// https://github.com/llvm/llvm-project/issues/70494129//130// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions.131// The macro below is used for all classes whose ABI have changed as part of fixing these bugs.132#define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua")))133 134// Changes the iterator type of select containers (see below) to a bounded iterator that keeps track of whether it's135// within the bounds of the original container and asserts it on every dereference.136//137// ABI impact: changes the iterator type of the relevant containers.138//139// Supported containers:140// - `span`;141// - `string_view`.142// #define _LIBCPP_ABI_BOUNDED_ITERATORS143 144// Changes the iterator type of `basic_string` to a bounded iterator that keeps track of whether it's within the bounds145// of the original container and asserts it on every dereference and when performing iterator arithmetics.146//147// ABI impact: changes the iterator type of `basic_string` and its specializations, such as `string` and `wstring`.148// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING149 150// Changes the iterator type of `vector` to a bounded iterator that keeps track of whether it's within the bounds of the151// original container and asserts it on every dereference and when performing iterator arithmetics. Note: this doesn't152// yet affect `vector<bool>`.153//154// ABI impact: changes the iterator type of `vector` (except `vector<bool>`).155// #define _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR156 157#if defined(_LIBCPP_COMPILER_CLANG_BASED)158#  if defined(__APPLE__)159#    if defined(__i386__) || defined(__x86_64__)160// use old string layout on x86_64 and i386161#    elif defined(__arm__)162// use old string layout on arm (which does not include aarch64/arm64), except on watch ABIs163#      if defined(__ARM_ARCH_7K__) && __ARM_ARCH_7K__ >= 2164#        define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT165#      endif166#    else167#      define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT168#    endif169#  endif170#endif171 172#endif // _LIBCPP___CXX03___CONFIGURATION_ABI_H173