Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 172cd765 authored by Dan Albert's avatar Dan Albert Committed by Gerrit Code Review
Browse files

Merge "Allow coverage with clang."

parents 9ba25d6b 2c03e044
Loading
Loading
Loading
Loading
+16 −14
Original line number Original line Diff line number Diff line
@@ -287,20 +287,22 @@ endif # LOCAL_IS_HOST_MODULE
# clean build of your module after toggling it.
# clean build of your module after toggling it.
ifeq ($(NATIVE_COVERAGE),true)
ifeq ($(NATIVE_COVERAGE),true)
    ifeq ($(my_native_coverage),true)
    ifeq ($(my_native_coverage),true)
        # We can't currently generate coverage for clang binaries for two
        my_cflags += --coverage -O0
        # reasons:
        ifeq ($(my_clang),true)
            # b/17574078
            # We currently don't have a prebuilt libclang_rt.profile-<ARCH>.a,
            # which clang is hardcoded to link if --coverage is passed in the
            # link stage.  For now we manually link libprofile_rt (which is the
            # name it is built as from external/compiler-rt).
            #
            #
        # 1) b/17574078 We currently don't have a prebuilt
            # Note that clang coverage doesn't play nicely with acov out of the
        #    libclang_rt.profile-<ARCH>.a, which clang is hardcoded to link if
            # box. Clang apparently generates .gcno files that aren't compatible
        #    --coverage is passed in the link stage. For now we manually link
            # with gcov-4.8.  This can be solved by installing gcc-4.6 and
        #    libprofile_rt (which is the name it is built as from
            # invoking lcov with `--gcov-tool /usr/bin/gcov-4.6`.
        #    external/compiler-rt).
            #
            #
        # 2) b/17583330 Clang doesn't generate .gcno files when using
            # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
        #    -no-integrated-as. Since most of the assembly in our tree is
            my_static_libraries += libprofile_rt
        #    incompatible with clang's assembler, we can't turn off this flag.
        else
        ifneq ($(my_clang),true)
            my_cflags += --coverage -O0
            my_ldflags += --coverage
            my_ldflags += --coverage
        endif
        endif
    endif
    endif