Bug 476787 - Build of Valgrind 3.21.0 fails when SOLARIS_PT_SUNDWTRACE_THRP is defined
Summary: Build of Valgrind 3.21.0 fails when SOLARIS_PT_SUNDWTRACE_THRP is defined
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.21.0
Platform: Other Unspecified
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-10 10:40 UTC by Jakub Kulik
Modified: 2023-11-10 19:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch (1.06 KB, patch)
2023-11-10 10:41 UTC, Jakub Kulik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Kulik 2023-11-10 10:40:32 UTC
SUMMARY
With commit 7844752299b5472b21fc4df765d4cffdf92c6c3d (Bug 452802 Handle lld 9+ split RW PT_LOAD segments correctly), the newly added
```
+
+        if (inrw2) {
+           inrw = inrw2;
+        } else {
+           inrw = inrw1;
+        }
```
block was incorrectly placed right bellow the `#if defined(SOLARIS_PT_SUNDWTRACE_THRP)` section, which very much changed the code as the `SOLARIS_PT_SUNDWTRACE_THRP` section ends with opened `else` intended for `if (inrw && !di->data_present) {` below.

Moving the section above the ifdef block fixes the issue (path attached).

OBSERVED RESULT
Many elf related tests fail.

EXPECTED RESULT
They should pass.

SOFTWARE/OS VERSIONS
Oracle Solaris 11.4.66 (where SOLARIS_PT_SUNDWTRACE_THRP is defined)

ADDITIONAL INFORMATION
https://sourceware.org/git/?p=valgrind.git;a=commit;h=7844752299b5472b21fc4df765d4cffdf92c6c3d
https://sourceware.org/git/?p=valgrind.git;a=blobdiff;f=coregrind/m_debuginfo/readelf.c;h=b4edb4fe854237f053ae6946dd27a4304a2efc96;hp=ea9c80415b83734f04ed498d5661a0280cd03854;hb=7844752299b5472b21fc4df765d4cffdf92c6c3d;hpb=67b8fef50bfaed0ce5a1d8130836bcef0eafcd4b
Comment 1 Jakub Kulik 2023-11-10 10:41:28 UTC
Created attachment 163015 [details]
patch
Comment 2 Paul Floyd 2023-11-10 13:24:35 UTC
Which version of Solaris is this?
Have you tried with git head?
Comment 3 Paul Floyd 2023-11-10 13:35:21 UTC
Ah yes, Solaris 11.4

Cool, I see that this comes from
https://github.com/oracle/solaris-userland/blob/master/components/valgrind/patches/06-dtrace-fix.patch

It's been on my todo list for a long long time to get in touch with you to merge these things.
Comment 4 Jakub Kulik 2023-11-10 15:16:38 UTC
I didn't try the current git head, but nothing changed in the affected code since 3.21.0.

(In reply to Paul Floyd from comment #3)
> Cool, I see that this comes from
> https://github.com/oracle/solaris-userland/blob/master/components/valgrind/
> patches/06-dtrace-fix.patch
> 
> It's been on my todo list for a long long time to get in touch with you to
> merge these things.

Oh yes. This one is pretty recent, but there are other older patches that I have yet to send your way. I will dust them off and do so.
Comment 5 Paul Floyd 2023-11-10 19:30:06 UTC
commit 242d8881e10328ff98c37ceb7fd31955a29cad82
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Fri Nov 10 17:56:52 2023 +0100

    Bug 476787 - Build of Valgrind 3.21.0 fails when SOLARIS_PT_SUNDWTRACE_THRP is defined
    
    Patch provided by
       Jakub Kulik kulikjak@gmail.com