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

            Bug ID: 17025
           Summary: [PATCH] Undefined reference in Nolibc build of
                    sanitizers
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 11111
  --> http://llvm.org/bugs/attachment.cgi?id=11111&action=edit
Proposed patch to avoid compiler-generated memset

Looks like my compiler finds sanitizer code to rewrite to memset() which
results in an undefined reference when attempting to build without libc:

FAILED: cd
/home/will/llvm/34-obj/projects/compiler-rt/lib/sanitizer_common/tests &&
/home/will/llvm/34-obj/bin/clang sanitizer_nolibc_test_main.x86_64.o
-Wl,-whole-archive libRTSanitizerCommon.test.nolibc.x86_64.a
-Wl,-no-whole-archive -o
/home/will/llvm/34-obj/projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc
-nostdlib -m64
libRTSanitizerCommon.test.nolibc.x86_64.a(sanitizer_libc.cc.o): In function
`__sanitizer::internal_strncpy(char*, char const*, unsigned long)':
/home/will/llvm/34-src/projects/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc:156:
undefined reference to `memset'
clang-3.3: error: linker command failed with exit code 1 (use -v to see
invocation)

The attached patch resolves the issue by leveraging the existing
internal_memset implementation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to