llvmPackages_{15,16}: fix libcxxabi -fno-exceptions build for wasm

+44 -24
+22 -12
pkgs/development/compilers/llvm/15/default.nix
··· 266 266 targetLlvmLibraries.compiler-rt 267 267 ]; 268 268 extraBuildCommands = mkExtraBuildCommands cc; 269 - nixSupport.cc-cflags = [ 270 - "-rtlib=compiler-rt" 271 - "-B${targetLlvmLibraries.compiler-rt}/lib" 272 - "-nostdlib++" 273 - ]; 269 + nixSupport.cc-cflags = 270 + [ 271 + "-rtlib=compiler-rt" 272 + "-B${targetLlvmLibraries.compiler-rt}/lib" 273 + "-nostdlib++" 274 + ] 275 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 274 276 }; 275 277 276 278 clangNoLibc = wrapCCWith rec { ··· 281 283 targetLlvmLibraries.compiler-rt 282 284 ]; 283 285 extraBuildCommands = mkExtraBuildCommands cc; 284 - nixSupport.cc-cflags = [ 285 - "-rtlib=compiler-rt" 286 - "-B${targetLlvmLibraries.compiler-rt}/lib" 287 - ]; 286 + nixSupport.cc-cflags = 287 + [ 288 + "-rtlib=compiler-rt" 289 + "-B${targetLlvmLibraries.compiler-rt}/lib" 290 + ] 291 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 288 292 }; 289 293 290 294 clangNoCompilerRt = wrapCCWith rec { ··· 293 297 bintools = bintoolsNoLibc'; 294 298 extraPackages = [ ]; 295 299 extraBuildCommands = mkExtraBuildCommands0 cc; 296 - nixSupport.cc-cflags = [ "-nostartfiles" ]; 300 + nixSupport.cc-cflags = 301 + [ 302 + "-nostartfiles" 303 + ] 304 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 297 305 }; 298 306 299 - clangNoCompilerRtWithLibc = wrapCCWith rec { 307 + clangNoCompilerRtWithLibc = wrapCCWith (rec { 300 308 cc = tools.clang-unwrapped; 301 309 libcxx = null; 302 310 bintools = bintools'; 303 311 extraPackages = [ ]; 304 312 extraBuildCommands = mkExtraBuildCommands0 cc; 305 - }; 313 + } // lib.optionalAttrs stdenv.targetPlatform.isWasm { 314 + nixSupport.cc-cflags = [ "-fno-exceptions" ]; 315 + }); 306 316 307 317 }); 308 318
+22 -12
pkgs/development/compilers/llvm/16/default.nix
··· 271 271 targetLlvmLibraries.compiler-rt 272 272 ]; 273 273 extraBuildCommands = mkExtraBuildCommands cc; 274 - nixSupport.cc-cflags = [ 275 - "-rtlib=compiler-rt" 276 - "-B${targetLlvmLibraries.compiler-rt}/lib" 277 - "-nostdlib++" 278 - ]; 274 + nixSupport.cc-cflags = 275 + [ 276 + "-rtlib=compiler-rt" 277 + "-B${targetLlvmLibraries.compiler-rt}/lib" 278 + "-nostdlib++" 279 + ] 280 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 279 281 }; 280 282 281 283 clangNoLibc = wrapCCWith rec { ··· 286 288 targetLlvmLibraries.compiler-rt 287 289 ]; 288 290 extraBuildCommands = mkExtraBuildCommands cc; 289 - nixSupport.cc-cflags = [ 290 - "-rtlib=compiler-rt" 291 - "-B${targetLlvmLibraries.compiler-rt}/lib" 292 - ]; 291 + nixSupport.cc-cflags = 292 + [ 293 + "-rtlib=compiler-rt" 294 + "-B${targetLlvmLibraries.compiler-rt}/lib" 295 + ] 296 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 293 297 }; 294 298 295 299 clangNoCompilerRt = wrapCCWith rec { ··· 298 302 bintools = bintoolsNoLibc'; 299 303 extraPackages = [ ]; 300 304 extraBuildCommands = mkExtraBuildCommands0 cc; 301 - nixSupport.cc-cflags = [ "-nostartfiles" ]; 305 + nixSupport.cc-cflags = 306 + [ 307 + "-nostartfiles" 308 + ] 309 + ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 302 310 }; 303 311 304 - clangNoCompilerRtWithLibc = wrapCCWith rec { 312 + clangNoCompilerRtWithLibc = wrapCCWith (rec { 305 313 cc = tools.clang-unwrapped; 306 314 libcxx = null; 307 315 bintools = bintools'; 308 316 extraPackages = [ ]; 309 317 extraBuildCommands = mkExtraBuildCommands0 cc; 310 - }; 318 + } // lib.optionalAttrs stdenv.targetPlatform.isWasm { 319 + nixSupport.cc-cflags = [ "-fno-exceptions" ]; 320 + }); 311 321 312 322 # Has to be in tools despite mostly being a library, 313 323 # because we use a native helper executable from a