Skip to content

Commit 0f71e6e

Browse files
committed
Merge branch 'rightlib' into mergelibs-241008-2121
2 parents ba4af7c + 44c730d commit 0f71e6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1037
-137
lines changed

build/conf/a.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

build/conf/linkers/msvc_linker.conf

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ when ($IDE_MSVS != "yes") {
5151
/LIBPATH:\""${_MSVC_TC_VC_ROOT}/lib/$_MSVC_ARCH"\"
5252
}
5353

54-
when ($WINDOWS_MANIFEST != "") {
55-
_FLAGS_MANIFEST=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
56-
}
57-
otherwise {
58-
_FLAGS_MANIFEST=
59-
}
60-
6154
_FLAGS_COMMON =/NOLOGO /ERRORREPORT:PROMPT /SUBSYSTEM:CONSOLE /TLBID:1 $MSVC_DYNAMICBASE /NXCOMPAT
6255
_FLAGS_COMMON+=$_FLAGS_IGNORE
6356
_FLAGS_COMMON+=$_FLAGS_MACHINE
@@ -107,7 +100,7 @@ LINK_STDLIBS=\
107100
ws2_32.lib
108101

109102
LDFLAGS_GLOBAL=
110-
LDFLAGS=$_FLAGS_MANIFEST
103+
LDFLAGS=
111104
OBJADDE=
112105
OBJADDE_LIB=
113106
OBJADDE_LIB_GLOBAL=

build/conf/ts/ts.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,36 @@ _TS_FILES_COPY_CMD=
183183
### TS_FILES(Files...)
184184
###
185185
### Adds files to output as is. Similar to FILES but works for TS build modules
186+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-files
186187
macro TS_FILES(Files...) {
188+
# TODO: FBP-1795
187189
_TS_FILES($Files)
188190
}
189191

190192
### TS_FILES_GLOB(Glob...)
191193
###
192194
### Adds files to output by glob, e.g. TS_FILES_GLOB(**/*.css)
195+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-files-glob
193196
macro TS_FILES_GLOB(Glob...) {
194197
_GLOB(FILES_BY_GLOB ${Glob})
195198
TS_FILES(${FILES_BY_GLOB})
196199
}
197200

201+
### @usage TS_LARGE_FILES(DESTINATION dest_dir Files...)
202+
###
203+
### Use large file ether from working copy or from remote storage via placeholder <File>.external
204+
### If <File> is present locally (and not a symlink!) it will be copied to build directory.
205+
### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
206+
###
207+
### Then file will be copied to DESTINATION folder preserving file structure.
208+
### Copied file becomes output of TS_PACKAGE
209+
### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-large-files
210+
macro TS_LARGE_FILES(DESTINATION="~~required~~", FILES...) {
211+
LARGE_FILES($FILES)
212+
# TODO: FBP-1795
213+
_TS_LARGE_FILES($DESTINATION $FILES)
214+
}
215+
198216
@import "${CONF_ROOT}/conf/ts/node_modules.conf"
199217
@import "${CONF_ROOT}/conf/ts/ts_next.conf"
200218
@import "${CONF_ROOT}/conf/ts/ts_package.conf"

build/plugins/nots.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"reset": "49",
2929
}
3030

31+
REQUIRED_MISSING = "~~required~~"
32+
3133

3234
class ConsoleColors(dict):
3335
def __init__(self, color_codes):
@@ -884,6 +886,32 @@ def on_ts_files(unit, *files):
884886
unit.set(["_TS_FILES_COPY_CMD", " && ".join(new_cmds)])
885887

886888

889+
@_with_report_configure_error
890+
def on_ts_large_files(unit, destination: str, *files: list[str]):
891+
if destination == REQUIRED_MISSING:
892+
ymake.report_configure_error(
893+
"Macro TS_LARGE_FILES() requires to use DESTINATION parameter.\n"
894+
" TS_LARGE_FILES(\n"
895+
" DESTINATION some_dir\n"
896+
" large/file1\n"
897+
" large/file2\n"
898+
" )\n"
899+
"Docs: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_PACKAGE#ts-large-files."
900+
)
901+
return
902+
903+
# TODO: FBP-1795
904+
# ${BINDIR} prefix for input is important to resove to result of LARGE_FILES and not to SOURCEDIR
905+
new_cmds = [
906+
'$COPY_CMD ${{input;context=TEXT:"${{BINDIR}}/{0}"}} ${{output;noauto:"{1}/{0}"}}'.format(f, destination)
907+
for f in files
908+
]
909+
all_cmds = unit.get("_TS_FILES_COPY_CMD")
910+
if all_cmds:
911+
new_cmds.insert(0, all_cmds)
912+
unit.set(["_TS_FILES_COPY_CMD", " && ".join(new_cmds)])
913+
914+
887915
@_with_report_configure_error
888916
def on_ts_package_check_files(unit):
889917
ts_files = unit.get("_TS_FILES_COPY_CMD")

build/ymake.core.conf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5697,20 +5697,19 @@ when (!$TENSORRT_VERSION) {
56975697
ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
56985698

56995699
# tag:windows-specific
5700-
WINDOWS_MANIFEST=${ARCADIA_ROOT}/build/long-path.manifest
5700+
WINDOWS_MANIFEST=
57015701
macro WINDOWS_MANIFEST(Manifest) {
57025702
SET(WINDOWS_MANIFEST $Manifest)
57035703
}
57045704

5705-
# tag:deprecated
57065705
# https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
57075706
macro WINDOWS_LONG_PATH_MANIFEST() {
5708-
ENABLE(UNUSED_MACRO)
5707+
SET(WINDOWS_MANIFEST build/long-path.manifest)
57095708
}
57105709

57115710
# tag:windows-specific
5712-
macro DISABLE_WINDOWS_MANIFEST() {
5713-
SET(WINDOWS_MANIFEST)
5711+
when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
5712+
LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
57145713
}
57155714

57165715
# tag:cpp-specific
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Files in this directory come from Bob Ippolito's py2app.
2+
3+
License: Any components of the py2app suite may be distributed under
4+
the MIT or PSF open source licenses.
5+
6+
This is version 1.0, SVN revision 789, from 2006/01/25.
7+
The main repository is http://svn.red-bean.com/bob/macholib/trunk/macholib/
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
3+
About
4+
=====
5+
6+
_decimal.c is a wrapper for the libmpdec library. libmpdec is a fast C
7+
library for correctly-rounded arbitrary precision decimal floating point
8+
arithmetic. It is a complete implementation of Mike Cowlishaw/IBM's
9+
General Decimal Arithmetic Specification.
10+
11+
12+
Build process for the module
13+
============================
14+
15+
As usual, the build process for _decimal.so is driven by setup.py in the top
16+
level directory. setup.py autodetects the following build configurations:
17+
18+
1) x64 - 64-bit Python, x86_64 processor (AMD, Intel)
19+
20+
2) uint128 - 64-bit Python, compiler provides __uint128_t (gcc)
21+
22+
3) ansi64 - 64-bit Python, ANSI C
23+
24+
4) ppro - 32-bit Python, x86 CPU, PentiumPro or later
25+
26+
5) ansi32 - 32-bit Python, ANSI C
27+
28+
6) ansi-legacy - 32-bit Python, compiler without uint64_t
29+
30+
7) universal - Mac OS only (multi-arch)
31+
32+
33+
It is possible to override autodetection by exporting:
34+
35+
PYTHON_DECIMAL_WITH_MACHINE=value, where value is one of the above options.
36+
37+
38+
NOTE
39+
====
40+
41+
decimal.so is not built from a static libmpdec.a since doing so led to
42+
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
43+
causes locale problems and more).
44+
45+
46+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
3+
libmpdec
4+
========
5+
6+
libmpdec is a fast C/C++ library for correctly-rounded arbitrary precision
7+
decimal floating point arithmetic. It is a complete implementation of
8+
Mike Cowlishaw/IBM's General Decimal Arithmetic Specification.
9+
10+
11+
Files required for the Python _decimal module
12+
=============================================
13+
14+
Core files for small and medium precision arithmetic
15+
----------------------------------------------------
16+
17+
basearith.{c,h} -> Core arithmetic in base 10**9 or 10**19.
18+
bits.h -> Portable detection of least/most significant one-bit.
19+
constants.{c,h} -> Constants that are used in multiple files.
20+
context.c -> Context functions.
21+
io.{c,h} -> Conversions between mpd_t and ASCII strings,
22+
mpd_t formatting (allows UTF-8 fill character).
23+
mpalloc.{c,h} -> Allocation handlers with overflow detection
24+
and functions for switching between static
25+
and dynamic mpd_t.
26+
mpdecimal.{c,h} -> All (quiet) functions of the specification.
27+
typearith.h -> Fast primitives for double word multiplication,
28+
division etc.
29+
30+
Visual Studio only:
31+
~~~~~~~~~~~~~~~~~~~
32+
vcdiv64.asm -> Double word division used in typearith.h. VS 2008 does
33+
not allow inline asm for x64. Also, it does not provide
34+
an intrinsic for double word division.
35+
36+
Files for bignum arithmetic:
37+
----------------------------
38+
39+
The following files implement the Fast Number Theoretic Transform
40+
used for multiplying coefficients with more than 1024 words (see
41+
mpdecimal.c: _mpd_fntmul()).
42+
43+
umodarith.h -> Fast low level routines for unsigned modular arithmetic.
44+
numbertheory.{c,h} -> Routines for setting up the Number Theoretic Transform.
45+
difradix2.{c,h} -> Decimation in frequency transform, used as the
46+
"base case" by the following three files:
47+
48+
fnt.{c,h} -> Transform arrays up to 4096 words.
49+
sixstep.{c,h} -> Transform larger arrays of length 2**n.
50+
fourstep.{c,h} -> Transform larger arrays of length 3 * 2**n.
51+
52+
convolute.{c,h} -> Fast convolution using one of the three transform
53+
functions.
54+
transpose.{c,h} -> Transpositions needed for the sixstep algorithm.
55+
crt.{c,h} -> Chinese Remainder Theorem: use information from three
56+
transforms modulo three different primes to get the
57+
final result.
58+
59+
60+
Pointers to literature, proofs and more
61+
=======================================
62+
63+
literature/
64+
-----------
65+
66+
REFERENCES.txt -> List of relevant papers.
67+
bignum.txt -> Explanation of the Fast Number Theoretic Transform (FNT).
68+
fnt.py -> Verify constants used in the FNT; Python demo for the
69+
O(N**2) discrete transform.
70+
71+
matrix-transform.txt -> Proof for the Matrix Fourier Transform used in
72+
fourstep.c.
73+
six-step.txt -> Show that the algorithm used in sixstep.c is
74+
a variant of the Matrix Fourier Transform.
75+
mulmod-64.txt -> Proof for the mulmod64 algorithm from
76+
umodarith.h.
77+
mulmod-ppro.txt -> Proof for the x87 FPU modular multiplication
78+
from umodarith.h.
79+
umodarith.lisp -> ACL2 proofs for many functions from umodarith.h.
80+
81+
82+
Library Author
83+
==============
84+
85+
Stefan Krah <skrah@bytereef.org>
86+
87+
88+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Algorithm implementations used by the `hashlib` module.
2+
3+
This code comes from the
4+
[HACL\*](https://github.com/hacl-star/hacl-star/) project.
5+
6+
HACL\* is a cryptographic library that has been formally verified for memory
7+
safety, functional correctness, and secret independence.
8+
9+
## Updating HACL*
10+
11+
Use the `refresh.sh` script in this directory to pull in a new upstream code
12+
version. The upstream git hash used for the most recent code pull is recorded
13+
in the script. Modify the script as needed to bring in more if changes are
14+
needed based on upstream code refactoring.
15+
16+
Never manually edit HACL\* files. Always add transformation shell code to the
17+
`refresh.sh` script to perform any necessary edits. If there are serious code
18+
changes needed, work with the upstream repository.
19+
20+
## Local files
21+
22+
1. `./include/python_hacl_namespaces.h`
23+
1. `./README.md`
24+
1. `./refresh.sh`
25+
26+
## ACKS
27+
28+
* Jonathan Protzenko aka [@msprotz on Github](https://github.com/msprotz)
29+
contributed our HACL\* based builtin code.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Fuzz Tests for CPython
2+
======================
3+
4+
These fuzz tests are designed to be included in Google's `oss-fuzz`_ project.
5+
6+
oss-fuzz works against a library exposing a function of the form
7+
``int LLVMFuzzerTestOneInput(const uint8_t* data, size_t length)``. We provide
8+
that library (``fuzzer.c``), and include a ``_fuzz`` module for testing with
9+
some toy values -- no fuzzing occurs in Python's test suite.
10+
11+
oss-fuzz will regularly pull from CPython, discover all the tests in
12+
``fuzz_tests.txt``, and run them -- so adding a new test here means it will
13+
automatically be run in oss-fuzz, while also being smoke-tested as part of
14+
CPython's test suite.
15+
16+
Adding a new fuzz test
17+
----------------------
18+
19+
Add the test name on a new line in ``fuzz_tests.txt``.
20+
21+
In ``fuzzer.c``, add a function to be run::
22+
23+
int $test_name (const char* data, size_t size) {
24+
...
25+
return 0;
26+
}
27+
28+
29+
And invoke it from ``LLVMFuzzerTestOneInput``::
30+
31+
#if _Py_FUZZ_YES(fuzz_builtin_float)
32+
rv |= _run_fuzz(data, size, fuzz_builtin_float);
33+
#endif
34+
35+
``LLVMFuzzerTestOneInput`` will run in oss-fuzz, with each test in
36+
``fuzz_tests.txt`` run separately.
37+
38+
Seed data (corpus) for the test can be provided in a subfolder called
39+
``<test_name>_corpus`` such as ``fuzz_json_loads_corpus``. A wide variety
40+
of good input samples allows the fuzzer to more easily explore a diverse
41+
set of paths and provides a better base to find buggy input from.
42+
43+
Dictionaries of tokens (see oss-fuzz documentation for more details) can
44+
be placed in the ``dictionaries`` folder with the name of the test.
45+
For example, ``dictionaries/fuzz_json_loads.dict`` contains JSON tokens
46+
to guide the fuzzer.
47+
48+
What makes a good fuzz test
49+
---------------------------
50+
51+
Libraries written in C that might handle untrusted data are worthwhile. The
52+
more complex the logic (e.g. parsing), the more likely this is to be a useful
53+
fuzz test. See the existing examples for reference, and refer to the
54+
`oss-fuzz`_ docs.
55+
56+
.. _oss-fuzz: https://github.com/google/oss-fuzz

0 commit comments

Comments
 (0)