Page MenuHomeFreeBSD

Enable WITHOUT_PROFILE by default
ClosedPublic

Authored by emaste on Jun 20 2021, 7:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 7:22 PM
Unknown Object (File)
Thu, Nov 7, 5:38 PM
Unknown Object (File)
Wed, Nov 6, 10:52 AM
Unknown Object (File)
Thu, Oct 17, 3:56 PM
Unknown Object (File)
Oct 16 2024, 4:27 AM
Unknown Object (File)
Oct 15 2024, 9:57 PM
Unknown Object (File)
Oct 15 2024, 10:12 AM
Unknown Object (File)
Oct 13 2024, 10:18 AM

Details

Summary

Hardware based profiling (e.g. hwpmc) is much better / more usable.
Today the profiling lib archives (_p.a) serve no real purpose other than
increasing the library build time by 50%.

https://lists.freebsd.org/pipermail/freebsd-hackers/2020-January/055551.html

Deprecation notice would be committed first, followed by changing the default.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jun 20 2021, 7:34 PM

Thanks! I explicitly pass -DWITHOUT_PROFILE in cheribuild, looking forward to getting our build flags closer to the upstream defaults.

Cirrus-CI runs
main: https://cirrus-ci.com/task/4988055556718592
28:46 build time
11886 du -m -s /usr/obj

w/ this change: https://cirrus-ci.com/task/6464673903017984
24:48 build time
10644 du -m -s /usr/obj

I still think we should switch the profiled libraries to support gcov instead of statistical profiling, but I'm fine with not building them by default.

I tried a quick sanity check of -pg on my ~ FreeBSD 13.0 amd64 laptop, without success:

% cc -pg -O0 -g profil.c
% ./a.out
Segmentation fault (core dumped)

I wanted to determine if this is a local problem, but was unable to test on the FreeBSD ref machines because they do not install the profiling libs (PR256749)

ref13-amd64% cc -pg -O0 profil.c
/usr/local/bin/x86_64-unknown-freebsd13.0-ld: cannot find -lgcc_p
/usr/local/bin/x86_64-unknown-freebsd13.0-ld: cannot find -lgcc_eh_p
/usr/local/bin/x86_64-unknown-freebsd13.0-ld: cannot find -lc_p
/usr/local/bin/x86_64-unknown-freebsd13.0-ld: cannot find -lgcc_p
/usr/local/bin/x86_64-unknown-freebsd13.0-ld: cannot find -lgcc_eh_p
cc: error: linker command failed with exit code 1 (use -v to see invocation)

You'd be better off testing on i386 than amd64 I imagine. You could try that with '-m32' on your local machine perhaps?

I tried a quick sanity check of -pg on my ~ FreeBSD 13.0 amd64 laptop, without success:

% cc -pg -O0 -g profil.c
% ./a.out
Segmentation fault (core dumped)

I believe this is a known issue in lld, which cannot make his own decision whether the resulting binary static or not. Better try with gcc.

You'd be better off testing on i386 than amd64 I imagine.

Indeed, that ran and did not segfault, but I do not have an i386 gprof to parse the data (and native gprof produces a SIGBUS).

In D30833#694029, @kib wrote:

I tried a quick sanity check of -pg on my ~ FreeBSD 13.0 amd64 laptop, without success:

% cc -pg -O0 -g profil.c
% ./a.out
Segmentation fault (core dumped)

I believe this is a known issue in lld, which cannot make his own decision whether the resulting binary static or not. Better try with gcc.

Indeed, cc -fuse-ld=bfd -pg -O0 -g profil.c works.

Created D30861 to have Clang stop linking against _p libraries with -pg for FreeBSD 14 and up. We'll need a similar change for GCC.

exp-run requested for good measure: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256873
will commit after that's finished

This revision was automatically updated to reflect the committed changes.