From: Guanzhong Chen Date: Tue, 6 Aug 2019 21:52:58 +0000 (+0000) Subject: [WebAssembly] Lower ASan constructor priority on Emscripten X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0f6f6ffc9e3e59aecee7612231c5ce17f9ac58d;p=clang [WebAssembly] Lower ASan constructor priority on Emscripten 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 --- diff --git a/test/CodeGen/asan-constructor.c b/test/CodeGen/asan-constructor.c new file mode 100644 index 0000000000..0184bf918b --- /dev/null +++ b/test/CodeGen/asan-constructor.c @@ -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 }]