]> granicus.if.org Git - clang/commitdiff
[WebAssembly] Lower ASan constructor priority on Emscripten
authorGuanzhong Chen <gzchen@google.com>
Tue, 6 Aug 2019 21:52:58 +0000 (21:52 +0000)
committerGuanzhong Chen <gzchen@google.com>
Tue, 6 Aug 2019 21:52:58 +0000 (21:52 +0000)
Summary:
This change gives Emscripten the ability to use more than one constructor
priorities that runs before ASan. By convention, constructor priorites 0-100
are reserved for use by the system. ASan on Emscripten now uses priority 50,
leaving plenty of room for use by Emscripten before and after ASan.

This change is done in response to:
https://github.com/emscripten-core/emscripten/pull/9076#discussion_r310323723

Reviewers: kripken, tlively, aheejin

Reviewed By: tlively

Subscribers: cfe-commits, dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D65684

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368101 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/asan-constructor.c [new file with mode: 0644]

diff --git a/test/CodeGen/asan-constructor.c b/test/CodeGen/asan-constructor.c
new file mode 100644 (file)
index 0000000..0184bf9
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple wasm32-unknown-emscripten -fsanitize=address -emit-llvm -o - %s | FileCheck %s --check-prefix=EMSCRIPTEN
+
+// CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 1, void ()* @asan.module_ctor, i8* null }]
+// EMSCRIPTEN: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 50, void ()* @asan.module_ctor, i8* null }]