git: cb61cd8b665e - main - devel/orc: work around armv7 libc bug

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Mon, 26 Jun 2023 23:30:48 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cb61cd8b665eccd6764df0ecae01dcaa4b8f5b5f

commit cb61cd8b665eccd6764df0ecae01dcaa4b8f5b5f
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-06-26 19:43:25 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-06-26 23:30:29 +0000

    devel/orc: work around armv7 libc bug
    
    The armv7 libc has a bug in printf() where printing a denormal double
    may cause NUL bytes to be written out.  This port tries to write a
    diagnostic comment containing such a denormal to a C source file.  The
    bug causes the source file to be malformed, breaking the port and its
    consumers.
    
    Work around the bug by killing the offending part of the diagnostic
    comment.
    
    Approved by:    portmgr (build fix blanket)
    Reviewed by:    diizzy
    PR:             272229
---
 devel/orc/Makefile                       |  1 +
 devel/orc/files/patch-orc_orcprogram-c.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/devel/orc/Makefile b/devel/orc/Makefile
index 3ebbd84bf732..d7f331d03bd6 100644
--- a/devel/orc/Makefile
+++ b/devel/orc/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	orc
 DISTVERSION=	0.4.34
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	http://gstreamer.freedesktop.org/data/src/orc/
 
diff --git a/devel/orc/files/patch-orc_orcprogram-c.c b/devel/orc/files/patch-orc_orcprogram-c.c
new file mode 100644
index 000000000000..e97ca08db3a7
--- /dev/null
+++ b/devel/orc/files/patch-orc_orcprogram-c.c
@@ -0,0 +1,19 @@
+This patch works around a bug in the armv7 libc where sprintf(buf, "%g", 1.26e-321);
+generates a string with an embedded NUL byte, causing broken source code to be
+generated (PR272229).
+
+--- orc/orcprogram-c.c.orig	2023-06-26 19:40:12 UTC
++++ orc/orcprogram-c.c
+@@ -825,10 +825,9 @@ c_rule_loadpX (OrcCompiler *p, void *user, OrcInstruct
+     }
+   } else if (p->vars[insn->src_args[0]].vartype == ORC_VAR_TYPE_CONST) {
+     if (p->vars[insn->src_args[0]].size <= 4) {
+-      ORC_ASM_CODE(p,"    %s = 0x%08x; /* %d or %gf */\n", dest,
++      ORC_ASM_CODE(p,"    %s = 0x%08x; /* %d */\n", dest,
+           (unsigned int)p->vars[insn->src_args[0]].value.i,
+-          (int)p->vars[insn->src_args[0]].value.i,
+-          p->vars[insn->src_args[0]].value.f);
++          (int)p->vars[insn->src_args[0]].value.i);
+     } else {
+       ORC_ASM_CODE(p,"    %s = ORC_UINT64_C(0x%08x%08x); /* %gf */\n", dest,
+           (orc_uint32)(((orc_uint64)p->vars[insn->src_args[0]].value.i)>>32),