File: README.md

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (47 lines) | stat: -rw-r--r-- 1,857 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Private Code Test

This directory provides a mechanism for testing that native does not link in
object files from unwanted directories. The test finds all linker inputs, and
checks that none live inside a list of internal paths.

Original bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1266989

## Determining Internal Directories

This is done by parsing the `.gclient_entries` file for all paths coming from
https://chrome-internal.googlesource.com. I chose this approach since it is
simple.

The main alternative I found was to use `gclient flatten`. Example output:

```
  # src -> src/internal
  "src/internal": {
    "url": "https://chrome-internal.googlesource.com/chrome/src-internal.git@c649c6a155fe65c3730e2d663d7d2058d33bf1f9",
    "condition": 'checkout_src_internal',
  },
```

* Paths could be found in this way by looking for `checkout_src_internal`
  within `condition`, and by looking for the comment line for `recurse_deps`
  that went through an internal repo.

## Determining Linker Inputs

This is done by parsing `build.ninja` to find all inputs to an executable. This
approach is pretty fast & simple, but does not catch the case where a public
`.cc` file has an `#include` a private `.h` file.

Alternatives considered:

1) Dump paths found in debug information.
  * Hard to do cross-platform.
2) Scan a linker map file for input paths.
  * LTO causes paths in linker map to be inaccurate.
3) Use a fake link step to capture all object file inputs
  * Object files paths are relative to GN target, so this does not catch
    internal sources referenced by public GN targets.
4) Query GN / Ninja for transitive inputs
  * This ends up listing non-linker inputs as well, which we do not want.
5) Parse depfiles to find all headers, and add them to the list of inputs
  * Additional work, but would give us full coverage.