Bug 433477 - FreeBSD support, part 6
Summary: FreeBSD support, part 6
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: helgrind (show other bugs)
Version: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-23 11:01 UTC by Paul Floyd
Modified: 2021-10-06 21:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Helgrind code patch (27.77 KB, patch)
2021-02-23 11:01 UTC, Paul Floyd
Details
code diff in helgrind (27.77 KB, patch)
2021-09-23 19:25 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2021-02-23 11:01:17 UTC
Created attachment 136079 [details]
Helgrind code patch

Changes to Helgrind code. Another fairly small patch.

Adding defined(VGO_freebsd)
Add wraps for sem functions in libc
Comment 1 Paul Floyd 2021-09-23 19:25:29 UTC
Created attachment 141837 [details]
code diff in helgrind
Comment 2 Mark Wielaard 2021-09-26 22:27:57 UTC
This patch looks good as is. It compiles fine on Fedora amd64.

Same question as with the drd change, could the LIBC_FUNC define be replaced with some PTH_FUNC macro magic? I assume not, since some wrappers already fo use PTH_FUNC instead of the new LIBC_FUNC. Just wondering why.
Comment 3 Mark Wielaard 2021-09-26 22:30:30 UTC
O, one nitpick, it does:
mode change 100644 => 100755 helgrind/hg_intercepts.c
which is wrong IMHO.
Comment 4 Paul Floyd 2021-09-27 06:09:24 UTC
Fixed the file rights change. No idea where that came from.
Comment 5 Paul Floyd 2021-09-27 18:48:28 UTC
For the PTH_FUNC and LIBC_FUNC, it's all a fairly big mess.

On Soilaris, libpthread contains stubs and the real implementations are in libc. Nothing much works on macOS.

On Linux glibc, functions seem to be fairly randomly in either libc or libpthread or both. For muslc there is no lib libpthread and everything is in libc.

On FreeBSD the pthread functions have stubs in libc but the implementation is in libpthread. The exception is the semaphore functions which are only in libc.

As a rule it is safe to have multiple filenames and patterns for these redirs, as long as a match is made and not to the stub. The duplicates will then do nothing.

When there is a stub we mustn't look for them - which is why Solaris only looks in libc and FreeBSD only looks in libpthread for PTH_FUNC.

I don't know of any way to achieve this with macros, or at least not in a way that is not worse than the current code.
Comment 6 Paul Floyd 2021-10-06 21:09:56 UTC
Code committed as
commit e2073121004fa969961c056594fcbf327cb57217

(but with a slightly wrong commit message
    FreeBSD support, patch 5
which should be patch 6)