[WebAssembly] Don't use Wasm function sections for more than one function
authorDan Gohman <dan433584@gmail.com>
Tue, 5 Dec 2017 17:46:17 +0000 (17:46 +0000)
committerDan Gohman <dan433584@gmail.com>
Tue, 5 Dec 2017 17:46:17 +0000 (17:46 +0000)
Patch by Nicholas Wilson!

Fixes PR35467.

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

llvm-svn: 319801

clang/lib/Basic/Targets/OSTargets.h
clang/test/CodeGenCXX/static-init-wasm.cpp

index 03895f7..5af6361 100644 (file)
@@ -711,11 +711,6 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
       Builder.defineMacro("_GNU_SOURCE");
   }
 
-  // As an optimization, group static init code together in a section.
-  const char *getStaticInitSectionSpecifier() const final {
-    return ".text.__startup";
-  }
-
 public:
   explicit WebAssemblyOSTargetInfo(const llvm::Triple &Triple,
                                    const TargetOptions &Opts)
index 5f2f94f..68d1391 100644 (file)
@@ -43,12 +43,12 @@ struct A {
 
 A theA;
 
-// WEBASSEMBLY32: define internal void @__cxx_global_var_init() #3 section ".text.__startup" {
+// WEBASSEMBLY32: define internal void @__cxx_global_var_init() #3 {
 // WEBASSEMBLY32: call %struct.A* @_ZN1AC1Ev(%struct.A* @theA)
-// WEBASSEMBLY32: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #3 section ".text.__startup" {
+// WEBASSEMBLY32: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #3 {
 // WEBASSEMBLY32: call void @__cxx_global_var_init()
 //
-// WEBASSEMBLY64: define internal void @__cxx_global_var_init() #3 section ".text.__startup" {
+// WEBASSEMBLY64: define internal void @__cxx_global_var_init() #3 {
 // WEBASSEMBLY64: call %struct.A* @_ZN1AC1Ev(%struct.A* @theA)
-// WEBASSEMBLY64: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #3 section ".text.__startup" {
+// WEBASSEMBLY64: define internal void @_GLOBAL__sub_I_static_init_wasm.cpp() #3 {
 // WEBASSEMBLY64: call void @__cxx_global_var_init()