diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-03 15:53:06 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-03 15:53:06 +0000 |
commit | f26ff462b3d99472526df0380ebcf59d8e13f44d (patch) | |
tree | d4e95b4855b772d7cf850fb6ab34420b47f7d803 | |
parent | 7985bb4152465f8330d1290f9326f79c8251e244 (diff) | |
parent | 507dcbeef3514d2b511af0229ff4972130875427 (diff) | |
download | pdfium-f26ff462b3d99472526df0380ebcf59d8e13f44d.tar.gz |
Snap for 10428683 from 507dcbeef3514d2b511af0229ff4972130875427 to mainline-adbd-releaseaml_adb_340912530aml_adb_340912350aml_adb_340912200aml_adb_340912000android14-mainline-adbd-release
Change-Id: Ia50add2f27b9102c296fb3c7c89731853d29cd90
-rw-r--r-- | core/fxcrt/widestring.cpp | 13 | ||||
-rw-r--r-- | third_party/Android.bp | 6 | ||||
-rw-r--r-- | third_party/base/allocator/partition_allocator/address_space_randomization.h | 6 | ||||
-rw-r--r-- | third_party/base/allocator/partition_allocator/spin_lock.cc | 4 |
4 files changed, 20 insertions, 9 deletions
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index 10a31c3fa..4e51a85d9 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp @@ -287,18 +287,13 @@ static_assert(sizeof(WideString) <= sizeof(wchar_t*), WideString WideString::FormatV(const wchar_t* format, va_list argList) { va_list argListCopy; va_copy(argListCopy, argList); - int maxLen = vswprintf(nullptr, 0, format, argListCopy); + auto guess = GuessSizeForVSWPrintf(format, argListCopy); va_end(argListCopy); - if (maxLen <= 0) { - va_copy(argListCopy, argList); - auto guess = GuessSizeForVSWPrintf(format, argListCopy); - va_end(argListCopy); - - if (!guess.has_value()) - return WideString(); - maxLen = pdfium::base::checked_cast<int>(guess.value()); + if (!guess.has_value()) { + return WideString(); } + int maxLen = pdfium::base::checked_cast<int>(guess.value()); while (maxLen < 32 * 1024) { va_copy(argListCopy, argList); diff --git a/third_party/Android.bp b/third_party/Android.bp index 3fcb08d80..1c8e251cf 100644 --- a/third_party/Android.bp +++ b/third_party/Android.bp @@ -39,6 +39,12 @@ cc_library_static { "-DARCH_CPU_ARM64", ], }, + riscv64: { + cflags: [ + "-DARCH_CPU_64_BITS", + "-DARCH_CPU_RISCV64", + ], + }, x86: { cflags: [ "-DARCH_CPU_32_BITS", diff --git a/third_party/base/allocator/partition_allocator/address_space_randomization.h b/third_party/base/allocator/partition_allocator/address_space_randomization.h index 5cb2cccc3..7ed7f6ba4 100644 --- a/third_party/base/allocator/partition_allocator/address_space_randomization.h +++ b/third_party/base/allocator/partition_allocator/address_space_randomization.h @@ -100,6 +100,12 @@ constexpr uintptr_t AslrMask(uintptr_t bits) { #endif + #elif defined(ARCH_CPU_RISCV64) + + // RISCV64 on Linux has 39-bit user space. + constexpr uintptr_t kASLRMask = AslrMask(38); + constexpr uintptr_t kASLROffset = AslrAddress(0x1000000000ULL); + #elif defined(ARCH_CPU_PPC64) #if defined(OS_AIX) diff --git a/third_party/base/allocator/partition_allocator/spin_lock.cc b/third_party/base/allocator/partition_allocator/spin_lock.cc index 42055836b..99e56b256 100644 --- a/third_party/base/allocator/partition_allocator/spin_lock.cc +++ b/third_party/base/allocator/partition_allocator/spin_lock.cc @@ -45,6 +45,10 @@ #define YIELD_PROCESSOR __asm__ __volatile__("pause") #elif defined(ARCH_CPU_PPC64_FAMILY) #define YIELD_PROCESSOR __asm__ __volatile__("or 31,31,31") +#elif defined(ARCH_CPU_RISCV64) +// Encoding of the pause instruction from the Zihintpause extension. This +// is a noop on cpus that don't have the Zihintpause extension. +#define YIELD_PROCESSOR __asm__ __volatile__ (".4byte 0x100000F"); #elif defined(ARCH_CPU_S390_FAMILY) // just do nothing #define YIELD_PROCESSOR ((void)0) |