Accumulate multiple -Zsanitizer target modifiers#157788
Conversation
|
Some changes occurred in tests/codegen-llvm/sanitizer cc @rcvalle |
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
17905c2 to
fe9caed
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b1fec2d to
0dcc9d6
Compare
This comment has been minimized.
This comment has been minimized.
0dcc9d6 to
76f555b
Compare
This comment has been minimized.
This comment has been minimized.
76f555b to
1148afe
Compare
|
@rustbot author |
… r=petrochenkov Accumulate multiple -Zsanitizer target modifiers When passing multiple `-Zsanitizer` flags to the compiler (e.g., `-Zsanitizer=address -Zsanitizer=shadow-call-stack`), the options parser was overwriting the previous values in `target_modifiers` instead of accumulating them. This resulted in only the last sanitizer being recorded in the crate metadata's target modifiers, even though the frontend correctly enabled all of them. The only way to provide multiple sanitizers is to combine them into a comma-separated list passed to a single `-Zsanitizer=` flag, but this doesn't fit very well into the GN build system where different targets may pass different combinations of sanitizer flags. Consequently, this caused spurious "incompatible target modifiers" ABI mismatch errors when linking against dependencies compiled with accumulated flags. Fix this by entry-modifying the `target_modifiers` map to accumulate the sanitizers as a comma-separated list when the option is `sanitizer`.
|
💔 I suspect this PR failed tests as part of a rollup After fixing the problem, consider running a try job for the failed job before re-approving. Link to failure: #157963 (comment) |
|
This pull request was unapproved. This PR was contained in a rollup (#157963), which was unapproved. |
When passing multiple `-Zsanitizer` flags to the compiler (e.g., `-Zsanitizer=address -Zsanitizer=shadow-call-stack`), the options parser was overwriting the previous values in `target_modifiers` instead of accumulating them. This resulted in only the last sanitizer being recorded in the crate metadata's target modifiers, even though the frontend correctly enabled all of them. The only way to provide multiple sanitizers was to combine them into a comma-separated list passed to a single `-Zsanitizer=` flag, but this does not fit well into the GN build system where different targets may pass different combinations of sanitizer flags. Consequently, this caused spurious "incompatible target modifiers" ABI mismatch errors when linking against dependencies compiled with accumulated flags (e.g., `-Zsanitizer=address,shadow-call-stack`). Fix this by entry-modifying the `target_modifiers` map to accumulate the sanitizers as a comma-separated list when the option is `sanitizer`. Also add a codegen test verifying that both CFI and SafeStack attributes/metadata are present when enabled together via multiple flags. Test: ./x.py test tests/codegen-llvm/sanitizer/multiple-sanitizers.rs
dad6583 to
115338b
Compare
|
The presubmit failed since it attempted to run the @petrochenkov could you take another look? |
|
@bors try=test-various |
|
Unknown command "try". Run |
|
@bors try jobs=test-various |
Accumulate multiple -Zsanitizer target modifiers try-job: test-various
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
… r=petrochenkov Accumulate multiple -Zsanitizer target modifiers When passing multiple `-Zsanitizer` flags to the compiler (e.g., `-Zsanitizer=address -Zsanitizer=shadow-call-stack`), the options parser was overwriting the previous values in `target_modifiers` instead of accumulating them. This resulted in only the last sanitizer being recorded in the crate metadata's target modifiers, even though the frontend correctly enabled all of them. The only way to provide multiple sanitizers is to combine them into a comma-separated list passed to a single `-Zsanitizer=` flag, but this doesn't fit very well into the GN build system where different targets may pass different combinations of sanitizer flags. Consequently, this caused spurious "incompatible target modifiers" ABI mismatch errors when linking against dependencies compiled with accumulated flags. Fix this by entry-modifying the `target_modifiers` map to accumulate the sanitizers as a comma-separated list when the option is `sanitizer`.
…uwer Rollup of 8 pull requests Successful merges: - #157788 (Accumulate multiple -Zsanitizer target modifiers) - #158012 (Stabilize `strip_circumfix`) - #157810 (Query the trait solver in slow path for `missing_debug_implementations`) - #157829 (tests: adapt two tests for LLVM 23 changes) - #157917 (Don't suggest adding `in` to a `for` loop that already has one) - #157967 (Preserve track_caller for by-value dyn vtable shims) - #158019 (delegation: add simple test for incremental compilation) - #158023 (Move `UnusedDuplicate` diag struct to `rustc_attr_parsing`)
…uwer Rollup of 12 pull requests Successful merges: - #157788 (Accumulate multiple -Zsanitizer target modifiers) - #158012 (Stabilize `strip_circumfix`) - #157810 (Query the trait solver in slow path for `missing_debug_implementations`) - #157829 (tests: adapt two tests for LLVM 23 changes) - #157873 (mips: set llvm_args -mno-check-zero-division for all mips targets) - #157886 (Reject extra fields in MGCA struct const arguments) - #157917 (Don't suggest adding `in` to a `for` loop that already has one) - #157967 (Preserve track_caller for by-value dyn vtable shims) - #158019 (delegation: add simple test for incremental compilation) - #158023 (Move `UnusedDuplicate` diag struct to `rustc_attr_parsing`) - #158029 (Rename `project-stable-mir` to `project-rustc-public`) - #158044 (Add more tests for parallel frontend issues)
…uwer Rollup of 12 pull requests Successful merges: - rust-lang/rust#157788 (Accumulate multiple -Zsanitizer target modifiers) - rust-lang/rust#158012 (Stabilize `strip_circumfix`) - rust-lang/rust#157810 (Query the trait solver in slow path for `missing_debug_implementations`) - rust-lang/rust#157829 (tests: adapt two tests for LLVM 23 changes) - rust-lang/rust#157873 (mips: set llvm_args -mno-check-zero-division for all mips targets) - rust-lang/rust#157886 (Reject extra fields in MGCA struct const arguments) - rust-lang/rust#157917 (Don't suggest adding `in` to a `for` loop that already has one) - rust-lang/rust#157967 (Preserve track_caller for by-value dyn vtable shims) - rust-lang/rust#158019 (delegation: add simple test for incremental compilation) - rust-lang/rust#158023 (Move `UnusedDuplicate` diag struct to `rustc_attr_parsing`) - rust-lang/rust#158029 (Rename `project-stable-mir` to `project-rustc-public`) - rust-lang/rust#158044 (Add more tests for parallel frontend issues)
View all comments
When passing multiple
-Zsanitizerflags to the compiler (e.g.,-Zsanitizer=address -Zsanitizer=shadow-call-stack), the options parser was overwriting the previous values intarget_modifiersinstead of accumulating them. This resulted in only the last sanitizer being recorded in the crate metadata's target modifiers, even though the frontend correctly enabled all of them. The only way to provide multiple sanitizers is to combine them into a comma-separated list passed to a single-Zsanitizer=flag, but this doesn't fit very well into the GN build system where different targets may pass different combinations of sanitizer flags.Consequently, this caused spurious "incompatible target modifiers" ABI mismatch errors when linking against dependencies compiled with accumulated flags.
Fix this by entry-modifying the
target_modifiersmap to accumulate the sanitizers as a comma-separated list when the option issanitizer.