From 4b94d06021ab209c542fa3a22415ea989fdde9af Mon Sep 17 00:00:00 2001 From: Florian Walpen Date: Wed, 2 Feb 2022 11:39:48 +0100 Subject: [PATCH] audio/jack: Fix build on arm64 and powerpc platforms. The alignment errors were exposed by the following combination: * alignas() is not allowed to weaken alignment requirements. * Clang enforces this according to standard, GCC does not. * JACK uses packed structs on x86 platforms, but not on others. Let the compiler choose between minimum alignment (packed) and "natural" alignment (non-packed). Fixes bug #261508. This reverts commit 0e3bf07e2ced19b9f43100288f5733eed7ff08de "audio/jack: fix build on powerpc64le" and commit 159b44b2fb70889722fbf810f22aea435848684d "audio/jack: fix build on powerpc and powerpc64" --- audio/jack/Makefile | 10 +--------- .../files/patch-common_JackAtomicArrayState.h | 11 ++++++++++ .../jack/files/patch-common_JackAtomicState.h | 11 ++++++++++ .../patch-common_JackConnectionManager.h | 11 ++++++++++ .../files/patch-common_JackEngineControl.h | 20 +++++++++++++++++++ 5 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 audio/jack/files/patch-common_JackAtomicArrayState.h create mode 100644 audio/jack/files/patch-common_JackAtomicState.h create mode 100644 audio/jack/files/patch-common_JackConnectionManager.h create mode 100644 audio/jack/files/patch-common_JackEngineControl.h diff --git a/audio/jack/Makefile b/audio/jack/Makefile index 25a0b22e8c03..c33166d1df5d 100644 --- a/audio/jack/Makefile +++ b/audio/jack/Makefile @@ -12,7 +12,7 @@ LICENSE_COMB= multi LIB_DEPENDS= libsamplerate.so:audio/libsamplerate \ libsysinfo.so:devel/libsysinfo -USES= pkgconfig python:3.4+ shebangfix waf +USES= compiler:c11 pkgconfig python:3.4+ shebangfix waf USE_LDCONFIG= yes USE_RC_SUBR= jackd @@ -49,14 +49,6 @@ OPUS_CONFIGURE_OFF= --opus=no PROFILING_DESC= Build with profiling information PROFILING_CONFIGURE_ON= --profile -.include - -.if ${ARCH} == powerpc || ${ARCH} == powerpc64 || ${ARCH} == powerpc64le -USES+= compiler:gcc-c++11-lib -.else -USES+= compiler:c11 -.endif - .include .if ${PORT_OPTIONS:MDBUS} diff --git a/audio/jack/files/patch-common_JackAtomicArrayState.h b/audio/jack/files/patch-common_JackAtomicArrayState.h new file mode 100644 index 000000000000..7b940a75da70 --- /dev/null +++ b/audio/jack/files/patch-common_JackAtomicArrayState.h @@ -0,0 +1,11 @@ +--- common/JackAtomicArrayState.h.orig 2022-01-15 15:09:56 UTC ++++ common/JackAtomicArrayState.h +@@ -122,7 +122,7 @@ class JackAtomicArrayState + // fState[2] ==> request + + T fState[3]; +- alignas(UInt32) volatile AtomicArrayCounter fCounter; ++ alignas(UInt32) alignas(AtomicArrayCounter) volatile AtomicArrayCounter fCounter; + + UInt32 WriteNextStateStartAux(int state, bool* result) + { diff --git a/audio/jack/files/patch-common_JackAtomicState.h b/audio/jack/files/patch-common_JackAtomicState.h new file mode 100644 index 000000000000..601ec2c0a81e --- /dev/null +++ b/audio/jack/files/patch-common_JackAtomicState.h @@ -0,0 +1,11 @@ +--- common/JackAtomicState.h.orig 2022-01-15 15:09:56 UTC ++++ common/JackAtomicState.h +@@ -94,7 +94,7 @@ class JackAtomicState + protected: + + T fState[2]; +- alignas(UInt32) volatile AtomicCounter fCounter; ++ alignas(UInt32) alignas(AtomicCounter) volatile AtomicCounter fCounter; + SInt32 fCallWriteCounter; + + UInt32 WriteNextStateStartAux() diff --git a/audio/jack/files/patch-common_JackConnectionManager.h b/audio/jack/files/patch-common_JackConnectionManager.h new file mode 100644 index 000000000000..30a17f23bbb9 --- /dev/null +++ b/audio/jack/files/patch-common_JackConnectionManager.h @@ -0,0 +1,11 @@ +--- common/JackConnectionManager.h.orig 2022-01-15 15:09:56 UTC ++++ common/JackConnectionManager.h +@@ -417,7 +417,7 @@ class SERVER_EXPORT JackConnectionManager + JackFixedArray1 fInputPort[CLIENT_NUM]; /*! Table of input port per refnum : to find a refnum for a given port */ + JackFixedArray fOutputPort[CLIENT_NUM]; /*! Table of output port per refnum : to find a refnum for a given port */ + JackFixedMatrix fConnectionRef; /*! Table of port connections by (refnum , refnum) */ +- alignas(UInt32) JackActivationCount fInputCounter[CLIENT_NUM]; /*! Activation counter per refnum */ ++ alignas(UInt32) alignas(JackActivationCount) JackActivationCount fInputCounter[CLIENT_NUM]; /*! Activation counter per refnum */ + JackLoopFeedback fLoopFeedback; /*! Loop feedback connections */ + + bool IsLoopPathAux(int ref1, int ref2) const; diff --git a/audio/jack/files/patch-common_JackEngineControl.h b/audio/jack/files/patch-common_JackEngineControl.h new file mode 100644 index 000000000000..7e79eb084792 --- /dev/null +++ b/audio/jack/files/patch-common_JackEngineControl.h @@ -0,0 +1,20 @@ +--- common/JackEngineControl.h.orig 2022-01-15 15:09:56 UTC ++++ common/JackEngineControl.h +@@ -64,7 +64,7 @@ struct SERVER_EXPORT JackEngineControl : public JackSh + int fClientPriority; + int fMaxClientPriority; + char fServerName[JACK_SERVER_NAME_SIZE+1]; +- alignas(UInt32) JackTransportEngine fTransport; ++ alignas(UInt32) alignas(JackTransportEngine) JackTransportEngine fTransport; + jack_timer_type_t fClockSource; + int fDriverNum; + bool fVerbose; +@@ -86,7 +86,7 @@ struct SERVER_EXPORT JackEngineControl : public JackSh + UInt64 fConstraint; + + // Timer +- alignas(UInt32) JackFrameTimer fFrameTimer; ++ alignas(UInt32) alignas(JackFrameTimer) JackFrameTimer fFrameTimer; + + #ifdef JACK_MONITOR + JackEngineProfiling fProfiler; -- 2.34.1