@@ -51,13 +51,9 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
5151 is_64 = '64' in src_file
5252
5353 compile_cmd = [
54- os .path .join (llvm_bin , 'clang' ), src_path , '-o' , obj_path ,
54+ os .path .join (llvm_bin , 'clang' ), '-c' , src_path , '-o' , obj_path ,
5555 '-mllvm' , '-enable-emscripten-sjlj' ,
56- '-c' ,
57- '-nostdinc' ,
58- '-Xclang' , '-nobuiltininc' ,
59- '-Xclang' , '-nostdsysteminc' ,
60- '-Xclang' , f'-I{ emscripten_sysroot } /include'
56+ '--sysroot' , emscripten_sysroot ,
6157 '-O1' ,
6258 ]
6359
@@ -68,7 +64,6 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
6864 '--export' , '__wasm_call_ctors' ,
6965 '--export' , '__start_em_asm' ,
7066 '--export' , '__stop_em_asm' ,
71- '--global-base=568' ,
7267 ]
7368 # We had a regression where this test only worked if debug names
7469 # were included.
@@ -79,10 +74,13 @@ def generate_wat_files(llvm_bin, emscripten_sysroot):
7974 compile_cmd .append ('-fvisibility=default' )
8075 link_cmd .append ('-shared' )
8176 link_cmd .append ('--experimental-pic' )
82- elif 'reserved_func_ptr' in src_file :
83- link_cmd .append ('--entry=__main_argc_argv' )
8477 else :
85- link_cmd .append ('--entry=main' )
78+ link_cmd .append ('--global-base=568' )
79+ link_cmd .append ('--no-stack-first' )
80+ if 'reserved_func_ptr' in src_file :
81+ link_cmd .append ('--entry=__main_argc_argv' )
82+ else :
83+ link_cmd .append ('--entry=main' )
8684
8785 if is_64 :
8886 compile_cmd .append ('--target=wasm64-emscripten' )
0 commit comments