@@ -122,7 +122,7 @@ config("compiler") {
122122 cflags += [ " --target=x86_64-windows" ]
123123 }
124124 } else if (current_cpu == " arm64" ) {
125- cflags += [ " --target=arm64 -windows" ]
125+ cflags += [ " --target=aarch64-pc -windows" ]
126126 } else {
127127 assert (false , " unknown current_cpu " + current_cpu )
128128 }
@@ -399,25 +399,40 @@ config("cfi_linker") {
399399}
400400
401401# This is a superset of all the delayloads needed for chrome.exe, chrome.dll,
402- # chrome_child.dll, and chrome_elf.dll. The linker will automatically ignore
403- # anything which is not linked to the binary at all.
404- # Most of the dlls are simply not required at startup (or at all, depending
405- # on how the browser is used). The following dlls are interconnected and need to
406- # be delayloaded together to ensure user32 does not load too early or at all,
407- # depending on the process type: user32, gdi32, comctl32, comdlg32, cryptui,
408- # d3d9, dwmapi, imm32, msi, ole32, oleacc, rstrtmgr, shell32, shlwapi, and
409- # uxtheme.
410- # There are some exceptions to this list which need to be declared separately.
411- # Some dlls cannot be delayloaded by chrome_child.dll due to the sandbox
412- # restrictions that prevent them from being loaded properly. Those dlls are
413- # specified in the separate config below.
402+ # and chrome_elf.dll. The linker will automatically ignore anything which is not
403+ # linked to the binary at all (it is harmless to have an unmatched /delayload).
404+ #
405+ # We delayload most libraries as the dlls are simply not required at startup (or
406+ # at all, depending on the process type). In unsandboxed process they will load
407+ # when first needed.
408+ #
409+ # Some dlls open handles when they are loaded, and we may not want them to be
410+ # loaded in renderers or other sandboxed processes. Conversely, some dlls must
411+ # be loaded before sandbox lockdown.
412+ #
413+ # Some dlls themselves load others - in particular, to avoid unconditionally
414+ # loading user32.dll - we require that the following dlls are all delayloaded:
415+ # user32, gdi32, comctl32, comdlg32, cryptui, d3d9, dwmapi, imm32, msi, ole32,
416+ # oleacc, rstrtmgr, shell32, shlwapi, and uxtheme.
417+ #
418+ # Advapi32.dll is unconditionally loaded at process startup on Windows 10, but
419+ # on Windows 11 it is not, which makes it worthwhile to delay load it.
420+ # Additionally, advapi32.dll exports several functions that are forwarded to
421+ # other DLLs such as cryptbase.dll. If calls to those functions are present but
422+ # there are some processes where the functions are never called then delay
423+ # loading of advapi32.dll avoids pulling in those DLLs (such as cryptbase.dll)
424+ # unnecessarily, even if advapi32.dll itself is loaded.
425+ #
426+ # This config applies to chrome.exe, chrome.dll, chrome_elf.dll (& others).
427+ #
414428# This config should also be used for any test binary whose goal is to run
415429# tests with the full browser.
416430config (" delayloads" ) {
417431 ldflags = [
418432 " /DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll" ,
419433 " /DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll" ,
420434 " /DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll" ,
435+ " /DELAYLOAD:advapi32.dll" ,
421436 " /DELAYLOAD:comctl32.dll" ,
422437 " /DELAYLOAD:comdlg32.dll" ,
423438 " /DELAYLOAD:credui.dll" ,
@@ -444,6 +459,7 @@ config("delayloads") {
444459 " /DELAYLOAD:setupapi.dll" ,
445460 " /DELAYLOAD:shell32.dll" ,
446461 " /DELAYLOAD:shlwapi.dll" ,
462+ " /DELAYLOAD:uiautomationcore.dll" ,
447463 " /DELAYLOAD:urlmon.dll" ,
448464 " /DELAYLOAD:user32.dll" ,
449465 " /DELAYLOAD:usp10.dll" ,
@@ -457,17 +473,17 @@ config("delayloads") {
457473 ]
458474}
459475
476+ # This config (along with `:delayloads`) applies to chrome.exe & chrome_elf.dll.
477+ # Entries should not appear in both configs.
460478config (" delayloads_not_for_child_dll" ) {
461479 ldflags = [
462- " /DELAYLOAD:advapi32.dll" ,
463480 " /DELAYLOAD:crypt32.dll" ,
464481 " /DELAYLOAD:dbghelp.dll" ,
465482 " /DELAYLOAD:dhcpcsvc.dll" ,
466483 " /DELAYLOAD:dwrite.dll" ,
467484 " /DELAYLOAD:iphlpapi.dll" ,
468485 " /DELAYLOAD:oleaut32.dll" ,
469486 " /DELAYLOAD:secur32.dll" ,
470- " /DELAYLOAD:uiautomationcore.dll" ,
471487 " /DELAYLOAD:userenv.dll" ,
472488 " /DELAYLOAD:winhttp.dll" ,
473489 " /DELAYLOAD:winmm.dll" ,
@@ -652,6 +668,10 @@ config("default_incremental_linking") {
652668 # TODO(thakis ): /INCREMENTAL is on by default in link.exe, but not in
653669 # lld.
654670 ldflags += [ " /OPT:NOREF" ]
671+
672+ # TODO(crbug.com/1444129): Mixing incrememntal and icf produces an error
673+ # in lld-link.
674+ ldflags += [ " /OPT:NOICF" ]
655675 }
656676 } else {
657677 ldflags = [ " /INCREMENTAL:NO" ]
0 commit comments