Commit df430c3
authored
[Frontend] Define __SANITIZE__ macros for kernel address variants (#156543)
GCC defines these macros for both userspace and kernel address
sanitizers:
$ gcc -E -dM -fsanitize=address -x c /dev/null &| string match -er
SANITIZE
#define __SANITIZE_ADDRESS__ 1
$ gcc -E -dM -fsanitize=kernel-address -x c /dev/null &| string match
-er SANITIZE
#define __SANITIZE_ADDRESS__ 1
$ gcc -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er
SANITIZE
#define __SANITIZE_HWADDRESS__ 1
$ gcc -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string match
-er SANITIZE
#define __SANITIZE_HWADDRESS__ 1
PR #153888 added these same defines for clang but only for the userspace
address sanitizers:
$ clang -E -dM -fsanitize=address -x c /dev/null &| string match -er
SANITIZE
#define __SANITIZE_ADDRESS__ 1
$ clang -E -dM -fsanitize=kernel-address -x c /dev/null &| string match
-er SANITIZE
$ clang -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er
SANITIZE
#define __SANITIZE_HWADDRESS__ 1
$ clang -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string
match -er SANITIZE
Match GCC's behavior so that the Linux kernel can eventually drop its
own internal defines.1 parent c424468 commit df430c3
File tree
2 files changed
+6
-2
lines changed- clang
- lib/Frontend
- test/Preprocessor
2 files changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1519 | 1519 | | |
1520 | 1520 | | |
1521 | 1521 | | |
1522 | | - | |
| 1522 | + | |
| 1523 | + | |
1523 | 1524 | | |
1524 | | - | |
| 1525 | + | |
| 1526 | + | |
1525 | 1527 | | |
1526 | 1528 | | |
1527 | 1529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
0 commit comments