[PATCH] D58184: [scudo][standalone] Introduce platform specific code & mutexes
Brian Rzycki via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 11:19:24 PST 2019
brzycki added a comment.
Hello @cryptoad , I am seeing compiler build failures starting with the commit for this patch (sha 41aba567d991c2bd551c <https://reviews.llvm.org/rG41aba567d991c2bd551c72c73b8f76f2de392984> ).
There are actually two breaks I've seen. The first is a linker error when attempting to add i386 and x86_64 objects together on an Ubuntu 18.04 LTS host:
[1840/4478] : && /usr/bin/clang++-6.0 -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-string
s -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-con
version -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O3 -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libRTScudoStandalone.test.i386.so -o
lib/libRTScudoStandalone.test.i386.so projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/common.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoS
tandalone.i386.dir/fuchsia.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/linux.cc.o && :
FAILED: lib/libRTScudoStandalone.test.i386.so
: && /usr/bin/clang++-6.0 -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O3 -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libRTScudoStandalone.test.i386.so -o lib/libRTScudoStandalone.test.i386.so projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/common.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/fuchsia.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/linux.cc.o && :
/usr/bin/ld: i386 architecture of input file `projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/common.cc.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/fuchsia.cc.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/linux.cc.o' is incompatible with i386:x86-64 output
/usr/bin/ld: projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.i386.dir/common.cc.o: file class ELFCLASS32 incompatible with ELFCLASS64
/usr/bin/ld: final link failed: File in wrong format
clang: error: linker command failed with exit code 1 (use -v to see invocation)
which I suspect are partly caused by CMake detecting i386 and x86_64 support for Compiler-RT:
-- Looking for __i386__
-- Looking for __i386__ - found
-- Compiler-RT supported architectures: x86_64;i386
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD - Success
-- Builtin supported architectures: i386;x86_64
The second compiler failure is due to `clock_gettime` undefined on RHEL 6.7 hosts:
[2428/3976] : && /tools/build/gcc-8.2.0/bin/g++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wc
ast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment
-fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O3 -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libRTScudoStandalone.test.x86_64.so -o lib/
libRTScudoStandalone.test.x86_64.so projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/common.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoSt
andalone.x86_64.dir/fuchsia.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/linux.cc.o && :
FAILED: lib/libRTScudoStandalone.test.x86_64.so
: && /tools/build/gcc-8.2.0/bin/g++ -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O3 -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libRTScudoStandalone.test.x86_64.so -o lib/libRTScudoStandalone.test.x86_64.so projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/common.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/fuchsia.cc.o projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/linux.cc.o && :
projects/compiler-rt/lib/scudo/standalone/CMakeFiles/RTScudoStandalone.x86_64.dir/linux.cc.o: In function `scudo::getMonotonicTime()':
linux.cc:(.text._ZN5scudo16getMonotonicTimeEv+0xd): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
I suspect this is due to glibc being very old :
$ rpm -qa | grep ^glibc-2
glibc-2.12-1.166.el6_7.7.i686
glibc-2.12-1.166.el6_7.7.x86_64
The glibc maintainers moved `clock_*()` from `librt` to `libc` in version 2.17 <https://sourceware.org/glibc/wiki/Release/2.17>. This means some builds require `-lrt` for linking while others do not. And yes, this is ancient code but the folks at RedHat move at glacial speed when upgrading core packages in RHEL. They just barely moved to glibc 2.17 in RHEL 7.
I don't have patches for these yet but I wanted to inform you in case you may be aware of quick fixes/workarounds for these issues.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58184/new/
https://reviews.llvm.org/D58184
More information about the llvm-commits
mailing list