1From 8ce23d5fae2f523753547c9d656aeeb29914976e Mon Sep 17 00:00:00 2001
2From: Qi Tiezheng <qitiezheng@360.cn>
3Date: Fri, 29 Jul 2022 14:50:19 +0000
4Subject: [PATCH 14/17] page_characteristics in base should be exported
5
6Cross compiling Chromium for linux arm64 may fails,
7partition_alloc::internal::page_characteristics is used on arm64
8in inline function PageAllocationGranularityShift()
9
10[42925/82488] SOLINK ./libwtf.so
11FAILED: libwtf.so libwtf.so.TOC
12python3 "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/llvm-build/Release+Asserts/bin/llvm-readelf" --nm="../../third_party/llvm-build/Release+Asserts/bin/llvm-nm"  --sofile="./libwtf.so" --tocfile="./libwtf.so.TOC" --output="./libwtf.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libwtf.so" -Werror -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--color-diagnostics -Wl,--no-call-graph-profile-sort --target=aarch64-linux-gnu -no-canonical-prefixes -rdynamic -Wl,-z,defs -Wl,--as-needed -nostdlib++ --sysroot=../../build/linux/debian_stretch_arm64-sysroot -Wl,-rpath=\$ORIGIN -Wl,--gdb-index -L../../build/linux/debian_stretch_arm64-sysroot/usr/lib/aarch64-linux-gnu -o "./libwtf.so" @"./libwtf.so.rsp"
13ld.lld: error: undefined symbol: partition_alloc::internal::page_characteristics
14>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0)
15>>>               obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity())
16>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0)
17>>>               obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity())
18>>> referenced by page_allocator_constants.h:0 (../../base/allocator/partition_allocator/page_allocator_constants.h:0)
19>>>               obj/third_party/blink/renderer/platform/wtf/wtf/partitions.o:(partition_alloc::internal::PageAllocationGranularity())
20>>> referenced 3 more times
21clang++: error: linker command failed with exit code 1 (use -v to see invocation)
22[43049/82488] ACTION //third_party/blink/renderer/bindings:generate_bindings_all(//build/toolchain/linux:clang_x64_v8_arm64)
23
24Bug: 1346491
25Change-Id: Ie5ce8d9cea0b3eff2303f8fe372eb2e3773e8839
26Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3780440
27Auto-Submit: Qi Tiezheng <qitiezheng@360.cn>
28Reviewed-by: Takashi Sakamoto <tasak@google.com>
29Commit-Queue: Benoit Lize <lizeb@chromium.org>
30Reviewed-by: Benoit Lize <lizeb@chromium.org>
31Cr-Commit-Position: refs/heads/main@{#1029784}
32---
33 base/allocator/partition_allocator/page_allocator_constants.h | 2 ++
34 1 file changed, 2 insertions(+)
35
36diff --git a/base/allocator/partition_allocator/page_allocator_constants.h b/base/allocator/partition_allocator/page_allocator_constants.h
37index 5ed440c3f..004dcfd96 100644
38--- a/base/allocator/partition_allocator/page_allocator_constants.h
39+++ b/base/allocator/partition_allocator/page_allocator_constants.h
40@@ -7,6 +7,7 @@
41
42 #include <stddef.h>
43
44+#include "base/allocator/partition_allocator/partition_alloc_base/component_export.h"
45 #include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h"
46 #include "build/build_config.h"
47
48@@ -45,6 +46,7 @@ struct PageCharacteristics {
49   std::atomic<int> size;
50   std::atomic<int> shift;
51 };
52+PA_COMPONENT_EXPORT(PARTITION_ALLOC)
53 extern PageCharacteristics page_characteristics;
54
55 }  // namespace partition_alloc::internal
56--
572.20.1
58
59