123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- {% 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
- cat << EOF > join.py
- import os
- import sys
- common = open(sys.argv[1]).read().strip().split('\n')
- special = open(sys.argv[2]).read().strip().split('\n')
- def name(n):
- return os.path.basename(n).split('.')[0]
- sset = frozenset([name(x) for x in special])
- def it_srcs():
- for x in common:
- if name(x) not in sset:
- yield x
- yield from special
- print('\n'.join(sorted(list(it_srcs()))).strip())
- EOF
- ls *.c > common
- echo 'IF (ARCH_AARCH64)'
- echo 'SRCS('
- ls aarch64/*.c aarch64/*.S > special
- python3 join.py common special
- echo ')'
- echo 'ELSEIF (ARCH_X86_64)'
- echo 'SRCS('
- ls x86_64/*.c x86_64/*.S > special
- python3 join.py common special
- echo ')'
- echo 'ELSE()'
- echo 'SRCS('
- cat common | sort
- echo ')'
- echo 'ENDIF()'
- rm join.py common special
- ) >> ya.make
- {% endblock %}
- {% block move_to_output %}
- {{super()}}
- cp -R lib/builtins/* ${OUTPUT}/
- {% endblock %}
- {% block run_license_analyzer %}
- {{super()}}
- sed -e 's|.* LLVM.*||' -i ${OUTPUT}/ya.make
- {% endblock %}
|