Enable build-tunable asan shadow scale size
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Fri, 28 Jun 2019 18:31:32 +0000 (21:31 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Fri, 28 Jul 2023 12:01:39 +0000 (21:01 +0900)
Use the following for the project config (3 is default):

  %define asan_shadow_scale 3
  Macros:
  asan_shadow_scale 3
  :Macros

Change-Id: I23b231f03d6ab47c6b4264f8c7837eb1197f4cc4

gcc/asan.h
packaging/gcc-aarch64.spec
packaging/gcc-armv7hl.spec
packaging/gcc-armv7l.spec
packaging/linaro-gcc.spec

index 7d26b41..a8e9d72 100644 (file)
@@ -66,7 +66,11 @@ extern hash_set <tree> *asan_used_labels;
 
 /* Shadow memory is found at
    (address >> ASAN_SHADOW_SHIFT) + asan_shadow_offset ().  */
+#if defined(ASAN_SHADOW_SCALE)
+#define ASAN_SHADOW_SHIFT      ASAN_SHADOW_SCALE
+#else
 #define ASAN_SHADOW_SHIFT      3
+#endif
 #define ASAN_SHADOW_GRANULARITY (1UL << ASAN_SHADOW_SHIFT)
 
 /* Red zone size, stack and global variables are padded by ASAN_RED_ZONE_SIZE
index 443ff35..561e812 100644 (file)
@@ -715,6 +715,7 @@ if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
 fi
 
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
+%{?asan_shadow_scale: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -Wp,-DASAN_SHADOW_SCALE=%{asan_shadow_scale})}
 
 %ifarch armv7l armv7hl aarch64
 %undefine gcc_profiledbootstrap
index ada6266..99449a5 100644 (file)
@@ -715,6 +715,7 @@ if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
 fi
 
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
+%{?asan_shadow_scale: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -Wp,-DASAN_SHADOW_SCALE=%{asan_shadow_scale})}
 
 %ifarch armv7l armv7hl aarch64
 %undefine gcc_profiledbootstrap
index 45cade0..26c50c8 100644 (file)
@@ -715,6 +715,7 @@ if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
 fi
 
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
+%{?asan_shadow_scale: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -Wp,-DASAN_SHADOW_SCALE=%{asan_shadow_scale})}
 
 %ifarch armv7l armv7hl aarch64
 %undefine gcc_profiledbootstrap
index 99f9a81..8fcae34 100644 (file)
@@ -712,6 +712,7 @@ if [ ! -z "$(echo $RPM_OPT_FLAGS | grep -o "\B\-Wformat\-")" ]; then
 fi
 
 %{?asan: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -DASAN_INIT_FIRST) }
+%{?asan_shadow_scale: RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -Wp,-DASAN_SHADOW_SCALE=%{asan_shadow_scale})}
 
 %ifarch armv7l armv7hl aarch64
 %undefine gcc_profiledbootstrap