| ... | @@ -5626,15 +5626,6 @@ pub fn addCCArgs( | ... | @@ -5626,15 +5626,6 @@ pub fn addCCArgs( |
| 5626 | if (mod.sanitize_c) { | 5626 | if (mod.sanitize_c) { |
| 5627 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); | 5627 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); |
| 5628 | try san_arg.appendSlice(arena, "undefined,"); | 5628 | try san_arg.appendSlice(arena, "undefined,"); |
| 5629 | try argv.append("-fsanitize-trap=undefined"); | | |
| 5630 | // It is very common, and well-defined, for a pointer on one side of a C ABI | | |
| 5631 | // to have a different but compatible element type. Examples include: | | |
| 5632 | // `char*` vs `uint8_t*` on a system with 8-bit bytes | | |
| 5633 | // `const char*` vs `char*` | | |
| 5634 | // `char*` vs `unsigned char*` | | |
| 5635 | // Without this flag, Clang would invoke UBSAN when such an extern | | |
| 5636 | // function was called. | | |
| 5637 | try argv.append("-fno-sanitize=function"); | | |
| 5638 | } | 5629 | } |
| 5639 | if (mod.sanitize_thread) { | 5630 | if (mod.sanitize_thread) { |
| 5640 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); | 5631 | if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); |
| ... | @@ -5645,7 +5636,23 @@ pub fn addCCArgs( | ... | @@ -5645,7 +5636,23 @@ pub fn addCCArgs( |
| 5645 | try san_arg.appendSlice(arena, "fuzzer-no-link,"); | 5636 | try san_arg.appendSlice(arena, "fuzzer-no-link,"); |
| 5646 | } | 5637 | } |
| 5647 | // Chop off the trailing comma and append to argv. | 5638 | // Chop off the trailing comma and append to argv. |
| 5648 | if (san_arg.popOrNull()) |_| try argv.append(san_arg.items); | 5639 | if (san_arg.popOrNull()) |_| { |
| | 5640 | try argv.append(san_arg.items); |
| | 5641 | |
| | 5642 | // These args have to be added after the `-fsanitize` arg or |
| | 5643 | // they won't take effect. |
| | 5644 | if (mod.sanitize_c) { |
| | 5645 | try argv.append("-fsanitize-trap=undefined"); |
| | 5646 | // It is very common, and well-defined, for a pointer on one side of a C ABI |
| | 5647 | // to have a different but compatible element type. Examples include: |
| | 5648 | // `char*` vs `uint8_t*` on a system with 8-bit bytes |
| | 5649 | // `const char*` vs `char*` |
| | 5650 | // `char*` vs `unsigned char*` |
| | 5651 | // Without this flag, Clang would invoke UBSAN when such an extern |
| | 5652 | // function was called. |
| | 5653 | try argv.append("-fno-sanitize=function"); |
| | 5654 | } |
| | 5655 | } |
| 5649 | } | 5656 | } |
| 5650 | | 5657 | |
| 5651 | if (mod.red_zone) { | 5658 | if (mod.red_zone) { |