diff mbox series

[meta-oe,104/128] breakpad: fix build with GCC 16

Message ID 20260628162222.4081517-4-khem.raj@oss.qualcomm.com
State New
Headers show
Series None | expand

Commit Message

Khem Raj June 28, 2026, 4:21 p.m. UTC
Move ModuleFactory::CreateModule out of line.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...ove-CreateModule-out-of-line-to-fix-.patch | 95 +++++++++++++++++++
 .../breakpad/breakpad_2023.06.01.bb           |  1 +
 2 files changed, 96 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-module_factory-move-CreateModule-out-of-line-to-fix-.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0001-module_factory-move-CreateModule-out-of-line-to-fix-.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0001-module_factory-move-CreateModule-out-of-line-to-fix-.patch
new file mode 100644
index 0000000000..baa5ca2a58
--- /dev/null
+++ b/meta-oe/recipes-devtools/breakpad/breakpad/0001-module_factory-move-CreateModule-out-of-line-to-fix-.patch
@@ -0,0 +1,95 @@ 
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 23 Jun 2026 00:00:00 +0000
+Subject: [PATCH] module_factory: move CreateModule out of line to fix vtable
+ link error
+
+module_factory.h defines BasicModuleFactory::CreateModule and
+FastModuleFactory::CreateModule inline. These inline functions
+construct a {Basic,Fast}SourceLineResolver::Module, whose only
+out-of-line virtual ("key") function lives in
+{basic,fast}_source_line_resolver.cc. Consequently every translation
+unit that includes module_factory.h (notably
+source_line_resolver_base.cc) emits an undefined reference to the
+Module vtable.
+
+With newer linkers (and --as-needed) the binaries that link
+source_line_resolver_base.o but not fast_source_line_resolver.o, such
+as microdump_stackwalk, fail to link with:
+
+  undefined reference to `vtable for
+  google_breakpad::FastSourceLineResolver::Module'
+
+Move the CreateModule definitions out of the header into the
+respective .cc files, which already include module_factory.h and which
+are also where the Module vtables are emitted. This way
+source_line_resolver_base.o no longer references the Fast/Basic Module
+vtables.
+
+Upstream-Status: Submitted [https://github.com/google/breakpad]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/processor/basic_source_line_resolver.cc | 5 +++++
+ src/processor/fast_source_line_resolver.cc  | 5 +++++
+ src/processor/module_factory.h              | 8 ++------
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
+index 1111111..2222222 100644
+--- a/src/processor/basic_source_line_resolver.cc
++++ b/src/processor/basic_source_line_resolver.cc
+@@ -108,6 +108,11 @@ static const char* kWhitespace = " \r\n";
+ static const int kMaxErrorsPrinted = 5;
+ static const int kMaxErrorsBeforeBailing = 100;
+
++BasicSourceLineResolver::Module* BasicModuleFactory::CreateModule(
++    const string& name) const {
++  return new BasicSourceLineResolver::Module(name);
++}
++
+ BasicSourceLineResolver::BasicSourceLineResolver() :
+     SourceLineResolverBase(new BasicModuleFactory) { }
+
+diff --git a/src/processor/fast_source_line_resolver.cc b/src/processor/fast_source_line_resolver.cc
+index 1111111..2222222 100644
+--- a/src/processor/fast_source_line_resolver.cc
++++ b/src/processor/fast_source_line_resolver.cc
+@@ -60,6 +60,11 @@ using std::unique_ptr;
+
+ namespace google_breakpad {
+
++FastSourceLineResolver::Module* FastModuleFactory::CreateModule(
++    const string& name) const {
++  return new FastSourceLineResolver::Module(name);
++}
++
+ FastSourceLineResolver::FastSourceLineResolver()
+   : SourceLineResolverBase(new FastModuleFactory) { }
+
+diff --git a/src/processor/module_factory.h b/src/processor/module_factory.h
+index 1111111..2222222 100644
+--- a/src/processor/module_factory.h
++++ b/src/processor/module_factory.h
+@@ -52,18 +52,14 @@ class BasicModuleFactory : public ModuleFactory {
+  public:
+   virtual ~BasicModuleFactory() { }
+   virtual BasicSourceLineResolver::Module* CreateModule(
+-      const string& name) const {
+-    return new BasicSourceLineResolver::Module(name);
+-  }
++      const string& name) const;
+ };
+
+ class FastModuleFactory : public ModuleFactory {
+  public:
+   virtual ~FastModuleFactory() { }
+   virtual FastSourceLineResolver::Module* CreateModule(
+-      const string& name) const {
+-    return new FastSourceLineResolver::Module(name);
+-  }
++      const string& name) const;
+ };
+
+ }  // namespace google_breakpad
+--
+2.49.0
diff --git a/meta-oe/recipes-devtools/breakpad/breakpad_2023.06.01.bb b/meta-oe/recipes-devtools/breakpad/breakpad_2023.06.01.bb
index e7cb29289d..26f6ab9195 100644
--- a/meta-oe/recipes-devtools/breakpad/breakpad_2023.06.01.bb
+++ b/meta-oe/recipes-devtools/breakpad/breakpad_2023.06.01.bb
@@ -38,6 +38,7 @@  SRC_URI = "git://github.com/google/breakpad;name=breakpad;branch=main;protocol=h
            file://mcontext.patch \
            file://0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch \
            file://0001-Fixed-missing-include-for-std-find_if.patch \
+           file://0001-module_factory-move-CreateModule-out-of-line-to-fix-.patch \
            file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \
            file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \
 "