Skip to contentSkip to conversation

test: fix soring build with LTO

PATCH New Stephen Hemminger 1 participant 1 message Nov 10 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: fix soring build with LTO

With LTO, gcc inlines rte_soring_acquirx_bulk() into test_soring_stages(). The element copy switches on the runtime r->esize, so the 16-byte copy path stays live and gcc reports -Wstringop-overflow writing into the 32 x uint32_t stack arrays. That path is never taken since the ring is created with 4 byte elements and metadata.

The diagnostic is emitted by lto1 at link time, so it cannot be silenced from lib/ring. Disable it for the dpdk-test link only when LTO is enabled with gcc; non-LTO builds are unchanged.

Bugzilla ID: 2101

Fixes 70581c355d69 ("test/ring: add unit tests for soring API")
---
 app/test/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)
app/test/meson.build +6 -0
index 2f1cd817cd..d16ca9f287 100644
@@ -277,6 +277,12 @@ extra_flags = [
         '-fno-strict-aliasing',
 ]
 
+# LTO inlines soring acquire into the test, gcc then flags the
+# unreachable 16-byte element copy path (false positive).
+if get_option('b_lto') and cc.get_id() == 'gcc'
+	ldflags += '-Wno-stringop-overflow'
+endif
+
 foreach arg: extra_flags
     if cc.has_argument(arg)
         cflags += arg
Signature · 1 line
2.53.0