Skip to content

Clean and sync debugging C flags #12659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Clean and sync debugging C flags #12659

merged 1 commit into from
Jul 8, 2024

Conversation

petk
Copy link
Member

@petk petk commented Nov 13, 2023

These are already better set in the main configure.ac file. Also check is done if optimization flags need to be adjusted.

The unused DEBUG_CFLAGS variable has been removed from Zend.m4 macros and configure.ac file. DEBUG_CFLAGS has been once set in the build files similarly to Zend.m4 but was then removed and simplified.

Also, this syncs phpize.m4 debug check with configure.ac so that #78788 is fixed there as well.
Related to: 0988f69

Edit: Marking this as draft PR, I'll recheck it again...
Edit 2: Marked as ready. I've changed that Zend.m4 changes back because they are needed in possible some edge cases when doing --enable-debug-assertions or using very customized and simplified CFLAGS override. So, let's leave them be then.

@danog
Copy link
Contributor

danog commented Nov 13, 2023

Btw this is maybe a bit unrelated, but it would be nice if the --enable-address-sanitizer, --enable-undefined-sanitizer, --enable-memory-sanitizer actually enabled the relative fsanitize flags, instead of having to manually provide them in the CFLAGS as well...

@devnexen
Copy link
Member

devnexen commented Nov 13, 2023

Btw this is maybe a bit unrelated, but it would be nice if the --enable-address-sanitizer, --enable-undefined-sanitizer, --enable-memory-sanitizer actually enabled the relative fsanitize flags, instead of having to manually provide them in the CFLAGS as well...

weird, seems there is no need ... otherwise those configure flags kind of defeat their own purpose don t you think ?

@iluuu1994
Copy link
Member

iluuu1994 commented Nov 14, 2023

If you're referencing -DZEND_TRACK_ARENA_ALLOC, I'd agree. --enable-address-sanitizer should set this flag. No other flag should be necessary. In CI, for some reason we also have to set LDFLAGS="-fsanitize=address,undefined", but I haven't looked into why that is necessary there. Maybe @petk knows.

@petk
Copy link
Member Author

petk commented Nov 17, 2023

I've now changed this a bit better. I've only removed dead code from configure.ac and synced the phpize.m4 file, so it will be possible to debug also extensions on systems where "${SED}" (nixOS) needs to be used (if it comes to such case of course). So this is ready for review/merge.

@danog, I'm not entirely sure what you mean here. I think that these current sanitizer options should work ok. Is there something that needs to be adjusted manually using CFLAGS on some system? Because the idea with all these debuging and more "development" oriented flags is that they are like a configuration that is shared but they are also adjusted manually in some cases. It is quite common case in these build systems and nothing special or anti-pattern alike is done here.

P.S.: Sorry for such late reply :D

@petk petk marked this pull request as ready for review November 17, 2023 17:13
@iluuu1994
Copy link
Member

If you're referencing -DZEND_TRACK_ARENA_ALLOC, I'd agree.

Nevermind, this is already the case.

@danog
Copy link
Contributor

danog commented Nov 17, 2023

Indeed, I was under the false impression that setting CFLAGS manually was needed to enable asan regardless of the configure flags, since the CI tasks did that too.

Might be a good idea to remove those redundant flags from the CI then :)

@iluuu1994
Copy link
Member

@danog As mentioned above, CI sets the flags manually because for some reason we get linker errors if we don't also set LDFLAGS. Maybe we can drop them now, I'm not sure. I never looked into exactly why this only happens in CI.

This removes the unused DEBUG_CFLAGS variable from configure.ac. It has
been once set in the build files similarly to Zend.m4 but was then
removed and simplified.

CS synced and DEBUG_CFLAGS checked and appended with AS_VAR_* macros.
@petk
Copy link
Member Author

petk commented Jul 8, 2024

With the latest commit in the PR here only DEBUG_CFLAGS are synced. Merge coming up.

@petk petk merged commit 05b9345 into php:master Jul 8, 2024
11 checks passed
@petk petk deleted the patch-debug branch July 8, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants