InstrProf: Support profiling dlopen'd shared libraries
Shared objects are hard. After this commit, we do the right thing when
profiling two separate shared objects that have been dlopen'd with
RTLD_LOCAL, when the main executable is *not* being profiled.
This mainly simplifies the writer logic.
- At initialization, determine the output filename and truncate the file. Depending on whether shared objects can see each other, this may happen multiple times.
- At exit, each executable writes its own profile in append mode.