Skip to content

Commit

Permalink
pw_kvs: Move inline variable definition to .cc file
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Armando Montanez <[email protected]>
Lint: Lint 🤖 <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Aug 13, 2024
1 parent e011157 commit 7ef5e1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
20 changes: 0 additions & 20 deletions pw_blob_store/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions pw_kvs/fake_flash_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Status FlashError::Check(FlashMemory::Address start_address, size_t size) {
return status_;
}

Vector<FlashError, 0> FakeFlashMemory::no_errors_;

Status FakeFlashMemory::Erase(Address address, size_t num_sectors) {
if (address % sector_size_bytes() != 0) {
PW_LOG_ERROR(
Expand Down
2 changes: 1 addition & 1 deletion pw_kvs/public/pw_kvs/fake_flash_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FakeFlashMemory : public FlashMemory {
}

private:
static inline Vector<FlashError, 0> no_errors_;
static Vector<FlashError, 0> no_errors_;

const span<std::byte> buffer_;
Vector<FlashError>& read_errors_;
Expand Down

0 comments on commit 7ef5e1f

Please sign in to comment.