Bug 430158 - below main misses some "optimizations"
Summary: below main misses some "optimizations"
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: massif (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Nicholas Nethercote
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-08 15:41 UTC by Mark Wielaard
Modified: 2021-02-28 23:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2020-12-08 15:41:06 UTC
gcc can do a couple more optimizations for generic_start_main, like generic_start_main.isra.0 or generic_start_main.constprop.0.isra.0.

For ppc we already recognize generic_start_main.isra.0, but nothing else.

It would probably be good to recognize any optimization in get_fnname_kind like so:

#      if defined(VGO_linux)
        VG_STREQ("__libc_start_main",  name) ||  // glibc glibness               
        VG_STREQ("generic_start_main", name) ||  // Yellow Dog doggedness        
        VG_STREQN(19, "generic_start_main.", name) || // gcc optimization        
#      elif defined(VGO_darwin)

This fixes ./massif/tests/deep-D.vgtest on same setups, and we could then get rid of ./massif/tests/deep-D.post.diff-ppc64
Comment 1 Mark Wielaard 2021-02-28 23:34:14 UTC
commit 24a94df7386ce4de56a9779bbb5a3214d20067af
Author: Mark Wielaard <mark@klomp.org>
Date:   Mon Mar 1 00:26:00 2021 +0100

    VG_(get_fnname_kind): Recognize gcc "optimized" below main functions.
    
    The VG_(get_fnname_kind) function detects some special "below main"
    function names. Specifically __libc_start_main and generic_start_main
    both of which are used to call the actual main () function from the
    application. We already recognized one variant, generic_start_main.isra.0,
    but only for powerpc. Recognize all possibly specialed optimized variants
    gcc can produce by simply checking for the function name with dot as
    prefix. This fixes the memcheck/tests/supp_unknown.vgtest and
    massif/tests/deep-D.vgtest with gcc 11.
    
    We can now also get rid of the special cases in
    massif/tests/deep-D.post.exp-ppc64 and memcheck/tests/supp_unknown.supp.
    
    https://bugs.kde.org/show_bug.cgi?id=430158