gyp rules for ubsan

BUG=skia:2481
R=bungeman@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/258393004

git-svn-id: http://skia.googlecode.com/svn/trunk@14511 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 39ee953..817c4a1 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -413,6 +413,16 @@
                   }],
                 ],
               }],
+              [ 'skia_sanitizer == "undefined"', {
+                'cflags': [ '-fPIC' ],
+                'cflags_cc!': ['-fno-rtti'],
+                'target_conditions': [
+                  [ '_type == "executable"', {
+                    'cflags': [ '-fPIE' ],
+                    'ldflags': [ '-pie' ],
+                  }],
+                ],
+              }],
             ],
           }],
           [ 'skia_clang_build', {