@@ -17,7 +17,6 @@ use rustc_middle::middle::exported_symbols::{
1717use  rustc_middle:: ty:: TyCtxt ; 
1818use  rustc_session:: Session ; 
1919use  rustc_session:: config:: { self ,  CrateType ,  DebugInfo ,  LinkerPluginLto ,  Lto ,  OptLevel ,  Strip } ; 
20- use  rustc_span:: sym; 
2120use  rustc_target:: spec:: { Cc ,  LinkOutputKind ,  LinkerFlavor ,  Lld } ; 
2221use  tracing:: { debug,  warn} ; 
2322
@@ -1324,37 +1323,7 @@ struct WasmLd<'a> {
13241323
13251324impl < ' a >  WasmLd < ' a >  { 
13261325    fn  new ( cmd :  Command ,  sess :  & ' a  Session )  -> WasmLd < ' a >  { 
1327-         // If the atomics feature is enabled for wasm then we need a whole bunch 
1328-         // of flags: 
1329-         // 
1330-         // * `--shared-memory` - the link won't even succeed without this, flags 
1331-         //   the one linear memory as `shared` 
1332-         // 
1333-         // * `--max-memory=1G` - when specifying a shared memory this must also 
1334-         //   be specified. We conservatively choose 1GB but users should be able 
1335-         //   to override this with `-C link-arg`. 
1336-         // 
1337-         // * `--import-memory` - it doesn't make much sense for memory to be 
1338-         //   exported in a threaded module because typically you're 
1339-         //   sharing memory and instantiating the module multiple times. As a 
1340-         //   result if it were exported then we'd just have no sharing. 
1341-         // 
1342-         // On wasm32-unknown-unknown, we also export symbols for glue code to use: 
1343-         //    * `--export=*tls*` - when `#[thread_local]` symbols are used these 
1344-         //      symbols are how the TLS segments are initialized and configured. 
1345-         let  mut  wasm_ld = WasmLd  {  cmd,  sess } ; 
1346-         if  sess. target_features . contains ( & sym:: atomics)  { 
1347-             wasm_ld. link_args ( & [ "--shared-memory" ,  "--max-memory=1073741824" ,  "--import-memory" ] ) ; 
1348-             if  sess. target . os  == "unknown"  || sess. target . os  == "none"  { 
1349-                 wasm_ld. link_args ( & [ 
1350-                     "--export=__wasm_init_tls" , 
1351-                     "--export=__tls_size" , 
1352-                     "--export=__tls_align" , 
1353-                     "--export=__tls_base" , 
1354-                 ] ) ; 
1355-             } 
1356-         } 
1357-         wasm_ld
1326+         WasmLd  {  cmd,  sess } 
13581327    } 
13591328} 
13601329
0 commit comments