Skip to content
  • Iustin Pop's avatar
    Fix profiling targets · 675f65b7
    Iustin Pop authored
    
    
    As noted by Guido, there are problems when using the hs-prof and
    hs-prof-quick targets in the default configuration (compiling all
    programs). The errors manifest in the form of wrong symbols during
    compilation.
    
    I knew that the hs-prof targets, which compiled multiple objects with
    the '.o' suffix, could be problematic; but the objects that are
    actually needed in the Template Haskell phase are very standard and
    don't differ between the binaries (Constants, BasicTypes, JSON,
    THH). What I didn't realise (although it's obvious) is that also the
    hs_prof_quick targets (the final binaries) are also compiled with a
    single suffix ('.prof_o'), which means that the object files are
    actually compiled for the last binary.
    
    This means that targets later in the HS_ALL_PROGS list would work
    correct, but early targets, especially htools/htools, would fail.
    
    So the obvious, and the single simple solution is to make these two
    rules only work on a single binary at a time. This should be fine,
    since one is looking at a specific problem usually, and it has the
    advantage that the hs-prof step is much faster (since it wasn't
    buildable in parallel anyway).
    
    Thanks to Guido for finding and making the initial diagnose on this!
    
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
    675f65b7