Skip to content

Conversation

probablytom
Copy link
Contributor

When compiling gnutls we saw the configure script use the preprocessor to determine flags to pass to the compiler. It did this by preprocessing a list of prospective args to $CC, and using the preprocessor to determine which of those were valid. It takes the output from the preprocessor --- a list of "valid" flags to $CC --- and supplies that to future calls to $CC.

Because allocscc injects liballocs-related machinery into the code it compiles, the output of allocscc's preprocessor contains liballocs-related C code. However, gnutls uses the preprocessor on something that isn't really C code! When the list of arguments was passed to later calls to $CC, the C code injected by allocscc would gum up the works.

#118 tracks this.

This PR disables any liballocs-related work if we see -E in allocscc's arguments.

@stephenrkell
Copy link
Owner

Thanks for this. Small code-review comment: instead of a new onlyPreprocessing flag, can we instead test enabledPhases, checking for when it is the singleton set containing only PREPROCESS?

@probablytom
Copy link
Contributor Author

Of course! Change incoming.

Just realised it'll likely be set to allocscc, and that could cause
issues. Not falling back to `$CC` makes the behaviour the same as
when we're not only preprocessing, so matching that behaviour is
probably advisable anyway.
@stephenrkell stephenrkell merged commit e5730ac into stephenrkell:master Sep 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants