[compiler-rt] r182177 - Fix the UBSan CMake build broken in r182118

Peter Collingbourne peter at pcc.me.uk
Sun May 19 07:53:15 PDT 2013


On Sun, May 19, 2013 at 07:04:39AM -0700, David Blaikie wrote:
> On May 19, 2013 6:31 AM, "Peter Collingbourne" <peter at pcc.me.uk> wrote:
> >
> > On Fri, May 17, 2013 at 11:57:24PM -0000, David Blaikie wrote:
> > > Author: dblaikie
> > > Date: Fri May 17 18:57:24 2013
> > > New Revision: 182177
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=182177&view=rev
> > > Log:
> > > Fix the UBSan CMake build broken in r182118
> > >
> > > Modified:
> > >     compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
> > >
> > > Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
> > > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=182177&r1=182176&r2=182177&view=diff
> > >
> ==============================================================================
> > > --- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
> > > +++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Fri May 17
> 18:57:24 2013
> > > @@ -83,7 +83,9 @@ else()
> > >      add_compiler_rt_object_library(RTSanitizerCommonLibc ${arch}
> > >        SOURCES ${SANITIZER_LIBCDEP_SOURCES} CFLAGS ${SANITIZER_CFLAGS})
> > >      add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch}
> > > -      SOURCES ${SANITIZER_SOURCES} CFLAGS ${SANITIZER_CFLAGS})
> > > +      SOURCES ${SANITIZER_SOURCES}
> > > +      $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> CFLAGS
> > > +      ${SANITIZER_CFLAGS})
> >
> > So it looks like we're building most of sanitizer_common's
> > objects twice here.  Is there any reason why we shouldn't use
> > RTSanitizerCommon's objects when building clang_rt.san?
> 
> My very limited understanding is that this is using the objects
> (target_objects) rather than the source, but I admit I haven't spent
> much/any time understanding the cmake build system or our use of it (& had
> some help from Richard smith with this change).
> 
> If you have better ideas/understanding about how to do this, I'm happy to
> defer to that.

Well, we're using the target objects from RTSanitizerCommonLibc, but
RTSanitizerCommon (where the majority of sanitizer_common lives)
objects are rebuilt because we use ${SANITIZER_SOURCES} to refer to
the source files.  I think we ought to be able to use this in place
of the add_compiler_rt_static_runtime command above:

add_compiler_rt_static_runtime(clang_rt.san-${arch} ${arch}
  SOURCES $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
  $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}> CFLAGS
  ${SANITIZER_CFLAGS})

But first, I'd like to ask Richard why he used ${SANITIZER_SOURCES}
when he introduced clang_rt.san in r177606.

Thanks,
-- 
Peter



More information about the llvm-commits mailing list