diff --git a/community/leveldb/APKBUILD b/community/leveldb/APKBUILD
index 7433f5876c8a502d34eede3ae97d3c05a6b31438..35630ec38f613cfd91997ca8eed675da3d940b16 100644
--- a/community/leveldb/APKBUILD
+++ b/community/leveldb/APKBUILD
@@ -15,16 +15,18 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/google/$pkgname/archive/$pkg
 	benchmark-$_benchmark.tar.gz::https://github.com/google/benchmark/archive/$_benchmark.tar.gz
 	gtest-$_gtest.tar.gz::https://github.com/google/googletest/archive/$_gtest.tar.gz
 	no-install-test-deps.patch
+	benchmark.patch
 	"
 
 prepare() {
-	default_prepare
-
 	rmdir third_party/benchmark
 	rmdir third_party/googletest
 
 	mv "$srcdir"/googletest-$_gtest third_party/googletest
 	mv "$srcdir"/benchmark-$_benchmark third_party/benchmark
+
+	# patch after completed third-party packages
+	default_prepare
 }
 
 build() {
@@ -53,4 +55,5 @@ ac15eac29387b9f702a901b6567d47a9f8c17cf5c7d8700a77ec771da25158c83b04959c33f3d4de
 10d9cab9dd20b59d38ff89f499590d1648f3347052c8e7662e36120c9a7e8d0f9a6334f5be673de83ab894faf15cf69bfc90edd6030342e46f8bdb9f9f07d47c  benchmark-7d0d9061d83b663ce05d9de5da3d5865a3845b79.tar.gz
 8c58145d8a19909ce57bf5fcfa69a9b65eced7521349204cf5e6e34772492de98c58831bc2bb36fea8b359b4ba5fd8b7fbc4a44e89dfc5e0cc686c8c30d65c80  gtest-662fe38e44900c007eccb65a5d2ea19df7bd520e.tar.gz
 53f5b94aecfb81dcfde17319d36446fc4a0f5131991ed8bfab7f86d572870405e7926515617f0eb433e38c3de84b50fb00aba26a07804900fdd7b0974a44a12d  no-install-test-deps.patch
+11979bdb870e42f3b977dbc849c36055d5144b9dac8d158d533de56fa84760f92139b97080c1cd804d3838cd0649386110586c00ffd389ffe096855f935033de  benchmark.patch
 "
diff --git a/community/leveldb/benchmark.patch b/community/leveldb/benchmark.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4e04b783a793f11791a86b954b07a9c3a2a8a780
--- /dev/null
+++ b/community/leveldb/benchmark.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/benchmark/src/cycleclock.h b/third_party/benchmark/src/cycleclock.h
+index 9bef594..cc4a433 100644
+--- a/third_party/benchmark/src/cycleclock.h
++++ b/third_party/benchmark/src/cycleclock.h
+@@ -167,7 +167,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
+   struct timeval tv;
+   gettimeofday(&tv, nullptr);
+   return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
+-#elif defined(__mips__) || defined(__m68k__)
++#elif defined(__mips__) || defined(__m68k__) || defined(__loongarch64)
+   // mips apparently only allows rdtsc for superusers, so we fall
+   // back to gettimeofday.  It's possible clock_gettime would be better.
+   struct timeval tv;