Fix for 2.5 i386 - mangle.h add __attribute__ ((used)) to the arrays also

Started by nibbles, April 08, 2012, 12:19:44 AM

Previous topic - Next topic

nibbles

ADM_mangle.h was patched before, in r7712, to stop the symbols from being optimized out on OSX with llvm and clang,
by using the __attribute__ ((used)) syntax, thanks to Gruntster for that code.  We did that for x86_64, but we only
partially did that for __APPLE__ and i386.

This patch adds that syntax to the statement for the array too.  The error details and links to the previous patch are here:
http://www.avidemux.org/smf/index.php?topic=10441.0

This patch was tested on 32bit OSX Snow Leopard 10.6.8 using llvm-gcc-4.2.1.
This would be the patch:

--- a/avidemux/ADM_core/include/ADM_mangle.h    2011-12-28 16:32:37.000000000 -0800
+++ b/avidemux/ADM_core/include/ADM_mangle.h    2012-04-07 10:49:11.000000000 -0700
@@ -26,7 +26,7 @@
#    else
#        define MANGLE(a) "_" #a
#        define FUNNY_MANGLE(x) __attribute__((used)) x asm(MANGLE(x))
-#        define FUNNY_MANGLE_ARRAY(x, y) x[y] asm(MANGLE(x))
+#        define FUNNY_MANGLE_ARRAY(x, y) __attribute__((used)) x[y] asm(MANGLE(x))
#    endif
#else
#    if defined(ADM_CPU_X86_64) && defined(PIC)

nibbles

Thanks @mean for applying this patch to the head of 2.5 in r7908.