[LLVMbugs] [Bug 13864] New: [ASan] Use target compiler to build the tests

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 18 04:07:30 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13864

             Bug #: 13864
           Summary: [ASan] Use target compiler to build the tests
           Product: compiler-rt
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: glider at google.com
                CC: chandlerc at gmail.com, kcc at google.com,
                    llvmbugs at cs.uiuc.edu, samsonov at google.com
    Classification: Unclassified


According to
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/CMakeLists.txt?revision=163704&view=markup
and what Alexey told me, ASan tests are now built as follows:

-- gtest is built uninstrumented using the host compiler
-- asan_tests.cc (and other test modules) are built with the target compiler
and -faddress-sanitizer
-- the object files are linked together with ASan runtime library using the
host compiler

I see the following problems here:
-- instrumented code should never be linked with uninstrumented code unless we
can guarantee that non-instrumented static constructors are called before
__asan_init() (otherwise they may call an instrumented function, which will
lead to a crash)
-- we should use -faddress-sanitizer to link the resulting binaries. On
different platforms -faddress-sanitizer may pass different flags to the linker,
so we must test this behavior instead of trying to mimic it.

That said, I believe all our tests need to be built using only the target
compiler. This ideally applies to asan_noinst_test.cc as well: it must have the
static constructors instrumented, although instrumenting memory accesses should
be disabled

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list