-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
options: restore special behavior of CFLAGS vs. c_args #14566
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
Conversation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Make space for moving the larger comment about *_env_args, which will be before the for loop once *_env_args is removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
For compatibility with Autotools, CFLAGS is added to the linker command line if the compiler acts as a linker driver. However, this behavior was lost in commit d37d649 ("Make all Meson level options overridable per subproject.", 2025-02-13). The issue is that (for example) c_link_args is stored in env.options, and from that point on it is treated as a machine-file option. This includes not being able to override it in compilers.get_global_options: - initialize_from_top_level_project_call places it in pending_options - add_lang_args passes the right value to add_compiler_option - add_compiler_option calls add_system_option_internal - add_system_option_internal fishes the value out of pending_options and ignores what get_global_options provided. Instead, store the putative values of the compiler options coming from the environment in a separate dictionary, that is only accessed by get_global_options. This way it never appears in pending_options, and also there is no internal *_env_args variable anymore. Fixes: mesonbuild#14533 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
dcbaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct to me (and is really similar to a patch I have on a WIP branch locally). I'll give others a chance to look at this an plan to merge it in the next day or two unless someone else beats me to it or has more review.
|
FWIW, it seems that the current 1.8 branch doesn't fix all the issues. It builds fine with 1.7.0. |
For compatibility with Autotools, CFLAGS is added to the linker command line if the compiler acts as a linker driver. However, this behavior was lost in commit d37d649 ("Make all Meson level options overridable per subproject.", 2025-02-13).
The issue is that LDFLAGS is stored in env.options as (for example) c_link_args, and from that point on it is treated as a machine-file option. This includes not being able to override it in compilers.get_global_options:
initialize_from_top_level_project_call places it in pending_options
add_lang_args passes the right value to add_compiler_option
add_compiler_option calls add_system_option_internal
add_system_option_internal fishes the value out of pending_options and ignores what get_global_options provided.
Instead, store the putative values of the compiler options coming from the environment in a separate dictionary, that is only accessed by get_global_options, so that it never appears in pending_options.
Fixes: #14533