aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/builtins/.yandex_meta/build.ym
blob: 573546c8a54f332373fcfaf9730c27d7e0699f29 (plain) (blame)
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
{% extends '//builtin/bag.ym' %}

{% block current_version %}16.0.6{% endblock %}

{% block current_url %}
https://github.com/llvm/llvm-project/releases/download/llvmorg-{{self.version().strip()}}/compiler-rt-{{self.version().strip()}}.src.tar.xz
{% endblock %}

{% block patch_source %}
(
cd lib/builtins
rm CMakeLists.txt
rm aarch64/lse.S
sed -e 's|.*zircon/features.h.*||' -i cpu_model.c
sed -e 's|.*sys/byteorder.h.*||' -i int_endianness.h
)
{% endblock %}

{% block ya_make %}
SUBSCRIBER(
    pg
    somov
    g:contrib
    g:cpp-contrib
)

# Check MUSL before NO_PLATFORM() disables it.
IF (MUSL)
    # We use C headers despite NO_PLATFORM, but we do not propagate
    # them with ADDINCL GLOBAL because we do not have an API, and we
    # can not propagate them because libcxx has to put its own
    # includes before musl includes for its include_next to work.
    IF (ARCH_X86_64)
        ADDINCL(
            contrib/libs/musl/arch/x86_64
        )
    ENDIF()

    IF (ARCH_AARCH64)
        ADDINCL(
            contrib/libs/musl/arch/aarch64
        )
    ENDIF()

    ADDINCL(
        contrib/libs/musl/arch/generic
        contrib/libs/musl/include
        contrib/libs/musl/extra
    )
ENDIF()

NO_UTIL()

NO_RUNTIME()

NO_PLATFORM()

NO_COMPILER_WARNINGS()

IF (GCC OR CLANG)
    # Clang (maybe GCC too) LTO code generator leaves the builtin calls unresolved
    # even if they are available. After the code generation pass is done
    # a linker is forced to select original object files from this library again
    # as they contain unresolved symbols. But code generation is already done,
    # object files actually are not ELFs but an LLVM bytecode and we get
    # "member at xxxxx is not an ELF object" errors from the linker.
    # Just generate native code from the beginning.
    NO_LTO()
ENDIF()
{% endblock %}

{% block gen_ya_make %}
(
cd lib/builtins
echo 'SRCS('
ls *.c | sort
echo ')'
echo 'IF (ARCH_AARCH64)'
echo 'SRCS('
ls aarch64/*.c | sort
ls aarch64/*.S | sort
echo ')'
echo 'ENDIF()'
echo 'IF (ARCH_X86_64)'
echo 'SRCS('
ls x86_64/*.c | sort
ls x86_64/*.S | sort
echo ')'
echo 'ENDIF()'
) >> ya.make
{% endblock %}

{% block move_to_output %}
{{super()}}
cp -R lib/builtins/* ${OUTPUT}/
{% endblock %}