From 7ef5e1f643b8439a1a1e9737827933c075d00f68 Mon Sep 17 00:00:00 2001 From: Wyatt Hepler Date: Tue, 13 Aug 2024 21:55:59 +0000 Subject: [PATCH] pw_kvs: Move inline variable definition to .cc file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no_inline_ is defined as an inline variable. pw::Vector has a non-default constructor, which causes Clang to use the SHF_GNU_RETAIN section flag (at least when compiling for RP2). Since SHF_GNU_RETAIN is a GNU extension, Clang sets the ELF's EI_OSABI field to ELFOSABI_GNU, instead of the default ELFOSABI_NONE. Picotool only accepts ELFs with an EI_OSABI of ELFOSABI_NONE, even if the binary is actually compatible. To avoid this issue, do not use an inline variable. Bug: b/357162923 Change-Id: I396a59dad714c89957235c8e77c7ee2019ea37f5 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/228514 Pigweed-Auto-Submit: Wyatt Hepler Commit-Queue: Auto-Submit Reviewed-by: Armando Montanez Lint: Lint 🤖 Presubmit-Verified: CQ Bot Account --- pw_blob_store/BUILD.bazel | 20 -------------------- pw_kvs/fake_flash_memory.cc | 2 ++ pw_kvs/public/pw_kvs/fake_flash_memory.h | 2 +- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/pw_blob_store/BUILD.bazel b/pw_blob_store/BUILD.bazel index c7030e647d..09df02429a 100644 --- a/pw_blob_store/BUILD.bazel +++ b/pw_blob_store/BUILD.bazel @@ -62,11 +62,6 @@ pw_cc_test( srcs = [ "blob_store_test.cc", ], - # TODO: b/357162923 - Fails on clang + Pico. - target_compatible_with = select({ - "//targets/rp2040:pico_clang_build": ["@platforms//:incompatible"], - "//conditions:default": [], - }), deps = [ ":pw_blob_store", "//pw_kvs:crc16", @@ -84,11 +79,6 @@ pw_cc_test( srcs = [ "blob_store_chunk_write_test.cc", ], - # TODO: b/357162923 - Fails on clang + Pico. - target_compatible_with = select({ - "//targets/rp2040:pico_clang_build": ["@platforms//:incompatible"], - "//conditions:default": [], - }), deps = [ ":pw_blob_store", "//pw_kvs:crc16", @@ -105,11 +95,6 @@ pw_cc_test( srcs = [ "blob_store_deferred_write_test.cc", ], - # TODO: b/357162923 - Fails on clang + Pico. - target_compatible_with = select({ - "//targets/rp2040:pico_clang_build": ["@platforms//:incompatible"], - "//conditions:default": [], - }), deps = [ ":pw_blob_store", "//pw_kvs:crc16", @@ -124,11 +109,6 @@ pw_cc_test( pw_cc_test( name = "flat_file_system_entry_test", srcs = ["flat_file_system_entry_test.cc"], - # TODO: b/357162923 - Fails on clang + Pico. - target_compatible_with = select({ - "//targets/rp2040:pico_clang_build": ["@platforms//:incompatible"], - "//conditions:default": [], - }), deps = [ ":flat_file_system_entry", ":pw_blob_store", diff --git a/pw_kvs/fake_flash_memory.cc b/pw_kvs/fake_flash_memory.cc index fed4222dc2..ee85736ed2 100644 --- a/pw_kvs/fake_flash_memory.cc +++ b/pw_kvs/fake_flash_memory.cc @@ -57,6 +57,8 @@ Status FlashError::Check(FlashMemory::Address start_address, size_t size) { return status_; } +Vector FakeFlashMemory::no_errors_; + Status FakeFlashMemory::Erase(Address address, size_t num_sectors) { if (address % sector_size_bytes() != 0) { PW_LOG_ERROR( diff --git a/pw_kvs/public/pw_kvs/fake_flash_memory.h b/pw_kvs/public/pw_kvs/fake_flash_memory.h index c15111b7f7..de2b7ec426 100644 --- a/pw_kvs/public/pw_kvs/fake_flash_memory.h +++ b/pw_kvs/public/pw_kvs/fake_flash_memory.h @@ -137,7 +137,7 @@ class FakeFlashMemory : public FlashMemory { } private: - static inline Vector no_errors_; + static Vector no_errors_; const span buffer_; Vector& read_errors_;