-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Suppress new profiler_builtins warning since LLVM 11 #76224
Conversation
@tmandry FYI |
b6c0a7e
to
913b639
Compare
It looks like that warning flag was fairly recently added in this commit (gcc-9.1.0), so it's definitely better conditionally. However, I think this should probably be fixed in LLVM: https://reviews.llvm.org/D82253 #ifndef _WIN32
// __attribute__((destructor)) and destructors whose priorities are greater than
// 100 run before this function and can thus be tracked. The priority is
// compatible with GCC 7 onwards.
__attribute__((destructor(100)))
#endif
static void llvm_writeout_and_clear(void) {
llvm_writeout_files();
fn_list_remove(&writeout_fn_list);
} It sounds like the intent was to avoid this warning, but I think it would actually need to start at 101. Digging in GCC history, cc @MaskRay |
For more context, here is how the warning is documented in the manpage as of GCC 10.2:
|
@cuviper - I agree there should be a fix in LLVM, but until then, Rust builds (with profiler=true) are not clean. This is creating multiple occurrences of yellow warning messages during builds. (Very distracting, and unnecessary.) Most other warnings are suppressed in Rust builds. This is a stopgap solution, not knowing how long it will take to resolve upstream. Are you OK with this? |
I have also filed https://bugs.llvm.org/show_bug.cgi?id=47399, so let's give that a chance for response. If it's really as simple as raising this priority to 101, we can patch that rather than papering over it. |
No. The patch can suppress GCC>=9 -Wprio-ctor-dtor warning but GCC 8 still warns --- i/compiler-rt/lib/profile/GCDAProfiling.c
+++ w/compiler-rt/lib/profile/GCDAProfiling.c
@@ -628,6 +628,9 @@ void llvm_writeout_files(void) {
}
}
+#if defined(__GNUC__) && __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
+#endif
#ifndef _WIN32
// __attribute__((destructor)) and destructors whose priorities are greater than
// 100 run before this function and can thus be tracked. The priority is |
Well, pragma-masking this function on GCC 9 is an improvement, more focused than Rust doing it from the command line. @MaskRay are you going to make this change on the LLVM side? |
Yes. Suppressed GCC 9 -Wprio-ctor-dtor in llvm/llvm-project@1cfde14 |
@cuviper will you be updating the Rust fork with this fix? |
@richkadel In the LLVM bug, I've asked for the patch to be backported to the 11.x branch. If you'd like to see it sooner, you can follow our backport procedure and I'll approve those PRs. |
…d write_string/length_of_string The `__attribute__((destructor(100)))` diagnostic does not have a warning option in GCC 8 (before r264853) and thus cannot be suppressed. -- ported from llvm/llvm-project fix: llvm@1cfde14 https://bugs.llvm.org/show_bug.cgi?id=47399 (Fixes problem behind rust-lang/rust#76224)
#73) …d write_string/length_of_string The `__attribute__((destructor(100)))` diagnostic does not have a warning option in GCC 8 (before r264853) and thus cannot be suppressed. -- ported from llvm/llvm-project fix: llvm@1cfde14 https://bugs.llvm.org/show_bug.cgi?id=47399 (Fixes problem behind rust-lang/rust#76224)
This PR is no longer needed as of: |
GCC is emitting a new warning while building profiler_builtins with gcc. This should suppress that warning.
r? @cuviper