Skip to content

Commit

Permalink
raw_ptr: Fix component build
Browse files Browse the repository at this point in the history
`raw_ptr` cannot be promoted into a component without hitting issues
with undefined CRT symbols. Instead,

1. We assert that the `//base` component provides access to the
   `raw_ptr` source set in Chromium and
2. We provide the appropriate define to make the component build work
   with `HookableRawPtrImpl`.

Fixed: 1413475
Change-Id: Iadd0c13ab3bd768006f972121f27d90ab429bca8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4235042
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104358}
  • Loading branch information
Kalvin Lee authored and Chromium LUCI CQ committed Feb 13, 2023
1 parent 0d841ba commit 8aaf87f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,11 @@ component("base") {
"//third_party/modp_b64",
]

# `raw_ptr` cannot be made a component due to CRT symbol issues.
# Its gateway to being a component is through `//base`, so we have
# to provide the appropriate `#define` here.
defines += [ "IS_RAW_PTR_IMPL" ]

if (is_apple) {
deps += [ "//base/time/buildflags:buildflags" ]
}
Expand Down
6 changes: 6 additions & 0 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ source_set("raw_ptr") {

# See also: `partition_alloc_base/component_export.h`
defines = [ "IS_RAW_PTR_IMPL" ]

# When built inside Chromium, although this cannot directly be made a
# component, we expect `//base` to provide the only GN-level access.
if (build_with_chromium) {
visibility = [ "//base" ]
}
}

buildflag_header("partition_alloc_buildflags") {
Expand Down

0 comments on commit 8aaf87f

Please sign in to comment.