Conversation
ghost
left a comment
There was a problem hiding this comment.
I was worried about the removal of -fsanitize=thread from cclibs in configure.ac (last chunk), but it turns out to be indeed unnecessary as long as *cflags are correct.
|
There are weird mscv64 failure logs in the CI, and I don't know if they are a fluke (a bug in the mscv64 CI in trunk at the time, that was fixed since) or related to the PR. @shindere, could you rebase the PR on top of the current trunk, so that the CI reruns in a known-good configuration? |
|
I will rebase yes, and intend to go through the PR again because I think
there is still room for improvemnet. In particular, I think it's
important to pass the TSan flags at link time because, as I understood
it, some platforms do require that.
|
All platforms do - TSan-enabled binaries need to be linked against the TSan runtime library. |
1e11bed to
76852d3
Compare
|
I just pushed an updated version of the PR that passes CI. (I know it does because it did and I just squashed a tentative fix in the Basically, the problem was that there were some flags missing in those This is, in turn, the consequence of two things. On the one hand, it is I think this should be fixed and the build system shoudl not compute the |
76852d3 to
c0f8478
Compare
This commit removes the oc_ prefix from the tsan_cflags and tsan_cppflags configure variables since the OC_ prefix is used only for build variables which have a non OC_ prefixed counterpart that can be defined by users to provide additional flags.
To make it possible to instrument only native code, we need to have two sets of flags to be passed to the C compiler, one when called by ocamlc and one when called by ocamlopt. This commit re-introduces this distinction by reverting commit 2b4fe09 (PR ocaml#8631).
c0f8478 to
29e854b
Compare
configure.ac
Outdated
| [PTHREAD_LIBS=''], | ||
| [AX_PTHREAD( | ||
| [common_cflags="$common_cflags $PTHREAD_CFLAGS" | ||
| AC_MSG_NOTICE([SEB: common_cflags="$common_cflags"]) |
There was a problem hiding this comment.
You forgot that leftover debug message.
| AC_MSG_NOTICE([SEB: common_cflags="$common_cflags"]) |
29e854b to
3dcf8ec
Compare
|
Miod Vallat (2024/06/03 02:52 -0700):
@dustanddreams commented on this pull request.
> @@ -2339,6 +2340,7 @@ AS_CASE([$host],
[PTHREAD_LIBS=''],
[AX_PTHREAD(
[common_cflags="$common_cflags $PTHREAD_CFLAGS"
+ AC_MSG_NOTICE([SEB: common_cflags="$common_cflags"])
You forgot that leftover debug message.
```suggestion
```
Oops! Thanks! Fixed!
|
This commit does two things: 1. Add TSAN CPP flags to native CPP flags rather than to common CPP flags 2. Remove -fsanitize=thread from CCLIBS
3dcf8ec to
3d3f099
Compare
| # The following variable defines flags to be passed to the C preprocessor | ||
| # when compiling C files to be linked with native code. This includes | ||
| # the native runtime itself and can also include the stub code around | ||
| # C libraries when it needs to be different from the one used to | ||
| # link with bytecode. | ||
|
|
||
| # These flags should be passed *in addition* to those in OC_CPPFLAGS, they | ||
| # should not replace them. | ||
|
|
||
| OC_NATIVE_CPPFLAGS=@native_cppflags@ | ||
|
|
||
| # Same as above, for CFLAGS | ||
| OC_NATIVE_CFLAGS=@native_cflags@ | ||
|
|
There was a problem hiding this comment.
As I understand it from private discussion, these two sets of flags cannot currently be complemented by the user, but may be in the future (which is fine).
|
Thanks a lot @OlivierNicole for your very thorough review.
Olivier has asked very good quesitons and I was happy to have the
possibility to explain in a ocnversation rather than in a written form,
until we hae a good documentaiton for all the build system.
|
|
Gabriel Scherer (2024/06/04 04:51 -0700):
Merged #13201 into trunk.
Thnaks!
|
Could someone provide a stronger argument for breaking every single user of |
|
I think that you are reporting an unintended regression, but there is too much sarcasm and not enough information to know what the regression is and how to fix it. Could you try again with a gentler explanation of the issue? |
|
No sarcasm intended, this is a pretty serious regression. On OCaml 5.2: On OCaml trunk (what will be 5.3): Tooling such as dune relies on those variables being present. |
|
Thanks! This sounds easy to fix by undoing the renaming from |
|
(I'm not planning to work on this myself right away as I suppose that @shindere or @OlivierNicole will probably do it, but of course anyone else is welcome to propose a PR.) |
|
If there's a strong desire to rename theses variables, you can still introduce the new variables alongside the current ones and establish some kind of deprecation strategy. That's what puzzled me so much, given the OCaml compiler's track record of not introducing breaking changes like these. |
|
Antonio Nuno Monteiro (2024/06/14 21:43 -0700):
If there's a strong desire to rename theses variables, you can still
introduce the new variables alongside the current ones and establish
some kind of deprecation strategy.
Taht was actually my initial intention, and then I forgot about it, I
apologize for that and the trouble it created.
That's what puzzled me so much, given the OCaml compiler's track
record of not introducing breaking changes like these.
So is it okay if I (1) submit a PR that re-introduces the older names
but with deprecation marks and (2) make sure dune is transitionning to
the new names?
I intend to submit this as part of a revised version of #12586 I am
currently working on, unless people feel there is a need for a dedicated
PR but I'd definitely prefer to have this in #12586 which basically
deals with C and CPP flags.
|
|
I think that we should just go back to the old names.
The renaming would be a very small change that can easily be reviewed and merged, and un-break |
|
I'd like to insist on the renaming because it's more future proof.
As I think I already wrote, I am hoping that we will once have a unified
compiler that will have several backends, including bytecode and native.
To me the proposed names work better in such a context and are easier to
extend to potential other backends.
|
|
In my opinion the priority is to un-break the various CI systems that are following trunk to make the ecosystem better ahead of time, with the minimal change that achieves it. I can either (1) just let you do whatever you want, even if I don't like the result, because other approaches lead to potential conflicts, or (2) do the minimal thing myself. I guess that a last option is to (3) revert the present PR from trunk for the time being. What do you think is best? |
|
Am I correct that re-introducing the old names with deprecation would fix
trunk? If so I can prepare a PR with just that promptly.
|
Thes e variables have been renamed by ocaml#13201 but should actually be preserved so that the use of `ocamlc -config` remains backward-compatible.
These variables have been renamed by ocaml#13201 but should actually have been preserved so that the use of `ocamlc -config` remains backward-compatible.
|
Just opened #13244 to fix |
These variables have been renamed by ocaml#13201 but should actually have been preserved so that the use of `ocamlc -config` remains backward-compatible.
This reverts commits 19c98b1 and 7e5deb0. Upstream restored the variables that were removed in ocaml/ocaml#13201 in ocaml/ocaml#13244 for backward-compatibility.
This reverts commits 19c98b1 and 7e5deb0. Upstream restored the variables that were removed in ocaml/ocaml#13201 in ocaml/ocaml#13244 for backward-compatibility.
This PR fixes issue #13042 and also addresses the problem PR #12781 attempted to resolve.
Both of these are instances of artefacts for bytecode programs or libraries being instrumented whereas they should not be.
The present PR makes sure only the artefacts related to native programs and libraries get instrumented. As a side effect, the build time for the compiler when configured with
--endable-tsanis considerably reduced, as can be seen from these results obtained withmake -j:Trunk:
PR branch:
This PR consists of the four following commits:
configurescript.runtime/tsan.cis compiled and linked only for native programs and libraries.Of these four commits, the third one can certainly be seen as the core of this PR. It basically reverts 2b4fe09, which had been submitted as part of PR #8631. However, the present PR proposes new names for the different types of flags, which are based on the backend for which we compile rather than on the name of the associated compiler, since the backend names seem more stable than the compiler names. So we use
bytecode_cflagsrather thanocamlc_cflags, etc., for the day whenocamlcandocamloptwill have a unified compiler driver. ;)This work may be of interest to @fabbing and @OlivierNicole, among others.