mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
www/chromium: unbreak on i386 by enforcing 8 byte alignment on i386 in partition alloc
This commit is contained in:
parent
4dce853b5f
commit
17f46f7198
4 changed files with 18 additions and 37 deletions
|
@ -15,7 +15,6 @@ LICENSE= BSD3CLAUSE LGPL21 MPL11
|
||||||
LICENSE_COMB= multi
|
LICENSE_COMB= multi
|
||||||
|
|
||||||
ONLY_FOR_ARCHS= aarch64 amd64 i386
|
ONLY_FOR_ARCHS= aarch64 amd64 i386
|
||||||
BROKEN_i386= does not build due to 4k alignment
|
|
||||||
|
|
||||||
BUILD_DEPENDS= bash:shells/bash \
|
BUILD_DEPENDS= bash:shells/bash \
|
||||||
${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \
|
${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
--- base/allocator/partition_allocator/partition_alloc.cc.orig 2022-10-24 13:33:33 UTC
|
|
||||||
+++ base/allocator/partition_allocator/partition_alloc.cc
|
|
||||||
@@ -67,8 +67,13 @@ void PartitionAllocGlobalInit(OomFunction on_out_of_me
|
|
||||||
"maximum direct mapped allocation");
|
|
||||||
|
|
||||||
// Check that some of our zanier calculations worked out as expected.
|
|
||||||
+#if defined(__i386__) && defined(OS_FREEBSD)
|
|
||||||
+ static_assert(internal::kSmallestBucket >= internal::kAlignment,
|
|
||||||
+ "generic smallest bucket");
|
|
||||||
+#else
|
|
||||||
static_assert(internal::kSmallestBucket == internal::kAlignment,
|
|
||||||
"generic smallest bucket");
|
|
||||||
+#endif
|
|
||||||
static_assert(internal::kMaxBucketed == 983040, "generic max bucketed");
|
|
||||||
STATIC_ASSERT_OR_PA_CHECK(
|
|
||||||
internal::MaxSystemPagesPerRegularSlotSpan() <= 16,
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
--- base/allocator/partition_allocator/partition_alloc_forward.h.orig 2022-11-06 16:08:29 UTC
|
||||||
|
+++ base/allocator/partition_allocator/partition_alloc_forward.h
|
||||||
|
@@ -25,9 +25,13 @@ namespace internal {
|
||||||
|
// the second one 16. We could technically return something different for
|
||||||
|
// malloc() and operator new(), but this would complicate things, and most of
|
||||||
|
// our allocations are presumably coming from operator new() anyway.
|
||||||
|
+#if defined(__i386__) && defined(OS_FREEBSD)
|
||||||
|
+constexpr size_t kAlignment = 8;
|
||||||
|
+#else
|
||||||
|
constexpr size_t kAlignment =
|
||||||
|
std::max(alignof(max_align_t),
|
||||||
|
static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
|
||||||
|
+#endif
|
||||||
|
static_assert(kAlignment <= 16,
|
||||||
|
"PartitionAlloc doesn't support a fundamental alignment larger "
|
||||||
|
"than 16 bytes.");
|
|
@ -1,14 +1,6 @@
|
||||||
--- base/allocator/partition_allocator/partition_page.h.orig 2022-10-24 13:33:33 UTC
|
--- base/allocator/partition_allocator/partition_page.h.orig 2022-11-06 16:08:29 UTC
|
||||||
+++ base/allocator/partition_allocator/partition_page.h
|
+++ base/allocator/partition_allocator/partition_page.h
|
||||||
@@ -138,13 +138,14 @@ struct SlotSpanMetadata {
|
@@ -144,7 +144,7 @@ struct SlotSpanMetadata {
|
||||||
PartitionBucket<thread_safe>* const bucket = nullptr;
|
|
||||||
|
|
||||||
// CHECK()ed in AllocNewSlotSpan().
|
|
||||||
-#if defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE)
|
|
||||||
+#if (defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE)) || \
|
|
||||||
+ (BUILDFLAG(IS_FREEBSD) && defined(__i386__))
|
|
||||||
// System page size is not a constant on Apple OSes, but is either 4 or 16kiB
|
|
||||||
// (1 << 12 or 1 << 14), as checked in PartitionRoot::Init(). And
|
|
||||||
// PartitionPageSize() is 4 times the OS page size.
|
// PartitionPageSize() is 4 times the OS page size.
|
||||||
static constexpr size_t kMaxSlotsPerSlotSpan =
|
static constexpr size_t kMaxSlotsPerSlotSpan =
|
||||||
4 * (1 << 14) / kSmallestBucket;
|
4 * (1 << 14) / kSmallestBucket;
|
||||||
|
@ -17,13 +9,3 @@
|
||||||
// System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is
|
// System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is
|
||||||
// currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code,
|
// currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code,
|
||||||
// so we use the 16 kiB maximum (64 kiB will crash).
|
// so we use the 16 kiB maximum (64 kiB will crash).
|
||||||
@@ -158,7 +159,9 @@ struct SlotSpanMetadata {
|
|
||||||
#endif // defined(PA_HAS_64_BITS_POINTERS) && BUILDFLAG(IS_APPLE)
|
|
||||||
// The maximum number of bits needed to cover all currently supported OSes.
|
|
||||||
static constexpr size_t kMaxSlotsPerSlotSpanBits = 13;
|
|
||||||
+#if !BUILDFLAG(IS_FREEBSD) && defined(__i386__)
|
|
||||||
static_assert(kMaxSlotsPerSlotSpan < (1 << kMaxSlotsPerSlotSpanBits), "");
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
// |marked_full| isn't equivalent to being full. Slot span is marked as full
|
|
||||||
// iff it isn't on the active slot span list (or any other list).
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue