On Fuchsia, we always use the continuous mode with runtime counter
relocation, so there's no need for atexit hook or support for dumping
the profile manually.
Details
- Reviewers
mcgrathr - Commits
- rG32bddad37bf0: [profile] Make atexit hook a no-op on Fuchsia
Diff Detail
Event Timeline
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
---|---|---|
195–196 | To remove this function altogether, we would need to wrap its invocation in https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/profile/InstrProfilingRuntime.cpp#L24 in #if !defined(__Fuchsia__), I'm not sure if that's better than defining an empty function? |
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
---|---|---|
195–196 | Some other runtimes (e.g. hwasan) have an OS-specific InstallAtExitHandler() called by the common initialization function, so we can define that as a no-op. |
compiler-rt/lib/profile/InstrProfilingFile.c | ||
---|---|---|
39 | Can we make this a function defined in File.c to return a static variable kept there and in Fuchsia.c to return constant 1? | |
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
104 | This function is responsible for initializing before return and the link-time initializer in BiasVar.c is -1 so this will always be true at startup. |
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
---|---|---|
104 | It's defined as -1 in https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/profile/InstrProfilingBiasVar.c#L15 which is a weak definition, but compiler will generate a strong definition with the default value 0 when runtime counter relocation is enabled (default on Fuchsia), so this should only kick in when someone accidentally disables runtime counter relocation on Fuchsia? I'm happy to omit this check if you think it's unnecessary. |
lgtm with comment and nits
compiler-rt/lib/profile/InstrProfilingInternal.h | ||
---|---|---|
188 | C functions need (void). | |
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c | ||
37 | C functions need (void). | |
104 | I see. That makes sense but there should be a comment here explaining the compiler's semantics for this symbol. |
Can we make this a function defined in File.c to return a static variable kept there and in Fuchsia.c to return constant 1?
Then at least in an LTO future it will fold away for Fuchsia, and not add a data word.