nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 1 | # Windows Split DLLs |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 3 | A build mode where chrome.dll is split into two separate DLLs. This was |
| 4 | undertaken as one possible workaround for toolchain limitations on Windows. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 5 | |
| 6 | ## How |
| 7 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 8 | Normally, you probably don't need to worry about doing this build. If for some |
| 9 | reason you need to build it locally: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 10 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 11 | 1. From a _Visual Studio Command Prompt_ running as **Administrator** run |
| 12 | `python tools\win\split_link\install_split_link.py`. |
| 13 | 1. Set `GYP_DEFINES=chrome_split_dll=1`. In particular, don't have |
| 14 | `component=shared_library`. Other things, like `buildtype` or `fastbuild` |
| 15 | are fine. |
| 16 | 1. `gclient runhooks` |
| 17 | 1. `ninja -C out\Release chrome` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 18 | |
| 19 | `chrome_split_dll` currently applies only to chrome.dll (and not test binaries). |
| 20 | |
| 21 | ## What |
| 22 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 23 | This is intended to be a temporary measure until either the toolchain is |
| 24 | improved or the code can be physically separated into two DLLs (based on a |
| 25 | browser/child split). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 26 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 27 | The link replacement forcibly splits chrome.dll into two halves based on a |
| 28 | description in `build\split_link_partition.py`. Code is primarily split along |
| 29 | browser/renderer lines. Roughly, Blink and its direct dependencies are in the |
| 30 | "chrome1.dll", and the rest of the browser code remains in "chrome.dll". |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 31 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 32 | TODO: build\split_link_partition.py doesn't exist. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 33 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 34 | Splitting the code this way allows keeping maximum optimization on the Blink |
| 35 | portion of the code, which is important for performance. |
| 36 | |
| 37 | There is a compile time define set when building in this mode |
| 38 | `CHROME_SPLIT_DLL`, however it should be used very sparingly-to-not-at-all. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 39 | |
| 40 | ## Details |
| 41 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 42 | This forcible split is implemented by putting .lib files in either one DLL or |
| 43 | the other, and causing unresolved externals that result during linking to be |
| 44 | forcibly exported from the other DLL. This works relatively cleanly for function |
| 45 | import/export, however it cannot work for data export. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 46 | |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 47 | There are relatively few instances where data exports are required across the |
| 48 | DLL boundary. The waterfall builder |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 49 | https://build.chromium.org/p/chromium/waterfall?show=Win%20Split will detect when |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 50 | new data exports are added, and these will need to be repaired. For constants, |
| 51 | the data can be duplicated to both DLLs, but for writeable data, a wrapping |
| 52 | set/get function will need to be added. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 53 | |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 54 | https://build.chromium.org/p/chromium/waterfall?show=Win%20Split does not exist. |
nodir | 62c9184e | 2015-08-25 00:57:46 | [diff] [blame] | 55 | |
| 56 | Some more details can be found on the initial commit of the split_link script |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 57 | https://src.chromium.org/viewvc/chrome?revision=200049&view=revision and the |
| 58 | associated bugs: https://crbug.com/237249 https://crbug.com/237267. |