-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmcpp.toml
More file actions
135 lines (125 loc) · 6.09 KB
/
Copy pathmcpp.toml
File metadata and controls
135 lines (125 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# libc++ and libc++abi as a SOURCE package, for a hosted target whose toolchain
# payload cannot supply a static libc++ built for that target.
#
# THE CASE THAT CREATED IT. mcpp's LLVM payload ships libc++ headers, a std
# module source and static archives built for the machine the payload runs on.
# On the iOS rows the archives are macOS objects and ld64 refuses them, so the
# engine linked the SDK's libc++ under the payload's newer headers: an inline
# function in libc++ 22's headers then referenced a symbol the SDK's libc++ 19
# does not export, and a program using std::unordered_map<std::string, int>
# or std::atomic<int>::notify_all failed at link. Measured on Xcode 16.4 with
# llvm 22.1.8 (mcpp-community/mcpp#630).
#
# A standard library is configured for one C library and compiled against its
# headers; a program that merely FINDS headers is not the same thing. This
# package carries the whole library, so that the headers a translation unit is
# compiled against, the module it imports and the objects it links are one
# release by construction. The C library beneath stays the target's own: the
# SDK's libSystem on Apple platforms, glibc or musl on Linux.
#
# THE MECHANISM IS THE ONE `mcpplibs/openkal-llvm-runtime` USES. `provides`
# declares the C++ layer; the engine broadcasts this package's headers to every
# translation unit, adopts its std module over the toolchain's, and resolves
# the distribution contract to self-contained with `-nostdlib++`. Nothing here
# is Apple-specific: libc++ recognises Darwin and glibc by itself, and one
# configuration serves both.
#
# THE NAMESPACE AND THE VERSION ARE UPSTREAM'S, as `llvm.compiler-rt-builtins`
# established: every file under llvm/ is byte-identical to `llvmorg-22.1.8`
# (llvm/UPSTREAM-REV), and the fourth segment is the packaging revision. A
# consumer writes the version out in full, because a bare requirement in mcpp
# is an exact pin and not a caret.
[package]
namespace = "llvm"
name = "libcxx"
version = "22.1.8.2"
description = "libc++ and libc++abi as a source package: the C++ standard library compiled with the consuming program's own flags, for a hosted target whose toolchain payload cannot supply a static libc++ built for it"
license = "Apache-2.0 WITH LLVM-exception"
authors = ["LLVM contributors", "mcpplibs (packaging)"]
repo = "https://github.com/mcpplibs/libcxx"
# The platforms this package is measured on, in mcpp's vocabulary. `linux` is
# measured over glibc on x86_64, `macos` natively on Apple silicon, and `ios`
# on the device row (build) and both simulator rows (build; a run on the
# arm64 simulator). Windows is not claimed: libc++ over the MSVC runtime
# takes a different configuration (`_LIBCPP_HAS_THREAD_API_WIN32`, the
# `src/support/win32` units, `_LIBCPP_NO_VCRUNTIME`), which this package
# does not carry, and a probe job measures that row on request rather than
# asserting it.
platforms = ["linux", "macos", "ios"]
# The C++ layer. The older spelling is kept beside the current one so that an
# engine predating the layer vocabulary still recognises this package; both
# name the same layer.
provides = ["hosted-standard-library", "mcpp:c++-abi=libc++"]
# libc++'s sources, and its std module above all, are compiled by clang.
requires = ["mcpp:compiler=llvm"]
# Where this package's std module sources are. The engine otherwise asks the
# compiler for its own, which is the right question when the standard library
# is the compiler's and the wrong one here.
std-module = "generated/std.cppm"
std-compat-module = "generated/std.compat.cppm"
std-module-flags = [
# The payload's clang++.cfg names a host C library's headers and the
# payload's own libc++; the module must see neither.
"--no-default-config",
"-nostdinc++",
# The module source includes ninety-odd fragments by relative name; they are
# upstream's and unmodified, so the search path names their directory.
"-I", "llvm/libcxx/modules",
]
[build]
cxx_standard = "c++23"
# Order is load-bearing: the generated configuration first, because every
# header of the library includes it; then libc++'s headers, which must precede
# any C library's; then the source-tree headers the .cpp files reach by
# relative name; then llvm-libc's shared floating-point utilities, which
# libc++'s from_chars implementation includes as "shared/...".
include_dirs = [
"generated",
"llvm/libcxx/include",
"llvm/libcxx/src",
"llvm/libcxxabi/include",
"llvm/libcxxabi/src",
"llvm/libc",
]
sources = [
# The Itanium C++ ABI: exception objects, the demangler, guard variables,
# dynamic casts, the terminate handler.
"llvm/libcxxabi/src/*.cpp",
"!llvm/libcxxabi/src/cxa_noexception.cpp",
# `libcxx/src/new.cpp` is the canonical copy of the same code; upstream builds
# the two into separate libraries and links one. One artefact takes one copy.
"!llvm/libcxxabi/src/stdlib_new_delete.cpp",
# The standard library.
"llvm/libcxx/src/*.cpp",
"llvm/libcxx/src/filesystem/*.cpp",
# `__muloti4` and its relatives are the compiler runtime's; the driver links
# them on every hosted target this package serves, and a second definition
# is a duplicate symbol.
"!llvm/libcxx/src/filesystem/int128_builtins.cpp",
"llvm/libcxx/src/ryu/*.cpp",
]
cxxflags = [
"-nostdinc++",
"-D_LIBCPP_BUILDING_LIBRARY",
"-D_LIBCXXABI_BUILDING_LIBRARY",
"-DLIBCXX_BUILDING_LIBCXXABI",
# Hidden visibility for the library's own objects. A second libc++ in one
# process (the system's, loaded by every framework on Apple platforms) is
# kept apart by visibility, not by name: with default visibility dyld unifies
# the two copies and objects freed across them abort in libmalloc.
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-DNDEBUG",
"-fexceptions",
"-frtti",
"-funwind-tables",
"-w",
"-ffunction-sections",
"-fdata-sections",
]
# glibc declares the `*_l` locale functions and `vasprintf` under _GNU_SOURCE;
# clang defines it for C++ on Linux already, and Apple's libSystem ignores it.
[target.'cfg(os = "linux")'.build]
cxxflags = ["-D_GNU_SOURCE"]