Bug 433438 - FreeBSD support, part 2
Summary: FreeBSD support, part 2
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-22 18:14 UTC by Paul Floyd
Modified: 2021-10-07 06:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
files in the root directory (39.95 KB, patch)
2021-02-22 18:14 UTC, Paul Floyd
Details
files in the root directory (43.07 KB, patch)
2021-09-23 19:18 UTC, Paul Floyd
Details
freebsd2 patch (38.15 KB, text/plain)
2021-09-26 17:19 UTC, Mark Wielaard
Details
files in the root directory (47.17 KB, patch)
2021-10-05 20:47 UTC, Paul Floyd
Details
files in the root directory (48.47 KB, patch)
2021-10-05 21:08 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-22 18:14:52 UTC
Created attachment 136051 [details]
files in the root directory

Changed configure and Makefiles
Added a new README.freebsd and suppression files
Added new tests and expecteds to .gitignore

TODOs here
Better checking for GNU tools like sed and cp
If I clean up the expected, they will need removing from .gitignore
Comment 1 Paul Floyd 2021-09-23 19:18:58 UTC
Created attachment 141833 [details]
files in the root directory
Comment 2 Mark Wielaard 2021-09-26 15:46:35 UTC
Nice new README.freebsd. I assume the new suppression files are correct for freebsd, they are only used for freebsd.

Most new entries in .gitignore look plausible, but I don't know what these are for:

+/vg.cflags
+/vg.config
+/vg.creator
+/vg.creator.user
+/vg.cxxflags
+/vg.files
+/vg.includes

And I don't know whether the new filter entries are relevant (for this commit).

As far as I can tell the Makefile.all.am look correct and should only be used in the freebsd case. Same for Makefile.am and Makefile.tool.am.

Most of the configure.ac changes look correct as far as I can tell they apply to freebsd only. The addition of FLAG_32ON64 looks correct (although the use of gcc9 seems oddly specific). Adding -Wexpansion-to-defined is probably a good thing.

I don't think adding -Werror when pie support is detected is correct:

-CFLAGS="-no-pie"
+CFLAGS="-no-pie -Werror"

The --image-base and/or -Ttext-segment changes look correct.

If -pthread is needed for AC_CHECK_FUNCS doesn't it need to be set in some build flag?

It looks like some of the AC_CONFIG_FILES should go into some later patch, which will introduce these files. Those generate errors during ./autogen.sh making this patch untestable on its own.
Comment 3 Paul Floyd 2021-09-26 16:35:52 UTC
I'll remove the vg.* files in .gitignore. That's for my Qt Creator project. I forgot to remove those lines.

The path for gcc9. I need to check to see what gets installed on FreeSD 13 and 14, and then to see how I can get the path based on the GCC version. For most users this is not much of an issue as they will be using clang.

I'll check and update shortly on the need for the changes related to -pie and -pthread. If they really are necessary I'll make them conditional.

When I made these patches, I didn't make sure that they apply separately. I'll take a look to see what the memcheck/tests/Makefile.am dependencies are.
Comment 4 Mark Wielaard 2021-09-26 16:38:07 UTC
> I don't think adding -Werror when pie support is detected is correct

I was incorrect here, this is for the flag detection, adding -Werror is correct here and probably helps clang because it just silently accepts any flag gcc accepts, even when not implemented, except when -Werror is given.

I still do like to understand when the -pthread addition is necessary for AC_CHECK_FUNCS. We might want to separate the functions for which this is necessary.
Comment 5 Mark Wielaard 2021-09-26 17:19:15 UTC
Created attachment 141930 [details]
freebsd2 patch

This is the variant of the patch that works for me on fedora x86_64. It removed some .gitignore entries (specifically the various filter_* entries which I believe are too broad), the extra -pthread addition (which I like to understand better) and the addition of the extra CONFIG files (which should be added to later patches that add the files themselves).
Comment 6 Paul Floyd 2021-09-26 19:37:52 UTC
I need to keep the filter ignore lines as I've changed these files to be automake generated. Doing this allows me to use gsed without having to think if the sed expressions are compatible or not between GNU sed and FreeBSD sed. The changed filter files are in the separate pathes for drd. memcheck etc.

The AC_CONFIG files are indeed spread amongst later patches.

It looks like the -pthread lines are not necessary.

In README.freebsd,  I should replace my github address with the valgrind bugzilla as the place to go for feedback.
Comment 7 Ed Maste 2021-09-26 23:18:00 UTC
FWIW while reviewing I noticed some EOL whitespace (because my editor highlighted it), e.g. in README.freebsd.
Comment 8 Paul Floyd 2021-09-27 06:05:41 UTC
Thanks Ed, I'll probably go through "git diff origin" and remove any offending red whitespace that I've added.

I've just updated the README and also modified the feedback section.
Comment 9 Paul Floyd 2021-09-27 20:38:32 UTC
Just been through all of the files and removed most of the trailing whitespace. Probably missed a bit, but most is gone.
Comment 10 Paul Floyd 2021-10-05 20:47:09 UTC
Created attachment 142183 [details]
files in the root directory

configure.ac is still not quite right
Comment 11 Paul Floyd 2021-10-05 21:08:19 UTC
Created attachment 142194 [details]
files in the root directory

Added some missing changes in coregrind Makefile.am
Comment 12 Paul Floyd 2021-10-07 06:40:39 UTC
Code committed in
commit e2583c02a5638fcbe7b3d693f7127ebde5d7c359