[llvm-bugs] [Bug 28712] New: clang still uses compiler-rt symbols on x86_32 when -nodefaultlibs is being used

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 26 05:14:49 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28712

            Bug ID: 28712
           Summary: clang still uses compiler-rt symbols on x86_32 when
                    -nodefaultlibs is being used
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: krejzi at email.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

I'm using clang version 3.9.0 (branches/release_39 276574) on my x86_64 Linux
install, with compiler-rt as the default runtime lib. I use clang for both 32
and 64 bit software (multilib).

There's an issue with programs that specify -nostdlib/-nodefaultlibs and are
built for x86_32 target. The built programs seem to reference the compiler-rt
symbols anyways, and because libclang_rt.builtins isn't being linked in, the
link process fails. The same program doesn't happen for programs built for
x86_64 target using the same compiler.

../coregrind/link_tool_exe_linux 0x38000000 clang     -o memcheck-x86-linux
-m32 -O2 -g -std=gnu99 -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith
-Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual
-Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers
-fno-stack-protector -fno-strict-aliasing -fno-builtin -Wno-cast-align
-Wno-self-assign -Wno-tautological-compare -fomit-frame-pointer -O2 -static
-nodefaultlibs -nostartfiles -u _start  -m32 memcheck_x86_linux-mc_leakcheck.o
memcheck_x86_linux-mc_malloc_wrappers.o memcheck_x86_linux-mc_main.o
memcheck_x86_linux-mc_translate.o memcheck_x86_linux-mc_machine.o
memcheck_x86_linux-mc_errors.o ../coregrind/libcoregrind-x86-linux.a
../VEX/libvex-x86-linux.a
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_execontext.o):
In function `vgPlain_print_ExeContext_stats':
/sources/valgrind-3.11.0/coregrind/m_execontext.c:196: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_libcproc.o):
In function `vgPlain_read_millisecond_timer':
/sources/valgrind-3.11.0/coregrind/m_libcproc.c:953: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_mallocfree.o):
In function `add_one_block_to_stats':
/sources/valgrind-3.11.0/coregrind/m_mallocfree.c:1662: undefined reference to
`__udivdi3'
/sources/valgrind-3.11.0/coregrind/m_mallocfree.c:1662: undefined reference to
`__udivdi3'
../coregrind/libcoregrind-x86-linux.a(libcoregrind_x86_linux_a-m_transtab.o):
In function `vgPlain_print_tt_tc_stats':
/sources/valgrind-3.11.0/coregrind/m_transtab.c:2435: undefined reference to
`__udivdi3'

All those functions are part of compiler-rt's libclang_rt.builtins-i386.a or
the x86_64 counterpart.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160726/b19247ff/attachment.html>


More information about the llvm-bugs mailing list