This discussion is archived
3 Replies Latest reply: Aug 28, 2012 8:43 AM by Darryl Gove RSS

Unable to use dtrace USDT in conjunction with -xipo=2?

957224 Newbie
Currently Being Moderated
We're currently using Studio 12/CC 5.9 and our C++ application includes an internal static library into which we embed several of our own dtrace userland probes (USDT).

We're looking at updating to Studio 12.3/CC 5.12 but have run into problems with the dtrace probes in release/optimised builds only.

The basic build process for the library is as follows:

1) Use dtrace -h to generate a probe header file from a foo.d definition file
2) Compile (C++) source file foo.cpp which references the macros from (1) to create foo.obj
3) Use dtrace -G to generate a dtrace probe object foo_probe.obj and update foo.obj
4) Use CC -xar to create a static library libfoo.a containing both objects from (3)

This works fine in debug builds with both CC 5.9 and CC 5.12, however release builds with CC 5.12 fail when we try to link a binary against the static library with "Undefined symbol" errors referencing the dtrace probe functions in foo.obj.

I noticed that with CC 5.12 step (4) above seems to 'undo' the changes made to foo.obj file at step (3). I also noticed that step (4) is much slower with 5.12, hence suggesting that the compiler is doing some extra work, which then led me down the path of removing -xipo=2 from my commandline, at which point I get a library which I can link ok without missing symbols.

Questions:

1) Have there been changes to CC -xar which would explain this (eg previously -xipo=2 was ignored for archive creation)?

2) If it does 'make sense' that I'm having problems here, is there any better solution than simply removing -xipo=2 from the library creation step? Obviously I'd like to get the performance benefits if possible, but I suppose that it may simply not be compatible with the way dtrace USDT providers work...?

Thanks,

Matt.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points