Should the aux image include an ICC profile?
Use of ICC profiles within the auxiliary (secondary) image varies quite a bit by encoder for JPGs. Libultra currently uses a linear Google ICC profile, Apple uses a different (PQ) ICC profile, and Adobe does not appear to embed an ICC profile in the aux image. Based on various bugs I have seen in implementations of support for gain maps, I believe the Adobe approach may be the safest (to avoid problems downstream).
All three of these approaches are consistent with the ISO and ICC specs (to the best of my knowledge). However, I do not see significant benefit in the libultrahdr result as compared to Adobe's approach. I may be overlooking something, so please comment if you believe the linear profile has some important advantage.
If the linear profile does not have clear benefit, I recommend new/original encodings should ideally not include an ICC profile in the aux image (if the SDR and HDR images use the same primaries). This would align with the Adobe approach, and create one less variable that downstream transcoding / decoding software needs to manage well.
There are a few scenarios where it may be required (if the HDR is deliberately encoded for a different color space, or when transcoding an existing gain map already uses a profile in the aux image). But for most original encodings, I believe it is optional and probably not valuable to include.
Unless I am missing some important benefit of the linear ICC profile when both the SDR and HDR use the same primaries, I would propose to not embed an ICC profile in the aux image unless required, in order to reduce the risk that the output from libultrahdr will not be well managed by some downstream library/application.
[ revised from my original post for clarity ]