On Tue, Dec 21, 2021 at 12:17:24PM +0100, Otto Moerbeek wrote:

> On Tue, Dec 21, 2021 at 09:06:55AM +0100, Otto Moerbeek wrote:
> 
> > On Tue, Dec 21, 2021 at 06:54:16PM +1100, Jonathan Gray wrote:
> > 
> > > On Tue, Dec 21, 2021 at 08:25:14AM +0100, Otto Moerbeek wrote:
> > > > Hi,
> > > > 
> > > > I noticed dnsdist on amd64 segfaults runtime when compiled with
> > > > clang-13.  The most recent package snapshot has a broken dnsdist.
> > > > 
> > > > This does not seem to happen on arm64.
> > > > 
> > > > I'm investigating.
> > > > 
> > > >         -Otto
> > > 
> > > There was a backported fix for a runtime segfault with bind9
> > > on FreeBSD that might be related?
> > > 
> > > https://github.com/llvm/llvm-project/commit/c446ac46746edcffab57d22c42c249a3954698c9
> > 
> > Thanks!,
> > 
> > I'll take a look,
> > 
> >     -Otto
> > 
> 
> Sadly, the diff above does not make a difference. As a last try I'll
> check with a compiler compiled with the diff.
> 
> - Compiling with -O1 creates a working executable. 
> - Clang-13 on arch or debian linux creates working executables.
> 
> I think I'll go for the -O1 woraround unless somebody has a better
> suggestion (or my test above has better results).
> 
>       -Otto
> 

So I'm comitting this until a better fix is found, unless somebody
objects.

        -Otto

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/dnsdist/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- Makefile    21 Sep 2021 10:00:05 -0000      1.24
+++ Makefile    21 Dec 2021 13:06:16 -0000
@@ -3,6 +3,7 @@
 COMMENT=               highly DNS-, DoS- and abuse-aware loadbalancer
 
 DISTNAME=              dnsdist-1.6.1
+REVISION=              0
 EXTRACT_SUFX=          .tar.bz2
 
 CATEGORIES=            net
@@ -35,7 +36,12 @@ CONFIGURE_ARGS+=     --without-gnutls \
                        --enable-dnscrypt \
                        --enable-dnstap \
                        --enable-dns-over-https
+#
+# On at least amd64 using clang13 dnsdist-lua-bindings.cc gets
+# miscompiled with -O2, resulting in a segfault on startup
+#
 CONFIGURE_ENV+=                CPPFLAGS="-I${LOCALBASE}/include" \
+                       CXXFLAGS="-O1" \
                        LDFLAGS="-L${LOCALBASE}/lib" \
                        LIBEDIT_LIBS='-ledit -lcurses' \
                        LIBEDIT_CFLAGS=' '

Reply via email to